Remove TUI data window special case
authorTom Tromey <tom@tromey.com>
Sat, 29 Jun 2019 05:32:05 +0000 (23:32 -0600)
committerTom Tromey <tom@tromey.com>
Wed, 17 Jul 2019 18:19:11 +0000 (12:19 -0600)
The TUI has a couple of special cases for updating the data window:
one in tui_rl_other_windowand one in tui_set_focus_command.  As part
of the project to remove references to globals, I wanted to remove
these calls; but when I did, some simple operations (like "C-x o")
would cause the register window to blank.

This fixes the underlying problem by arranging for the data window's
refresh_window method to call the superclass method first, and then to
refresh the child windows.  Then the special cases can be removed.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

* tui/tui.c (tui_rl_other_window): Update.
* tui/tui-wingeneral.c (tui_data_window::refresh_window): Call
superclass method first.  Always iterate over regs_content.
(tui_unhighlight_win, tui_highlight_win): Use refresh_window
method.
* tui/tui-win.c (tui_set_focus_command): Update.

gdb/ChangeLog
gdb/tui/tui-win.c
gdb/tui/tui-wingeneral.c
gdb/tui/tui.c

index 1467352d27e4cc0ab3809e2333484bcf8a180294..97d5e85f691927fc0f7f6b1ddcd5408ae2f20c7a 100644 (file)
@@ -1,3 +1,12 @@
+2019-07-17  Tom Tromey  <tom@tromey.com>
+
+       * tui/tui.c (tui_rl_other_window): Update.
+       * tui/tui-wingeneral.c (tui_data_window::refresh_window): Call
+       superclass method first.  Always iterate over regs_content.
+       (tui_unhighlight_win, tui_highlight_win): Use refresh_window
+       method.
+       * tui/tui-win.c (tui_set_focus_command): Update.
+
 2019-07-17  Tom Tromey  <tom@tromey.com>
 
        * tui/tui-win.c (tui_set_focus_command): Rename from
index 083f046cafa800da8c8df76710b81c11dc45b235..9d9d9a5f57788c1896229c77daa28d8298f4ef16 100644 (file)
@@ -857,8 +857,6 @@ The window name specified must be valid and visible.\n"));
          keypad (TUI_CMD_WIN->handle, (win_info != TUI_CMD_WIN));
        }
 
-      if (TUI_DATA_WIN && TUI_DATA_WIN->is_visible)
-       TUI_DATA_WIN->refresh_all ();
       xfree (buf_ptr);
       printf_filtered (_("Focus set to %s window.\n"),
                       tui_win_with_focus ()->name ());
index 2902b8006b75621c371ec3a1fc1072aa1c1d5a48..dc008cd71980c642526acac78596ba3b656f1791 100644 (file)
@@ -48,15 +48,12 @@ tui_gen_win_info::refresh_window ()
 void
 tui_data_window::refresh_window ()
 {
-  if (!regs_content.empty ())
+  tui_gen_win_info::refresh_window ();
+  for (auto &&win : regs_content)
     {
-      for (auto &&win : regs_content)
-       {
-         if (win != NULL)
-           win->refresh_window ();
-       }
+      if (win != NULL)
+       win->refresh_window ();
     }
-  tui_gen_win_info::refresh_window ();
 }
 
 /* Function to delete the curses window, checking for NULL.  */
@@ -108,7 +105,7 @@ tui_unhighlight_win (struct tui_win_info *win_info)
       && win_info->handle != NULL)
     {
       box_win (win_info, NO_HILITE);
-      wrefresh (win_info->handle);
+      win_info->refresh_window ();
       win_info->set_highlight (false);
     }
 }
@@ -122,7 +119,7 @@ tui_highlight_win (struct tui_win_info *win_info)
       && win_info->handle != NULL)
     {
       box_win (win_info, HILITE);
-      wrefresh (win_info->handle);
+      win_info->refresh_window ();
       win_info->set_highlight (true);
     }
 }
index 693c2ff4a03ead9c5e82460b09d84d1094d3d7af..ee2c35587df6cc2da2b7e1794e24c4e7ee06671a 100644 (file)
@@ -236,8 +236,6 @@ tui_rl_other_window (int count, int key)
   if (win_info)
     {
       tui_set_win_focus_to (win_info);
-      if (TUI_DATA_WIN && TUI_DATA_WIN->is_visible)
-       TUI_DATA_WIN->refresh_all ();
       keypad (TUI_CMD_WIN->handle, (win_info != TUI_CMD_WIN));
     }
   return 0;