aboutsummaryrefslogtreecommitdiff
path: root/gdb/tui/tui-io.c
diff options
context:
space:
mode:
authorPatrick Palka <patrick@parcs.ath.cx>2015-02-17 11:13:43 -0500
committerPatrick Palka <patrick@parcs.ath.cx>2015-02-18 17:26:06 -0500
commitc4ef48c6b22472f197eeefbda1d9fb295ff61a77 (patch)
tree459899637c91b0552eb5496900aceaedeca75e1d /gdb/tui/tui-io.c
parentf6a88844c36e2c03806563c9703b92af6ba0b345 (diff)
downloadgdb-c4ef48c6b22472f197eeefbda1d9fb295ff61a77.zip
gdb-c4ef48c6b22472f197eeefbda1d9fb295ff61a77.tar.gz
gdb-c4ef48c6b22472f197eeefbda1d9fb295ff61a77.tar.bz2
Asynchronously resize the TUI
This patch teaches the TUI to resize itself asynchronously instead of synchronously. Asynchronously resizing the screen when the underlying terminal gets resized is the more intuitive behavior and is surprisingly simple to implement thanks to GDB's async infrastructure. The implementation is straightforward. TUI's SIGWINCH handler is just tweaked to asynchronously invoke a new callback, tui_async_resize_screen, which is responsible for safely resizing the screen. Care must be taken to not to attempt to asynchronously resize the screen while the TUI is not active. When the TUI is not active, the callback will do nothing, but the screen will yet be resized in the next call to tui_enable() by virtue of win_resized being TRUE. (So, after the patch there are still two places where the screen gets resized: one in tui_enable() and the other now in tui_async_resize_screen() as opposed to being in tui_handle_resize_during_io(). The one in tui_enable() is still necessary to handle the case where the terminal gets resized inside the CLI: in that case, the TUI still needs resizing, but it must wait until the TUI gets re-enabled.) gdb/ChangeLog: * tui/tui-io.c (tui_handle_resize_during_io): Remove this function. (tui_putc): Don't call tui_handle_resize_during_io. (tui_getc): Likewise. (tui_mld_getc): Likewise. * tui/tui-win.c: Include event-loop.h and tui/tui-io.h. (tui_sigwinch_token): New static variable. (tui_initialize_win): Adjust documentation. Set tui_sigwinch_token. (tui_async_resize_screen): New asynchronous callback. (tui_sigwinch_handler): Adjust documentation. Asynchronously invoke tui_async_resize_screen.
Diffstat (limited to 'gdb/tui/tui-io.c')
-rw-r--r--gdb/tui/tui-io.c27
1 files changed, 0 insertions, 27 deletions
diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c
index 12bd29f..a8af9b6 100644
--- a/gdb/tui/tui-io.c
+++ b/gdb/tui/tui-io.c
@@ -136,8 +136,6 @@ static int tui_readline_pipe[2];
This may be the main gdb prompt or a secondary prompt. */
static char *tui_rl_saved_prompt;
-static int tui_handle_resize_during_io (int, int);
-
static void
tui_putc (char c)
{
@@ -397,8 +395,6 @@ tui_mld_getc (FILE *fp)
WINDOW *w = TUI_CMD_WIN->generic.handle;
int c = wgetch (w);
- c = tui_handle_resize_during_io (c, 1);
-
return c;
}
@@ -593,7 +589,6 @@ tui_getc (FILE *fp)
#endif
ch = wgetch (w);
- ch = tui_handle_resize_during_io (ch, 0);
/* The \n must be echoed because it will not be printed by
readline. */
@@ -719,25 +714,3 @@ tui_expand_tabs (const char *string, int col)
return ret;
}
-
-/* Cleanup when a resize has occured.
- Returns the character that must be processed. */
-
-static int
-tui_handle_resize_during_io (int original_ch, int for_completion)
-{
- if (tui_win_resized ())
- {
- tui_resize_all ();
- tui_refresh_all_win ();
- tui_update_gdb_sizes ();
- tui_set_win_resized_to (FALSE);
- if (!for_completion)
- {
- dont_repeat ();
- return '\n';
- }
- }
-
- return original_ch;
-}