… | |
… | |
316 | |
316 | |
317 | // the XOpenIM manpage lies about hardcoding the locale |
317 | // the XOpenIM manpage lies about hardcoding the locale |
318 | // at the point of XOpenIM, so temporarily switch locales |
318 | // at the point of XOpenIM, so temporarily switch locales |
319 | if (rs[Rs_imLocale]) |
319 | if (rs[Rs_imLocale]) |
320 | SET_LOCALE (rs[Rs_imLocale]); |
320 | SET_LOCALE (rs[Rs_imLocale]); |
|
|
321 | |
321 | // assume wchar_t == unicode or better |
322 | // assume wchar_t == unicode or better |
322 | len = XwcLookupString (Input_Context, &ev, wkbuf, |
323 | len = XwcLookupString (Input_Context, &ev, wkbuf, |
323 | KBUFSZ, &keysym, &status_return); |
324 | KBUFSZ, &keysym, &status_return); |
|
|
325 | |
324 | if (rs[Rs_imLocale]) |
326 | if (rs[Rs_imLocale]) |
325 | SET_LOCALE (locale); |
327 | SET_LOCALE (locale); |
326 | |
328 | |
327 | if (status_return == XLookupChars |
329 | if (status_return == XLookupChars |
328 | || status_return == XLookupBoth) |
330 | || status_return == XLookupBoth) |
… | |
… | |
1330 | button_release (ev.xbutton); |
1332 | button_release (ev.xbutton); |
1331 | break; |
1333 | break; |
1332 | |
1334 | |
1333 | case ClientMessage: |
1335 | case ClientMessage: |
1334 | if (ev.xclient.format == 32 |
1336 | if (ev.xclient.format == 32 |
1335 | && ev.xclient.message_type == xa[XA_WM_PROTOCOLS] |
1337 | && ev.xclient.message_type == xa[XA_WM_PROTOCOLS]) |
|
|
1338 | { |
1336 | && ev.xclient.data.l[0] == xa[XA_WM_DELETE_WINDOW]) |
1339 | if (ev.xclient.data.l[0] == xa[XA_WM_DELETE_WINDOW]) |
1337 | destroy (); |
1340 | destroy (); |
|
|
1341 | #if ENABLE_EWMH |
|
|
1342 | else if (ev.xclient.data.l[0] == xa[XA_NET_WM_PING]) |
|
|
1343 | XSendEvent (disp, ev.xclient.window = display->root, |
|
|
1344 | False, SubstructureRedirectMask | SubstructureNotifyMask, |
|
|
1345 | &ev); |
|
|
1346 | #endif |
|
|
1347 | } |
1338 | #if ENABLE_XEMBED |
1348 | #if ENABLE_XEMBED |
1339 | else if (ev.xclient.format == 32 |
1349 | else if (ev.xclient.format == 32 && ev.xclient.message_type == xa[XA_XEMBED]) |
1340 | && ev.xclient.message_type == xa[XA_XEMBED]) |
|
|
1341 | { |
1350 | { |
1342 | if (ev.xclient.data.l[1] == XEMBED_FOCUS_IN) |
1351 | if (ev.xclient.data.l[1] == XEMBED_FOCUS_IN) |
1343 | focus_in (); |
1352 | focus_in (); |
1344 | else if (ev.xclient.data.l[1] == XEMBED_FOCUS_OUT) |
1353 | else if (ev.xclient.data.l[1] == XEMBED_FOCUS_OUT) |
1345 | focus_out (); |
1354 | focus_out (); |
… | |
… | |
3581 | else if (ch < 0x20) |
3590 | else if (ch < 0x20) |
3582 | return NULL; /* other control character - exit */ |
3591 | return NULL; /* other control character - exit */ |
3583 | |
3592 | |
3584 | seen_esc = false; |
3593 | seen_esc = false; |
3585 | |
3594 | |
3586 | if (n >= sizeof (string) - 1) |
3595 | if (n >= STRING_MAX - 1) |
3587 | // stop at some sane length |
3596 | // stop at some sane length |
3588 | return NULL; |
3597 | return NULL; |
3589 | |
3598 | |
3590 | if (ch == C0_SYN) |
3599 | if (ch == C0_SYN) |
3591 | string[n++] = cmd_get8 (); |
3600 | string[n++] = cmd_get8 (); |
… | |
… | |
3659 | set_window_color (color, str); |
3668 | set_window_color (color, str); |
3660 | } |
3669 | } |
3661 | |
3670 | |
3662 | /* |
3671 | /* |
3663 | * XTerm escape sequences: ESC ] Ps;Pt (ST|BEL) |
3672 | * XTerm escape sequences: ESC ] Ps;Pt (ST|BEL) |
3664 | * 0 = change iconName/title |
|
|
3665 | * 1 = change iconName |
|
|
3666 | * 2 = change title |
|
|
3667 | * 4 = change color |
|
|
3668 | * 10 = change fg color |
|
|
3669 | * 11 = change bg color |
|
|
3670 | * 12 = change text color |
|
|
3671 | * 13 = change mouse foreground color |
|
|
3672 | * 17 = change highlight character colour |
|
|
3673 | * 18 = change bold character color |
|
|
3674 | * 19 = change underlined character color |
|
|
3675 | * 46 = change logfile (not implemented) |
|
|
3676 | * 50 = change font |
|
|
3677 | * |
|
|
3678 | * rxvt extensions: |
|
|
3679 | * 20 = bg pixmap |
|
|
3680 | * 39 = change default fg color |
|
|
3681 | * 49 = change default bg color |
|
|
3682 | * 55 = dump scrollback buffer and all of screen |
|
|
3683 | * 701 = change locale |
|
|
3684 | * 702 = find font |
|
|
3685 | * 703 = menu |
|
|
3686 | */ |
3673 | */ |
3687 | void |
3674 | void |
3688 | rxvt_term::process_xterm_seq (int op, const char *str, unsigned char resp) |
3675 | rxvt_term::process_xterm_seq (int op, const char *str, unsigned char resp) |
3689 | { |
3676 | { |
3690 | int changed = 0; |
3677 | int changed = 0; |
… | |
… | |
3789 | break; |
3776 | break; |
3790 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
3777 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
3791 | case XTerm_Color_BD: |
3778 | case XTerm_Color_BD: |
3792 | process_color_seq (XTerm_Color_BD, Color_BD, str, resp); |
3779 | process_color_seq (XTerm_Color_BD, Color_BD, str, resp); |
3793 | break; |
3780 | break; |
3794 | case XTerm_Color_IT: |
|
|
3795 | process_color_seq (XTerm_Color_IT, Color_IT, str, resp); |
|
|
3796 | break; |
|
|
3797 | case XTerm_Color_UL: |
3781 | case XTerm_Color_UL: |
3798 | process_color_seq (XTerm_Color_UL, Color_UL, str, resp); |
3782 | process_color_seq (XTerm_Color_UL, Color_UL, str, resp); |
3799 | break; |
3783 | break; |
3800 | case XTerm_Color_RV: |
3784 | case XTerm_Color_RV: |
3801 | process_color_seq (XTerm_Color_RV, Color_RV, str, resp); |
3785 | process_color_seq (XTerm_Color_RV, Color_RV, str, resp); |
3802 | break; |
3786 | break; |
|
|
3787 | case URxvt_Color_IT: |
|
|
3788 | process_color_seq (URxvt_Color_IT, Color_IT, str, resp); |
|
|
3789 | break; |
3803 | #endif |
3790 | #endif |
3804 | #if TRANSPARENT && TINTING |
3791 | #if TRANSPARENT && TINTING |
3805 | case XTerm_Color_tint: |
3792 | case URxvt_Color_tint: |
3806 | process_color_seq (XTerm_Color_tint, Color_tint, str, resp); |
3793 | process_color_seq (URxvt_Color_tint, Color_tint, str, resp); |
3807 | check_our_parents (); |
3794 | check_our_parents (); |
3808 | if (am_transparent) |
3795 | if (am_transparent) |
3809 | want_full_refresh = want_refresh = 1; |
3796 | want_full_refresh = want_refresh = 1; |
3810 | break; |
3797 | break; |
3811 | #endif |
3798 | #endif |
… | |
… | |
3845 | |
3832 | |
3846 | case XTerm_logfile: |
3833 | case XTerm_logfile: |
3847 | // TODO, when secure mode? |
3834 | // TODO, when secure mode? |
3848 | break; |
3835 | break; |
3849 | |
3836 | |
|
|
3837 | #ifdef MENUBAR |
|
|
3838 | case URxvt_Menu: |
|
|
3839 | if (options & Opt_insecure) |
|
|
3840 | menubar_dispatch (const_cast<char *>(str)); // casting away constness is checked |
|
|
3841 | break; |
|
|
3842 | #endif |
|
|
3843 | #if 0 |
|
|
3844 | case XTerm_dumpscreen: /* no error notices */ |
|
|
3845 | { |
|
|
3846 | int fd; |
|
|
3847 | if ((fd = open (str, O_RDWR | O_CREAT | O_EXCL, 0600)) >= 0) |
|
|
3848 | { |
|
|
3849 | scr_dump (fd); |
|
|
3850 | close (fd); |
|
|
3851 | } |
|
|
3852 | } |
|
|
3853 | break; |
|
|
3854 | #endif |
3850 | case XTerm_font: |
3855 | case XTerm_font: |
3851 | op = URxvt_font; |
3856 | op = URxvt_font; |
3852 | case URxvt_font: |
3857 | case URxvt_font: |
3853 | #if ENABLE_STYLES |
3858 | #if ENABLE_STYLES |
3854 | case URxvt_boldFont: |
3859 | case URxvt_boldFont: |
… | |
… | |
3869 | set_fonts (); |
3874 | set_fonts (); |
3870 | } |
3875 | } |
3871 | break; |
3876 | break; |
3872 | |
3877 | |
3873 | #if ENABLE_FRILLS |
3878 | #if ENABLE_FRILLS |
3874 | case XTerm_locale: |
3879 | case URxvt_locale: |
3875 | if (query) |
3880 | if (query) |
3876 | tt_printf ("\33]%d;%-.250s%c", XTerm_locale, (options & Opt_insecure) ? locale : "", resp); |
3881 | tt_printf ("\33]%d;%-.250s%c", URxvt_locale, (options & Opt_insecure) ? locale : "", resp); |
3877 | else |
3882 | else |
3878 | { |
3883 | { |
3879 | set_locale (str); |
3884 | set_locale (str); |
3880 | pty.set_utf8_mode (enc_utf8); |
3885 | pty.set_utf8_mode (enc_utf8); |
3881 | # ifdef USE_XIM |
|
|
3882 | im_cb (); |
3886 | init_xlocale (); |
3883 | # endif |
|
|
3884 | } |
3887 | } |
3885 | break; |
3888 | break; |
3886 | #endif |
|
|
3887 | |
3889 | |
3888 | #ifdef MENUBAR |
3890 | case URxvt_view_up: |
3889 | case XTerm_Menu: |
3891 | case URxvt_view_down: |
3890 | if (options & Opt_insecure) |
3892 | int lines = atoi (str); |
3891 | menubar_dispatch (const_cast<char *>(str)); // casting away constness is checked |
3893 | |
3892 | break; |
3894 | if (lines) |
3893 | #endif |
3895 | scr_page (op == URxvt_view_up ? UP : DN, lines); |
3894 | #if 0 |
|
|
3895 | case XTerm_dumpscreen: /* no error notices */ |
|
|
3896 | { |
3896 | else |
3897 | int fd; |
|
|
3898 | if ((fd = open (str, O_RDWR | O_CREAT | O_EXCL, 0600)) >= 0) |
|
|
3899 | { |
3897 | { |
3900 | scr_dump (fd); |
3898 | scr_erase_savelines (); |
3901 | close (fd); |
|
|
3902 | } |
3899 | } |
3903 | } |
3900 | |
3904 | break; |
3901 | break; |
3905 | #endif |
3902 | #endif |
3906 | } |
3903 | } |
3907 | } |
3904 | } |
3908 | /*----------------------------------------------------------------------*/ |
3905 | /*----------------------------------------------------------------------*/ |