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 EA6B53858420 for ; Sun, 6 Feb 2022 14:13:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EA6B53858420 Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-556-DKF1iI1yN8m9YCawD0uXzQ-1; Sun, 06 Feb 2022 09:13:05 -0500 X-MC-Unique: DKF1iI1yN8m9YCawD0uXzQ-1 Received: by mail-ed1-f70.google.com with SMTP id p10-20020a50c94a000000b0040f5bf89a65so850093edh.4 for ; Sun, 06 Feb 2022 06:13:05 -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=vTszDySbIgL5ryDwTdQwSTZyo9J3H5byt81XPjmnLcqc+4UMkN7oGqSSxhNsTJoGYI smcK6W736Y8RZcBoS75SK6Vub+asFFNMeqT7T4m37gHg7ncTRbV879dP0GBigyvt0Ord jiw4xfxpHSv6qKT/Tynci8uDPoIyc0xzMcgzewq8DDopPekXzQW+I7YdcF/3eo3KgSvg cvlcOqGDtdva6Mn411f+PuPJoGX1J9+4/p22gIyqZbm825wC9W0N2BwmhV8wJj6HIEdI dzjc44oUayVmR5PJF93seiHZYN2gDkXAhXulU2Gy4ENB77obtVN/zbn81O0nyNGJdxwV cIZQ== X-Gm-Message-State: AOAM532DiOB0qJ+Ak0P/MBA8rBLh83xB0a+dVVjFryLg95Gbj72iAzEa LsO3nxkcAhunk/eKoFa9J/KgyXTspIurXBxethzQDBp/3VYWYoa5Ub3J6doQwuE/aBtDsZxTTml OesKg8cptC3AnGjRAA5fK4R+cxThlP1/TqX7FE+Iegpj7RTkDPrd6XJRBQLeuR6rYUkL2SDZF9g == X-Received: by 2002:a05:6402:278f:: with SMTP id b15mr9080244ede.103.1644156784229; Sun, 06 Feb 2022 06:13:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJzYXfSBQrYyaTCnZjpaleYAyI8M6hvouaR7+PAZIW3Zrvv0fOLg8DysGjOytHUuEMmzI2zmmQ== X-Received: by 2002:a05:6402:278f:: with SMTP id b15mr9080218ede.103.1644156784004; Sun, 06 Feb 2022 06:13:04 -0800 (PST) Received: from localhost (92.40.178.36.threembb.co.uk. [92.40.178.36]) by smtp.gmail.com with ESMTPSA id t15sm2618277eju.1.2022.02.06.06.13.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Feb 2022 06:13:03 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCHv2 03/15] gdb/tui: rename tui_layout_split:set_weights_from_heights Date: Sun, 6 Feb 2022 14:12:41 +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-Spam-Status: No, score=-10.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_LOW, 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: Sun, 06 Feb 2022 14:13:08 -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