From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id MKg2AIES9GGyBAAAWB0awg (envelope-from ) for ; Fri, 28 Jan 2022 10:57:53 -0500 Received: by simark.ca (Postfix, from userid 112) id F2BC91F3B7; Fri, 28 Jan 2022 10:57:52 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.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 6DD2C1EE18 for ; Fri, 28 Jan 2022 10:57:52 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 00E5F3947C33 for ; Fri, 28 Jan 2022 15:57:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 00E5F3947C33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1643385472; 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=KD2m26REWg2DGLc17mP/BDbvE1p9mHqp38G0WbHL/nSEqoowv1gVVuOqX0JaDRz7m qTKZUDb14uP7PohgrvBtnXgrQ+mRx7BToZc2mmmYBK/yM/PTwNLQ8qpsy/rH5FIWg7 fBLrUcAJcRUcQNnZkm5PHRuRlkA48thNA/KPB0W0= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id D12AC386482C for ; Fri, 28 Jan 2022 15:55:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D12AC386482C Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-563-aW-fDUEANpu6VlKYKlrZoQ-1; Fri, 28 Jan 2022 10:55:23 -0500 X-MC-Unique: aW-fDUEANpu6VlKYKlrZoQ-1 Received: by mail-wr1-f71.google.com with SMTP id w19-20020adf8bd3000000b001df887ad0caso1057089wra.18 for ; Fri, 28 Jan 2022 07:55:23 -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=uULHDrPyIwOguS410/f7AV4yC3ZudThastU0jSVaQQDVhCgi+D6LpVQneddY99wkxM XzgtszlWuK9wp2RTs1g+MRK3zkZunuFPKW1pupfHRMuAwgAzXtNCO7EuhK5aIkS1UYji md+Rw5dyb3TUXrZAPzePLmHsHwO59b5wA9F2EsvlaNJ6vizz6YSMVazEFvfyS3FEO4pw A89AqZ02tb17CNdoMGrVaMGRZkgFOM776MRwyIifME1OWbadJC2OhT1cdiOzUub3giVr fVXPUGNUo8GKts8J5YPJAywqULiqW6Sd7mZxWlnDmYcN/k058rZH0pPIFiSzTpGV6H1o ziTQ== X-Gm-Message-State: AOAM530fArqeRcTLs+6ToCFw2zgLjQKKIrexdcF5M9JDwNRd6P8QdXrv 9LSv9ZuSiwmds7E/BOfhdUipJBaa2VJVaVi2doMdbyXd7X3eQBYfKstaY+vA1yTstLsf2yQRBA3 l9e6aJ1/+0SW+2qtnwSu3MlpMb2/nBylvYL9dIkk9jQQb+DqFz0FO2kQX27V/IUqOsDT0879YRA == X-Received: by 2002:a7b:c042:: with SMTP id u2mr7748205wmc.123.1643385322377; Fri, 28 Jan 2022 07:55:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJzKhHtKb8qrOpiUjM59L6CB85hENPxIeO5Di8Eyv3vkrUaPRenbomgWNEUvTXef36IKBPWzQw== X-Received: by 2002:a7b:c042:: with SMTP id u2mr7748182wmc.123.1643385322042; Fri, 28 Jan 2022 07:55:22 -0800 (PST) Received: from localhost (host86-140-92-93.range86-140.btcentralplus.com. [86.140.92.93]) by smtp.gmail.com with ESMTPSA id u7sm2238262wml.7.2022.01.28.07.55.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jan 2022 07:55:21 -0800 (PST) To: gdb-patches@sourceware.org Subject: [PATCH 5/7] gdb/tui: rename tui_layout_split:set_weights_from_heights Date: Fri, 28 Jan 2022 15:55:06 +0000 Message-Id: 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