From: <ebl...@us...> - 2006-08-20 16:20:55
|
Revision: 16901 Author: eblanton Date: 2006-08-20 09:20:45 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16901&view=rev Log Message: ----------- Alt+n window switching for libgnt Modified Paths: -------------- trunk/console/libgnt/gntmain.c Modified: trunk/console/libgnt/gntmain.c =================================================================== --- trunk/console/libgnt/gntmain.c 2006-08-20 14:56:53 UTC (rev 16900) +++ trunk/console/libgnt/gntmain.c 2006-08-20 16:20:45 UTC (rev 16901) @@ -12,6 +12,7 @@ #include <locale.h> #include <unistd.h> #include <string.h> +#include <ctype.h> /** * Notes: Interesting functions to look at: @@ -240,6 +241,27 @@ } static void +switch_window_n(int n) +{ + GntWidget *w = NULL; + GList *l; + + if (focus_list) + w = focus_list->data; + + if ((l = g_list_nth(g_list_first(focus_list), n)) != NULL) + { + focus_list = l; + bring_on_top(focus_list->data); + } + + if (w && (!focus_list || w != focus_list->data)) + { + gnt_widget_set_focus(w, FALSE); + } +} + +static void window_list_activate(GntTree *tree, gpointer null) { GntWidget *widget = gnt_tree_get_selection_data(GNT_TREE(tree)); @@ -531,6 +553,15 @@ update_screen(NULL); draw_taskbar(); } + else if (strlen(buffer) == 2 && isdigit(*(buffer + 1))) + { + int n = *(buffer + 1) - '0'; + + if (n == 0) + n = 10; + + switch_window_n(n - 1); + } } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |