1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

Resizing terminal works now properly, also sends "terminal resized" signal

now.


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1830 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2001-10-14 10:45:00 +00:00 committed by cras
parent de3bae13c5
commit 1718083cf6
2 changed files with 27 additions and 6 deletions

View File

@ -86,8 +86,10 @@ static void mainwindow_resize(MAIN_WINDOW_REC *window, int xdiff, int ydiff)
WINDOW_REC *rec = tmp->data;
if (rec->gui_data != NULL &&
WINDOW_GUI(rec)->parent == window)
gui_window_resize(rec, window->width, window->height);
WINDOW_GUI(rec)->parent == window) {
gui_window_resize(rec, window->width,
MAIN_WINDOW_TEXT_HEIGHT(window));
}
}
textbuffer_view_set_window(WINDOW_GUI(window->active)->view,
@ -468,6 +470,8 @@ void mainwindows_resize(int width, int height)
mainwindows_resize_bigger(xdiff, ydiff);
else if (xdiff != 0)
mainwindows_resize_horiz(xdiff);
signal_emit("terminal resized", 0);
screen_refresh_thaw();
irssi_redraw();

View File

@ -322,7 +322,7 @@ void statusbar_item_redraw(SBAR_ITEM_REC *item)
active_win = old_active_win;
}
static void statusbar_recalc_ypos(STATUSBAR_REC *bar)
static void statusbars_recalc_ypos(STATUSBAR_REC *bar)
{
GSList *tmp, *bar_group;
int ypos;
@ -441,7 +441,7 @@ STATUSBAR_REC *statusbar_create(STATUSBAR_GROUP_REC *group,
bar->color = g_strconcat("%n", value, NULL);
g_free(value);
statusbar_recalc_ypos(bar);
statusbars_recalc_ypos(bar);
signal_emit("statusbar created", 1, bar);
/* create the items to statusbar */
@ -474,7 +474,7 @@ void statusbar_destroy(STATUSBAR_REC *bar)
if (bar->config->type != STATUSBAR_TYPE_WINDOW ||
bar->parent_window != NULL)
statusbar_recalc_ypos(bar);
statusbars_recalc_ypos(bar);
top = bar->config->placement == STATUSBAR_TOP;
if (bar->config->type == STATUSBAR_TYPE_ROOT) {
@ -804,6 +804,21 @@ void statusbar_item_destroy(SBAR_ITEM_REC *item)
g_free(item);
}
static void sig_terminal_resized(void)
{
GSList *tmp;
for (tmp = active_statusbar_group->bars; tmp != NULL; tmp = tmp->next) {
STATUSBAR_REC *bar = tmp->data;
if (bar->config->type == STATUSBAR_TYPE_ROOT &&
bar->config->placement == STATUSBAR_BOTTOM) {
statusbars_recalc_ypos(bar);
break;
}
}
}
static void mainwindow_recalc_ypos(MAIN_WINDOW_REC *window, int placement)
{
GSList *tmp;
@ -812,7 +827,7 @@ static void mainwindow_recalc_ypos(MAIN_WINDOW_REC *window, int placement)
STATUSBAR_REC *bar = tmp->data;
if (bar->config->placement == placement) {
statusbar_recalc_ypos(bar);
statusbars_recalc_ypos(bar);
break;
}
}
@ -922,6 +937,7 @@ void statusbar_init(void)
statusbar_items_init();
statusbar_config_init();
signal_add("terminal resized", (SIGNAL_FUNC) sig_terminal_resized);
signal_add("mainwindow resized", (SIGNAL_FUNC) sig_mainwindow_resized);
signal_add("mainwindow moved", (SIGNAL_FUNC) sig_mainwindow_resized);
signal_add("window changed", (SIGNAL_FUNC) sig_window_changed);
@ -947,6 +963,7 @@ void statusbar_deinit(void)
(GHFunc) statusbar_item_signal_destroy, NULL);
g_hash_table_destroy(sbar_item_signals);
signal_remove("terminal resized", (SIGNAL_FUNC) sig_terminal_resized);
signal_remove("mainwindow resized", (SIGNAL_FUNC) sig_mainwindow_resized);
signal_remove("mainwindow moved", (SIGNAL_FUNC) sig_mainwindow_resized);
signal_remove("window changed", (SIGNAL_FUNC) sig_window_changed);