# HG changeset patch # User Sadrul Habib Chowdhury # Date 1156196138 0 # Node ID 2f82c2494f3fdb65cb3cb2da2e135338addbfda9 # Parent 7635195195c07f020b4af40914f51a54e0a4f728 [gaim-migrate @ 16958] 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 =) committer: Tailor Script diff -r 7635195195c0 -r 2f82c2494f3f COPYRIGHT --- a/COPYRIGHT Mon Aug 21 20:58:20 2006 +0000 +++ b/COPYRIGHT Mon Aug 21 21:35:38 2006 +0000 @@ -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 diff -r 7635195195c0 -r 2f82c2494f3f console/libgnt/gntmain.c --- a/console/libgnt/gntmain.c Mon Aug 21 20:58:20 2006 +0000 +++ b/console/libgnt/gntmain.c Mon Aug 21 21:35:38 2006 +0000 @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -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(); }