- Timestamp:
- Feb 15, 2008, 12:56:49 AM (17 years ago)
- Branches:
- master, barnowl_perlaim, debian, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- 18a54ee
- Parents:
- a6a4155
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
owl.c
reebef19 r9c7a701 46 46 #include <sys/param.h> 47 47 #include <sys/types.h> 48 #include <sys/time.h> 48 49 #include <termios.h> 49 50 #include <sys/stat.h> … … 60 61 #endif 61 62 63 #define STDIN 0 64 62 65 static const char fileIdent[] = "$Id$"; 63 66 … … 69 72 owl_editwin *tw; 70 73 owl_popwin *pw; 71 int j,ret, initialsubs, debug, argcsave, followlast;74 int ret, initialsubs, debug, argcsave, followlast; 72 75 int newmsgs, nexttimediff; 73 76 struct sigaction sigact; … … 206 209 owl_global_set_haveaim(&g); 207 210 211 /* prepare stdin dispatch */ 212 { 213 owl_dispatch *d = owl_malloc(sizeof(owl_dispatch)); 214 d->fd = STDIN; 215 d->cfunc = &owl_process_input; 216 d->pfunc = NULL; 217 owl_select_add_dispatch(d); 218 } 219 208 220 #ifdef HAVE_LIBZEPHYR 209 221 /* zephyr init */ 210 222 ret=owl_zephyr_initialize(); 211 if (!ret) 212 owl_global_set_havezephyr(&g); 223 if (!ret) { 224 owl_dispatch *d = owl_malloc(sizeof(owl_dispatch)); 225 d->fd = ZGetFD(); 226 d->cfunc = &owl_zephyr_process_events; 227 d->pfunc = NULL; 228 owl_select_add_dispatch(d); 229 owl_global_set_havezephyr(&g); 230 } 231 213 232 #endif 214 233 … … 425 444 followlast=owl_global_should_followlast(&g); 426 445 427 /* Do AIM stuff */428 if (owl_global_is_doaimevents(&g)) {429 owl_aim_process_events();430 431 if (owl_global_is_aimloggedin(&g)) {432 if (owl_timer_is_expired(owl_global_get_aim_buddyinfo_timer(&g))) {433 /* owl_buddylist_request_idletimes(owl_global_get_buddylist(&g)); */434 owl_timer_reset(owl_global_get_aim_buddyinfo_timer(&g));435 }436 }437 }438 439 446 owl_perlconfig_mainloop(); 440 447 … … 454 461 } 455 462 456 owl_zephyr_process_events();457 458 463 /* Grab incoming messages. */ 459 464 newmsgs=0; … … 530 535 * little bit, but otherwise do not. This lets input be grabbed 531 536 * as quickly as possbile */ 532 j=wgetch(typwin); 533 if (j==ERR) { 534 usleep(10000); 535 } else { 536 owl_global_set_lastinputtime(&g, now); 537 /* find and activate the current keymap. 538 * TODO: this should really get fixed by activating 539 * keymaps as we switch between windows... 540 */ 541 if (pw && owl_popwin_is_active(pw) && owl_global_get_viewwin(&g)) { 542 owl_context_set_popless(owl_global_get_context(&g), 543 owl_global_get_viewwin(&g)); 544 owl_function_activate_keymap("popless"); 545 } else if (owl_global_is_typwin_active(&g) 546 && owl_editwin_get_style(tw)==OWL_EDITWIN_STYLE_ONELINE) { 547 /* 548 owl_context_set_editline(owl_global_get_context(&g), tw); 549 owl_function_activate_keymap("editline"); 550 */ 551 } else if (owl_global_is_typwin_active(&g) 552 && owl_editwin_get_style(tw)==OWL_EDITWIN_STYLE_MULTILINE) { 553 owl_context_set_editmulti(owl_global_get_context(&g), tw); 554 owl_function_activate_keymap("editmulti"); 555 } else { 556 owl_context_set_recv(owl_global_get_context(&g)); 557 owl_function_activate_keymap("recv"); 558 } 559 /* now actually handle the keypress */ 560 ret = owl_keyhandler_process(owl_global_get_keyhandler(&g), j); 561 if (ret!=0 && ret!=1) { 562 owl_function_makemsg("Unable to handle keypress"); 563 } 564 } 537 538 /* select on FDs we know about. */ 539 owl_select(); 565 540 566 541 /* Log any error signals */ … … 680 655 } 681 656 657 void owl_process_aim() 658 { 659 if (owl_global_is_doaimevents(&g)) { 660 owl_aim_process_events(); 661 662 if (owl_global_is_aimloggedin(&g)) { 663 if (owl_timer_is_expired(owl_global_get_aim_buddyinfo_timer(&g))) { 664 /* owl_buddylist_request_idletimes(owl_global_get_buddylist(&g)); */ 665 owl_timer_reset(owl_global_get_aim_buddyinfo_timer(&g)); 666 } 667 } 668 } 669 } 670 671 void owl_process_input() 672 { 673 int ret, j; 674 owl_popwin *pw; 675 owl_editwin *tw; 676 677 j = wgetch(owl_global_get_curs_typwin(&g)); 678 if (j == ERR) return; 679 680 owl_global_set_lastinputtime(&g, time(NULL)); 681 pw=owl_global_get_popwin(&g); 682 tw=owl_global_get_typwin(&g); 683 684 /* find and activate the current keymap. 685 * TODO: this should really get fixed by activating 686 * keymaps as we switch between windows... 687 */ 688 if (pw && owl_popwin_is_active(pw) && owl_global_get_viewwin(&g)) { 689 owl_context_set_popless(owl_global_get_context(&g), 690 owl_global_get_viewwin(&g)); 691 owl_function_activate_keymap("popless"); 692 } else if (owl_global_is_typwin_active(&g) 693 && owl_editwin_get_style(tw) == OWL_EDITWIN_STYLE_ONELINE) { 694 /* 695 owl_context_set_editline(owl_global_get_context(&g), tw); 696 owl_function_activate_keymap("editline"); 697 */ 698 } else if (owl_global_is_typwin_active(&g) 699 && owl_editwin_get_style(tw) == OWL_EDITWIN_STYLE_MULTILINE) { 700 owl_context_set_editmulti(owl_global_get_context(&g), tw); 701 owl_function_activate_keymap("editmulti"); 702 } else { 703 owl_context_set_recv(owl_global_get_context(&g)); 704 owl_function_activate_keymap("recv"); 705 } 706 /* now actually handle the keypress */ 707 ret = owl_keyhandler_process(owl_global_get_keyhandler(&g), j); 708 if (ret != 0 && ret != 1) { 709 owl_function_makemsg("Unable to handle keypress"); 710 } 711 } 712 682 713 void sig_handler(int sig, siginfo_t *si, void *data) 683 714 { … … 694 725 owl_function_quit(); 695 726 } 696 697 727 } 698 728
Note: See TracChangeset
for help on using the changeset viewer.