From patchwork Thu Jul 4 17:03: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: 33585 Received: (qmail 113423 invoked by alias); 4 Jul 2019 17:04:19 -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 107864 invoked by uid 89); 4 Jul 2019 17:03:44 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-19.4 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=cleaner, felt X-HELO: gateway32.websitewelcome.com Received: from gateway32.websitewelcome.com (HELO gateway32.websitewelcome.com) (192.185.145.123) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 04 Jul 2019 17:03:37 +0000 Received: from cm13.websitewelcome.com (cm13.websitewelcome.com [100.42.49.6]) by gateway32.websitewelcome.com (Postfix) with ESMTP id 692361A3C0 for ; Thu, 4 Jul 2019 12:03:36 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id j58yhUt8ZYTGMj58yhNgA9; Thu, 04 Jul 2019 12:03:36 -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=XT4j0W2cllGxUEAjK9jdDkFNnTWCWOTQy+ni2L9SHgQ=; b=X8Ll3Pk8MHa2f0zAnStVolEyah pWOgHaITDJbjlrtawRmQNOhdXHohqkm/ABaB3OieE6NA5Jjq9ccZ0813wLy/BBqPpfRwHGJ97kI3/ sGAB9/t5t0osjfAeNecdJg9bS; Received: from 174-29-58-150.hlrn.qwest.net ([174.29.58.150]:34704 helo=bapiya.Home) by box5379.bluehost.com with esmtpa (Exim 4.92) (envelope-from ) id 1hj58y-002sNV-3R; Thu, 04 Jul 2019 12:03:36 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 58/61] Change make_invisible_and_set_new_height to be a method Date: Thu, 4 Jul 2019 11:03:08 -0600 Message-Id: <20190704170311.15982-59-tom@tromey.com> In-Reply-To: <20190704170311.15982-1-tom@tromey.com> References: <20190704170311.15982-1-tom@tromey.com> This changes make_invisible_and_set_new_height to be a method on tui_win_info. I felt that this was cleaner. 2019-07-04 Tom Tromey * tui/tui-win.c (tui_resize_all) (tui_source_window_base::update_tab_width) (tui_adjust_win_heights): Update. (tui_win_info::make_invisible_and_set_new_height): Rename from make_invisible_and_set_new_height. * tui/tui-data.h (struct tui_win_info) : New method. --- gdb/ChangeLog | 10 ++++++ gdb/tui/tui-data.h | 5 +++ gdb/tui/tui-win.c | 78 +++++++++++++++++++++------------------------- 3 files changed, 50 insertions(+), 43 deletions(-) diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h index 0d984ad3b4c..84a8117c754 100644 --- a/gdb/tui/tui-data.h +++ b/gdb/tui/tui-data.h @@ -299,6 +299,11 @@ public: { } + /* Function make the target window (and auxiliary windows associated + with the target) invisible, and set the new height and + location. */ + void make_invisible_and_set_new_height (int height); + /* Make the window visible after the height has been changed. */ void make_visible_with_new_height (); diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c index 124fdb11c7e..227ab94bdc7 100644 --- a/gdb/tui/tui-win.c +++ b/gdb/tui/tui-win.c @@ -55,8 +55,6 @@ /******************************* ** Static Local Decls ********************************/ -static void make_invisible_and_set_new_height (struct tui_win_info *, - int); static enum tui_status tui_adjust_win_heights (struct tui_win_info *, int); static int new_height_ok (struct tui_win_info *, int); @@ -601,11 +599,11 @@ tui_resize_all (void) new_height = first_win->height + split_diff; locator->origin.y = new_height + 1; - make_invisible_and_set_new_height (first_win, new_height); + first_win->make_invisible_and_set_new_height (new_height); TUI_CMD_WIN->origin.y = locator->origin.y + 1; TUI_CMD_WIN->width += width_diff; new_height = screenheight - TUI_CMD_WIN->origin.y; - make_invisible_and_set_new_height (TUI_CMD_WIN, new_height); + TUI_CMD_WIN->make_invisible_and_set_new_height (new_height); first_win->make_visible_with_new_height (); TUI_CMD_WIN->make_visible_with_new_height (); if (src_win->content.empty ()) @@ -640,7 +638,7 @@ tui_resize_all (void) new_height = MIN_WIN_HEIGHT; else new_height = first_win->height + split_diff; - make_invisible_and_set_new_height (first_win, new_height); + first_win->make_invisible_and_set_new_height (new_height); locator->width += width_diff; @@ -663,13 +661,12 @@ tui_resize_all (void) else new_height = second_win->height + split_diff; second_win->origin.y = first_win->height - 1; - make_invisible_and_set_new_height (second_win, new_height); + second_win->make_invisible_and_set_new_height (new_height); /* Change the command window's height/width. */ TUI_CMD_WIN->origin.y = locator->origin.y + 1; - make_invisible_and_set_new_height (TUI_CMD_WIN, - TUI_CMD_WIN->height - + cmd_split_diff); + TUI_CMD_WIN->make_invisible_and_set_new_height (TUI_CMD_WIN->height + + cmd_split_diff); first_win->make_visible_with_new_height (); second_win->make_visible_with_new_height (); TUI_CMD_WIN->make_visible_with_new_height (); @@ -911,7 +908,7 @@ tui_source_window_base::update_tab_width () calling these 2 functions causes a complete regeneration and redisplay of the window's contents, which will take the new tab width into account. */ - make_invisible_and_set_new_height (this, height); + make_invisible_and_set_new_height (height); make_visible_with_new_height (); } @@ -1081,7 +1078,7 @@ tui_adjust_win_heights (struct tui_win_info *primary_win_info, { struct tui_win_info *src_win_info; - make_invisible_and_set_new_height (primary_win_info, new_height); + primary_win_info->make_invisible_and_set_new_height (new_height); if (primary_win_info->type == CMD_WIN) { win_info = tui_source_windows ()[0]; @@ -1092,8 +1089,8 @@ tui_adjust_win_heights (struct tui_win_info *primary_win_info, win_info = tui_win_list[CMD_WIN]; src_win_info = primary_win_info; } - make_invisible_and_set_new_height (win_info, - win_info->height + diff); + win_info->make_invisible_and_set_new_height + (win_info->height + diff); TUI_CMD_WIN->origin.y = locator->origin.y + 1; win_info->make_visible_with_new_height (); primary_win_info->make_visible_with_new_height (); @@ -1159,15 +1156,13 @@ tui_adjust_win_heights (struct tui_win_info *primary_win_info, second_split_diff++; first_split_diff--; } - make_invisible_and_set_new_height ( - first_win, - first_win->height + first_split_diff); + first_win->make_invisible_and_set_new_height + (first_win->height + first_split_diff); second_win->origin.y = first_win->height - 1; - make_invisible_and_set_new_height (second_win, - second_win->height - + second_split_diff); + second_win->make_invisible_and_set_new_height + (second_win->height + second_split_diff); TUI_CMD_WIN->origin.y = locator->origin.y + 1; - make_invisible_and_set_new_height (TUI_CMD_WIN, new_height); + TUI_CMD_WIN->make_invisible_and_set_new_height (new_height); } else { @@ -1188,23 +1183,22 @@ tui_adjust_win_heights (struct tui_win_info *primary_win_info, } } if (primary_win_info == first_win) - make_invisible_and_set_new_height (first_win, new_height); + first_win->make_invisible_and_set_new_height (new_height); else - make_invisible_and_set_new_height ( - first_win, - first_win->height); + first_win->make_invisible_and_set_new_height + (first_win->height); second_win->origin.y = first_win->height - 1; if (primary_win_info == second_win) - make_invisible_and_set_new_height (second_win, new_height); + second_win->make_invisible_and_set_new_height (new_height); else - make_invisible_and_set_new_height ( - second_win, second_win->height); + second_win->make_invisible_and_set_new_height + (second_win->height); TUI_CMD_WIN->origin.y = locator->origin.y + 1; if ((TUI_CMD_WIN->height + diff) < 1) - make_invisible_and_set_new_height (TUI_CMD_WIN, 1); + TUI_CMD_WIN->make_invisible_and_set_new_height (1); else - make_invisible_and_set_new_height (TUI_CMD_WIN, - TUI_CMD_WIN->height + diff); + TUI_CMD_WIN->make_invisible_and_set_new_height + (TUI_CMD_WIN->height + diff); } TUI_CMD_WIN->make_visible_with_new_height (); second_win->make_visible_with_new_height (); @@ -1243,24 +1237,22 @@ tui_source_window_base::set_new_height (int height) } } -/* Function make the target window (and auxiliary windows associated - with the targer) invisible, and set the new height and - location. */ -static void -make_invisible_and_set_new_height (struct tui_win_info *win_info, - int height) +/* See tui-data.h. */ + +void +tui_win_info::make_invisible_and_set_new_height (int height) { - win_info->make_visible (false); - win_info->height = height; + make_visible (false); + height = height; if (height > 1) - win_info->viewport_height = height - 1; + viewport_height = height - 1; else - win_info->viewport_height = height; - if (win_info != TUI_CMD_WIN) - win_info->viewport_height--; + viewport_height = height; + if (this != TUI_CMD_WIN) + viewport_height--; /* Now deal with the auxiliary windows associated with win_info. */ - win_info->set_new_height (height); + set_new_height (height); }