# HG changeset patch # User Ethan Blanton # Date 1156090845 0 # Node ID 1d793e808e5b8e53b5190217d79561c2858f450d # Parent fe8c31618e6fd688242e0c4249c72044d59fd5df [gaim-migrate @ 16901] Alt+n window switching for libgnt committer: Tailor Script diff -r fe8c31618e6f -r 1d793e808e5b console/libgnt/gntmain.c --- a/console/libgnt/gntmain.c Sun Aug 20 14:56:53 2006 +0000 +++ b/console/libgnt/gntmain.c Sun Aug 20 16:20:45 2006 +0000 @@ -12,6 +12,7 @@ #include #include #include +#include /** * 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); + } } } }