From: <sa...@us...> - 2006-08-21 21:35:43
|
Revision: 16958 Author: sadrul Date: 2006-08-21 14:35:38 -0700 (Mon, 21 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16958&view=rev Log Message: ----------- Patch from Mark Schneider (queueRAM): this automatically updates the widgets when the terminal is resized. Pressing alt+l does a better job at refreshing the screen if things get scrambled. But it's not perfect yet. I warmenhoved the patch. I have been waiting to say that =) Modified Paths: -------------- trunk/COPYRIGHT trunk/console/libgnt/gntmain.c Modified: trunk/COPYRIGHT =================================================================== --- trunk/COPYRIGHT 2006-08-21 20:58:20 UTC (rev 16957) +++ trunk/COPYRIGHT 2006-08-21 21:35:38 UTC (rev 16958) @@ -1,5 +1,5 @@ Gaim -Copyright (C) 1998-2005 by the following: +Copyright (C) 1998-2006 by the following: If you have contributed to Gaim, you deserve to be on this list. Contact us (see: AUTHORS) and we'll add you. @@ -250,6 +250,7 @@ Luke Schierer Ralph Schmieder David Schmitt +Mark Schneider Evan Schoenberg Federico Schwindt Torrey Searle Modified: trunk/console/libgnt/gntmain.c =================================================================== --- trunk/console/libgnt/gntmain.c 2006-08-21 20:58:20 UTC (rev 16957) +++ trunk/console/libgnt/gntmain.c 2006-08-21 21:35:38 UTC (rev 16958) @@ -11,6 +11,7 @@ #include <stdlib.h> #include <locale.h> #include <unistd.h> +#include <signal.h> #include <string.h> #include <ctype.h> @@ -60,6 +61,8 @@ static void draw_taskbar(gboolean reposition); static void bring_on_top(GntWidget *widget); +static gboolean refresh_screen(); + static gboolean update_screen(gpointer null) { @@ -572,17 +575,7 @@ } else if (strcmp(buffer + 1, "l") == 0) { - update_screen(NULL); - werase(stdscr); - wrefresh(stdscr); - - X_MAX = getmaxx(stdscr); - Y_MAX = getmaxy(stdscr) - 1; - - g_hash_table_foreach(nodes, (GHFunc)refresh_node, NULL); - - update_screen(NULL); - draw_taskbar(TRUE); + refresh_screen(); } else if (strlen(buffer) == 2 && isdigit(*(buffer + 1))) { @@ -716,11 +709,41 @@ } } + return TRUE; +} + +static gboolean +refresh_screen() +{ + endwin(); refresh(); - return TRUE; + X_MAX = getmaxx(stdscr); + Y_MAX = getmaxy(stdscr) - 1; + + g_hash_table_foreach(nodes, (GHFunc)refresh_node, NULL); + update_screen(NULL); + draw_taskbar(TRUE); + + return FALSE; } +#ifdef SIGWINCH +static void +sighandler(int sig) +{ + if (sig == SIGWINCH) + { + werase(stdscr); + wrefresh(stdscr); + + g_idle_add(refresh_screen, NULL); + } + + signal(SIGWINCH, sighandler); +} +#endif + void gnt_init() { static GIOChannel *channel = NULL; @@ -780,6 +803,10 @@ werase(stdscr); wrefresh(stdscr); +#ifdef SIGWINCH + signal(SIGWINCH, sighandler); +#endif + g_type_init(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |