From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id E5E6A3858030 for ; Mon, 7 Mar 2022 22:13:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E5E6A3858030 Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-88-h4EB4MDMNjqOp3fESm1Ybw-1; Mon, 07 Mar 2022 17:13:55 -0500 X-MC-Unique: h4EB4MDMNjqOp3fESm1Ybw-1 Received: by mail-wr1-f69.google.com with SMTP id a16-20020adff7d0000000b001f0473a6b25so4671052wrq.1 for ; Mon, 07 Mar 2022 14:13:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cL/DUr+DHfxC6fAGL1p/NE2JlY4b/wO55kf0ZqmQHGY=; b=V6+LtsWf9ojtDjPREvp/Kg/odlJ65YjwFQeJO2uvPrGTsCEC6H0KXB6TFH6h7uT8/c cee3+wT1UufIsdZtIB4io6QvIoxD1iOb85sa8mQcJs7eCb0kosavCUUwsosAdFCGH3AR XusC+0ZW0ipFOAjIBYEvGfbsLQ9WF4JGIC8YcdIG0n0Ran791b6osGv5jPIXaiu1cs5f u8cJUPaZd5fc7juB+DRxHVSQKEJzdKDrggqpZz1oaaRaE/qgOezxWcnIfVbe+6P/N2NN LhiIAcAAd8HiHfDCtKahUun4m6KwYaqHq9DpKpyPydoHF+3Tx9nL30B8mKxd0FLsY4Vi zusA== X-Gm-Message-State: AOAM531rdRm7NPOxqeY5oJqOgJdEzoqpbaa5QfzhVE2hGTEqAfNRc/LQ FGY3DYecxWuIKDyAzUSIVZl3I7NbucE/cScaabhjGPj5noWEq/LAc6aq1HphLXV6bJTbxk6l1qC 4n01gR6HYU+ZEMAx2utMrUwpRwMX12elkPOZFjvQOjEIxpP7Cea/XvGvNjMaGdHllVXHTCt0Pnw == X-Received: by 2002:a5d:534a:0:b0:1f0:5c4b:cec8 with SMTP id t10-20020a5d534a000000b001f05c4bcec8mr10333714wrv.115.1646691233869; Mon, 07 Mar 2022 14:13:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJyi07nloi3W8FH38twiVAJSBjZWOtt3Ac5YOP511Xn1YoO2lQ8RH04p0lI382T7HC/+vZTqiw== X-Received: by 2002:a5d:534a:0:b0:1f0:5c4b:cec8 with SMTP id t10-20020a5d534a000000b001f05c4bcec8mr10333701wrv.115.1646691233547; Mon, 07 Mar 2022 14:13:53 -0800 (PST) Received: from localhost (host86-134-151-205.range86-134.btcentralplus.com. [86.134.151.205]) by smtp.gmail.com with ESMTPSA id f20-20020a05600c4e9400b003898e252cd4sm545237wmq.12.2022.03.07.14.13.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 14:13:53 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCHv3 03/15] gdb/tui: rename tui_layout_split:set_weights_from_heights Date: Mon, 7 Mar 2022 22:13:35 +0000 Message-Id: <83784eef6092498b729d70d4639e07b626369dbb.1646691034.git.aburgess@redhat.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Mar 2022 22:13:58 -0000 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. --- 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 4c355c79d65..9e856ccf3fa 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 acea7ac8f64..8f41835b94c 100644 --- a/gdb/tui/tui-layout.h +++ b/gdb/tui/tui-layout.h @@ -217,8 +217,9 @@ class tui_layout_split : public tui_layout_base 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 { -- 2.25.4