summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2001-10-14 10:45:00 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2001-10-14 10:45:00 +0000
commit1718083cf655dd8e3a1f4cf91dd6f2ee064a3b2a (patch)
tree90d6ef46a96f154a02b96d6cf61e209e100ddad2 /src
parentde3bae13c550adcdb66726d4a718ed1ab224eee1 (diff)
downloadirssi-1718083cf655dd8e3a1f4cf91dd6f2ee064a3b2a.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/fe-text/mainwindows.c8
-rw-r--r--src/fe-text/statusbar.c25
2 files changed, 27 insertions, 6 deletions
diff --git a/src/fe-text/mainwindows.c b/src/fe-text/mainwindows.c
index 3944ac5f..a07fb824 100644
--- a/src/fe-text/mainwindows.c
+++ b/src/fe-text/mainwindows.c
@@ -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();
diff --git a/src/fe-text/statusbar.c b/src/fe-text/statusbar.c
index 3b4b1eeb..aa8b35b4 100644
--- a/src/fe-text/statusbar.c
+++ b/src/fe-text/statusbar.c
@@ -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);