changeset 18367:1648cd94dddf

Add a callback that gets triggered by SIGWINCH.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sat, 30 Jun 2007 01:45:21 +0000
parents 1aa08373442f
children 743ff8e14b17 76b7adc8e934
files finch/libgnt/gntwm.c finch/libgnt/gntwm.h finch/libgnt/wms/irssi.c
diffstat 3 files changed, 25 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/finch/libgnt/gntwm.c	Sat Jun 30 00:55:43 2007 +0000
+++ b/finch/libgnt/gntwm.c	Sat Jun 30 01:45:21 2007 +0000
@@ -61,6 +61,7 @@
 	SIG_GIVE_FOCUS,
 	SIG_KEY_PRESS,
 	SIG_MOUSE_CLICK,
+	SIG_TERMINAL_REFRESH,
 	SIGS
 };
 
@@ -1031,6 +1032,8 @@
 	endwin();
 
 	g_hash_table_foreach(wm->nodes, (GHFunc)refresh_node, NULL);
+	refresh();
+	g_signal_emit(wm, signals[SIG_TERMINAL_REFRESH], 0);
 	update_screen(wm);
 	gnt_ws_draw_taskbar(wm->cws, TRUE);
 	curs_set(0);   /* endwin resets the cursor to normal */
@@ -1238,6 +1241,15 @@
 					 gnt_closure_marshal_BOOLEAN__INT_INT_INT_POINTER,
 					 G_TYPE_BOOLEAN, 4, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_POINTER);
 
+	signals[SIG_TERMINAL_REFRESH] = 
+		g_signal_new("terminal-refresh",
+					 G_TYPE_FROM_CLASS(klass),
+					 G_SIGNAL_RUN_LAST,
+					 G_STRUCT_OFFSET(GntWMClass, terminal_refresh),
+					 NULL, NULL,
+					 g_cclosure_marshal_VOID__VOID,
+					 G_TYPE_NONE, 0);
+
 	gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "window-next", window_next,
 				"\033" "n", NULL);
 	gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "window-prev", window_prev,
--- a/finch/libgnt/gntwm.h	Sat Jun 30 00:55:43 2007 +0000
+++ b/finch/libgnt/gntwm.h	Sat Jun 30 01:45:21 2007 +0000
@@ -169,10 +169,15 @@
 	 */
 	/*GList *(*window_list)();*/
 
+	/* This is invoked whenever the terminal window is resized, or the
+	 * screen session is attached to a new terminal. (ie, from the
+	 * SIGWINCH callback)
+	 */
+	void (*terminal_refresh)(GntWM *wm);
+
 	void (*res1)(void);
 	void (*res2)(void);
 	void (*res3)(void);
-	void (*res4)(void);
 };
 
 G_BEGIN_DECLS
--- a/finch/libgnt/wms/irssi.c	Sat Jun 30 00:55:43 2007 +0000
+++ b/finch/libgnt/wms/irssi.c	Sat Jun 30 01:45:21 2007 +0000
@@ -248,6 +248,12 @@
 }
 
 static void
+irssi_terminal_refresh(GntWM *wm)
+{
+	draw_line_separators((Irssi*)wm);
+}
+
+static void
 irssi_class_init(IrssiClass *klass)
 {
 	GntWMClass *pclass = GNT_WM_CLASS(klass);
@@ -258,6 +264,7 @@
 	pclass->window_resized = irssi_window_resized;
 	pclass->close_window = irssi_close_window;
 	pclass->window_update = irssi_update_window;
+	pclass->terminal_refresh = irssi_terminal_refresh;
 
 	gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "move-up", move_direction,
 			"\033" "K", GINT_TO_POINTER('k'), NULL);