+2019-08-15 Tom Tromey <tom@tromey.com>
+
+ * tui/tui-layout.c (show_layout, show_source_disasm_command)
+ (show_data): Don't change window visibility.
+ (tui_gen_win_info::resize): Remove special case for command
+ window. Use wresize, when available.
+ (show_source_or_disasm_and_command): Don't change window
+ visibility.
+ * tui/tui-command.h (struct tui_cmd_window) <resize>: Declare.
+ <make_visible>: New method.
+ * tui/tui-command.c (tui_cmd_window::resize): New method.
+
2019-08-15 Tom Tromey <tom@tromey.com>
* tui/tui-winsource.h (struct tui_source_window_iterator): New.
#include "tui/tui-win.h"
#include "tui/tui-io.h"
#include "tui/tui-command.h"
+#include "tui/tui-wingeneral.h"
#include "gdb_curses.h"
return tui_term_height () - 4;
}
+void
+tui_cmd_window::resize (int height_, int width_, int origin_x, int origin_y)
+{
+ width = width_;
+ height = height_;
+ if (height > 1)
+ {
+ /* Note this differs from the base class implementation, because
+ this window can't be boxed. */
+ viewport_height = height - 1;
+ }
+ else
+ viewport_height = 1;
+ origin.x = origin_x;
+ origin.y = origin_y;
+
+ if (handle == nullptr)
+ tui_make_window (this);
+ else
+ {
+ /* Another reason we don't call the base class method here is
+ that for the command window in particular, we want to avoid
+ destroying the underlying handle. We don't currently track
+ the contents of this window, and so have no way to re-render
+ it. However we can at least move it and keep the old size if
+ wresize isn't available. */
+#ifdef HAVE_WRESIZE
+ wresize (handle, height, width);
+#endif
+ mvwin (handle, origin.y, origin.x);
+ wmove (handle, 0, 0);
+ }
+}
+
/* See tui-command.h. */
void
if (layout != cur_layout)
{
- /* First make the current layout be invisible. */
tui_make_all_invisible ();
- tui_locator_win_info_ptr ()->make_visible (false);
switch (layout)
{
case SRC_DATA_COMMAND:
tui_term_width (),
0,
0);
- TUI_SRC_WIN->make_visible (true);
TUI_SRC_WIN->m_has_locator = false;
struct tui_locator_window *locator = tui_locator_win_info_ptr ();
tui_term_width (),
0,
src_height - 1);
- TUI_DISASM_WIN->make_visible (true);
locator->resize (2 /* 1 */ ,
tui_term_width (),
0,
(src_height + asm_height) - 1);
TUI_SRC_WIN->m_has_locator = false;
TUI_DISASM_WIN->m_has_locator = true;
- locator->make_visible (true);
tui_show_locator_content ();
TUI_DISASM_WIN->show_source_content ();
tui_term_width (),
0,
tui_term_height () - cmd_height);
- TUI_CMD_WIN->make_visible (true);
current_layout = SRC_DISASSEM_COMMAND;
}
if (tui_win_list[DATA_WIN] == nullptr)
tui_win_list[DATA_WIN] = new tui_data_window ();
tui_win_list[DATA_WIN]->resize (data_height, tui_term_width (), 0, 0);
- tui_win_list[DATA_WIN]->make_visible (true);
if (new_layout == SRC_DATA_COMMAND)
win_type = SRC_WIN;
tui_term_width (),
0,
total_height - 1);
- base->make_visible (true);
+ TUI_CMD_WIN->resize (TUI_CMD_WIN->height, tui_term_width (),
+ 0, total_height);
+
base->m_has_locator = true;
- locator->make_visible (true);
tui_show_locator_content ();
- TUI_CMD_WIN->make_visible (true);
current_layout = new_layout;
}
tui_gen_win_info::resize (int height_, int width_,
int origin_x_, int origin_y_)
{
- int h = height_;
-
width = width_;
- height = h;
- if (h > 1)
- {
- viewport_height = h - 1;
- if (type != CMD_WIN)
- viewport_height--;
- }
+ height = height_;
+ if (height > 1)
+ viewport_height = height - 2;
else
viewport_height = 1;
origin.x = origin_x_;
origin.y = origin_y_;
+
+ if (handle != nullptr)
+ {
+#ifdef HAVE_WRESIZE
+ wresize (handle, height, width);
+ mvwin (handle, origin.y, origin.x);
+ wmove (handle, 0, 0);
+#else
+ tui_delete_win (handle);
+ handle = NULL;
+#endif
+ }
+
+ if (handle == nullptr)
+ tui_make_window (this);
}
/* Show the Source/Command or the Disassem layout. */
tui_term_width (),
0,
0);
- win_info->make_visible (true);
-
win_info->m_has_locator = true;
- locator->make_visible (true);
tui_show_locator_content ();
win_info->show_source_content ();
tui_term_width (),
0,
src_height);
- TUI_CMD_WIN->make_visible (true);
current_layout = layout_type;
}