Remove struct tui_point
authorTom Tromey <tom@tromey.com>
Sat, 26 Oct 2019 22:00:01 +0000 (16:00 -0600)
committerTom Tromey <tom@tromey.com>
Wed, 11 Dec 2019 22:49:01 +0000 (15:49 -0700)
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-12-11  Tom Tromey  <tom@tromey.com>

* 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) <origin>: Remove.
<x, y>: New fields.
* tui/tui-command.c (tui_cmd_window::resize): Update.

Change-Id: I3f77920585b9ea9e2b4b189f3f3ae32d4da0c252

gdb/ChangeLog
gdb/tui/tui-command.c
gdb/tui/tui-data.h
gdb/tui/tui-layout.c
gdb/tui/tui-win.c
gdb/tui/tui-wingeneral.c

index d436bb514b4fd729e72f6f5847376d6469d6ed3d..7821d2cdd7de17f71b79d4c7186bbd9277a0b28f 100644 (file)
@@ -1,3 +1,13 @@
+2019-12-11  Tom Tromey  <tom@tromey.com>
+
+       * 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) <origin>: Remove.
+       <x, y>: New fields.
+       * tui/tui-command.c (tui_cmd_window::resize): Update.
+
 2019-12-11  Tom Tromey  <tom@tromey.com>
 
        * tui/tui-stack.h (struct tui_locator_window) <min_height>:
index 9a43297133904327e51ab8217f9e9c1afe1845dd..e4c3a1b749161298a057a9e83339793951222d38 100644 (file)
@@ -50,8 +50,8 @@ tui_cmd_window::resize (int height_, int width_, int origin_x, int origin_y)
     }
   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 @@ tui_cmd_window::resize (int height_, int width_, int origin_x, int origin_y)
 #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);
     }
 }
index a25ab11dc5eb6e8a5981536550cb66a8a8c66940..a0e296fa68c5ed2480c7c8c1c23b7a652c1122c2 100644 (file)
@@ -30,12 +30,6 @@ struct tui_cmd_window;
 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 @@ public:
   /* 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;
 };
index ba0b367e16dee79230ece248db90521c9798cf7a..0a7812a53ea5d581939fb06aef21e6add9588e94 100644 (file)
@@ -468,7 +468,7 @@ tui_gen_win_info::resize (int height_, int width_,
                          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 @@ tui_gen_win_info::resize (int height_, int width_,
     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);
index b0111d7cf8cb5fb44357e84cfe987d5b67c01ff1..4339b7e967abe38d98ac32a20a58fbcdd9bf2fcb 100644 (file)
@@ -593,7 +593,7 @@ tui_resize_all (void)
 
          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)
@@ -646,12 +646,12 @@ tui_resize_all (void)
                              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;
        }
 
@@ -1078,7 +1078,7 @@ tui_adjust_win_heights (struct tui_win_info *primary_win_info,
              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 ());
@@ -1090,8 +1090,8 @@ tui_adjust_win_heights (struct tui_win_info *primary_win_info,
                  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))
                {
@@ -1156,16 +1156,16 @@ tui_adjust_win_heights (struct tui_win_info *primary_win_info,
                    }
                  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
                {
@@ -1189,7 +1189,7 @@ tui_adjust_win_heights (struct tui_win_info *primary_win_info,
                    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);
@@ -1197,14 +1197,14 @@ tui_adjust_win_heights (struct tui_win_info *primary_win_info,
                    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 ();
index b92f203b3b2f73e8c7e7320783d08075e23be224..17be3e23e9a6430b34b3c1180a66939ce829e6dd 100644 (file)
@@ -131,7 +131,7 @@ tui_win_info::check_and_display_highlight_if_needed ()
 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);
 }