… | |
… | |
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 | |
… | |
… | |
1683 | |
1686 | |
1684 | refresh_check (); |
1687 | refresh_check (); |
1685 | } |
1688 | } |
1686 | |
1689 | |
1687 | void |
1690 | void |
|
|
1691 | rxvt_term::set_urgency (bool enable) |
|
|
1692 | { |
|
|
1693 | if (enable == urgency_hint) |
|
|
1694 | return; |
|
|
1695 | |
|
|
1696 | if (XWMHints *h = XGetWMHints (dpy, parent[0])) |
|
|
1697 | { |
|
|
1698 | h->flags = h->flags & ~XUrgencyHint | (enable ? XUrgencyHint : 0); |
|
|
1699 | XSetWMHints (dpy, parent[0], h); |
|
|
1700 | urgency_hint = enable; |
|
|
1701 | } |
|
|
1702 | } |
|
|
1703 | |
|
|
1704 | void |
1688 | rxvt_term::focus_in () |
1705 | rxvt_term::focus_in () |
1689 | { |
1706 | { |
1690 | if (!focus) |
1707 | if (!focus) |
1691 | { |
1708 | { |
1692 | focus = 1; |
1709 | focus = 1; |
1693 | want_refresh = 1; |
1710 | want_refresh = 1; |
1694 | |
|
|
1695 | HOOK_INVOKE ((this, HOOK_FOCUS_IN, DT_END)); |
|
|
1696 | |
1711 | |
1697 | #if USE_XIM |
1712 | #if USE_XIM |
1698 | if (Input_Context != NULL) |
1713 | if (Input_Context != NULL) |
1699 | { |
1714 | { |
1700 | IMSetPosition (); |
1715 | IMSetPosition (); |
… | |
… | |
1712 | scr_recolour (); |
1727 | scr_recolour (); |
1713 | } |
1728 | } |
1714 | #endif |
1729 | #endif |
1715 | #if ENABLE_FRILLS |
1730 | #if ENABLE_FRILLS |
1716 | if (option (Opt_urgentOnBell)) |
1731 | if (option (Opt_urgentOnBell)) |
1717 | { |
1732 | 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 |
1733 | #endif |
|
|
1734 | |
|
|
1735 | HOOK_INVOKE ((this, HOOK_FOCUS_IN, DT_END)); |
1725 | } |
1736 | } |
1726 | } |
1737 | } |
1727 | |
1738 | |
1728 | void |
1739 | void |
1729 | rxvt_term::focus_out () |
1740 | rxvt_term::focus_out () |
… | |
… | |
1731 | if (focus) |
1742 | if (focus) |
1732 | { |
1743 | { |
1733 | focus = 0; |
1744 | focus = 0; |
1734 | want_refresh = 1; |
1745 | want_refresh = 1; |
1735 | |
1746 | |
1736 | HOOK_INVOKE ((this, HOOK_FOCUS_OUT, DT_END)); |
1747 | #if ENABLE_FRILLS |
1737 | |
1748 | if (option (Opt_urgentOnBell)) |
|
|
1749 | set_urgency (0); |
|
|
1750 | #endif |
1738 | #if ENABLE_FRILLS || ISO_14755 |
1751 | #if ENABLE_FRILLS || ISO_14755 |
1739 | if (iso14755buf) |
1752 | if (iso14755buf) |
1740 | { |
1753 | { |
1741 | iso14755buf = 0; |
1754 | iso14755buf = 0; |
1742 | # if ISO_14755 |
1755 | # if ISO_14755 |
… | |
… | |
1759 | { |
1772 | { |
1760 | pix_colors = pix_colors_unfocused; |
1773 | pix_colors = pix_colors_unfocused; |
1761 | scr_recolour (); |
1774 | scr_recolour (); |
1762 | } |
1775 | } |
1763 | #endif |
1776 | #endif |
|
|
1777 | |
|
|
1778 | HOOK_INVOKE ((this, HOOK_FOCUS_OUT, DT_END)); |
1764 | } |
1779 | } |
1765 | } |
1780 | } |
1766 | |
1781 | |
1767 | void |
1782 | void |
1768 | rxvt_term::update_fade_color (unsigned int idx) |
1783 | rxvt_term::update_fade_color (unsigned int idx) |
… | |
… | |
3272 | |
3287 | |
3273 | assert (str != NULL); |
3288 | assert (str != NULL); |
3274 | |
3289 | |
3275 | if (HOOK_INVOKE ((this, HOOK_OSC_SEQ, DT_INT, op, DT_STR, str, DT_END))) |
3290 | if (HOOK_INVOKE ((this, HOOK_OSC_SEQ, DT_INT, op, DT_STR, str, DT_END))) |
3276 | return; |
3291 | return; |
3277 | fprintf (stderr, "op %d<%s>\n", op, str);//D |
|
|
3278 | |
3292 | |
3279 | switch (op) |
3293 | switch (op) |
3280 | { |
3294 | { |
3281 | case XTerm_name: |
3295 | case XTerm_name: |
3282 | set_title (str); |
3296 | set_title (str); |