ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/command.C
(Generate patch)

Comparing rxvt-unicode/src/command.C (file contents):
Revision 1.419 by root, Fri Oct 10 13:23:56 2008 UTC vs.
Revision 1.427 by root, Wed Nov 5 15:44:04 2008 UTC

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
1687void 1689void
1690rxvt_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
1703void
1688rxvt_term::focus_in () 1704rxvt_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
1728void 1738void
1729rxvt_term::focus_out () 1739rxvt_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
1767void 1781void
1768rxvt_term::update_fade_color (unsigned int idx) 1782rxvt_term::update_fade_color (unsigned int idx)
2170 } 2184 }
2171} 2185}
2172 2186
2173/*}}} */ 2187/*}}} */
2174 2188
2175bool 2189void
2176rxvt_term::cmd_parse () 2190rxvt_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
2309wchar_t 2318wchar_t
2310rxvt_term::next_char () NOTHROW 2319rxvt_term::next_char () NOTHROW
2679 /* 8.3.110: SINGLE CHARACTER INTRODUCER */ 2688 /* 8.3.110: SINGLE CHARACTER INTRODUCER */
2680 case C1_SCI: /* ESC Z */ 2689 case C1_SCI: /* ESC Z */
2681 tt_write (ESCZ_ANSWER, sizeof (ESCZ_ANSWER) - 1); 2690 tt_write (ESCZ_ANSWER, sizeof (ESCZ_ANSWER) - 1);
2682 break; /* steal obsolete ESC [ c */ 2691 break; /* steal obsolete ESC [ c */
2683 2692
2684 /* 8.3.16: CONTROL SEQUENCE INTRODUCER */ 2693 /* 8.3.16: CONTROL SEQUENCE INTRODUCER (CSI) */
2685 case C1_CSI: /* ESC [ */ 2694 case C1_CSI: /* ESC [ */
2686 process_csi_seq (); 2695 process_csi_seq ();
2687 break; 2696 break;
2688 2697
2689 /* 8.3.90: OPERATING SYSTEM COMMAND */ 2698 /* 8.3.90: OPERATING SYSTEM COMMAND (OSC) */
2690 case C1_OSC: /* ESC ] */ 2699 case C1_OSC: /* ESC ] */
2691 process_osc_seq (); 2700 process_osc_seq ();
2692 break; 2701 break;
2693 2702
2694 /* 8.3.106: RESET TO INITIAL STATE */ 2703 /* 8.3.106: RESET TO INITIAL STATE (RIS) */
2695 case 'c': 2704 case 'c':
2696 mbstate.reset (); 2705 mbstate.reset ();
2697 scr_poweron (); 2706 scr_poweron ();
2698 scrollBar.show (1); 2707 scrollBar.show (1);
2699 break; 2708 break;
2754 2763
2755 nargs = 0; 2764 nargs = 0;
2756 2765
2757 priv = 0; 2766 priv = 0;
2758 ch = cmd_getc (); 2767 ch = cmd_getc ();
2759 if (ch >= '<' && ch <= '?') 2768 if ((ch >= '<' && ch <= '?') || ch == '!')
2760 { 2769 {
2761 /* '<' '=' '>' '?' */ 2770 /* '<' '=' '>' '?' '!' */
2762 priv = ch; 2771 priv = ch;
2763 ch = cmd_getc (); 2772 ch = cmd_getc ();
2764 } 2773 }
2765 2774
2766 /* read any numerical arguments */ 2775 /* read any numerical arguments */
2820 2829
2821 case '?': 2830 case '?':
2822 if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') 2831 if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't')
2823 process_terminal_mode (ch, priv, nargs, arg); 2832 process_terminal_mode (ch, priv, nargs, arg);
2824 break; 2833 break;
2834
2835 case '!':
2836 if (ch == CSI_70)
2837 {
2838 /* DECSTR: soft terminal reset, used by our terminfo since 9.06 */
2839 scr_soft_reset ();
2840
2841 static const int pm_h[] = { 7, 25 };
2842 static const int pm_l[] = { 1, 3, 4, 5, 6, 9, 66, 1000, 1001, 1049 };
2843
2844 process_terminal_mode ('h', 0, sizeof (pm_h) / sizeof (pm_h[0]), pm_h);
2845 process_terminal_mode ('l', 0, sizeof (pm_l) / sizeof (pm_l[0]), pm_l);
2825 } 2846 }
2847 break;
2848 }
2849
2826 return; 2850 return;
2827 } 2851 }
2828 2852
2829 switch (ch) 2853 switch (ch)
2830 { 2854 {
3376 break; 3400 break;
3377 case URxvt_Color_IT: 3401 case URxvt_Color_IT:
3378 process_color_seq (op, Color_IT, str, resp); 3402 process_color_seq (op, Color_IT, str, resp);
3379 break; 3403 break;
3380#endif 3404#endif
3405 case URxvt_Color_border:
3406 process_color_seq (op, Color_border, str, resp);
3407 break;
3381#if ENABLE_TRANSPARENCY 3408#if ENABLE_TRANSPARENCY
3382 case URxvt_Color_tint: 3409 case URxvt_Color_tint:
3383 process_color_seq (op, Color_tint, str, resp); 3410 process_color_seq (op, Color_tint, str, resp);
3384 { 3411 {
3385 bool changed = false; 3412 bool changed = false;
3560 static const struct 3587 static const struct
3561 { 3588 {
3562 const int argval; 3589 const int argval;
3563 const unsigned long bit; 3590 const unsigned long bit;
3564 } argtopriv[] = { 3591 } argtopriv[] = {
3565 { 1, PrivMode_aplCUR }, 3592 { 1, PrivMode_aplCUR }, // DECCKM
3566 { 2, PrivMode_vt52 }, 3593 { 2, PrivMode_vt52 },
3567 { 3, PrivMode_132 }, 3594 { 3, PrivMode_132 }, // DECCOLM
3568 { 4, PrivMode_smoothScroll }, 3595 { 4, PrivMode_smoothScroll }, // DECSCLM
3569 { 5, PrivMode_rVideo }, 3596 { 5, PrivMode_rVideo }, // DECSCNM
3570 { 6, PrivMode_relOrigin }, 3597 { 6, PrivMode_relOrigin }, // DECOM
3571 { 7, PrivMode_Autowrap }, 3598 { 7, PrivMode_Autowrap }, // DECAWM
3572 // 8, bi-directional support mode 3599 // 8, auto-repeat keys // DECARM
3573 { 9, PrivMode_MouseX10 }, 3600 { 9, PrivMode_MouseX10 },
3574 // 18, 19 printing-related 3601 // 18 end FF to printer after print screen
3602 // 19 Print screen prints full screen/scorll region
3575 { 25, PrivMode_VisibleCursor }, 3603 { 25, PrivMode_VisibleCursor }, // cnorm/cvvis/civis
3576#ifdef scrollBar_esc 3604#ifdef scrollBar_esc
3577 { scrollBar_esc, PrivMode_scrollBar }, 3605 { scrollBar_esc, PrivMode_scrollBar },
3578#endif 3606#endif
3579 { 35, PrivMode_ShiftKeys }, // rxvt extension 3607 { 35, PrivMode_ShiftKeys }, // rxvt extension
3608 // 38, tektronix mode // DECTEK
3580 { 40, PrivMode_132OK }, 3609 { 40, PrivMode_132OK },
3581 // 41 xterm more fixes NYI 3610 // 41 xterm more fixes NYI
3582 // 45 margin bell NYI 3611 // 45 margin bell NYI
3583 // 46 start logging 3612 // 46 start logging
3584 { 47, PrivMode_Screen }, 3613 { 47, PrivMode_Screen },
3585 { 66, PrivMode_aplKP }, 3614 { 66, PrivMode_aplKP }, // DECPAM/DECPNM
3586#ifndef NO_BACKSPACE_KEY 3615#ifndef NO_BACKSPACE_KEY
3587 { 67, PrivMode_BackSpace }, 3616 { 67, PrivMode_BackSpace }, // DECBKM
3588#endif 3617#endif
3589 { 1000, PrivMode_MouseX11 }, 3618 { 1000, PrivMode_MouseX11 },
3590 { 1002, PrivMode_MouseBtnEvent }, 3619 { 1002, PrivMode_MouseBtnEvent },
3591 { 1003, PrivMode_MouseAnyEvent }, 3620 { 1003, PrivMode_MouseAnyEvent },
3592 { 1010, PrivMode_TtyOutputInh }, // rxvt extension 3621 { 1010, PrivMode_TtyOutputInh }, // rxvt extension
3654 */ 3683 */
3655 set_privmode (PrivMode_vt52, 1); 3684 set_privmode (PrivMode_vt52, 1);
3656 break; 3685 break;
3657 case 3: /* 80/132 */ 3686 case 3: /* 80/132 */
3658 if (priv_modes & PrivMode_132OK) 3687 if (priv_modes & PrivMode_132OK)
3659 {
3660 scr_poweron ();
3661 set_widthheight (((state ? 132 : 80) * fwidth), 24 * fheight); 3688 set_widthheight ((state ? 132 : 80) * fwidth, 24 * fheight);
3662 }
3663 break; 3689 break;
3664 case 4: /* smooth scrolling */ 3690 case 4: /* smooth scrolling */
3665 set_option (Opt_jumpScroll, !state); 3691 set_option (Opt_jumpScroll, !state);
3666 break; 3692 break;
3667 case 5: /* reverse video */ 3693 case 5: /* reverse video */
3709 priv_modes &= arg[i] == 1003 ? ~PrivMode_MouseBtnEvent : ~PrivMode_MouseAnyEvent; 3735 priv_modes &= arg[i] == 1003 ? ~PrivMode_MouseBtnEvent : ~PrivMode_MouseAnyEvent;
3710 vt_emask_mouse = PointerMotionMask; 3736 vt_emask_mouse = PointerMotionMask;
3711 } 3737 }
3712 else 3738 else
3713 vt_emask_mouse = NoEventMask; 3739 vt_emask_mouse = NoEventMask;
3740
3714 vt_select_input (); 3741 vt_select_input ();
3715 break; 3742 break;
3716 case 1010: /* scroll to bottom on TTY output inhibit */ 3743 case 1010: /* scroll to bottom on TTY output inhibit */
3717 set_option (Opt_scrollTtyOutput, !state); 3744 set_option (Opt_scrollTtyOutput, !state);
3718 break; 3745 break;
3721 break; 3748 break;
3722 case 1047: /* secondary screen w/ clearing last */ 3749 case 1047: /* secondary screen w/ clearing last */
3723 if (option (Opt_secondaryScreen)) 3750 if (option (Opt_secondaryScreen))
3724 if (current_screen != PRIMARY) 3751 if (current_screen != PRIMARY)
3725 scr_erase_screen (2); 3752 scr_erase_screen (2);
3753
3726 scr_change_screen (state); 3754 scr_change_screen (state);
3727 break; 3755 break;
3728 case 1049: /* secondary screen w/ clearing first */ 3756 case 1049: /* secondary screen w/ clearing first */
3729 scr_change_screen (state); 3757 scr_change_screen (state);
3730 if (option (Opt_secondaryScreen)) 3758 if (option (Opt_secondaryScreen))

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines