From patchwork Sun Jun 23 22:42:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 33302 Received: (qmail 50850 invoked by alias); 23 Jun 2019 22:44:07 -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 48988 invoked by uid 89); 23 Jun 2019 22:43:53 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.5 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=5086 X-HELO: gateway22.websitewelcome.com Received: from gateway22.websitewelcome.com (HELO gateway22.websitewelcome.com) (192.185.46.156) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 23 Jun 2019 22:43:46 +0000 Received: from cm10.websitewelcome.com (cm10.websitewelcome.com [100.42.49.4]) by gateway22.websitewelcome.com (Postfix) with ESMTP id DAFCA1DC6A for ; Sun, 23 Jun 2019 17:43:44 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id fBD6hIMbE2PzOfBD6hXxvY; Sun, 23 Jun 2019 17:43:44 -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=jlvcDpe2X+SVRbtm8x4HOy/N2PvukZhjU/G7+7uqhdg=; b=oFXeH4cH2IetvOSdsZ4vr0gMo6 d/P7eo5U/ssmpZaZUmz0LshMgLQN+9t92XX5q3vkweKHrM2uzMhWW6jItk0c3nt5PQuL+1wh3IbQs +S+gZOCTplBqWa/BNR3l9k6ZG; 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 1hfBD6-000vDQ-MW; Sun, 23 Jun 2019 17:43:44 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 25/66] Introduce the refresh_all method Date: Sun, 23 Jun 2019 16:42:48 -0600 Message-Id: <20190623224329.16060-26-tom@tromey.com> In-Reply-To: <20190623224329.16060-1-tom@tromey.com> References: <20190623224329.16060-1-tom@tromey.com> This introduces the tui_win_info::refresh_all method and implements it as needed in subclasses. The name and comment are a bit of a guess on my part. The main benefit of this patch is removing another switch on the type of the window. gdb/ChangeLog 2019-06-23 Tom Tromey * tui/tui.c (tui_rl_other_window): Call the refresh_all method. * tui/tui-windata.c (tui_data_window::refresh_all): Rename from tui_refresh_data_win. * tui/tui-win.c (tui_source_window_base::refresh_all): New method. (tui_refresh_all_win): Call the refresh_all method. (tui_set_focus): Likewise. * tui/tui-data.h (struct tui_win_info) : New method. (struct tui_source_window_base, struct tui_data_window) : Likewise. --- gdb/ChangeLog | 13 +++++++++++++ gdb/tui/tui-data.h | 8 ++++++++ gdb/tui/tui-win.c | 34 ++++++++++++++-------------------- gdb/tui/tui-windata.c | 4 ++-- gdb/tui/tui.c | 2 +- 5 files changed, 38 insertions(+), 23 deletions(-) diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h index c41e812c483..e838c0e1622 100644 --- a/gdb/tui/tui-data.h +++ b/gdb/tui/tui-data.h @@ -261,6 +261,12 @@ public: /* Refresh this window and any associated windows. */ virtual void refresh (); + /* Called after all the TUI windows are refreshed, to let this + window have a chance to update itself further. */ + virtual void refresh_all () + { + } + /* Methods to scroll the contents of this window. Note that they are named with "_scroll" coming at the end because the more obvious "scroll_forward" is defined as a macro in term.h. */ @@ -303,6 +309,7 @@ public: void make_visible (bool visible) override; void refresh () override; + void refresh_all () override; /* Refill the source window's source cache and update it. If this is a disassembly window, then just update it. */ @@ -371,6 +378,7 @@ struct tui_data_window : public tui_win_info DISABLE_COPY_AND_ASSIGN (tui_data_window); void clear_detail () override; + void refresh_all () override; /* Start of data display content. */ tui_win_content data_content = NULL; diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c index 9c4f9ad5779..383487e5f7a 100644 --- a/gdb/tui/tui-win.c +++ b/gdb/tui/tui-win.c @@ -508,6 +508,17 @@ tui_win_info::right_scroll (int num_to_scroll) } +/* See tui-data.h. */ + +void +tui_source_window_base::refresh_all () +{ + tui_show_source_content (this); + tui_check_and_display_highlight_if_needed (this); + tui_erase_exec_info_content (this); + tui_update_exec_info (this); +} + void tui_refresh_all_win (void) { @@ -517,25 +528,8 @@ tui_refresh_all_win (void) tui_refresh_all (tui_win_list); for (type = SRC_WIN; type < MAX_MAJOR_WINDOWS; type++) { - if (tui_win_list[type] - && tui_win_list[type]->generic.is_visible) - { - switch (type) - { - case SRC_WIN: - case DISASSEM_WIN: - tui_show_source_content (tui_win_list[type]); - tui_check_and_display_highlight_if_needed (tui_win_list[type]); - tui_erase_exec_info_content (tui_win_list[type]); - tui_update_exec_info (tui_win_list[type]); - break; - case DATA_WIN: - tui_refresh_data_win (); - break; - default: - break; - } - } + if (tui_win_list[type] && tui_win_list[type]->generic.is_visible) + tui_win_list[type]->refresh_all (); } tui_show_locator_content (); } @@ -872,7 +866,7 @@ The window name specified must be valid and visible.\n")); } if (TUI_DATA_WIN && TUI_DATA_WIN->generic.is_visible) - tui_refresh_data_win (); + TUI_DATA_WIN->refresh_all (); xfree (buf_ptr); printf_filtered (_("Focus set to %s window.\n"), tui_win_name (&tui_win_with_focus ()->generic)); diff --git a/gdb/tui/tui-windata.c b/gdb/tui/tui-windata.c index 67228a6c5ee..770baf857f6 100644 --- a/gdb/tui/tui-windata.c +++ b/gdb/tui/tui-windata.c @@ -193,10 +193,10 @@ tui_display_data_from (int element_no, int reuse_windows) /* Function to redisplay the contents of the data window. */ void -tui_refresh_data_win (void) +tui_data_window::refresh_all () { tui_erase_data_content (NULL); - if (TUI_DATA_WIN->generic.content_size > 0) + if (generic.content_size > 0) { int first_element = tui_first_data_item_displayed (); diff --git a/gdb/tui/tui.c b/gdb/tui/tui.c index d7201992ae4..55a44e8840e 100644 --- a/gdb/tui/tui.c +++ b/gdb/tui/tui.c @@ -237,7 +237,7 @@ tui_rl_other_window (int count, int key) { tui_set_win_focus_to (win_info); if (TUI_DATA_WIN && TUI_DATA_WIN->generic.is_visible) - tui_refresh_data_win (); + TUI_DATA_WIN->refresh_all (); keypad (TUI_CMD_WIN->generic.handle, (win_info != TUI_CMD_WIN)); } return 0;