… | |
… | |
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 | |
53 | #if HAVE_SCHED_YIELD |
54 | #if HAVE_SCHED_YIELD |
54 | # include <sched.h> |
55 | # include <sched.h> |
… | |
… | |
984 | SET_LOCALE (locale); |
985 | SET_LOCALE (locale); |
985 | |
986 | |
986 | display->flush (); |
987 | display->flush (); |
987 | |
988 | |
988 | if (want_refresh && !flush_ev.active) |
989 | if (want_refresh && !flush_ev.active) |
989 | flush_ev.start (NOW + 0.01); |
990 | flush_ev.start (NOW + 1. / 60.); // refresh at max. 60 hz normally |
990 | } |
991 | } |
991 | |
992 | |
992 | void |
993 | void |
993 | rxvt_term::flush_cb (time_watcher &w) |
994 | rxvt_term::flush_cb (time_watcher &w) |
994 | { |
995 | { |
… | |
… | |
1069 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1070 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1070 | } |
1071 | } |
1071 | } |
1072 | } |
1072 | #endif |
1073 | #endif |
1073 | |
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 | |
1074 | bool |
1093 | bool |
1075 | rxvt_term::pty_fill () |
1094 | rxvt_term::pty_fill () |
1076 | { |
1095 | { |
1077 | ssize_t n = cmdbuf_endp - cmdbuf_ptr; |
1096 | ssize_t n = cmdbuf_endp - cmdbuf_ptr; |
1078 | |
1097 | |
… | |
… | |
1094 | return true; |
1113 | return true; |
1095 | } |
1114 | } |
1096 | else if (r < 0 && (errno == EAGAIN || errno == EINTR)) |
1115 | else if (r < 0 && (errno == EAGAIN || errno == EINTR)) |
1097 | { |
1116 | { |
1098 | #if HAVE_SCHED_YIELD |
1117 | #if HAVE_SCHED_YIELD |
1099 | sched_yield (); |
1118 | event_handler.cw_yield.start (); |
1100 | #endif |
1119 | #endif |
1101 | } |
1120 | } |
1102 | else |
1121 | else |
1103 | { |
1122 | { |
1104 | pty_ev.stop (); |
1123 | pty_ev.stop (); |
… | |
… | |
1680 | { |
1699 | { |
1681 | if (!focus) |
1700 | if (!focus) |
1682 | { |
1701 | { |
1683 | focus = 1; |
1702 | focus = 1; |
1684 | want_refresh = 1; |
1703 | want_refresh = 1; |
|
|
1704 | |
|
|
1705 | PERL_INVOKE ((this, HOOK_FOCUS_OUT, DT_END)); |
|
|
1706 | |
1685 | #if USE_XIM |
1707 | #if USE_XIM |
1686 | if (Input_Context != NULL) |
1708 | if (Input_Context != NULL) |
1687 | { |
1709 | { |
1688 | IMSetStatusPosition (); |
1710 | IMSetStatusPosition (); |
1689 | XSetICFocus (Input_Context); |
1711 | XSetICFocus (Input_Context); |
… | |
… | |
1709 | if (focus) |
1731 | if (focus) |
1710 | { |
1732 | { |
1711 | focus = 0; |
1733 | focus = 0; |
1712 | want_refresh = 1; |
1734 | want_refresh = 1; |
1713 | |
1735 | |
|
|
1736 | PERL_INVOKE ((this, HOOK_FOCUS_OUT, DT_END)); |
|
|
1737 | |
1714 | #if ENABLE_FRILLS || ISO_14755 |
1738 | #if ENABLE_FRILLS || ISO_14755 |
|
|
1739 | if (iso14755buf) |
|
|
1740 | { |
1715 | iso14755buf = 0; |
1741 | iso14755buf = 0; |
1716 | #endif |
|
|
1717 | #if ENABLE_OVERLAY |
1742 | # if ENABLE_OVERLAY |
1718 | scr_overlay_off (); |
1743 | scr_overlay_off (); |
|
|
1744 | # endif |
|
|
1745 | } |
1719 | #endif |
1746 | #endif |
1720 | #if USE_XIM |
1747 | #if USE_XIM |
1721 | if (Input_Context != NULL) |
1748 | if (Input_Context != NULL) |
1722 | XUnsetICFocus (Input_Context); |
1749 | XUnsetICFocus (Input_Context); |
1723 | #endif |
1750 | #endif |
… | |
… | |
2694 | |
2721 | |
2695 | if (!OPTION (Opt_jumpScroll) |
2722 | if (!OPTION (Opt_jumpScroll) |
2696 | || (refresh_count >= refresh_limit * (nrow - 1))) |
2723 | || (refresh_count >= refresh_limit * (nrow - 1))) |
2697 | { |
2724 | { |
2698 | refreshnow = true; |
2725 | refreshnow = true; |
|
|
2726 | refresh_count = 0; |
2699 | ch = NOCHAR; |
2727 | ch = NOCHAR; |
2700 | break; |
2728 | break; |
2701 | } |
2729 | } |
2702 | |
2730 | |
2703 | // scr_add_lines only works for nlines <= nrow - 1. |
2731 | // scr_add_lines only works for nlines <= nrow - 1. |
… | |
… | |
2740 | refresh_limit++; |
2768 | refresh_limit++; |
2741 | else |
2769 | else |
2742 | { |
2770 | { |
2743 | flag = true; |
2771 | flag = true; |
2744 | scr_refresh (refresh_type); |
2772 | scr_refresh (refresh_type); |
|
|
2773 | flush_ev.stop (); |
2745 | } |
2774 | } |
2746 | } |
2775 | } |
2747 | |
2776 | |
2748 | } |
2777 | } |
2749 | else |
2778 | else |
… | |
… | |
4063 | if (mode) |
4092 | if (mode) |
4064 | SET_OPTION (Opt_intensityStyles); |
4093 | SET_OPTION (Opt_intensityStyles); |
4065 | else |
4094 | else |
4066 | CLR_OPTION (Opt_intensityStyles); |
4095 | CLR_OPTION (Opt_intensityStyles); |
4067 | |
4096 | |
4068 | want_refresh = 1; |
4097 | scr_touch (true); |
4069 | want_full_refresh = 1; |
|
|
4070 | break; |
4098 | break; |
4071 | #endif |
4099 | #endif |
4072 | case 1048: /* alternative cursor save */ |
4100 | case 1048: /* alternative cursor save */ |
4073 | case 1049: |
4101 | case 1049: |
4074 | if (OPTION (Opt_secondaryScreen)) |
4102 | if (OPTION (Opt_secondaryScreen)) |