From patchwork Sat Aug 3 13:29:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 33933 Received: (qmail 95039 invoked by alias); 3 Aug 2019 13:29: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 94925 invoked by uid 89); 3 Aug 2019 13:29:33 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-19.0 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= X-HELO: gateway24.websitewelcome.com Received: from gateway24.websitewelcome.com (HELO gateway24.websitewelcome.com) (192.185.50.93) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 03 Aug 2019 13:29:31 +0000 Received: from cm14.websitewelcome.com (cm14.websitewelcome.com [100.42.49.7]) by gateway24.websitewelcome.com (Postfix) with ESMTP id 28073C73A for ; Sat, 3 Aug 2019 08:29:30 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id tu6EhOi8B2qH7tu6EhQBj9; Sat, 03 Aug 2019 08:29:30 -0500 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=sLWTlyN9ohGtFlL0JuKWZJ7Hc6ERBiHVOhedyjqP9Wg=; b=TdWGeOh8WQ3mNy9cXZBxlPRscs vcf8iKYgCzNFfJiuZSZ3x28+Fr55OLUwR4oMJFaCQBJbIGvV185vBqGdybLTQ5PlL162c69pftL6D o6PF9y9HaXGSh8rI2xzjHNPbu; Received: from 97-122-178-82.hlrn.qwest.net ([97.122.178.82]:36980 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1htu6D-003nqS-T4; Sat, 03 Aug 2019 08:29:30 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 05/19] Simplify tui_make_all_invisible Date: Sat, 3 Aug 2019 07:29:11 -0600 Message-Id: <20190803132925.25074-6-tom@tromey.com> In-Reply-To: <20190803132925.25074-1-tom@tromey.com> References: <20190803132925.25074-1-tom@tromey.com> This simplifies the implementation of tui_make_all_invisible. Also, because show_data is only called by show_layout, this hoists the call to tui_make_all_invisible and removes the call from show_data. gdb/ChangeLog 2019-08-03 Tom Tromey * tui/tui-wingeneral.c (make_all_visible): Remove. (tui_make_all_invisible): Simplify. * tui/tui-layout.c (tui_make_all_invisible): Move from tui-wingeneral.c; simplify. (show_layout): Hoist call to tui_make_all_invisible. (show_data): Don't call tui_make_all_invisible. --- gdb/ChangeLog | 9 +++++++++ gdb/tui/tui-layout.c | 9 +++------ gdb/tui/tui-wingeneral.c | 12 +++--------- gdb/tui/tui-wingeneral.h | 4 +++- 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c index 2b25e7a57fd..3ee3354b2ff 100644 --- a/gdb/tui/tui-layout.c +++ b/gdb/tui/tui-layout.c @@ -80,6 +80,9 @@ show_layout (enum tui_layout_type layout) should free the content and reallocate on next display of source/asm. */ tui_clear_source_windows (); + /* First make the current layout be invisible. */ + tui_make_all_invisible (); + tui_locator_win_info_ptr ()->make_visible (false); if (layout == SRC_DATA_COMMAND || layout == DISASSEM_DATA_COMMAND) { @@ -88,10 +91,6 @@ show_layout (enum tui_layout_type layout) } else { - /* First make the current layout be invisible. */ - tui_make_all_invisible (); - tui_locator_win_info_ptr ()->make_visible (false); - switch (layout) { /* Now show the new layout. */ @@ -571,8 +570,6 @@ show_data (enum tui_layout_type new_layout) data_height = total_height / 2; src_height = total_height - data_height; - tui_make_all_invisible (); - locator->make_visible (false); if (tui_win_list[DATA_WIN] == nullptr) tui_win_list[DATA_WIN] = new tui_data_window (); tui_win_list[DATA_WIN]->reset (data_height, tui_term_width (), 0, 0); diff --git a/gdb/tui/tui-wingeneral.c b/gdb/tui/tui-wingeneral.c index 92a678cc1e2..79f93ceaf9f 100644 --- a/gdb/tui/tui-wingeneral.c +++ b/gdb/tui/tui-wingeneral.c @@ -165,19 +165,13 @@ tui_gen_win_info::make_visible (bool visible) } } -/* Makes all windows invisible (except the command and locator - windows). */ -static void -make_all_visible (bool visible) -{ - for (tui_win_info *win_info : all_tui_windows ()) - win_info->make_visible (visible); -} +/* See tui-wingeneral.h. */ void tui_make_all_invisible (void) { - make_all_visible (false); + for (tui_win_info *win_info : all_tui_windows ()) + win_info->make_visible (false); } /* Function to refresh all the windows currently displayed. */ diff --git a/gdb/tui/tui-wingeneral.h b/gdb/tui/tui-wingeneral.h index 3c035aa48b1..051be6da690 100644 --- a/gdb/tui/tui-wingeneral.h +++ b/gdb/tui/tui-wingeneral.h @@ -27,8 +27,10 @@ struct tui_win_info; struct tui_gen_win_info; -extern void tui_unhighlight_win (struct tui_win_info *); +/* Makes all windows invisible. */ extern void tui_make_all_invisible (void); + +extern void tui_unhighlight_win (struct tui_win_info *); extern void tui_make_window (struct tui_gen_win_info *, enum tui_box); extern void tui_highlight_win (struct tui_win_info *); extern void tui_check_and_display_highlight_if_needed (struct tui_win_info *);