From patchwork Sun Jun 23 22:43:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 33315 Received: (qmail 56811 invoked by alias); 23 Jun 2019 23:25:52 -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 56760 invoked by uid 89); 23 Jun 2019 23:25:52 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SEMBLACK, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy= X-HELO: gateway33.websitewelcome.com Received: from gateway33.websitewelcome.com (HELO gateway33.websitewelcome.com) (192.185.146.97) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 23 Jun 2019 23:25:50 +0000 Received: from cm11.websitewelcome.com (cm11.websitewelcome.com [100.42.49.5]) by gateway33.websitewelcome.com (Postfix) with ESMTP id C7A6726201 for ; Sun, 23 Jun 2019 18:25:48 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id fBrohwzOcdnCefBrohX8L3; Sun, 23 Jun 2019 18:25:48 -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=TzIpfFITkbCAQzkBdCU1OLwGaJlOOXXHwjFZA/HsqTs=; b=Kg1slSyCxJqq/+cWAni5eia18Z CqZtGmZ72CFYGOZu1GnNxiYiE1OCZvGZkpRtE3YlYdZt79BjU6ksxChmQ1o3HQkWUFv834maca4hK EvWXSl4F2KpsF7I9WCZc+udDg; Received: from 75-166-12-78.hlrn.qwest.net ([75.166.12.78]:54396 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1hfBDB-000vDQ-Bf; Sun, 23 Jun 2019 17:43:49 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 41/66] Move make_visible method to tui_gen_win_info Date: Sun, 23 Jun 2019 16:43:04 -0600 Message-Id: <20190623224329.16060-42-tom@tromey.com> In-Reply-To: <20190623224329.16060-1-tom@tromey.com> References: <20190623224329.16060-1-tom@tromey.com> This moves the make_visible method from tui_win_info to its base class, tui_gen_win_info. This allows the removal of another window type check. 2019-06-23 Tom Tromey * tui/tui-wingeneral.c (tui_gen_win_info::make_visible): Rename from make_visible. (tui_make_visible, tui_make_invisible): Rewrite. (tui_win_info::make_visible): Remove. (tui_source_window_base::make_visible): Update. * tui/tui-data.h (struct tui_gen_win_info) : New method. Moved from... (struct tui_win_info) : ...here. --- gdb/ChangeLog | 11 +++++++++++ gdb/tui/tui-data.h | 6 +++--- gdb/tui/tui-wingeneral.c | 41 ++++++++++++++-------------------------- 3 files changed, 28 insertions(+), 30 deletions(-) diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h index 92bfb39fe86..d5e46fed5c0 100644 --- a/gdb/tui/tui-data.h +++ b/gdb/tui/tui-data.h @@ -51,6 +51,9 @@ struct tui_gen_win_info /* Call to refresh this window. */ virtual void refresh_window (); + /* Make this window visible or invisible. */ + virtual void make_visible (bool visible); + /* Return the name of this type of window. */ virtual const char *name () const { @@ -273,9 +276,6 @@ public: return false; } - /* Make this window visible or invisible. */ - virtual void make_visible (bool visible); - /* Refresh this window and any associated windows. */ virtual void refresh (); diff --git a/gdb/tui/tui-wingeneral.c b/gdb/tui/tui-wingeneral.c index f1089a9f38a..acb8a26765b 100644 --- a/gdb/tui/tui-wingeneral.c +++ b/gdb/tui/tui-wingeneral.c @@ -168,51 +168,37 @@ tui_make_window (struct tui_gen_win_info *win_info, int box_it) /* We can't really make windows visible, or invisible. So we have to delete the entire window when making it visible, and create it again when making it visible. */ -static void -make_visible (struct tui_gen_win_info *win_info, bool visible) +void +tui_gen_win_info::make_visible (bool visible) { - /* Don't tear down/recreate command window. */ - if (win_info->type == CMD_WIN) - return; - if (visible) { - if (!win_info->is_visible) + if (!is_visible) { - tui_make_window (win_info, !tui_win_is_auxillary (win_info->type)); - win_info->is_visible = true; + tui_make_window (this, !tui_win_is_auxillary (type)); + is_visible = true; } } else if (!visible - && win_info->is_visible - && win_info->handle != NULL) + && is_visible + && handle != NULL) { - win_info->is_visible = false; - tui_delete_win (win_info->handle); - win_info->handle = NULL; + is_visible = false; + tui_delete_win (handle); + handle = NULL; } - - return; } void tui_make_visible (struct tui_gen_win_info *win_info) { - make_visible (win_info, true); + win_info->make_visible (true); } void tui_make_invisible (struct tui_gen_win_info *win_info) { - make_visible (win_info, false); -} - -/* See tui-data.h. */ - -void -tui_win_info::make_visible (bool visible) -{ - ::make_visible (this, visible); + win_info->make_visible (false); } /* See tui-data.h. */ @@ -220,7 +206,8 @@ tui_win_info::make_visible (bool visible) void tui_source_window_base::make_visible (bool visible) { - ::make_visible (execution_info, visible); + if (execution_info != nullptr) + execution_info->make_visible (visible); tui_win_info::make_visible (visible); }