Remove tui_set_win_with_focus
authorTom Tromey <tom@tromey.com>
Sat, 22 Feb 2020 18:48:26 +0000 (11:48 -0700)
committerTom Tromey <tom@tromey.com>
Sat, 22 Feb 2020 18:48:38 +0000 (11:48 -0700)
I noticed that the TUI had two functions with similar names:
tui_set_win_focus_to and tui_set_win_with_focus.

However, one was just an implementation detail of the latter.  So,
this patch removes tui_set_win_with_focus entirely, to avoid any
temptation to call it.

gdb/ChangeLog
2020-02-22  Tom Tromey  <tom@tromey.com>

* tui/tui-win.c (tui_set_win_focus_to): Move to tui-data.c.
* tui/tui-data.h (tui_set_win_with_focus): Don't declare.
* tui/tui-data.c (tui_set_win_with_focus): Remove.
(tui_set_win_focus_to): Move from tui-win.c.

Change-Id: Idffddab773436bdf80d55480906d76b292981ef2

gdb/ChangeLog
gdb/tui/tui-data.c
gdb/tui/tui-data.h
gdb/tui/tui-win.c

index fe8692782632378b33c2b670d314b2e5441ce440..474825b095c02dd71bc1645bc17e71c1a639030a 100644 (file)
@@ -1,3 +1,10 @@
+2020-02-22  Tom Tromey  <tom@tromey.com>
+
+       * tui/tui-win.c (tui_set_win_focus_to): Move to tui-data.c.
+       * tui/tui-data.h (tui_set_win_with_focus): Don't declare.
+       * tui/tui-data.c (tui_set_win_with_focus): Remove.
+       (tui_set_win_focus_to): Move from tui-win.c.
+
 2020-02-22  Tom Tromey  <tom@tromey.com>
 
        * tui/tui-layout.c (make_standard_window, get_locator_window): New
index db637d8fbe65cbbff4de6c3d8d9808f1d332897d..8f7d257e9457a8ef344b56f198e9f722abae6317 100644 (file)
@@ -23,6 +23,7 @@
 #include "symtab.h"
 #include "tui/tui.h"
 #include "tui/tui-data.h"
+#include "tui/tui-win.h"
 #include "tui/tui-wingeneral.h"
 #include "tui/tui-winsource.h"
 #include "gdb_curses.h"
@@ -59,11 +60,16 @@ tui_win_with_focus (void)
 }
 
 
-/* Set the window that has the logical focus.  */
+/* Set the logical focus to win_info.  */
 void
-tui_set_win_with_focus (struct tui_win_info *win_info)
+tui_set_win_focus_to (struct tui_win_info *win_info)
 {
-  win_with_focus = win_info;
+  if (win_info != NULL)
+    {
+      tui_unhighlight_win (win_with_focus);
+      win_with_focus = win_info;
+      tui_highlight_win (win_info);
+    }
 }
 
 
index 51208b1100e8781dd2bce20c36ef4029202d2b44..60c588ed1544843b7d9acf0520b05fe7eb487953 100644 (file)
@@ -251,7 +251,6 @@ extern int tui_term_width (void);
 extern void tui_set_term_width_to (int);
 extern struct tui_locator_window *tui_locator_win_info_ptr (void);
 extern struct tui_win_info *tui_win_with_focus (void);
-extern void tui_set_win_with_focus (struct tui_win_info *);
 extern bool tui_win_resized ();
 extern void tui_set_win_resized_to (bool);
 
index ac314d7d2ac20e51b81e8a6bcfc3cff5623b3ede..51d0365b72318789c51b8f766c828b215d1ddc60 100644 (file)
@@ -452,21 +452,6 @@ tui_update_gdb_sizes (void)
 }
 
 
-/* Set the logical focus to win_info.  */
-void
-tui_set_win_focus_to (struct tui_win_info *win_info)
-{
-  if (win_info != NULL)
-    {
-      struct tui_win_info *win_with_focus = tui_win_with_focus ();
-
-      tui_unhighlight_win (win_with_focus);
-      tui_set_win_with_focus (win_info);
-      tui_highlight_win (win_info);
-    }
-}
-
-
 void
 tui_win_info::forward_scroll (int num_to_scroll)
 {