… | |
… | |
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 | event_handler.cw_yield.start (); |
1101 | #endif |
1119 | #endif |
1102 | } |
1120 | } |
1103 | else |
1121 | else |
1104 | { |
1122 | { |
1105 | pty_ev.stop (); |
1123 | pty_ev.stop (); |
… | |
… | |
1681 | { |
1699 | { |
1682 | if (!focus) |
1700 | if (!focus) |
1683 | { |
1701 | { |
1684 | focus = 1; |
1702 | focus = 1; |
1685 | want_refresh = 1; |
1703 | want_refresh = 1; |
|
|
1704 | |
|
|
1705 | PERL_INVOKE ((this, HOOK_FOCUS_OUT, DT_END)); |
|
|
1706 | |
1686 | #if USE_XIM |
1707 | #if USE_XIM |
1687 | if (Input_Context != NULL) |
1708 | if (Input_Context != NULL) |
1688 | { |
1709 | { |
1689 | IMSetStatusPosition (); |
1710 | IMSetStatusPosition (); |
1690 | XSetICFocus (Input_Context); |
1711 | XSetICFocus (Input_Context); |
… | |
… | |
1710 | if (focus) |
1731 | if (focus) |
1711 | { |
1732 | { |
1712 | focus = 0; |
1733 | focus = 0; |
1713 | want_refresh = 1; |
1734 | want_refresh = 1; |
1714 | |
1735 | |
|
|
1736 | PERL_INVOKE ((this, HOOK_FOCUS_OUT, DT_END)); |
|
|
1737 | |
1715 | #if ENABLE_FRILLS || ISO_14755 |
1738 | #if ENABLE_FRILLS || ISO_14755 |
|
|
1739 | if (iso14755buf) |
|
|
1740 | { |
1716 | iso14755buf = 0; |
1741 | iso14755buf = 0; |
1717 | #endif |
|
|
1718 | #if ENABLE_OVERLAY |
1742 | # if ENABLE_OVERLAY |
1719 | scr_overlay_off (); |
1743 | scr_overlay_off (); |
|
|
1744 | # endif |
|
|
1745 | } |
1720 | #endif |
1746 | #endif |
1721 | #if USE_XIM |
1747 | #if USE_XIM |
1722 | if (Input_Context != NULL) |
1748 | if (Input_Context != NULL) |
1723 | XUnsetICFocus (Input_Context); |
1749 | XUnsetICFocus (Input_Context); |
1724 | #endif |
1750 | #endif |
… | |
… | |
2695 | |
2721 | |
2696 | if (!OPTION (Opt_jumpScroll) |
2722 | if (!OPTION (Opt_jumpScroll) |
2697 | || (refresh_count >= refresh_limit * (nrow - 1))) |
2723 | || (refresh_count >= refresh_limit * (nrow - 1))) |
2698 | { |
2724 | { |
2699 | refreshnow = true; |
2725 | refreshnow = true; |
|
|
2726 | refresh_count = 0; |
2700 | ch = NOCHAR; |
2727 | ch = NOCHAR; |
2701 | break; |
2728 | break; |
2702 | } |
2729 | } |
2703 | |
2730 | |
2704 | // scr_add_lines only works for nlines <= nrow - 1. |
2731 | // scr_add_lines only works for nlines <= nrow - 1. |
… | |
… | |
2741 | refresh_limit++; |
2768 | refresh_limit++; |
2742 | else |
2769 | else |
2743 | { |
2770 | { |
2744 | flag = true; |
2771 | flag = true; |
2745 | scr_refresh (refresh_type); |
2772 | scr_refresh (refresh_type); |
|
|
2773 | flush_ev.stop (); |
2746 | } |
2774 | } |
2747 | } |
2775 | } |
2748 | |
2776 | |
2749 | } |
2777 | } |
2750 | else |
2778 | else |
… | |
… | |
4064 | if (mode) |
4092 | if (mode) |
4065 | SET_OPTION (Opt_intensityStyles); |
4093 | SET_OPTION (Opt_intensityStyles); |
4066 | else |
4094 | else |
4067 | CLR_OPTION (Opt_intensityStyles); |
4095 | CLR_OPTION (Opt_intensityStyles); |
4068 | |
4096 | |
4069 | want_refresh = 1; |
4097 | scr_touch (true); |
4070 | want_full_refresh = 1; |
|
|
4071 | break; |
4098 | break; |
4072 | #endif |
4099 | #endif |
4073 | case 1048: /* alternative cursor save */ |
4100 | case 1048: /* alternative cursor save */ |
4074 | case 1049: |
4101 | case 1049: |
4075 | if (OPTION (Opt_secondaryScreen)) |
4102 | if (OPTION (Opt_secondaryScreen)) |