From patchwork Fri Dec 27 16:42:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 37103 Received: (qmail 125686 invoked by alias); 27 Dec 2019 16:42:34 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 125608 invoked by uid 89); 27 Dec 2019 16:42:33 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=spots, tromey, Tromey, viewport X-HELO: gateway22.websitewelcome.com Received: from gateway22.websitewelcome.com (HELO gateway22.websitewelcome.com) (192.185.46.152) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 27 Dec 2019 16:42:32 +0000 Received: from cm14.websitewelcome.com (cm14.websitewelcome.com [100.42.49.7]) by gateway22.websitewelcome.com (Postfix) with ESMTP id A55C9ACB3 for ; Fri, 27 Dec 2019 10:42:30 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id ksh4iNirM4kpjksh4itgaT; Fri, 27 Dec 2019 10:42:30 -0600 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: 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=mPM+Cv7ajRrEF+0fkqeIL45hVNNBM6ErA1q+nqDeE1Q=; b=SeaxHfUxxfqMraSbgXsNA84PGK C9JNt8n4LgGGGTjTXZARSi+m6QeJCSVWjIHnPvT9ekS0MlVqHwdmfXk4Aldwl+e0B0ROruzF9AmTi 3BuNeVHmTsi29uQwklOTRI3tX; Received: from 75-166-123-50.hlrn.qwest.net ([75.166.123.50]:36592 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1iksh4-001xYc-BU; Fri, 27 Dec 2019 09:42:30 -0700 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [FYI 1/3] Remove tui_gen_win_info::viewport_height Date: Fri, 27 Dec 2019 09:42:26 -0700 Message-Id: <20191227164228.27948-2-tom@tromey.com> In-Reply-To: <20191227164228.27948-1-tom@tromey.com> References: <20191227164228.27948-1-tom@tromey.com> tui_gen_win_info::viewport_height is only used in a couple of spots, and is redundant with "height". This patch removes viewport_height. gdb/ChangeLog 2019-12-27 Tom Tromey * tui/tui-source.c (tui_source_window::maybe_update): Update. * tui/tui-regs.c (tui_data_window::display_registers_from): Update. * tui/tui-layout.c (tui_gen_win_info::resize): Update. * tui/tui-data.h (struct tui_gen_win_info) : Remove. * tui/tui-command.c (tui_cmd_window::resize): Update. Change-Id: I020e026fbe289adda8e2fdfebca91bdbdbc312e8 --- gdb/ChangeLog | 10 ++++++++++ gdb/tui/tui-command.c | 8 -------- gdb/tui/tui-data.h | 2 -- gdb/tui/tui-layout.c | 4 ---- gdb/tui/tui-regs.c | 3 +-- gdb/tui/tui-source.c | 2 +- 6 files changed, 12 insertions(+), 17 deletions(-) diff --git a/gdb/tui/tui-command.c b/gdb/tui/tui-command.c index e4c3a1b7491..5f676b2e659 100644 --- a/gdb/tui/tui-command.c +++ b/gdb/tui/tui-command.c @@ -42,14 +42,6 @@ tui_cmd_window::resize (int height_, int width_, int origin_x, int origin_y) { width = width_; height = height_; - if (height > 1) - { - /* Note this differs from the base class implementation, because - this window can't be boxed. */ - viewport_height = height - 1; - } - else - viewport_height = 1; x = origin_x; y = origin_y; diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h index a0e296fa68c..2a822487fce 100644 --- a/gdb/tui/tui-data.h +++ b/gdb/tui/tui-data.h @@ -110,8 +110,6 @@ public: /* Origin of window. */ int x = 0; int y = 0; - /* Viewport height. */ - int viewport_height = 0; }; /* Constant definitions. */ diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c index 9ab89a87fa4..bd2e6aee651 100644 --- a/gdb/tui/tui-layout.c +++ b/gdb/tui/tui-layout.c @@ -373,10 +373,6 @@ tui_gen_win_info::resize (int height_, int width_, width = width_; height = height_; - if (height > 1) - viewport_height = height - 2; - else - viewport_height = 1; x = origin_x_; y = origin_y_; diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c index 1d936f712b6..85c7a31b0b6 100644 --- a/gdb/tui/tui-regs.c +++ b/gdb/tui/tui-regs.c @@ -266,8 +266,7 @@ tui_data_window::display_registers_from (int start_element_no) /* Now create each data "sub" window, and write the display into it. */ cur_y = 1; - while (i < m_regs_content.size () - && cur_y <= viewport_height) + while (i < m_regs_content.size () && cur_y <= height - 2) { for (j = 0; j < m_regs_column_count && i < m_regs_content.size (); diff --git a/gdb/tui/tui-source.c b/gdb/tui/tui-source.c index 0728263b8c5..2d8ecee7473 100644 --- a/gdb/tui/tui-source.c +++ b/gdb/tui/tui-source.c @@ -193,7 +193,7 @@ tui_source_window::line_is_displayed (int line) const void tui_source_window::maybe_update (struct frame_info *fi, symtab_and_line sal) { - int start_line = (sal.line - (viewport_height / 2)) + 1; + int start_line = (sal.line - ((height - 2) / 2)) + 1; if (start_line <= 0) start_line = 1;