comparison console/libgnt/gntmain.c @ 13927:9309d27d780c

[gaim-migrate @ 16447] Pseudo-shadow effect for the windows and buttons. Uses non-ASCII emblems for buddies in the buddy-list if locale is set to UTF. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Thu, 06 Jul 2006 17:54:46 +0000
parents 0febf380b473
children 3dbcbc5e57e1
comparison
equal deleted inserted replaced
13926:756c3d7177d9 13927:9309d27d780c
17 17
18 static int X_MIN; 18 static int X_MIN;
19 static int X_MAX; 19 static int X_MAX;
20 static int Y_MIN; 20 static int Y_MIN;
21 static int Y_MAX; 21 static int Y_MAX;
22
23 static gboolean ascii_only;
22 24
23 static GMainLoop *loop; 25 static GMainLoop *loop;
24 static struct 26 static struct
25 { 27 {
26 GntWidget *window; 28 GntWidget *window;
312 /* Alt + p to go to the previous window */ 314 /* Alt + p to go to the previous window */
313 switch_window(-1); 315 switch_window(-1);
314 } 316 }
315 else if (strcmp(buffer + 1, "m") == 0 && focus_list) 317 else if (strcmp(buffer + 1, "m") == 0 && focus_list)
316 { 318 {
319 /* Move a window */
317 mode = GNT_KP_MODE_MOVE; 320 mode = GNT_KP_MODE_MOVE;
318 } 321 }
319 else if (strcmp(buffer + 1, "w") == 0 && focus_list) 322 else if (strcmp(buffer + 1, "w") == 0 && focus_list)
320 { 323 {
324 /* Window list */
321 mode = GNT_KP_MODE_WINDOW_LIST; 325 mode = GNT_KP_MODE_WINDOW_LIST;
322 show_window_list(); 326 show_window_list();
323 } 327 }
324 } 328 }
325 } 329 }
373 changed = TRUE; 377 changed = TRUE;
374 } 378 }
375 379
376 if (changed) 380 if (changed)
377 { 381 {
378 lock_focus_list = 1; 382 GntNode *node = g_hash_table_lookup(nodes, widget);
379 gnt_widget_hide(widget);
380 gnt_widget_set_position(widget, x, y); 383 gnt_widget_set_position(widget, x, y);
381 gnt_widget_show(widget); 384 move_panel(node->panel, y, x);
382 lock_focus_list = 0; 385 update_panels();
386 doupdate();
383 } 387 }
384 } 388 }
385 else if (*buffer == '\r') 389 else if (*buffer == '\r')
386 { 390 {
387 mode = GNT_KP_MODE_NORMAL; 391 mode = GNT_KP_MODE_NORMAL;
417 g_io_channel_set_flags(channel, G_IO_FLAG_NONBLOCK, NULL ); 421 g_io_channel_set_flags(channel, G_IO_FLAG_NONBLOCK, NULL );
418 422
419 int result = g_io_add_watch(channel, 423 int result = g_io_add_watch(channel,
420 (G_IO_IN | G_IO_HUP | G_IO_ERR), 424 (G_IO_IN | G_IO_HUP | G_IO_ERR),
421 io_invoke, NULL); 425 io_invoke, NULL);
422 426 const char *locale = setlocale(LC_ALL, "");
423 setlocale(LC_ALL, ""); 427
428 if (locale && (strstr(locale, "UTF") || strstr(locale, "utf")))
429 ascii_only = FALSE;
430 else
431 ascii_only = TRUE;
432
424 initscr(); 433 initscr();
425 start_color(); 434 start_color();
426 gnt_init_colors(); 435 gnt_init_colors();
427 436
428 X_MIN = 0; 437 X_MIN = 0;
457 466
458 static void 467 static void
459 free_node(gpointer data) 468 free_node(gpointer data)
460 { 469 {
461 GntNode *node = data; 470 GntNode *node = data;
471 hide_panel(node->panel);
462 del_panel(node->panel); 472 del_panel(node->panel);
463 g_free(node); 473 g_free(node);
464 } 474 }
465 475
466 void gnt_screen_occupy(GntWidget *widget) 476 void gnt_screen_occupy(GntWidget *widget)
580 void gnt_quit() 590 void gnt_quit()
581 { 591 {
582 endwin(); 592 endwin();
583 } 593 }
584 594
595 gboolean gnt_ascii_only()
596 {
597 return ascii_only;
598 }
599