changeset 24919:dcf2f613a6a6

Don't crash on screen refresh if buddylist is maximized. Fixes #8003.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Tue, 06 Jan 2009 15:30:12 +0000
parents 55f4261e1358
children ea28a7b9113c
files finch/libgnt/wms/irssi.c
diffstat 1 files changed, 15 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/finch/libgnt/wms/irssi.c	Mon Jan 05 14:43:15 2009 +0000
+++ b/finch/libgnt/wms/irssi.c	Tue Jan 06 15:30:12 2009 +0000
@@ -71,7 +71,12 @@
 	width = (getmaxx(stdscr) - irssi->buddylistwidth) / irssi->horiz;
 	height = (getmaxy(stdscr) - 1) / irssi->vert;
 
-	rx = irssi->buddylistwidth;
+	if (width) {
+		rx = irssi->buddylistwidth;
+	} else {
+		rx = 0;
+		width = getmaxx(stdscr) / irssi->horiz;
+	}
 	if (hor)
 		rx += hor * width;
 	if (rx)
@@ -234,7 +239,7 @@
 	height = (getmaxy(stdscr) - 1) / irssi->vert;
 
 	if (h)
-		*h = (x - irssi->buddylistwidth) / width;
+		*h = width ? (x - irssi->buddylistwidth) / width : x / (getmaxx(stdscr) / irssi->horiz);
 	if (v)
 		*v = y / height;
 }
@@ -278,6 +283,7 @@
 {
 	int vert, hor;
 	int x, y, w, h;
+	const char *name;
 
 	if (!GNT_IS_WINDOW(widget))
 		return;
@@ -286,10 +292,13 @@
 		return;
 	}
 
-	find_window_position(irssi, widget, &hor, &vert);
-	get_xywh_for_frame(irssi, hor, vert, &x, &y, &w, &h);
-	gnt_wm_move_window(GNT_WM(irssi), widget, x, y);
-	gnt_wm_resize_window(GNT_WM(irssi), widget, w, h);
+	name = gnt_widget_get_name(widget);
+	if (name && strstr(name, "conversation-window")) {
+		find_window_position(irssi, widget, &hor, &vert);
+		get_xywh_for_frame(irssi, hor, vert, &x, &y, &w, &h);
+		gnt_wm_move_window(GNT_WM(irssi), widget, x, y);
+		gnt_wm_resize_window(GNT_WM(irssi), widget, w, h);
+	}
 }
 
 static void