From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id KOfHCgyEJmK2GgAAWB0awg (envelope-from ) for ; Mon, 07 Mar 2022 17:15:40 -0500 Received: by simark.ca (Postfix, from userid 112) id 2A2321F3CA; Mon, 7 Mar 2022 17:15:40 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id A12AA1EDF0 for ; Mon, 7 Mar 2022 17:15:39 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5AEDD3857832 for ; Mon, 7 Mar 2022 22:15:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5AEDD3857832 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1646691339; bh=cL/DUr+DHfxC6fAGL1p/NE2JlY4b/wO55kf0ZqmQHGY=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=EpXThaldkQ8cY5r0T+wm9Wk6vroden4BKG+xbrJgsy+Yy54ypgxfEuF825aLPWHlx CkeTDfxIKfhJE5Ko0U79bUTPZ8bScpsL9kBNmNK2c+Jn1D5rjnv+0au9im2T3ixNpx bz8wuQ5dP/G4BCt0qdoXAEXjemOprd9XwhlDtjyw= 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) To: gdb-patches@sourceware.org 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-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: , From: Andrew Burgess via Gdb-patches Reply-To: Andrew Burgess Cc: Andrew Burgess Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" 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