… | |
… | |
485 | wchar_t *wstr = va_arg (ap, wchar_t *); |
485 | wchar_t *wstr = va_arg (ap, wchar_t *); |
486 | int wlen = va_arg (ap, int); |
486 | int wlen = va_arg (ap, int); |
487 | |
487 | |
488 | XPUSHs (sv_2mortal (wcs2sv (wstr, wlen))); |
488 | XPUSHs (sv_2mortal (wcs2sv (wstr, wlen))); |
489 | } |
489 | } |
|
|
490 | break; |
490 | |
491 | |
491 | case DT_XEVENT: |
492 | case DT_XEVENT: |
492 | { |
493 | { |
493 | XEvent *xe = va_arg (ap, XEvent *); |
494 | XEvent *xe = va_arg (ap, XEvent *); |
494 | HV *hv = newHV (); |
495 | HV *hv = newHV (); |
… | |
… | |
704 | MODULE = urxvt PACKAGE = urxvt::term |
705 | MODULE = urxvt PACKAGE = urxvt::term |
705 | |
706 | |
706 | void |
707 | void |
707 | rxvt_term::destroy () |
708 | rxvt_term::destroy () |
708 | |
709 | |
|
|
710 | void |
|
|
711 | rxvt_term::grab (int eventtime) |
|
|
712 | CODE: |
|
|
713 | { |
|
|
714 | return; |
|
|
715 | XGrabPointer (THIS->display->display, THIS->vt, 0, |
|
|
716 | ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask, |
|
|
717 | GrabModeAsync, GrabModeAsync, None, None, eventtime); |
|
|
718 | XGrabKeyboard (THIS->display->display, THIS->vt, 0, GrabModeAsync, GrabModeAsync, eventtime); |
|
|
719 | } |
|
|
720 | |
709 | int |
721 | int |
710 | rxvt_term::strwidth (SV *str) |
722 | rxvt_term::strwidth (SV *str) |
711 | CODE: |
723 | CODE: |
712 | { |
724 | { |
713 | wchar_t *wstr = sv2wcs (str); |
725 | wchar_t *wstr = sv2wcs (str); |
… | |
… | |
847 | |
859 | |
848 | if (GIMME_V != G_VOID) |
860 | if (GIMME_V != G_VOID) |
849 | { |
861 | { |
850 | wchar_t *wstr = new wchar_t [THIS->ncol]; |
862 | wchar_t *wstr = new wchar_t [THIS->ncol]; |
851 | |
863 | |
852 | for (int col = 0; col <THIS->ncol; col++) |
864 | for (int col = 0; col < THIS->ncol; col++) |
853 | wstr [col] = l.t [col]; |
865 | wstr [col] = l.t [col]; |
854 | |
866 | |
855 | XPUSHs (sv_2mortal (wcs2sv (wstr))); |
867 | XPUSHs (sv_2mortal (wcs2sv (wstr, THIS->ncol))); |
856 | |
868 | |
857 | delete [] wstr; |
869 | delete [] wstr; |
858 | } |
870 | } |
859 | |
871 | |
860 | if (new_text) |
872 | if (new_text) |
… | |
… | |
950 | } |
962 | } |
951 | OUTPUT: |
963 | OUTPUT: |
952 | RETVAL |
964 | RETVAL |
953 | |
965 | |
954 | SV * |
966 | SV * |
955 | rxvt_term::special_encode (SV *str) |
967 | rxvt_term::special_encode (SV *string) |
956 | CODE: |
968 | CODE: |
957 | abort ();//TODO |
969 | { |
|
|
970 | wchar_t *wstr = sv2wcs (string); |
|
|
971 | int wlen = wcslen (wstr); |
|
|
972 | wchar_t *rstr = new wchar_t [wlen]; // cannot become longer |
|
|
973 | |
|
|
974 | rxvt_push_locale (THIS->locale); |
|
|
975 | |
|
|
976 | wchar_t *r = rstr; |
|
|
977 | for (wchar_t *s = wstr; *s; s++) |
|
|
978 | if (wcwidth (*s) == 0) |
|
|
979 | { |
|
|
980 | if (r == rstr) |
|
|
981 | croak ("leading combining character unencodable"); |
|
|
982 | |
|
|
983 | unicode_t n = rxvt_compose (r[-1], *s); |
|
|
984 | if (n == NOCHAR) |
|
|
985 | n = rxvt_composite.compose (r[-1], *s); |
|
|
986 | |
|
|
987 | r[-1] = n; |
|
|
988 | } |
|
|
989 | #if !UNICODE_3 |
|
|
990 | else if (*s >= 0x10000) |
|
|
991 | *r++ = rxvt_composite.compose (*s); |
|
|
992 | #endif |
|
|
993 | else |
|
|
994 | *r++ = *s; |
|
|
995 | |
|
|
996 | rxvt_pop_locale (); |
|
|
997 | |
|
|
998 | RETVAL = wcs2sv (rstr, r - rstr); |
|
|
999 | |
|
|
1000 | delete [] rstr; |
|
|
1001 | } |
|
|
1002 | OUTPUT: |
|
|
1003 | RETVAL |
958 | |
1004 | |
959 | SV * |
1005 | SV * |
960 | rxvt_term::special_decode (SV *str) |
1006 | rxvt_term::special_decode (SV *text) |
961 | CODE: |
1007 | CODE: |
962 | abort ();//TODO |
1008 | { |
|
|
1009 | wchar_t *wstr = sv2wcs (text); |
|
|
1010 | int wlen = wcslen (wstr); |
|
|
1011 | int dlen = 0; |
|
|
1012 | |
|
|
1013 | // find length |
|
|
1014 | for (wchar_t *s = wstr; *s; s++) |
|
|
1015 | if (*s == NOCHAR) |
|
|
1016 | ; |
|
|
1017 | else if (IS_COMPOSE (*s)) |
|
|
1018 | dlen += rxvt_composite.expand (*s, 0); |
|
|
1019 | else |
|
|
1020 | dlen++; |
|
|
1021 | |
|
|
1022 | wchar_t *rstr = new wchar_t [dlen]; |
|
|
1023 | |
|
|
1024 | // decode |
|
|
1025 | wchar_t *r = rstr; |
|
|
1026 | for (wchar_t *s = wstr; *s; s++) |
|
|
1027 | if (*s == NOCHAR) |
|
|
1028 | ; |
|
|
1029 | else if (IS_COMPOSE (*s)) |
|
|
1030 | r += rxvt_composite.expand (*s, r); |
|
|
1031 | else |
|
|
1032 | *r++ = *s; |
|
|
1033 | |
|
|
1034 | RETVAL = wcs2sv (rstr, r - rstr); |
|
|
1035 | |
|
|
1036 | delete [] rstr; |
|
|
1037 | } |
|
|
1038 | OUTPUT: |
|
|
1039 | RETVAL |
963 | |
1040 | |
964 | void |
1041 | void |
965 | rxvt_term::_resource (char *name, int index, SV *newval = 0) |
1042 | rxvt_term::_resource (char *name, int index, SV *newval = 0) |
966 | PPCODE: |
1043 | PPCODE: |
967 | { |
1044 | { |
… | |
… | |
1080 | char *old_cmdbuf_endp = THIS->cmdbuf_endp; |
1157 | char *old_cmdbuf_endp = THIS->cmdbuf_endp; |
1081 | |
1158 | |
1082 | THIS->cmdbuf_ptr = str; |
1159 | THIS->cmdbuf_ptr = str; |
1083 | THIS->cmdbuf_endp = str + len; |
1160 | THIS->cmdbuf_endp = str + len; |
1084 | |
1161 | |
|
|
1162 | rxvt_push_locale (THIS->locale); |
1085 | THIS->cmd_parse (); |
1163 | THIS->cmd_parse (); |
|
|
1164 | rxvt_pop_locale (); |
1086 | |
1165 | |
1087 | THIS->cmdbuf_ptr = old_cmdbuf_ptr; |
1166 | THIS->cmdbuf_ptr = old_cmdbuf_ptr; |
1088 | THIS->cmdbuf_endp = old_cmdbuf_endp; |
1167 | THIS->cmdbuf_endp = old_cmdbuf_endp; |
1089 | } |
1168 | } |
1090 | |
1169 | |