comparison console/libgnt/gntmain.c @ 14220:1d793e808e5b

[gaim-migrate @ 16901] Alt+n window switching for libgnt committer: Tailor Script <tailor@pidgin.im>
author Ethan Blanton <elb@pidgin.im>
date Sun, 20 Aug 2006 16:20:45 +0000
parents e9dd2f76e61b
children f64ff0c57457
comparison
equal deleted inserted replaced
14219:fe8c31618e6f 14220:1d793e808e5b
10 #include <stdio.h> 10 #include <stdio.h>
11 #include <stdlib.h> 11 #include <stdlib.h>
12 #include <locale.h> 12 #include <locale.h>
13 #include <unistd.h> 13 #include <unistd.h>
14 #include <string.h> 14 #include <string.h>
15 #include <ctype.h>
15 16
16 /** 17 /**
17 * Notes: Interesting functions to look at: 18 * Notes: Interesting functions to look at:
18 * scr_dump, scr_init, scr_restore: for workspaces 19 * scr_dump, scr_init, scr_restore: for workspaces
19 * 20 *
228 focus_list = g_list_last(focus_list); 229 focus_list = g_list_last(focus_list);
229 } 230 }
230 231
231 if (focus_list) 232 if (focus_list)
232 { 233 {
234 bring_on_top(focus_list->data);
235 }
236
237 if (w && (!focus_list || w != focus_list->data))
238 {
239 gnt_widget_set_focus(w, FALSE);
240 }
241 }
242
243 static void
244 switch_window_n(int n)
245 {
246 GntWidget *w = NULL;
247 GList *l;
248
249 if (focus_list)
250 w = focus_list->data;
251
252 if ((l = g_list_nth(g_list_first(focus_list), n)) != NULL)
253 {
254 focus_list = l;
233 bring_on_top(focus_list->data); 255 bring_on_top(focus_list->data);
234 } 256 }
235 257
236 if (w && (!focus_list || w != focus_list->data)) 258 if (w && (!focus_list || w != focus_list->data))
237 { 259 {
529 touchwin(newscr); 551 touchwin(newscr);
530 wrefresh(newscr); 552 wrefresh(newscr);
531 update_screen(NULL); 553 update_screen(NULL);
532 draw_taskbar(); 554 draw_taskbar();
533 } 555 }
556 else if (strlen(buffer) == 2 && isdigit(*(buffer + 1)))
557 {
558 int n = *(buffer + 1) - '0';
559
560 if (n == 0)
561 n = 10;
562
563 switch_window_n(n - 1);
564 }
534 } 565 }
535 } 566 }
536 } 567 }
537 else if (mode == GNT_KP_MODE_MOVE && focus_list) 568 else if (mode == GNT_KP_MODE_MOVE && focus_list)
538 { 569 {