This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[PATCH]: Add TUI key binding to switch TUI active window
- From: Stephane Carrez <stcarrez at nerim dot fr>
- To: gdb-patches at sources dot redhat dot com
- Date: Thu, 24 Jul 2003 22:29:44 +0200
- Subject: [PATCH]: Add TUI key binding to switch TUI active window
Hi!
This patch adds a new key binding to the TUI to switch the active TUI window
and give the focus to another window. The window with the focus is the one
that gets the page up/down and arrow keys. The switch is bound to CTRL-X O
(emacs other-window). Doc patch will follow shortly.
Committed on 6_0 and mainline.
Stephane
2003-07-24 Stephane Carrez <stcarrez@nerim.fr>
* tui.c (tui_rl_other_window): New function to switch the TUI active
window and give focus to a next window.
(tui_initialize_readline): Bind it to c-x o.
(tui_rl_next_keymap): Activate TUI mode when entering SingleKey mode.
Index: tui/tui.c
===================================================================
RCS file: /cvs/src/src/gdb/tui/tui.c,v
retrieving revision 1.31.2.1
diff -u -p -r1.31.2.1 tui.c
--- tui/tui.c 23 Jul 2003 21:41:22 -0000 1.31.2.1
+++ tui/tui.c 24 Jul 2003 20:17:28 -0000
@@ -45,6 +45,7 @@
#include "tuiStack.h"
#include "tuiWin.h"
#include "tuiSourceWin.h"
+#include "tuiDataWin.h"
#include "readline/readline.h"
#include "target.h"
#include "frame.h"
@@ -210,6 +211,27 @@ tui_rl_delete_other_windows (int notused
}
/* TUI readline command.
+ Switch the active window to give the focus to a next window. */
+static int
+tui_rl_other_window (int count, int key)
+{
+ TuiWinInfoPtr winInfo;
+
+ if (!tui_active)
+ tui_rl_switch_mode (0/*notused*/, 0/*notused*/);
+
+ winInfo = tuiNextWin (tuiWinWithFocus ());
+ if (winInfo)
+ {
+ tuiSetWinFocusTo (winInfo);
+ if (dataWin && dataWin->generic.isVisible)
+ tuiRefreshDataWin ();
+ keypad (cmdWin->generic.handle, (winInfo != cmdWin));
+ }
+ return 0;
+}
+
+/* TUI readline command.
Execute the gdb command bound to the specified key. */
static int
tui_rl_command_key (int count, int key)
@@ -248,6 +270,9 @@ tui_rl_command_mode (int count, int key)
static int
tui_rl_next_keymap (int notused1, int notused2)
{
+ if (!tui_active)
+ tui_rl_switch_mode (0/*notused*/, 0/*notused*/);
+
tui_set_key_mode (tui_current_key_mode == tui_command_mode
? tui_single_key_mode : tui_command_mode);
return 0;
@@ -326,6 +351,8 @@ tui_initialize_readline ()
rl_bind_key_in_map ('1', tui_rl_delete_other_windows, tui_ctlx_keymap);
rl_bind_key_in_map ('2', tui_rl_change_windows, emacs_ctlx_keymap);
rl_bind_key_in_map ('2', tui_rl_change_windows, tui_ctlx_keymap);
+ rl_bind_key_in_map ('o', tui_rl_other_window, emacs_ctlx_keymap);
+ rl_bind_key_in_map ('o', tui_rl_other_window, tui_ctlx_keymap);
rl_bind_key_in_map ('q', tui_rl_next_keymap, tui_keymap);
rl_bind_key_in_map ('s', tui_rl_next_keymap, emacs_ctlx_keymap);
rl_bind_key_in_map ('s', tui_rl_next_keymap, tui_ctlx_keymap);