… | |
… | |
1127 | { |
1127 | { |
1128 | // this should really be sched_yield(), but the linux guys thought |
1128 | // this should really be sched_yield(), but the linux guys thought |
1129 | // that giving a process calling sched_yield () less cpu time than |
1129 | // that giving a process calling sched_yield () less cpu time than |
1130 | // ones with high nice levels is a useful thing to do. It surely is is |
1130 | // ones with high nice levels is a useful thing to do. It surely is is |
1131 | // allowed by the sus... as is returning ENOSYS. |
1131 | // allowed by the sus... as is returning ENOSYS. |
|
|
1132 | // since the linux guys additionally thought that breaking the only |
|
|
1133 | // known workaroudn against their unusable sched_yield hack is cool, |
|
|
1134 | // we just nanosleep a bit and hope for the best. |
1132 | |
1135 | |
1133 | struct timespec ts = { 0, 0 }; |
1136 | struct timespec ts = { 0, 1000 }; |
1134 | nanosleep (&ts, 0); |
1137 | nanosleep (&ts, 0); |
1135 | |
1138 | |
1136 | w.stop (); |
1139 | w.stop (); |
1137 | } |
1140 | } |
1138 | |
1141 | |
… | |
… | |
1188 | { |
1191 | { |
1189 | make_current (); |
1192 | make_current (); |
1190 | |
1193 | |
1191 | if (revents & ev::READ) |
1194 | if (revents & ev::READ) |
1192 | // loop, but don't allow a single term to monopolize us |
1195 | // loop, but don't allow a single term to monopolize us |
1193 | while (pty_fill ()) |
1196 | for (int i = CBUFCNT; i-- && pty_fill (); ) |
1194 | if (cmd_parse ()) |
1197 | cmd_parse (); |
1195 | break; |
|
|
1196 | |
1198 | |
1197 | if (revents & ev::WRITE) |
1199 | if (revents & ev::WRITE) |
1198 | pty_write (); |
1200 | pty_write (); |
1199 | |
1201 | |
1200 | refresh_check (); |
1202 | refresh_check (); |
… | |
… | |
1683 | |
1685 | |
1684 | refresh_check (); |
1686 | refresh_check (); |
1685 | } |
1687 | } |
1686 | |
1688 | |
1687 | void |
1689 | void |
|
|
1690 | rxvt_term::set_urgency (bool enable) |
|
|
1691 | { |
|
|
1692 | if (enable == urgency_hint) |
|
|
1693 | return; |
|
|
1694 | |
|
|
1695 | if (XWMHints *h = XGetWMHints (dpy, parent[0])) |
|
|
1696 | { |
|
|
1697 | h->flags = h->flags & ~XUrgencyHint | (enable ? XUrgencyHint : 0); |
|
|
1698 | XSetWMHints (dpy, parent[0], h); |
|
|
1699 | urgency_hint = enable; |
|
|
1700 | } |
|
|
1701 | } |
|
|
1702 | |
|
|
1703 | void |
1688 | rxvt_term::focus_in () |
1704 | rxvt_term::focus_in () |
1689 | { |
1705 | { |
1690 | if (!focus) |
1706 | if (!focus) |
1691 | { |
1707 | { |
1692 | focus = 1; |
1708 | focus = 1; |
1693 | want_refresh = 1; |
1709 | want_refresh = 1; |
1694 | |
|
|
1695 | HOOK_INVOKE ((this, HOOK_FOCUS_IN, DT_END)); |
|
|
1696 | |
1710 | |
1697 | #if USE_XIM |
1711 | #if USE_XIM |
1698 | if (Input_Context != NULL) |
1712 | if (Input_Context != NULL) |
1699 | { |
1713 | { |
1700 | IMSetPosition (); |
1714 | IMSetPosition (); |
… | |
… | |
1712 | scr_recolour (); |
1726 | scr_recolour (); |
1713 | } |
1727 | } |
1714 | #endif |
1728 | #endif |
1715 | #if ENABLE_FRILLS |
1729 | #if ENABLE_FRILLS |
1716 | if (option (Opt_urgentOnBell)) |
1730 | if (option (Opt_urgentOnBell)) |
1717 | { |
1731 | set_urgency (0); |
1718 | if (XWMHints *h = XGetWMHints(dpy, parent[0])) |
|
|
1719 | { |
|
|
1720 | h->flags &= ~XUrgencyHint; |
|
|
1721 | XSetWMHints (dpy, parent[0], h); |
|
|
1722 | } |
|
|
1723 | } |
|
|
1724 | #endif |
1732 | #endif |
|
|
1733 | |
|
|
1734 | HOOK_INVOKE ((this, HOOK_FOCUS_IN, DT_END)); |
1725 | } |
1735 | } |
1726 | } |
1736 | } |
1727 | |
1737 | |
1728 | void |
1738 | void |
1729 | rxvt_term::focus_out () |
1739 | rxvt_term::focus_out () |
… | |
… | |
1731 | if (focus) |
1741 | if (focus) |
1732 | { |
1742 | { |
1733 | focus = 0; |
1743 | focus = 0; |
1734 | want_refresh = 1; |
1744 | want_refresh = 1; |
1735 | |
1745 | |
1736 | HOOK_INVOKE ((this, HOOK_FOCUS_OUT, DT_END)); |
1746 | #if ENABLE_FRILLS |
1737 | |
1747 | if (option (Opt_urgentOnBell)) |
|
|
1748 | set_urgency (0); |
|
|
1749 | #endif |
1738 | #if ENABLE_FRILLS || ISO_14755 |
1750 | #if ENABLE_FRILLS || ISO_14755 |
1739 | if (iso14755buf) |
1751 | if (iso14755buf) |
1740 | { |
1752 | { |
1741 | iso14755buf = 0; |
1753 | iso14755buf = 0; |
1742 | # if ISO_14755 |
1754 | # if ISO_14755 |
… | |
… | |
1759 | { |
1771 | { |
1760 | pix_colors = pix_colors_unfocused; |
1772 | pix_colors = pix_colors_unfocused; |
1761 | scr_recolour (); |
1773 | scr_recolour (); |
1762 | } |
1774 | } |
1763 | #endif |
1775 | #endif |
|
|
1776 | |
|
|
1777 | HOOK_INVOKE ((this, HOOK_FOCUS_OUT, DT_END)); |
1764 | } |
1778 | } |
1765 | } |
1779 | } |
1766 | |
1780 | |
1767 | void |
1781 | void |
1768 | rxvt_term::update_fade_color (unsigned int idx) |
1782 | rxvt_term::update_fade_color (unsigned int idx) |
… | |
… | |
2170 | } |
2184 | } |
2171 | } |
2185 | } |
2172 | |
2186 | |
2173 | /*}}} */ |
2187 | /*}}} */ |
2174 | |
2188 | |
2175 | bool |
2189 | void |
2176 | rxvt_term::cmd_parse () |
2190 | rxvt_term::cmd_parse () |
2177 | { |
2191 | { |
2178 | bool flag = false; |
|
|
2179 | wchar_t ch = NOCHAR; |
2192 | wchar_t ch = NOCHAR; |
2180 | char *seq_begin; // remember start of esc-sequence here |
2193 | char *seq_begin; // remember start of esc-sequence here |
2181 | |
2194 | |
2182 | for (;;) |
2195 | for (;;) |
2183 | { |
2196 | { |
… | |
… | |
2277 | * What the heck we'll cheat and only refresh less than every page-full. |
2290 | * What the heck we'll cheat and only refresh less than every page-full. |
2278 | * if skipScroll is enabled. |
2291 | * if skipScroll is enabled. |
2279 | */ |
2292 | */ |
2280 | if (refreshnow) |
2293 | if (refreshnow) |
2281 | { |
2294 | { |
2282 | flag = true; |
|
|
2283 | scr_refresh (); |
2295 | scr_refresh (); |
2284 | want_refresh = 1; |
2296 | want_refresh = 1; |
2285 | } |
2297 | } |
2286 | |
|
|
2287 | } |
2298 | } |
2288 | else |
2299 | else |
2289 | { |
2300 | { |
2290 | try |
2301 | try |
2291 | { |
2302 | { |
… | |
… | |
2299 | } |
2310 | } |
2300 | |
2311 | |
2301 | ch = NOCHAR; |
2312 | ch = NOCHAR; |
2302 | } |
2313 | } |
2303 | } |
2314 | } |
2304 | |
|
|
2305 | return flag; |
|
|
2306 | } |
2315 | } |
2307 | |
2316 | |
2308 | // read the next character |
2317 | // read the next character |
2309 | wchar_t |
2318 | wchar_t |
2310 | rxvt_term::next_char () NOTHROW |
2319 | rxvt_term::next_char () NOTHROW |