… | |
… | |
1191 | { |
1191 | { |
1192 | make_current (); |
1192 | make_current (); |
1193 | |
1193 | |
1194 | if (revents & ev::READ) |
1194 | if (revents & ev::READ) |
1195 | // loop, but don't allow a single term to monopolize us |
1195 | // loop, but don't allow a single term to monopolize us |
1196 | while (pty_fill ()) |
1196 | for (int i = CBUFCNT; i-- && pty_fill (); ) |
1197 | if (cmd_parse ()) |
1197 | cmd_parse (); |
1198 | break; |
|
|
1199 | |
1198 | |
1200 | if (revents & ev::WRITE) |
1199 | if (revents & ev::WRITE) |
1201 | pty_write (); |
1200 | pty_write (); |
1202 | |
1201 | |
1203 | refresh_check (); |
1202 | refresh_check (); |
… | |
… | |
1685 | #endif |
1684 | #endif |
1686 | |
1685 | |
1687 | refresh_check (); |
1686 | refresh_check (); |
1688 | } |
1687 | } |
1689 | |
1688 | |
|
|
1689 | #if ENABLE_FRILLS |
1690 | void |
1690 | void |
1691 | rxvt_term::set_urgency (bool enable) |
1691 | rxvt_term::set_urgency (bool enable) |
1692 | { |
1692 | { |
1693 | if (enable == urgency_hint) |
1693 | if (enable == urgency_hint) |
1694 | return; |
1694 | return; |
… | |
… | |
1698 | h->flags = h->flags & ~XUrgencyHint | (enable ? XUrgencyHint : 0); |
1698 | h->flags = h->flags & ~XUrgencyHint | (enable ? XUrgencyHint : 0); |
1699 | XSetWMHints (dpy, parent[0], h); |
1699 | XSetWMHints (dpy, parent[0], h); |
1700 | urgency_hint = enable; |
1700 | urgency_hint = enable; |
1701 | } |
1701 | } |
1702 | } |
1702 | } |
|
|
1703 | #endif |
1703 | |
1704 | |
1704 | void |
1705 | void |
1705 | rxvt_term::focus_in () |
1706 | rxvt_term::focus_in () |
1706 | { |
1707 | { |
1707 | if (!focus) |
1708 | if (!focus) |
… | |
… | |
2185 | } |
2186 | } |
2186 | } |
2187 | } |
2187 | |
2188 | |
2188 | /*}}} */ |
2189 | /*}}} */ |
2189 | |
2190 | |
2190 | bool |
2191 | void |
2191 | rxvt_term::cmd_parse () |
2192 | rxvt_term::cmd_parse () |
2192 | { |
2193 | { |
2193 | bool flag = false; |
|
|
2194 | wchar_t ch = NOCHAR; |
2194 | wchar_t ch = NOCHAR; |
2195 | char *seq_begin; // remember start of esc-sequence here |
2195 | char *seq_begin; // remember start of esc-sequence here |
2196 | |
2196 | |
2197 | for (;;) |
2197 | for (;;) |
2198 | { |
2198 | { |
… | |
… | |
2292 | * What the heck we'll cheat and only refresh less than every page-full. |
2292 | * What the heck we'll cheat and only refresh less than every page-full. |
2293 | * if skipScroll is enabled. |
2293 | * if skipScroll is enabled. |
2294 | */ |
2294 | */ |
2295 | if (refreshnow) |
2295 | if (refreshnow) |
2296 | { |
2296 | { |
2297 | flag = true; |
|
|
2298 | scr_refresh (); |
2297 | scr_refresh (); |
2299 | want_refresh = 1; |
2298 | want_refresh = 1; |
2300 | } |
2299 | } |
2301 | |
|
|
2302 | } |
2300 | } |
2303 | else |
2301 | else |
2304 | { |
2302 | { |
2305 | try |
2303 | try |
2306 | { |
2304 | { |
… | |
… | |
2314 | } |
2312 | } |
2315 | |
2313 | |
2316 | ch = NOCHAR; |
2314 | ch = NOCHAR; |
2317 | } |
2315 | } |
2318 | } |
2316 | } |
2319 | |
|
|
2320 | return flag; |
|
|
2321 | } |
2317 | } |
2322 | |
2318 | |
2323 | // read the next character |
2319 | // read the next character |
2324 | wchar_t |
2320 | wchar_t |
2325 | rxvt_term::next_char () NOTHROW |
2321 | rxvt_term::next_char () NOTHROW |
… | |
… | |
2340 | break; |
2336 | break; |
2341 | } |
2337 | } |
2342 | |
2338 | |
2343 | if (len == (size_t)-1) |
2339 | if (len == (size_t)-1) |
2344 | { |
2340 | { |
2345 | mbrtowc (0, 0, 0, mbstate); // reset now undefined conversion state |
2341 | mbstate.reset (); // reset now undefined conversion state |
2346 | return (unsigned char)*cmdbuf_ptr++; // the _occasional_ latin1 character is allowed to slip through |
2342 | return (unsigned char)*cmdbuf_ptr++; // the _occasional_ latin1 character is allowed to slip through |
2347 | } |
2343 | } |
2348 | |
2344 | |
2349 | // assume wchar == unicode |
2345 | // assume wchar == unicode |
2350 | cmdbuf_ptr += len; |
2346 | cmdbuf_ptr += len; |
… | |
… | |
2694 | /* 8.3.110: SINGLE CHARACTER INTRODUCER */ |
2690 | /* 8.3.110: SINGLE CHARACTER INTRODUCER */ |
2695 | case C1_SCI: /* ESC Z */ |
2691 | case C1_SCI: /* ESC Z */ |
2696 | tt_write (ESCZ_ANSWER, sizeof (ESCZ_ANSWER) - 1); |
2692 | tt_write (ESCZ_ANSWER, sizeof (ESCZ_ANSWER) - 1); |
2697 | break; /* steal obsolete ESC [ c */ |
2693 | break; /* steal obsolete ESC [ c */ |
2698 | |
2694 | |
2699 | /* 8.3.16: CONTROL SEQUENCE INTRODUCER */ |
2695 | /* 8.3.16: CONTROL SEQUENCE INTRODUCER (CSI) */ |
2700 | case C1_CSI: /* ESC [ */ |
2696 | case C1_CSI: /* ESC [ */ |
2701 | process_csi_seq (); |
2697 | process_csi_seq (); |
2702 | break; |
2698 | break; |
2703 | |
2699 | |
2704 | /* 8.3.90: OPERATING SYSTEM COMMAND */ |
2700 | /* 8.3.90: OPERATING SYSTEM COMMAND (OSC) */ |
2705 | case C1_OSC: /* ESC ] */ |
2701 | case C1_OSC: /* ESC ] */ |
2706 | process_osc_seq (); |
2702 | process_osc_seq (); |
2707 | break; |
2703 | break; |
2708 | |
2704 | |
2709 | /* 8.3.106: RESET TO INITIAL STATE */ |
2705 | /* 8.3.106: RESET TO INITIAL STATE (RIS) */ |
2710 | case 'c': |
2706 | case 'c': |
2711 | mbstate.reset (); |
2707 | mbstate.reset (); |
2712 | scr_poweron (); |
2708 | scr_poweron (); |
2713 | scrollBar.show (1); |
2709 | scrollBar.show (1); |
2714 | break; |
2710 | break; |
… | |
… | |
2769 | |
2765 | |
2770 | nargs = 0; |
2766 | nargs = 0; |
2771 | |
2767 | |
2772 | priv = 0; |
2768 | priv = 0; |
2773 | ch = cmd_getc (); |
2769 | ch = cmd_getc (); |
2774 | if (ch >= '<' && ch <= '?') |
2770 | if ((ch >= '<' && ch <= '?') || ch == '!') |
2775 | { |
2771 | { |
2776 | /* '<' '=' '>' '?' */ |
2772 | /* '<' '=' '>' '?' '!' */ |
2777 | priv = ch; |
2773 | priv = ch; |
2778 | ch = cmd_getc (); |
2774 | ch = cmd_getc (); |
2779 | } |
2775 | } |
2780 | |
2776 | |
2781 | /* read any numerical arguments */ |
2777 | /* read any numerical arguments */ |
… | |
… | |
2835 | |
2831 | |
2836 | case '?': |
2832 | case '?': |
2837 | if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') |
2833 | if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') |
2838 | process_terminal_mode (ch, priv, nargs, arg); |
2834 | process_terminal_mode (ch, priv, nargs, arg); |
2839 | break; |
2835 | break; |
|
|
2836 | |
|
|
2837 | case '!': |
|
|
2838 | if (ch == CSI_70) |
|
|
2839 | { |
|
|
2840 | /* DECSTR: soft terminal reset, used by our terminfo since 9.06 */ |
|
|
2841 | scr_soft_reset (); |
|
|
2842 | |
|
|
2843 | static const int pm_h[] = { 7, 25 }; |
|
|
2844 | static const int pm_l[] = { 1, 3, 4, 5, 6, 9, 66, 1000, 1001, 1049 }; |
|
|
2845 | |
|
|
2846 | process_terminal_mode ('h', 0, sizeof (pm_h) / sizeof (pm_h[0]), pm_h); |
|
|
2847 | process_terminal_mode ('l', 0, sizeof (pm_l) / sizeof (pm_l[0]), pm_l); |
2840 | } |
2848 | } |
|
|
2849 | break; |
|
|
2850 | } |
|
|
2851 | |
2841 | return; |
2852 | return; |
2842 | } |
2853 | } |
2843 | |
2854 | |
2844 | switch (ch) |
2855 | switch (ch) |
2845 | { |
2856 | { |
… | |
… | |
3391 | break; |
3402 | break; |
3392 | case URxvt_Color_IT: |
3403 | case URxvt_Color_IT: |
3393 | process_color_seq (op, Color_IT, str, resp); |
3404 | process_color_seq (op, Color_IT, str, resp); |
3394 | break; |
3405 | break; |
3395 | #endif |
3406 | #endif |
|
|
3407 | case URxvt_Color_border: |
|
|
3408 | process_color_seq (op, Color_border, str, resp); |
|
|
3409 | break; |
3396 | #if ENABLE_TRANSPARENCY |
3410 | #if ENABLE_TRANSPARENCY |
3397 | case URxvt_Color_tint: |
3411 | case URxvt_Color_tint: |
3398 | process_color_seq (op, Color_tint, str, resp); |
3412 | process_color_seq (op, Color_tint, str, resp); |
3399 | { |
3413 | { |
3400 | bool changed = false; |
3414 | bool changed = false; |
… | |
… | |
3575 | static const struct |
3589 | static const struct |
3576 | { |
3590 | { |
3577 | const int argval; |
3591 | const int argval; |
3578 | const unsigned long bit; |
3592 | const unsigned long bit; |
3579 | } argtopriv[] = { |
3593 | } argtopriv[] = { |
3580 | { 1, PrivMode_aplCUR }, |
3594 | { 1, PrivMode_aplCUR }, // DECCKM |
3581 | { 2, PrivMode_vt52 }, |
3595 | { 2, PrivMode_vt52 }, |
3582 | { 3, PrivMode_132 }, |
3596 | { 3, PrivMode_132 }, // DECCOLM |
3583 | { 4, PrivMode_smoothScroll }, |
3597 | { 4, PrivMode_smoothScroll }, // DECSCLM |
3584 | { 5, PrivMode_rVideo }, |
3598 | { 5, PrivMode_rVideo }, // DECSCNM |
3585 | { 6, PrivMode_relOrigin }, |
3599 | { 6, PrivMode_relOrigin }, // DECOM |
3586 | { 7, PrivMode_Autowrap }, |
3600 | { 7, PrivMode_Autowrap }, // DECAWM |
3587 | // 8, bi-directional support mode |
3601 | // 8, auto-repeat keys // DECARM |
3588 | { 9, PrivMode_MouseX10 }, |
3602 | { 9, PrivMode_MouseX10 }, |
3589 | // 18, 19 printing-related |
3603 | // 18 end FF to printer after print screen |
|
|
3604 | // 19 Print screen prints full screen/scorll region |
3590 | { 25, PrivMode_VisibleCursor }, |
3605 | { 25, PrivMode_VisibleCursor }, // cnorm/cvvis/civis |
3591 | #ifdef scrollBar_esc |
3606 | #ifdef scrollBar_esc |
3592 | { scrollBar_esc, PrivMode_scrollBar }, |
3607 | { scrollBar_esc, PrivMode_scrollBar }, |
3593 | #endif |
3608 | #endif |
3594 | { 35, PrivMode_ShiftKeys }, // rxvt extension |
3609 | { 35, PrivMode_ShiftKeys }, // rxvt extension |
|
|
3610 | // 38, tektronix mode // DECTEK |
3595 | { 40, PrivMode_132OK }, |
3611 | { 40, PrivMode_132OK }, |
3596 | // 41 xterm more fixes NYI |
3612 | // 41 xterm more fixes NYI |
3597 | // 45 margin bell NYI |
3613 | // 45 margin bell NYI |
3598 | // 46 start logging |
3614 | // 46 start logging |
3599 | { 47, PrivMode_Screen }, |
3615 | { 47, PrivMode_Screen }, |
3600 | { 66, PrivMode_aplKP }, |
3616 | { 66, PrivMode_aplKP }, // DECPAM/DECPNM |
3601 | #ifndef NO_BACKSPACE_KEY |
3617 | #ifndef NO_BACKSPACE_KEY |
3602 | { 67, PrivMode_BackSpace }, |
3618 | { 67, PrivMode_BackSpace }, // DECBKM |
3603 | #endif |
3619 | #endif |
3604 | { 1000, PrivMode_MouseX11 }, |
3620 | { 1000, PrivMode_MouseX11 }, |
3605 | { 1002, PrivMode_MouseBtnEvent }, |
3621 | { 1002, PrivMode_MouseBtnEvent }, |
3606 | { 1003, PrivMode_MouseAnyEvent }, |
3622 | { 1003, PrivMode_MouseAnyEvent }, |
3607 | { 1010, PrivMode_TtyOutputInh }, // rxvt extension |
3623 | { 1010, PrivMode_TtyOutputInh }, // rxvt extension |
… | |
… | |
3646 | |
3662 | |
3647 | scr_touch (true); |
3663 | scr_touch (true); |
3648 | break; |
3664 | break; |
3649 | #endif |
3665 | #endif |
3650 | case 1048: /* alternative cursor save */ |
3666 | case 1048: /* alternative cursor save */ |
3651 | case 1049: |
|
|
3652 | if (option (Opt_secondaryScreen)) |
3667 | if (option (Opt_secondaryScreen)) |
3653 | if (mode == 0) |
3668 | if (mode == 0) |
3654 | scr_cursor (RESTORE); |
3669 | scr_cursor (RESTORE); |
3655 | else if (mode == 1) |
3670 | else if (mode == 1) |
3656 | scr_cursor (SAVE); |
3671 | scr_cursor (SAVE); |
… | |
… | |
3669 | */ |
3684 | */ |
3670 | set_privmode (PrivMode_vt52, 1); |
3685 | set_privmode (PrivMode_vt52, 1); |
3671 | break; |
3686 | break; |
3672 | case 3: /* 80/132 */ |
3687 | case 3: /* 80/132 */ |
3673 | if (priv_modes & PrivMode_132OK) |
3688 | if (priv_modes & PrivMode_132OK) |
3674 | { |
|
|
3675 | scr_poweron (); |
|
|
3676 | set_widthheight (((state ? 132 : 80) * fwidth), 24 * fheight); |
3689 | set_widthheight ((state ? 132 : 80) * fwidth, 24 * fheight); |
3677 | } |
|
|
3678 | break; |
3690 | break; |
3679 | case 4: /* smooth scrolling */ |
3691 | case 4: /* smooth scrolling */ |
3680 | set_option (Opt_jumpScroll, !state); |
3692 | set_option (Opt_jumpScroll, !state); |
3681 | break; |
3693 | break; |
3682 | case 5: /* reverse video */ |
3694 | case 5: /* reverse video */ |
… | |
… | |
3724 | priv_modes &= arg[i] == 1003 ? ~PrivMode_MouseBtnEvent : ~PrivMode_MouseAnyEvent; |
3736 | priv_modes &= arg[i] == 1003 ? ~PrivMode_MouseBtnEvent : ~PrivMode_MouseAnyEvent; |
3725 | vt_emask_mouse = PointerMotionMask; |
3737 | vt_emask_mouse = PointerMotionMask; |
3726 | } |
3738 | } |
3727 | else |
3739 | else |
3728 | vt_emask_mouse = NoEventMask; |
3740 | vt_emask_mouse = NoEventMask; |
|
|
3741 | |
3729 | vt_select_input (); |
3742 | vt_select_input (); |
3730 | break; |
3743 | break; |
3731 | case 1010: /* scroll to bottom on TTY output inhibit */ |
3744 | case 1010: /* scroll to bottom on TTY output inhibit */ |
3732 | set_option (Opt_scrollTtyOutput, !state); |
3745 | set_option (Opt_scrollTtyOutput, !state); |
3733 | break; |
3746 | break; |
3734 | case 1011: /* scroll to bottom on key press */ |
3747 | case 1011: /* scroll to bottom on key press */ |
3735 | set_option (Opt_scrollTtyKeypress, state); |
3748 | set_option (Opt_scrollTtyKeypress, state); |
3736 | break; |
3749 | break; |
3737 | case 1047: /* secondary screen w/ clearing last */ |
3750 | case 1047: /* secondary screen w/ clearing last */ |
3738 | if (option (Opt_secondaryScreen)) |
3751 | if (option (Opt_secondaryScreen)) |
3739 | if (current_screen != PRIMARY) |
3752 | if (!state) |
3740 | scr_erase_screen (2); |
3753 | scr_erase_screen (2); |
|
|
3754 | |
3741 | scr_change_screen (state); |
3755 | scr_change_screen (state); |
3742 | break; |
3756 | break; |
3743 | case 1049: /* secondary screen w/ clearing first */ |
3757 | case 1049: /* secondary screen w/ clearing first */ |
|
|
3758 | if (option (Opt_secondaryScreen)) |
|
|
3759 | if (state) |
|
|
3760 | scr_cursor (SAVE); |
|
|
3761 | |
3744 | scr_change_screen (state); |
3762 | scr_change_screen (state); |
|
|
3763 | |
3745 | if (option (Opt_secondaryScreen)) |
3764 | if (option (Opt_secondaryScreen)) |
3746 | if (current_screen != PRIMARY) |
3765 | if (state) |
3747 | scr_erase_screen (2); |
3766 | scr_erase_screen (2); |
|
|
3767 | else |
|
|
3768 | scr_cursor (RESTORE); |
3748 | break; |
3769 | break; |
3749 | default: |
3770 | default: |
3750 | break; |
3771 | break; |
3751 | } |
3772 | } |
3752 | } |
3773 | } |