… | |
… | |
163 | void |
163 | void |
164 | rxvt_term::iso14755_51 (unicode_t ch, rend_t r) |
164 | rxvt_term::iso14755_51 (unicode_t ch, rend_t r) |
165 | { |
165 | { |
166 | rxvt_fontset *fs = FONTSET (r); |
166 | rxvt_fontset *fs = FONTSET (r); |
167 | rxvt_font *f = (*fs)[fs->find_font (ch)]; |
167 | rxvt_font *f = (*fs)[fs->find_font (ch)]; |
168 | wchar_t *chr, *alloc, ch2; |
168 | wchar_t *chr, *alloc, ch2, *fname; |
169 | int len; |
169 | int len; |
|
|
170 | |
|
|
171 | fname = rxvt_utf8towcs (f->name); |
170 | |
172 | |
171 | #if ENABLE_COMBINING |
173 | #if ENABLE_COMBINING |
172 | if (IS_COMPOSE (ch)) |
174 | if (IS_COMPOSE (ch)) |
173 | { |
175 | { |
174 | len = rxvt_composite.expand (ch, 0); |
176 | len = rxvt_composite.expand (ch, 0); |
… | |
… | |
183 | alloc = 0; |
185 | alloc = 0; |
184 | chr = &ch2; |
186 | chr = &ch2; |
185 | len = 1; |
187 | len = 1; |
186 | } |
188 | } |
187 | |
189 | |
188 | int width = strlen (f->name); |
190 | int width = wcswidth (fname, wcslen (fname)); |
189 | |
191 | |
190 | scr_overlay_new (0, -1, width < 8+5 ? 8+5 : width, len + 1); |
192 | scr_overlay_new (0, -1, width < 8+5 ? 8+5 : width, len + 1); |
191 | |
193 | |
192 | r = SET_STYLE (OVERLAY_RSTYLE, GET_STYLE (r)); |
194 | r = SET_STYLE (OVERLAY_RSTYLE, GET_STYLE (r)); |
193 | |
195 | |
… | |
… | |
206 | #endif |
208 | #endif |
207 | scr_overlay_set (11, y, ch, r); |
209 | scr_overlay_set (11, y, ch, r); |
208 | scr_overlay_set (12, y, NOCHAR, r); |
210 | scr_overlay_set (12, y, NOCHAR, r); |
209 | } |
211 | } |
210 | |
212 | |
211 | scr_overlay_set (0, len, f->name); |
213 | scr_overlay_set (0, len, fname); |
|
|
214 | |
|
|
215 | free (fname); |
212 | |
216 | |
213 | #if ENABLE_COMBINING |
217 | #if ENABLE_COMBINING |
214 | if (alloc) |
218 | if (alloc) |
215 | delete [] alloc; |
219 | delete [] alloc; |
216 | #endif |
220 | #endif |
… | |
… | |
316 | |
320 | |
317 | // the XOpenIM manpage lies about hardcoding the locale |
321 | // the XOpenIM manpage lies about hardcoding the locale |
318 | // at the point of XOpenIM, so temporarily switch locales |
322 | // at the point of XOpenIM, so temporarily switch locales |
319 | if (rs[Rs_imLocale]) |
323 | if (rs[Rs_imLocale]) |
320 | SET_LOCALE (rs[Rs_imLocale]); |
324 | SET_LOCALE (rs[Rs_imLocale]); |
|
|
325 | |
321 | // assume wchar_t == unicode or better |
326 | // assume wchar_t == unicode or better |
322 | len = XwcLookupString (Input_Context, &ev, wkbuf, |
327 | len = XwcLookupString (Input_Context, &ev, wkbuf, |
323 | KBUFSZ, &keysym, &status_return); |
328 | KBUFSZ, &keysym, &status_return); |
|
|
329 | |
324 | if (rs[Rs_imLocale]) |
330 | if (rs[Rs_imLocale]) |
325 | SET_LOCALE (locale); |
331 | SET_LOCALE (locale); |
326 | |
332 | |
327 | if (status_return == XLookupChars |
333 | if (status_return == XLookupChars |
328 | || status_return == XLookupBoth) |
334 | || status_return == XLookupBoth) |
… | |
… | |
1646 | { |
1652 | { |
1647 | if (!TermWin.focus) |
1653 | if (!TermWin.focus) |
1648 | { |
1654 | { |
1649 | TermWin.focus = 1; |
1655 | TermWin.focus = 1; |
1650 | want_refresh = 1; |
1656 | want_refresh = 1; |
1651 | #ifdef USE_XIM |
1657 | #if USE_XIM |
1652 | if (Input_Context != NULL) |
1658 | if (Input_Context != NULL) |
1653 | { |
1659 | { |
1654 | IMSetStatusPosition (); |
1660 | IMSetStatusPosition (); |
1655 | XSetICFocus (Input_Context); |
1661 | XSetICFocus (Input_Context); |
1656 | } |
1662 | } |
1657 | #endif |
1663 | #endif |
1658 | #ifdef CURSOR_BLINK |
1664 | #if CURSOR_BLINK |
1659 | if (options & Opt_cursorBlink) |
1665 | if (options & Opt_cursorBlink) |
1660 | cursor_blink_ev.start (NOW + BLINK_INTERVAL); |
1666 | cursor_blink_ev.start (NOW + BLINK_INTERVAL); |
1661 | #endif |
1667 | #endif |
1662 | #ifdef OFF_FOCUS_FADING |
1668 | #if OFF_FOCUS_FADING |
1663 | if (rs[Rs_fade]) |
1669 | if (rs[Rs_fade]) |
1664 | { |
1670 | { |
1665 | pix_colors = pix_colors_focused; |
1671 | pix_colors = pix_colors_focused; |
1666 | scr_recolour (); |
1672 | scr_recolour (); |
1667 | } |
1673 | } |
… | |
… | |
1681 | iso14755buf = 0; |
1687 | iso14755buf = 0; |
1682 | #endif |
1688 | #endif |
1683 | #if ENABLE_OVERLAY |
1689 | #if ENABLE_OVERLAY |
1684 | scr_overlay_off (); |
1690 | scr_overlay_off (); |
1685 | #endif |
1691 | #endif |
1686 | #ifdef USE_XIM |
1692 | #if USE_XIM |
1687 | if (Input_Context != NULL) |
1693 | if (Input_Context != NULL) |
1688 | XUnsetICFocus (Input_Context); |
1694 | XUnsetICFocus (Input_Context); |
1689 | #endif |
1695 | #endif |
1690 | #ifdef CURSOR_BLINK |
1696 | #if CURSOR_BLINK |
1691 | if (options & Opt_cursorBlink) |
1697 | if (options & Opt_cursorBlink) |
1692 | cursor_blink_ev.stop (); |
1698 | cursor_blink_ev.stop (); |
1693 | hidden_cursor = 0; |
1699 | hidden_cursor = 0; |
1694 | #endif |
1700 | #endif |
1695 | #ifdef OFF_FOCUS_FADING |
1701 | #if OFF_FOCUS_FADING |
1696 | if (rs[Rs_fade]) |
1702 | if (rs[Rs_fade]) |
1697 | { |
1703 | { |
1698 | pix_colors = pix_colors_unfocused; |
1704 | pix_colors = pix_colors_unfocused; |
1699 | scr_recolour (); |
1705 | scr_recolour (); |
1700 | } |
1706 | } |
… | |
… | |
2640 | /* Read a text string from the input buffer */ |
2646 | /* Read a text string from the input buffer */ |
2641 | unicode_t buf[UBUFSIZ]; |
2647 | unicode_t buf[UBUFSIZ]; |
2642 | bool refreshnow = false; |
2648 | bool refreshnow = false; |
2643 | int nlines = 0; |
2649 | int nlines = 0; |
2644 | unicode_t *str = buf; |
2650 | unicode_t *str = buf; |
|
|
2651 | unicode_t *eol = str + min (TermWin.ncol, UBUFSIZ); |
2645 | |
2652 | |
2646 | for (;;) |
2653 | for (;;) |
2647 | { |
2654 | { |
2648 | if (ch == NOCHAR || (IS_CONTROL (ch) && ch != C0_LF && ch != C0_CR && ch != C0_HT)) |
2655 | if (ch == NOCHAR || (IS_CONTROL (ch) && ch != C0_LF && ch != C0_CR && ch != C0_HT)) |
2649 | break; |
2656 | break; |
2650 | |
2657 | |
2651 | *str++ = ch; |
2658 | *str++ = ch; |
2652 | |
2659 | |
2653 | if (ch == C0_LF) |
2660 | if (ch == C0_LF || str >= eol) |
2654 | { |
2661 | { |
|
|
2662 | if (ch == C0_LF) |
2655 | nlines++; |
2663 | nlines++; |
|
|
2664 | |
2656 | refresh_count++; |
2665 | refresh_count++; |
2657 | |
2666 | |
2658 | if (!(options & Opt_jumpScroll) |
2667 | if (!(options & Opt_jumpScroll) |
2659 | || (refresh_count >= refresh_limit * (TermWin.nrow - 1))) |
2668 | || (refresh_count >= refresh_limit * (TermWin.nrow - 1))) |
2660 | { |
2669 | { |
… | |
… | |
2667 | if (nlines >= TermWin.nrow - 1) |
2676 | if (nlines >= TermWin.nrow - 1) |
2668 | { |
2677 | { |
2669 | scr_add_lines (buf, nlines, str - buf); |
2678 | scr_add_lines (buf, nlines, str - buf); |
2670 | nlines = 0; |
2679 | nlines = 0; |
2671 | str = buf; |
2680 | str = buf; |
|
|
2681 | eol = str + min (TermWin.ncol, UBUFSIZ); |
2672 | } |
2682 | } |
2673 | } |
|
|
2674 | |
2683 | |
2675 | if (str >= buf + UBUFSIZ) |
2684 | if (str >= eol) |
2676 | { |
2685 | { |
|
|
2686 | if (eol >= buf + UBUFSIZ) |
|
|
2687 | { |
2677 | ch = NOCHAR; |
2688 | ch = NOCHAR; |
2678 | break; |
2689 | break; |
|
|
2690 | } |
|
|
2691 | else |
|
|
2692 | eol = min (eol + TermWin.ncol, buf + UBUFSIZ); |
|
|
2693 | } |
|
|
2694 | |
2679 | } |
2695 | } |
2680 | |
2696 | |
2681 | seq_begin = cmdbuf_ptr; |
2697 | seq_begin = cmdbuf_ptr; |
2682 | ch = next_char (); |
2698 | ch = next_char (); |
2683 | } |
2699 | } |
… | |
… | |
3588 | else if (ch < 0x20) |
3604 | else if (ch < 0x20) |
3589 | return NULL; /* other control character - exit */ |
3605 | return NULL; /* other control character - exit */ |
3590 | |
3606 | |
3591 | seen_esc = false; |
3607 | seen_esc = false; |
3592 | |
3608 | |
3593 | if (n >= sizeof (string) - 1) |
3609 | if (n >= STRING_MAX - 1) |
3594 | // stop at some sane length |
3610 | // stop at some sane length |
3595 | return NULL; |
3611 | return NULL; |
3596 | |
3612 | |
3597 | if (ch == C0_SYN) |
3613 | if (ch == C0_SYN) |
3598 | string[n++] = cmd_get8 (); |
3614 | string[n++] = cmd_get8 (); |
… | |
… | |
3666 | set_window_color (color, str); |
3682 | set_window_color (color, str); |
3667 | } |
3683 | } |
3668 | |
3684 | |
3669 | /* |
3685 | /* |
3670 | * XTerm escape sequences: ESC ] Ps;Pt (ST|BEL) |
3686 | * XTerm escape sequences: ESC ] Ps;Pt (ST|BEL) |
3671 | * 0 = change iconName/title |
|
|
3672 | * 1 = change iconName |
|
|
3673 | * 2 = change title |
|
|
3674 | * 4 = change color |
|
|
3675 | * 10 = change fg color |
|
|
3676 | * 11 = change bg color |
|
|
3677 | * 12 = change text color |
|
|
3678 | * 13 = change mouse foreground color |
|
|
3679 | * 17 = change highlight character colour |
|
|
3680 | * 18 = change bold character color |
|
|
3681 | * 19 = change underlined character color |
|
|
3682 | * 46 = change logfile (not implemented) |
|
|
3683 | * 50 = change font |
|
|
3684 | * |
|
|
3685 | * rxvt extensions: |
|
|
3686 | * 20 = bg pixmap |
|
|
3687 | * 39 = change default fg color |
|
|
3688 | * 49 = change default bg color |
|
|
3689 | * 55 = dump scrollback buffer and all of screen |
|
|
3690 | * 701 = change locale |
|
|
3691 | * 702 = find font |
|
|
3692 | * 703 = menu |
|
|
3693 | */ |
3687 | */ |
3694 | void |
3688 | void |
3695 | rxvt_term::process_xterm_seq (int op, const char *str, unsigned char resp) |
3689 | rxvt_term::process_xterm_seq (int op, const char *str, unsigned char resp) |
3696 | { |
3690 | { |
3697 | int changed = 0; |
3691 | int changed = 0; |
… | |
… | |
3796 | break; |
3790 | break; |
3797 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
3791 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
3798 | case XTerm_Color_BD: |
3792 | case XTerm_Color_BD: |
3799 | process_color_seq (XTerm_Color_BD, Color_BD, str, resp); |
3793 | process_color_seq (XTerm_Color_BD, Color_BD, str, resp); |
3800 | break; |
3794 | break; |
3801 | case XTerm_Color_IT: |
|
|
3802 | process_color_seq (XTerm_Color_IT, Color_IT, str, resp); |
|
|
3803 | break; |
|
|
3804 | case XTerm_Color_UL: |
3795 | case XTerm_Color_UL: |
3805 | process_color_seq (XTerm_Color_UL, Color_UL, str, resp); |
3796 | process_color_seq (XTerm_Color_UL, Color_UL, str, resp); |
3806 | break; |
3797 | break; |
3807 | case XTerm_Color_RV: |
3798 | case XTerm_Color_RV: |
3808 | process_color_seq (XTerm_Color_RV, Color_RV, str, resp); |
3799 | process_color_seq (XTerm_Color_RV, Color_RV, str, resp); |
3809 | break; |
3800 | break; |
|
|
3801 | case URxvt_Color_IT: |
|
|
3802 | process_color_seq (URxvt_Color_IT, Color_IT, str, resp); |
|
|
3803 | break; |
3810 | #endif |
3804 | #endif |
3811 | #if TRANSPARENT && TINTING |
3805 | #if TRANSPARENT && TINTING |
3812 | case XTerm_Color_tint: |
3806 | case URxvt_Color_tint: |
3813 | process_color_seq (XTerm_Color_tint, Color_tint, str, resp); |
3807 | process_color_seq (URxvt_Color_tint, Color_tint, str, resp); |
3814 | check_our_parents (); |
3808 | check_our_parents (); |
3815 | if (am_transparent) |
3809 | if (am_transparent) |
3816 | want_full_refresh = want_refresh = 1; |
3810 | want_full_refresh = want_refresh = 1; |
3817 | break; |
3811 | break; |
3818 | #endif |
3812 | #endif |
… | |
… | |
3852 | |
3846 | |
3853 | case XTerm_logfile: |
3847 | case XTerm_logfile: |
3854 | // TODO, when secure mode? |
3848 | // TODO, when secure mode? |
3855 | break; |
3849 | break; |
3856 | |
3850 | |
|
|
3851 | #ifdef MENUBAR |
|
|
3852 | case URxvt_Menu: |
|
|
3853 | if (options & Opt_insecure) |
|
|
3854 | menubar_dispatch (const_cast<char *>(str)); // casting away constness is checked |
|
|
3855 | break; |
|
|
3856 | #endif |
|
|
3857 | #if 0 |
|
|
3858 | case XTerm_dumpscreen: /* no error notices */ |
|
|
3859 | { |
|
|
3860 | int fd; |
|
|
3861 | if ((fd = open (str, O_RDWR | O_CREAT | O_EXCL, 0600)) >= 0) |
|
|
3862 | { |
|
|
3863 | scr_dump (fd); |
|
|
3864 | close (fd); |
|
|
3865 | } |
|
|
3866 | } |
|
|
3867 | break; |
|
|
3868 | #endif |
3857 | case XTerm_font: |
3869 | case XTerm_font: |
3858 | op = URxvt_font; |
3870 | op = URxvt_font; |
3859 | case URxvt_font: |
3871 | case URxvt_font: |
3860 | #if ENABLE_STYLES |
3872 | #if ENABLE_STYLES |
3861 | case URxvt_boldFont: |
3873 | case URxvt_boldFont: |
… | |
… | |
3876 | set_fonts (); |
3888 | set_fonts (); |
3877 | } |
3889 | } |
3878 | break; |
3890 | break; |
3879 | |
3891 | |
3880 | #if ENABLE_FRILLS |
3892 | #if ENABLE_FRILLS |
3881 | case XTerm_locale: |
3893 | case URxvt_locale: |
3882 | if (query) |
3894 | if (query) |
3883 | tt_printf ("\33]%d;%-.250s%c", XTerm_locale, (options & Opt_insecure) ? locale : "", resp); |
3895 | tt_printf ("\33]%d;%-.250s%c", URxvt_locale, (options & Opt_insecure) ? locale : "", resp); |
3884 | else |
3896 | else |
3885 | { |
3897 | { |
3886 | set_locale (str); |
3898 | set_locale (str); |
3887 | pty.set_utf8_mode (enc_utf8); |
3899 | pty.set_utf8_mode (enc_utf8); |
3888 | init_xlocale (); |
3900 | init_xlocale (); |
3889 | } |
3901 | } |
3890 | break; |
3902 | break; |
3891 | #endif |
|
|
3892 | |
3903 | |
3893 | #ifdef MENUBAR |
3904 | case URxvt_view_up: |
3894 | case XTerm_Menu: |
3905 | case URxvt_view_down: |
3895 | if (options & Opt_insecure) |
3906 | int lines = atoi (str); |
3896 | menubar_dispatch (const_cast<char *>(str)); // casting away constness is checked |
3907 | |
3897 | break; |
3908 | if (lines) |
3898 | #endif |
3909 | scr_page (op == URxvt_view_up ? UP : DN, lines); |
3899 | #if 0 |
|
|
3900 | case XTerm_dumpscreen: /* no error notices */ |
|
|
3901 | { |
3910 | else |
3902 | int fd; |
|
|
3903 | if ((fd = open (str, O_RDWR | O_CREAT | O_EXCL, 0600)) >= 0) |
|
|
3904 | { |
3911 | { |
3905 | scr_dump (fd); |
3912 | scr_erase_savelines (); |
3906 | close (fd); |
|
|
3907 | } |
3913 | } |
3908 | } |
3914 | |
3909 | break; |
3915 | break; |
3910 | #endif |
3916 | #endif |
3911 | } |
3917 | } |
3912 | } |
3918 | } |
3913 | /*----------------------------------------------------------------------*/ |
3919 | /*----------------------------------------------------------------------*/ |