pidgin: 46528c7f: Don't crash on screen refresh if buddyli...

sadrul at pidgin.im sadrul at pidgin.im
Tue Jan 6 17:46:17 EST 2009


-----------------------------------------------------------------
Revision: 46528c7f7f4ff963e7c48587e615888721b5a7d3
Ancestor: 77c3495d32b389790ca4fd3cc8be9c006a94e451
Author: sadrul at pidgin.im
Date: 2009-01-06T15:30:12
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/46528c7f7f4ff963e7c48587e615888721b5a7d3

Modified files:
        finch/libgnt/wms/irssi.c

ChangeLog: 

Don't crash on screen refresh if buddylist is maximized. Fixes #8003.

-------------- next part --------------
============================================================
--- finch/libgnt/wms/irssi.c	e3dee7f0f54cd0c78f07d7e563d4b98d8a834841
+++ finch/libgnt/wms/irssi.c	a4b1b96ad8f786552b29b0a0061ad0f9b1b45312
@@ -71,7 +71,12 @@ get_xywh_for_frame(Irssi *irssi, int hor
 	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 @@ find_window_position(Irssi *irssi, GntWi
 	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 @@ refresh_window(GntWidget *widget, GntNod
 {
 	int vert, hor;
 	int x, y, w, h;
+	const char *name;
 
 	if (!GNT_IS_WINDOW(widget))
 		return;
@@ -286,10 +292,13 @@ refresh_window(GntWidget *widget, GntNod
 		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


More information about the Commits mailing list