From patchwork Sun Jun 23 22:43:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 33319 Received: (qmail 57380 invoked by alias); 23 Jun 2019 23:25:55 -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 57206 invoked by uid 89); 23 Jun 2019 23:25:54 -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, 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:52 +0000 Received: from cm16.websitewelcome.com (cm16.websitewelcome.com [100.42.49.19]) by gateway33.websitewelcome.com (Postfix) with ESMTP id 60E4E26205 for ; Sun, 23 Jun 2019 18:25:51 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id fBrrhMCPO4FKpfBrrhcnOC; Sun, 23 Jun 2019 18:25:51 -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=SAXf5NXjBRHXp6xjaMGPbUSTXBnj+zvydej8yA2/GXU=; b=XNUKWtHqAqQnN9B6cC/Gx7xEWD tDCaKvzH4+dymrxNUtILU7fYK1F1oLonu9CR87m3lArF4HHjMZ8mjkD+BJcUaXKlzLm1LvFQinzEY Zqxc5d7WS5x9uh6QWIPhDAGF8; 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 1hfBDC-000vDQ-Eh; Sun, 23 Jun 2019 17:43:50 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 45/66] Introduce tui_win_info::update_tab_width Date: Sun, 23 Jun 2019 16:43:08 -0600 Message-Id: <20190623224329.16060-46-tom@tromey.com> In-Reply-To: <20190623224329.16060-1-tom@tromey.com> References: <20190623224329.16060-1-tom@tromey.com> This introduces a new tui_win_info::update_tab_width method, and changes the TUI to call it. This fixes another spot that was checking the window type. 2019-06-23 Tom Tromey * tui/tui-win.c (tui_source_window_base::update_tab_width): New method. (update_tab_width): Call update_tab_width method. * tui/tui-data.h (struct tui_win_info) (struct tui_source_window_base) : New methods. --- gdb/ChangeLog | 8 ++++++++ gdb/tui/tui-data.h | 7 +++++++ gdb/tui/tui-win.c | 33 +++++++++++++++++---------------- 3 files changed, 32 insertions(+), 16 deletions(-) diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h index caf3bb4f408..298ee452d50 100644 --- a/gdb/tui/tui-data.h +++ b/gdb/tui/tui-data.h @@ -306,6 +306,11 @@ public: /* Compute the maximum height of this window. */ virtual int max_height () const; + /* Called after the tab width has been changed. */ + virtual void update_tab_width () + { + } + /* Set whether this window is highglighted. */ void set_highlight (bool highlight) { @@ -362,6 +367,8 @@ public: void set_new_height (int height) override; + void update_tab_width () override; + /* Does locator belongs to this window? */ bool m_has_locator = false; /* Execution information window. */ diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c index b92eb505b31..8a4e64f3c88 100644 --- a/gdb/tui/tui-win.c +++ b/gdb/tui/tui-win.c @@ -923,29 +923,30 @@ unsigned int tui_tab_width = DEFAULT_TAB_LEN; static unsigned int internal_tab_width = DEFAULT_TAB_LEN; -/* After the tab width is set, call this to update the relevant - windows. */ +/* See tui-data.h. */ -static void -update_tab_width () +void +tui_source_window_base::update_tab_width () { /* We don't really change the height of any windows, but calling these 2 functions causes a complete regeneration and redisplay of the window's contents, which will take the new tab width into account. */ - if (tui_win_list[SRC_WIN] - && tui_win_list[SRC_WIN]->is_visible) - { - make_invisible_and_set_new_height (TUI_SRC_WIN, - TUI_SRC_WIN->height); - make_visible_with_new_height (TUI_SRC_WIN); - } - if (tui_win_list[DISASSEM_WIN] - && tui_win_list[DISASSEM_WIN]->is_visible) + make_invisible_and_set_new_height (this, height); + make_visible_with_new_height (this); +} + +/* After the tab width is set, call this to update the relevant + windows. */ + +static void +update_tab_width () +{ + for (int win_type = SRC_WIN; win_type < MAX_MAJOR_WINDOWS; win_type++) { - make_invisible_and_set_new_height (TUI_DISASM_WIN, - TUI_DISASM_WIN->height); - make_visible_with_new_height (TUI_DISASM_WIN); + if (tui_win_list[win_type] != NULL + && tui_win_list[win_type]->is_visible) + tui_win_list[win_type]->update_tab_width (); } }