From patchwork Thu Nov 14 22:51:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Simon Marchi (Code Review)" X-Patchwork-Id: 35899 Received: (qmail 99484 invoked by alias); 14 Nov 2019 22:51:33 -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 99393 invoked by uid 89); 14 Nov 2019 22:51:32 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy=viewport, sk:tuiwin, sk:i3f7792, min_height X-HELO: mx1.osci.io Received: from polly.osci.io (HELO mx1.osci.io) (8.43.85.229) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 14 Nov 2019 22:51:30 +0000 Received: by mx1.osci.io (Postfix, from userid 994) id 5788F20413; Thu, 14 Nov 2019 17:51:26 -0500 (EST) Received: from gnutoolchain-gerrit.osci.io (gnutoolchain-gerrit.osci.io [8.43.85.239]) by mx1.osci.io (Postfix) with ESMTP id 4A147203AF; Thu, 14 Nov 2019 17:51:21 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by gnutoolchain-gerrit.osci.io (Postfix) with ESMTP id 2F01628173; Thu, 14 Nov 2019 17:51:21 -0500 (EST) X-Gerrit-PatchSet: 3 Date: Thu, 14 Nov 2019 17:51:20 -0500 From: "Tom Tromey (Code Review)" To: Andrew Burgess , gdb-patches@sourceware.org Auto-Submitted: auto-generated X-Gerrit-MessageType: newpatchset Subject: [review v3] Remove struct tui_point X-Gerrit-Change-Id: I3f77920585b9ea9e2b4b189f3f3ae32d4da0c252 X-Gerrit-Change-Number: 366 X-Gerrit-ChangeURL: X-Gerrit-Commit: 6dfd4bf22a418377252c0141110f01bbf7996cfb In-Reply-To: References: Reply-To: tromey@sourceware.org, andrew.burgess@embecosm.com, gdb-patches@sourceware.org MIME-Version: 1.0 Content-Disposition: inline User-Agent: Gerrit/3.0.3-76-gf8b6da0ab5 Message-Id: <20191114225121.2F01628173@gnutoolchain-gerrit.osci.io> Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/366 ...................................................................... Remove struct tui_point struct tui_point does not help very much. It is only used for storage, and never passed between functions. I think it makes the code more verbose without any corresponding benefit, so this patch removes it. gdb/ChangeLog 2019-11-12 Tom Tromey * tui/tui-wingeneral.c (tui_gen_win_info::make_window): Update. * tui/tui-win.c (tui_adjust_win_heights, tui_resize_all): Update. * tui/tui-layout.c (tui_gen_win_info::resize): Update. * tui/tui-data.h (struct tui_point): Remove. (struct tui_gen_win_info) : Remove. : New fields. * tui/tui-command.c (tui_cmd_window::resize): Update. Change-Id: I3f77920585b9ea9e2b4b189f3f3ae32d4da0c252 --- M gdb/ChangeLog M gdb/tui/tui-command.c M gdb/tui/tui-data.h M gdb/tui/tui-layout.c M gdb/tui/tui-win.c M gdb/tui/tui-wingeneral.c 6 files changed, 35 insertions(+), 30 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 0cc706a..c450e00 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,15 @@ 2019-11-12 Tom Tromey + * tui/tui-wingeneral.c (tui_gen_win_info::make_window): Update. + * tui/tui-win.c (tui_adjust_win_heights, tui_resize_all): Update. + * tui/tui-layout.c (tui_gen_win_info::resize): Update. + * tui/tui-data.h (struct tui_point): Remove. + (struct tui_gen_win_info) : Remove. + : New fields. + * tui/tui-command.c (tui_cmd_window::resize): Update. + +2019-11-12 Tom Tromey + * tui/tui-stack.h (struct tui_locator_window) : Implement. * tui/tui-regs.h (struct tui_data_item_window) : diff --git a/gdb/tui/tui-command.c b/gdb/tui/tui-command.c index 9a43297..e4c3a1b 100644 --- a/gdb/tui/tui-command.c +++ b/gdb/tui/tui-command.c @@ -50,8 +50,8 @@ } else viewport_height = 1; - origin.x = origin_x; - origin.y = origin_y; + x = origin_x; + y = origin_y; if (handle == nullptr) make_window (); @@ -66,7 +66,7 @@ #ifdef HAVE_WRESIZE wresize (handle.get (), height, width); #endif - mvwin (handle.get (), origin.y, origin.x); + mvwin (handle.get (), y, x); wmove (handle.get (), 0, 0); } } diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h index 59c96b8..58fe821 100644 --- a/gdb/tui/tui-data.h +++ b/gdb/tui/tui-data.h @@ -30,12 +30,6 @@ struct tui_source_window_base; struct tui_source_window; -/* This is a point definition. */ -struct tui_point -{ - int x, y; -}; - /* A deleter that calls delwin. */ struct curses_deleter { @@ -114,7 +108,8 @@ /* Window height. */ int height = 0; /* Origin of window. */ - struct tui_point origin = {0, 0}; + int x = 0; + int y = 0; /* Viewport height. */ int viewport_height = 0; }; diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c index ba0b367..0a7812a 100644 --- a/gdb/tui/tui-layout.c +++ b/gdb/tui/tui-layout.c @@ -468,7 +468,7 @@ int origin_x_, int origin_y_) { if (width == width_ && height == height_ - && origin.x == origin_x_ && origin.y == origin_y_ + && x == origin_x_ && y == origin_y_ && handle != nullptr) return; @@ -478,14 +478,14 @@ viewport_height = height - 2; else viewport_height = 1; - origin.x = origin_x_; - origin.y = origin_y_; + x = origin_x_; + y = origin_y_; if (handle != nullptr) { #ifdef HAVE_WRESIZE wresize (handle.get (), height, width); - mvwin (handle.get (), origin.y, origin.x); + mvwin (handle.get (), y, x); wmove (handle.get (), 0, 0); #else handle.reset (nullptr); diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c index feeee34..6ca57d8 100644 --- a/gdb/tui/tui-win.c +++ b/gdb/tui/tui-win.c @@ -590,7 +590,7 @@ new_height = screenheight - (new_height + 1); TUI_CMD_WIN->resize (new_height, screenwidth, - 0, locator->origin.y + 1); + 0, locator->y + 1); break; default: if (cur_layout == SRC_DISASSEM_COMMAND) @@ -643,12 +643,12 @@ 0, first_win->height - 1); locator->resize (1, screenwidth, - 0, second_win->origin.y + new_height); + 0, second_win->y + new_height); /* Change the command window's height/width. */ - new_height = screenheight - (locator->origin.y + 1); + new_height = screenheight - (locator->y + 1); TUI_CMD_WIN->resize (new_height, screenwidth, - 0, locator->origin.y + 1); + 0, locator->y + 1); break; } @@ -1032,7 +1032,7 @@ struct tui_win_info *src_win_info; primary_win_info->resize (new_height, width, - 0, primary_win_info->origin.y); + 0, primary_win_info->y); if (primary_win_info->type == CMD_WIN) { win_info = *(tui_source_windows ().begin ()); @@ -1044,8 +1044,8 @@ src_win_info = primary_win_info; } win_info->resize (win_info->height + diff, width, - 0, win_info->origin.y); - TUI_CMD_WIN->origin.y = locator->origin.y + 1; + 0, win_info->y); + TUI_CMD_WIN->y = locator->y + 1; if ((src_win_info->type == SRC_WIN || src_win_info->type == DISASSEM_WIN)) { @@ -1110,16 +1110,16 @@ } first_win->resize (first_win->height + first_split_diff, width, - 0, first_win->origin.y); + 0, first_win->y); second_win->resize (second_win->height + second_split_diff, width, 0, first_win->height - 1); locator->resize (1, width, - 0, (second_win->origin.y + 0, (second_win->y + second_win->height + 1)); TUI_CMD_WIN->resize (new_height, width, - 0, locator->origin.y + 1); + 0, locator->y + 1); } else { @@ -1143,7 +1143,7 @@ first_win->resize (new_height, width, 0, 0); else first_win->resize (first_win->height, width, 0, 0); - second_win->origin.y = first_win->height - 1; + second_win->y = first_win->height - 1; if (primary_win_info == second_win) second_win->resize (new_height, width, 0, first_win->height - 1); @@ -1151,14 +1151,14 @@ second_win->resize (second_win->height, width, 0, first_win->height - 1); locator->resize (1, width, - 0, (second_win->origin.y + 0, (second_win->y + second_win->height + 1)); - TUI_CMD_WIN->origin.y = locator->origin.y + 1; + TUI_CMD_WIN->y = locator->y + 1; if ((TUI_CMD_WIN->height + diff) < 1) - TUI_CMD_WIN->resize (1, width, 0, locator->origin.y + 1); + TUI_CMD_WIN->resize (1, width, 0, locator->y + 1); else TUI_CMD_WIN->resize (TUI_CMD_WIN->height + diff, width, - 0, locator->origin.y + 1); + 0, locator->y + 1); } if (src1 != nullptr && src1->content.empty ()) src1->erase_source_content (); diff --git a/gdb/tui/tui-wingeneral.c b/gdb/tui/tui-wingeneral.c index f6a6903..9e36747 100644 --- a/gdb/tui/tui-wingeneral.c +++ b/gdb/tui/tui-wingeneral.c @@ -123,7 +123,7 @@ void tui_gen_win_info::make_window () { - handle.reset (newwin (height, width, origin.y, origin.x)); + handle.reset (newwin (height, width, y, x)); if (handle != NULL) scrollok (handle.get (), TRUE); }