Patchwork [review] Remove some unnecessary focus switches

login
register
mail settings
Submitter Simon Marchi (Code Review)
Date Nov. 14, 2019, 11:35 p.m.
Message ID <gerrit.1573774548000.I0a5bb8a407cf8d52e2fd23b0598eb9bce56b1251@gnutoolchain-gerrit.osci.io>
Download mbox | patch
Permalink /patch/35910/
State New
Headers show

Comments

Simon Marchi (Code Review) - Nov. 14, 2019, 11:35 p.m.
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/635
......................................................................

Remove some unnecessary focus switches

A couple of lower-level utility functions can change the TUI focus.
This seems incorrect to me -- focus switches should only be done
either by explicit user request, or ass a side effect of changing the
layout.

gdb/ChangeLog
2019-11-14  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.c
	(tui_source_window_base::update_source_window_as_is): Don't switch focus.
	* tui/tui-disasm.c (tui_show_disassem): Don't switch focus.

Change-Id: I0a5bb8a407cf8d52e2fd23b0598eb9bce56b1251
---
M gdb/ChangeLog
M gdb/tui/tui-disasm.c
M gdb/tui/tui-winsource.c
3 files changed, 6 insertions(+), 12 deletions(-)

Patch

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 00a8985..5c5b888 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@ 
 2019-11-14  Tom Tromey  <tom@tromey.com>
 
+	* tui/tui-winsource.c
+	(tui_source_window_base::update_source_window_as_is): Don't switch focus.
+	* tui/tui-disasm.c (tui_show_disassem): Don't switch focus.
+
+2019-11-14  Tom Tromey  <tom@tromey.com>
+
 	* tui/tui-winsource.h (struct tui_source_window_base)
 	<maybe_update>: Remove line_no and addr parameters.
 	* tui/tui-stack.c (tui_show_frame_info): Set PC on sal.  Update.
diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c
index 9a1dc36..447dd2f 100644
--- a/gdb/tui/tui-disasm.c
+++ b/gdb/tui/tui-disasm.c
@@ -260,7 +260,6 @@ 
 tui_show_disassem (struct gdbarch *gdbarch, CORE_ADDR start_addr)
 {
   struct symtab *s = find_pc_line_symtab (start_addr);
-  struct tui_win_info *win_with_focus = tui_win_with_focus ();
   struct tui_line_or_address val;
 
   gdb_assert (TUI_DISASM_WIN != nullptr && TUI_DISASM_WIN->is_visible ());
@@ -268,12 +267,6 @@ 
   val.loa = LOA_ADDRESS;
   val.u.addr = start_addr;
   TUI_DISASM_WIN->update_source_window (gdbarch, s, val);
-
-  /* If the focus was in the src win, put it in the asm win, if the
-     source view isn't split.  */
-  if (tui_current_layout () != SRC_DISASSEM_COMMAND 
-      && win_with_focus == TUI_SRC_WIN)
-    tui_set_win_focus_to (TUI_DISASM_WIN);
 }
 
 void
diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
index 8e1d61a..3b609c3 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -194,11 +194,6 @@ 
 	  sal.symtab = s;
 	  sal.pspace = SYMTAB_PSPACE (s);
 	  set_current_source_symtab_and_line (sal);
-	  /* If the focus was in the asm win, put it in the src win if
-	     we don't have a split layout.  */
-	  if (tui_win_with_focus () == TUI_DISASM_WIN
-	      && tui_current_layout () != SRC_DISASSEM_COMMAND)
-	    tui_set_win_focus_to (this);
 	}
     }
 }