changeset 21304:add12afc3140

Fix size calculation when shadow is enabled. Also, when the terminal is resized, the SIGWINCH callback needs to refresh after endwin to get the correct new size of the terminal.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sat, 10 Nov 2007 23:48:57 +0000
parents a9482e431e43
children 0208beabfa33
files finch/libgnt/gntwidget.c finch/libgnt/gntwm.c
diffstat 2 files changed, 10 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/finch/libgnt/gntwidget.c	Sat Nov 10 17:39:31 2007 +0000
+++ b/finch/libgnt/gntwidget.c	Sat Nov 10 23:48:57 2007 +0000
@@ -466,7 +466,6 @@
 		*width = wid->priv.width + shadow;
 	if (height)
 		*height = wid->priv.height + shadow;
-	
 }
 
 static void
--- a/finch/libgnt/gntwm.c	Sat Nov 10 17:39:31 2007 +0000
+++ b/finch/libgnt/gntwm.c	Sat Nov 10 23:48:57 2007 +0000
@@ -109,12 +109,10 @@
 gnt_wm_copy_win(GntWidget *widget, GntNode *node)
 {
 	WINDOW *src, *dst;
-	int shadow;
 	if (!node)
 		return;
 	src = widget->window;
 	dst = node->window;
-	shadow = gnt_widget_has_shadow(widget) ? 1 : 0;
 	copywin(src, dst, node->scroll, 0, 0, 0, getmaxy(dst) - 1, getmaxx(dst) - 1, 0);
 }
 
@@ -1004,9 +1002,9 @@
 	GntWM *wm = GNT_WM(bindable);
 
 	endwin();
+	refresh();
 
-	g_hash_table_foreach(wm->nodes, (GHFunc)refresh_node, NULL);
-	refresh();
+	g_hash_table_foreach(wm->nodes, (GHFunc)refresh_node, GINT_TO_POINTER(TRUE));
 	g_signal_emit(wm, signals[SIG_TERMINAL_REFRESH], 0);
 	update_screen(wm);
 	gnt_ws_draw_taskbar(wm->cws, TRUE);
@@ -1622,13 +1620,11 @@
 			shadow = FALSE;
 		x = widget->priv.x;
 		y = widget->priv.y;
-		w = widget->priv.width;
-		h = widget->priv.height;
+		w = widget->priv.width + shadow;
+		h = widget->priv.height + shadow;
 
-		getmaxyx(stdscr, maxy, maxx);
-		maxy -= 1;              /* room for the taskbar */
-		maxy -= shadow;
-		maxx -= shadow;
+		maxx = getmaxx(stdscr);
+		maxy = getmaxy(stdscr) - 1;              /* room for the taskbar */
 
 		x = MAX(0, x);
 		y = MAX(0, y);
@@ -1639,7 +1635,7 @@
 
 		w = MIN(w, maxx);
 		h = MIN(h, maxy);
-		node->window = newwin(h + shadow, w + shadow, y, x);
+		node->window = newwin(h, w, y, x);
 		gnt_wm_copy_win(widget, node);
 	}
 #endif
@@ -1884,9 +1880,8 @@
 {
 	gboolean ret = TRUE;
 	GntNode *node;
-	int shadow;
 	int maxx, maxy;
-	
+
 	while (widget->parent)
 		widget = widget->parent;
 	node = g_hash_table_lookup(wm->nodes, widget);
@@ -1900,9 +1895,8 @@
 	gnt_widget_set_size(widget, width, height);
 	gnt_widget_draw(widget);
 
-	shadow = gnt_widget_has_shadow(widget) ? 1 : 0;
-	maxx = getmaxx(stdscr) - shadow;
-	maxy = getmaxy(stdscr) - 1 - shadow;
+	maxx = getmaxx(stdscr);
+	maxy = getmaxy(stdscr) - 1;
 	height = MIN(height, maxy);
 	width = MIN(width, maxx);
 	wresize(node->window, height, width);