From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from omta036.useast.a.cloudfilter.net (omta036.useast.a.cloudfilter.net [44.202.169.35]) by sourceware.org (Postfix) with ESMTPS id BF7623858C2F for ; Sat, 20 Jan 2024 18:23:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BF7623858C2F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org BF7623858C2F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.35 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705775002; cv=none; b=SfZX4oaYUtimIYskYnKi87yuJlbnHw2NcbuJwKxE6C5tEu/7oT1JCzPzH8+ojb16aXp77+eMxAC2M83arq0fx2nD/J+ZyEGHX8g0kbKz6QwLuXq38FmUrwBIM1S5QFyYWwyQ+BuhnuaBnrCiVtgrILBlK8NsjtiojBw0bqyuGh8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705775002; c=relaxed/simple; bh=MiVwzHC31AaCrn2ZcQ4xl3xAA2n4N/BAeHeTePBDrIQ=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=x6xEdOvhQ6hLNEjBG/MzhMxuFn/lWpPZ89wjoyCVris1sXwCCsyGesn7jp++H5g0DDGbevse1RU8maoSFAdol1fT0rTorXbjU+x5dOBVUAkQsCoRcLsbpDDF0LRLL+21Bi+O8ibu89bpqlBGOoa1/kVP5aJSJ12xmVJzqRRGHHw= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-6008a.ext.cloudfilter.net ([10.0.30.227]) by cmsmtp with ESMTPS id R9B7rS9J78uLRRG00rCQnN; Sat, 20 Jan 2024 18:23:20 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id RFzzrrTM8ZKctRG00rk1tv; Sat, 20 Jan 2024 18:23:20 +0000 X-Authority-Analysis: v=2.4 cv=a+kjSGeF c=1 sm=1 tr=0 ts=65ac0f98 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=IkcTkHD0fZMA:10 a=dEuoMetlWLkA:10 a=Qbun_eYptAEA:10 a=c5Q-8MILhn972Ji1mJcA:9 a=QEXdDO2ut3YA:10 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=yB8xZ2o949K63esPV1n2nophPgN36t0ZYmS4ZNeC2p8=; b=DYJWC1RPPbjTDK+pCJQ2ZLnygW Q9IM5Ihj89OC9UsB1Ck7lzzquYGHPZfrJEhlN9kbGZdqhuaMRvf2poAHtlA6A5mmS11iwx5s2g6Ui BgGQW2zoqGgASxWFt8ris2iPd; Received: from 97-122-68-157.hlrn.qwest.net ([97.122.68.157]:47898 helo=[192.168.0.21]) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1rRFzz-0049D4-1T for gdb-patches@sourceware.org; Sat, 20 Jan 2024 11:23:19 -0700 From: Tom Tromey Date: Sat, 20 Jan 2024 11:23:16 -0700 Subject: [PATCH v2 05/14] Change tui_register_info::visible to a method MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240120-tui-regs-cleanup-v2-5-a3cccc6a3573@tromey.com> References: <20240120-tui-regs-cleanup-v2-0-a3cccc6a3573@tromey.com> In-Reply-To: <20240120-tui-regs-cleanup-v2-0-a3cccc6a3573@tromey.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.4 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.122.68.157 X-Source-L: No X-Exim-ID: 1rRFzz-0049D4-1T X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-68-157.hlrn.qwest.net ([192.168.0.21]) [97.122.68.157]:47898 X-Source-Auth: tom+tromey.com X-Email-Count: 19 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfOgVlcAGJo8jqB+pKwFnLeEnj3uJPp1Ak3oNXp8vIFsI9yDHQ5LgnZ93we+W3Yu2JkLycVjI5KKQJJLlOsYxK5ebZebhs4hJWPOzCYjud7JMT/PqMm2r oKuFr845lqqlTPqxAtBcc1gHymY9yOjBrmfzGT0EkxU6+hVedtLWaO2vMmJaZuU+QnvdDhHe95sm4Fkv1SpdklhCTG6I9TwiG9s= X-Spam-Status: No, score=-3022.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,GIT_PATCH_0,JMQ_SPF_NEUTRAL,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: tui_register_info::visible is redundant with the fact that y==0 means that the register is not visible. This patch changes this member in favor of having a single indication of the register's visibility -- a method with the same name. This change makes it clear that delete_data_content_windows is not needed, so this is removed as well. --- gdb/tui/tui-regs.c | 17 ++--------------- gdb/tui/tui-regs.h | 8 +++----- 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c index bacb23ab298..12301552c34 100644 --- a/gdb/tui/tui-regs.c +++ b/gdb/tui/tui-regs.c @@ -268,7 +268,6 @@ tui_data_window::display_registers_from (int start_element_no) /* Create the window if necessary. */ m_regs_content[i].x = box_width () + (m_item_width * j); m_regs_content[i].y = cur_y; - m_regs_content[i].visible = true; m_regs_content[i].rerender (handle.get (), m_item_width); i++; /* Next register. */ } @@ -346,23 +345,13 @@ tui_data_window::first_data_item_displayed () { for (int i = 0; i < m_regs_content.size (); i++) { - if (m_regs_content[i].visible) + if (m_regs_content[i].visible ()) return i; } return -1; } -/* See tui-regs.h. */ - -void -tui_data_window::delete_data_content_windows () -{ - for (auto &win : m_regs_content) - win.visible = false; -} - - void tui_data_window::erase_data_content (const char *prompt) { @@ -400,7 +389,6 @@ tui_data_window::rerender (bool toplevel) else { erase_data_content (NULL); - delete_data_content_windows (); display_registers_from (0); } } @@ -425,7 +413,6 @@ tui_data_window::do_scroll_vertical (int num_to_scroll) { first_line += num_to_scroll; erase_data_content (NULL); - delete_data_content_windows (); display_registers_from_line (first_line); } } @@ -448,7 +435,7 @@ tui_data_window::check_register_values (frame_info_ptr frame) /* Register windows whose y == 0 are outside the visible area. */ if ((data_item_win.highlight || was_hilighted) - && data_item_win.y > 0) + && data_item_win.visible ()) data_item_win.rerender (handle.get (), m_item_width); } } diff --git a/gdb/tui/tui-regs.h b/gdb/tui/tui-regs.h index e7125e457f5..1b0eaa2033b 100644 --- a/gdb/tui/tui-regs.h +++ b/gdb/tui/tui-regs.h @@ -44,11 +44,13 @@ struct tui_register_info void rerender (WINDOW *handle, int field_width); + bool visible () const + { return y > 0; } + /* Location. */ int x = 0; int y = 0; bool highlight = false; - bool visible = false; std::string content; private: @@ -130,10 +132,6 @@ struct tui_data_window : public tui_win_info past the register area (-1) is returned. */ int first_reg_element_no_inline (int line_no) const; - /* Delete all the item windows in the data window. This is usually - done when the data window is scrolled. */ - void delete_data_content_windows (); - void erase_data_content (const char *prompt); /* Information about each register in the current register group. */ -- 2.43.0