… | |
… | |
43 | * along with this program; if not, write to the Free Software |
43 | * along with this program; if not, write to the Free Software |
44 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
44 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
45 | *----------------------------------------------------------------------*/ |
45 | *----------------------------------------------------------------------*/ |
46 | |
46 | |
47 | /*{{{ includes: */ |
47 | /*{{{ includes: */ |
48 | #include "../config.h" /* NECESSARY */ |
48 | #include "../config.h" |
49 | #include "rxvt.h" /* NECESSARY */ |
49 | #include "rxvt.h" |
|
|
50 | #include "rxvtperl.h" |
50 | #include "version.h" |
51 | #include "version.h" |
51 | #include "command.h" |
52 | #include "command.h" |
52 | |
53 | |
|
|
54 | #if HAVE_SCHED_YIELD |
|
|
55 | # include <sched.h> |
|
|
56 | #endif |
|
|
57 | |
53 | #ifdef KEYSYM_RESOURCE |
58 | #ifdef KEYSYM_RESOURCE |
54 | # include "keyboard.h" |
59 | # include "keyboard.h" |
55 | #endif |
60 | #endif |
56 | |
61 | |
57 | #include <csignal> |
62 | #include <csignal> |
58 | |
|
|
59 | #define HAVE_SCHED_YIELD 1 //D//TODO//FIXME |
|
|
60 | #if HAVE_SCHED_YIELD |
|
|
61 | # include <sched.h> |
|
|
62 | #endif |
|
|
63 | |
63 | |
64 | /*----------------------------------------------------------------------*/ |
64 | /*----------------------------------------------------------------------*/ |
65 | |
65 | |
66 | #define IS_CONTROL(ch) !((ch) & 0xffffff60UL) |
66 | #define IS_CONTROL(ch) !((ch) & 0xffffff60UL) |
67 | |
67 | |
… | |
… | |
985 | SET_LOCALE (locale); |
985 | SET_LOCALE (locale); |
986 | |
986 | |
987 | display->flush (); |
987 | display->flush (); |
988 | |
988 | |
989 | if (want_refresh && !flush_ev.active) |
989 | if (want_refresh && !flush_ev.active) |
990 | flush_ev.start (NOW + 0.01); |
990 | flush_ev.start (NOW + 1. / 60.); // refresh at max. 60 hz normally |
991 | } |
991 | } |
992 | |
992 | |
993 | void |
993 | void |
994 | rxvt_term::flush_cb (time_watcher &w) |
994 | rxvt_term::flush_cb (time_watcher &w) |
995 | { |
995 | { |
… | |
… | |
1070 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1070 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1071 | } |
1071 | } |
1072 | } |
1072 | } |
1073 | #endif |
1073 | #endif |
1074 | |
1074 | |
|
|
1075 | #if HAVE_SCHED_YIELD |
|
|
1076 | static struct event_handler |
|
|
1077 | { |
|
|
1078 | check_watcher cw_yield; |
|
|
1079 | |
|
|
1080 | void yield (check_watcher &w) |
|
|
1081 | { |
|
|
1082 | sched_yield (); |
|
|
1083 | w.stop (); |
|
|
1084 | } |
|
|
1085 | |
|
|
1086 | event_handler () |
|
|
1087 | : cw_yield (this, &event_handler::yield) |
|
|
1088 | { |
|
|
1089 | } |
|
|
1090 | } event_handler; |
|
|
1091 | #endif |
|
|
1092 | |
1075 | bool |
1093 | bool |
1076 | rxvt_term::pty_fill () |
1094 | rxvt_term::pty_fill () |
1077 | { |
1095 | { |
1078 | ssize_t n = cmdbuf_endp - cmdbuf_ptr; |
1096 | ssize_t n = cmdbuf_endp - cmdbuf_ptr; |
1079 | |
1097 | |
… | |
… | |
1095 | return true; |
1113 | return true; |
1096 | } |
1114 | } |
1097 | else if (r < 0 && (errno == EAGAIN || errno == EINTR)) |
1115 | else if (r < 0 && (errno == EAGAIN || errno == EINTR)) |
1098 | { |
1116 | { |
1099 | #if HAVE_SCHED_YIELD |
1117 | #if HAVE_SCHED_YIELD |
1100 | sched_yield (); |
1118 | if (display->is_local) |
|
|
1119 | event_handler.cw_yield.start (); |
1101 | #endif |
1120 | #endif |
1102 | } |
1121 | } |
1103 | else |
1122 | else |
1104 | { |
1123 | { |
1105 | pty_ev.stop (); |
1124 | pty_ev.stop (); |
… | |
… | |
1681 | { |
1700 | { |
1682 | if (!focus) |
1701 | if (!focus) |
1683 | { |
1702 | { |
1684 | focus = 1; |
1703 | focus = 1; |
1685 | want_refresh = 1; |
1704 | want_refresh = 1; |
|
|
1705 | |
|
|
1706 | PERL_INVOKE ((this, HOOK_FOCUS_OUT, DT_END)); |
|
|
1707 | |
1686 | #if USE_XIM |
1708 | #if USE_XIM |
1687 | if (Input_Context != NULL) |
1709 | if (Input_Context != NULL) |
1688 | { |
1710 | { |
1689 | IMSetStatusPosition (); |
1711 | IMSetStatusPosition (); |
1690 | XSetICFocus (Input_Context); |
1712 | XSetICFocus (Input_Context); |
… | |
… | |
1710 | if (focus) |
1732 | if (focus) |
1711 | { |
1733 | { |
1712 | focus = 0; |
1734 | focus = 0; |
1713 | want_refresh = 1; |
1735 | want_refresh = 1; |
1714 | |
1736 | |
|
|
1737 | PERL_INVOKE ((this, HOOK_FOCUS_OUT, DT_END)); |
|
|
1738 | |
1715 | #if ENABLE_FRILLS || ISO_14755 |
1739 | #if ENABLE_FRILLS || ISO_14755 |
|
|
1740 | if (iso14755buf) |
|
|
1741 | { |
1716 | iso14755buf = 0; |
1742 | iso14755buf = 0; |
1717 | #endif |
|
|
1718 | #if ENABLE_OVERLAY |
1743 | # if ENABLE_OVERLAY |
1719 | scr_overlay_off (); |
1744 | scr_overlay_off (); |
|
|
1745 | # endif |
|
|
1746 | } |
1720 | #endif |
1747 | #endif |
1721 | #if USE_XIM |
1748 | #if USE_XIM |
1722 | if (Input_Context != NULL) |
1749 | if (Input_Context != NULL) |
1723 | XUnsetICFocus (Input_Context); |
1750 | XUnsetICFocus (Input_Context); |
1724 | #endif |
1751 | #endif |
… | |
… | |
2695 | |
2722 | |
2696 | if (!OPTION (Opt_jumpScroll) |
2723 | if (!OPTION (Opt_jumpScroll) |
2697 | || (refresh_count >= refresh_limit * (nrow - 1))) |
2724 | || (refresh_count >= refresh_limit * (nrow - 1))) |
2698 | { |
2725 | { |
2699 | refreshnow = true; |
2726 | refreshnow = true; |
|
|
2727 | refresh_count = 0; |
2700 | ch = NOCHAR; |
2728 | ch = NOCHAR; |
2701 | break; |
2729 | break; |
2702 | } |
2730 | } |
2703 | |
2731 | |
2704 | // scr_add_lines only works for nlines <= nrow - 1. |
2732 | // scr_add_lines only works for nlines <= nrow - 1. |
… | |
… | |
2741 | refresh_limit++; |
2769 | refresh_limit++; |
2742 | else |
2770 | else |
2743 | { |
2771 | { |
2744 | flag = true; |
2772 | flag = true; |
2745 | scr_refresh (refresh_type); |
2773 | scr_refresh (refresh_type); |
|
|
2774 | flush_ev.stop (); |
2746 | } |
2775 | } |
2747 | } |
2776 | } |
2748 | |
2777 | |
2749 | } |
2778 | } |
2750 | else |
2779 | else |
… | |
… | |
4064 | if (mode) |
4093 | if (mode) |
4065 | SET_OPTION (Opt_intensityStyles); |
4094 | SET_OPTION (Opt_intensityStyles); |
4066 | else |
4095 | else |
4067 | CLR_OPTION (Opt_intensityStyles); |
4096 | CLR_OPTION (Opt_intensityStyles); |
4068 | |
4097 | |
4069 | want_refresh = 1; |
4098 | scr_touch (true); |
4070 | want_full_refresh = 1; |
|
|
4071 | break; |
4099 | break; |
4072 | #endif |
4100 | #endif |
4073 | case 1048: /* alternative cursor save */ |
4101 | case 1048: /* alternative cursor save */ |
4074 | case 1049: |
4102 | case 1049: |
4075 | if (OPTION (Opt_secondaryScreen)) |
4103 | if (OPTION (Opt_secondaryScreen)) |