… | |
… | |
50 | #undef LINENO |
50 | #undef LINENO |
51 | #define LINENO(n) MOD (THIS->term_start + int(n), THIS->total_rows) |
51 | #define LINENO(n) MOD (THIS->term_start + int(n), THIS->total_rows) |
52 | #undef ROW |
52 | #undef ROW |
53 | #define ROW(n) THIS->row_buf [LINENO (n)] |
53 | #define ROW(n) THIS->row_buf [LINENO (n)] |
54 | |
54 | |
|
|
55 | #define ENABLE_PERL_FRILLS 0 |
|
|
56 | |
55 | ///////////////////////////////////////////////////////////////////////////// |
57 | ///////////////////////////////////////////////////////////////////////////// |
56 | |
58 | |
57 | static SV * |
59 | static SV * |
58 | taint (SV *sv) |
60 | taint (SV *sv) |
59 | { |
61 | { |
… | |
… | |
479 | ((overlay *)SvIV (hv_iterval (hv, he)))->swap (); |
481 | ((overlay *)SvIV (hv_iterval (hv, he)))->swap (); |
480 | } |
482 | } |
481 | |
483 | |
482 | } |
484 | } |
483 | |
485 | |
484 | if (!should_invoke [htype]) |
486 | if (!term->perl.should_invoke [htype]) |
485 | return false; |
487 | return false; |
486 | } |
488 | } |
487 | |
489 | |
488 | swap (perl_environ, environ); |
490 | swap (perl_environ, environ); |
489 | |
491 | |
… | |
… | |
659 | # include "optinc.h" |
661 | # include "optinc.h" |
660 | # undef nodef |
662 | # undef nodef |
661 | # undef def |
663 | # undef def |
662 | |
664 | |
663 | HV *stash = gv_stashpv ("urxvt", 1); |
665 | HV *stash = gv_stashpv ("urxvt", 1); |
664 | # define export_const_iv(name) newCONSTSUB (stash, # name, newSViv (name)); |
666 | struct { |
|
|
667 | const char *name; |
|
|
668 | IV iv; |
|
|
669 | } *civ, const_iv[] = { |
|
|
670 | # define const_iv(name) { # name, (IV)name } |
665 | export_const_iv (DEFAULT_RSTYLE); |
671 | const_iv (DEFAULT_RSTYLE), |
666 | export_const_iv (OVERLAY_RSTYLE); |
672 | const_iv (OVERLAY_RSTYLE), |
667 | export_const_iv (RS_Bold); |
673 | const_iv (RS_Bold), |
668 | export_const_iv (RS_Italic); |
674 | const_iv (RS_Italic), |
669 | export_const_iv (RS_Blink); |
675 | const_iv (RS_Blink), |
670 | export_const_iv (RS_RVid); |
676 | const_iv (RS_RVid), |
671 | export_const_iv (RS_Uline); |
677 | const_iv (RS_Uline), |
672 | |
678 | |
673 | export_const_iv (CurrentTime); |
679 | const_iv (CurrentTime), |
674 | export_const_iv (ShiftMask); |
680 | const_iv (ShiftMask), |
675 | export_const_iv (LockMask); |
681 | const_iv (LockMask), |
676 | export_const_iv (ControlMask); |
682 | const_iv (ControlMask), |
677 | export_const_iv (Mod1Mask); |
683 | const_iv (Mod1Mask), |
678 | export_const_iv (Mod2Mask); |
684 | const_iv (Mod2Mask), |
679 | export_const_iv (Mod3Mask); |
685 | const_iv (Mod3Mask), |
680 | export_const_iv (Mod4Mask); |
686 | const_iv (Mod4Mask), |
681 | export_const_iv (Mod5Mask); |
687 | const_iv (Mod5Mask), |
682 | export_const_iv (Button1Mask); |
688 | const_iv (Button1Mask), |
683 | export_const_iv (Button2Mask); |
689 | const_iv (Button2Mask), |
684 | export_const_iv (Button3Mask); |
690 | const_iv (Button3Mask), |
685 | export_const_iv (Button4Mask); |
691 | const_iv (Button4Mask), |
686 | export_const_iv (Button5Mask); |
692 | const_iv (Button5Mask), |
687 | export_const_iv (AnyModifier); |
693 | const_iv (AnyModifier), |
688 | |
694 | |
689 | export_const_iv (EVENT_NONE); |
695 | const_iv (EVENT_NONE), |
690 | export_const_iv (EVENT_READ); |
696 | const_iv (EVENT_READ), |
691 | export_const_iv (EVENT_WRITE); |
697 | const_iv (EVENT_WRITE), |
692 | } |
|
|
693 | |
698 | |
694 | void |
699 | const_iv (NoEventMask), |
695 | set_should_invoke (int htype, int value) |
700 | const_iv (KeyPressMask), |
696 | CODE: |
701 | const_iv (KeyReleaseMask), |
697 | rxvt_perl.should_invoke [htype] = value; |
702 | const_iv (ButtonPressMask), |
|
|
703 | const_iv (ButtonReleaseMask), |
|
|
704 | const_iv (EnterWindowMask), |
|
|
705 | const_iv (LeaveWindowMask), |
|
|
706 | const_iv (PointerMotionMask), |
|
|
707 | const_iv (PointerMotionHintMask), |
|
|
708 | const_iv (Button1MotionMask), |
|
|
709 | const_iv (Button2MotionMask), |
|
|
710 | const_iv (Button3MotionMask), |
|
|
711 | const_iv (Button4MotionMask), |
|
|
712 | const_iv (Button5MotionMask), |
|
|
713 | const_iv (ButtonMotionMask), |
|
|
714 | const_iv (KeymapStateMask), |
|
|
715 | const_iv (ExposureMask), |
|
|
716 | const_iv (VisibilityChangeMask), |
|
|
717 | const_iv (StructureNotifyMask), |
|
|
718 | const_iv (ResizeRedirectMask), |
|
|
719 | const_iv (SubstructureNotifyMask), |
|
|
720 | const_iv (SubstructureRedirectMask), |
|
|
721 | const_iv (FocusChangeMask), |
|
|
722 | const_iv (PropertyChangeMask), |
|
|
723 | const_iv (ColormapChangeMask), |
|
|
724 | const_iv (OwnerGrabButtonMask), |
|
|
725 | |
|
|
726 | const_iv (KeyPress), |
|
|
727 | const_iv (KeyRelease), |
|
|
728 | const_iv (ButtonPress), |
|
|
729 | const_iv (ButtonRelease), |
|
|
730 | const_iv (MotionNotify), |
|
|
731 | const_iv (EnterNotify), |
|
|
732 | const_iv (LeaveNotify), |
|
|
733 | const_iv (FocusIn), |
|
|
734 | const_iv (FocusOut), |
|
|
735 | const_iv (KeymapNotify), |
|
|
736 | const_iv (Expose), |
|
|
737 | const_iv (GraphicsExpose), |
|
|
738 | const_iv (NoExpose), |
|
|
739 | const_iv (VisibilityNotify), |
|
|
740 | const_iv (CreateNotify), |
|
|
741 | const_iv (DestroyNotify), |
|
|
742 | const_iv (UnmapNotify), |
|
|
743 | const_iv (MapNotify), |
|
|
744 | const_iv (MapRequest), |
|
|
745 | const_iv (ReparentNotify), |
|
|
746 | const_iv (ConfigureNotify), |
|
|
747 | const_iv (ConfigureRequest), |
|
|
748 | const_iv (GravityNotify), |
|
|
749 | const_iv (ResizeRequest), |
|
|
750 | const_iv (CirculateNotify), |
|
|
751 | const_iv (CirculateRequest), |
|
|
752 | const_iv (PropertyNotify), |
|
|
753 | const_iv (SelectionClear), |
|
|
754 | const_iv (SelectionRequest), |
|
|
755 | const_iv (SelectionNotify), |
|
|
756 | const_iv (ColormapNotify), |
|
|
757 | const_iv (ClientMessage), |
|
|
758 | const_iv (MappingNotify), |
|
|
759 | }; |
|
|
760 | |
|
|
761 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); |
|
|
762 | civ-- > const_iv; ) |
|
|
763 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
|
|
764 | } |
698 | |
765 | |
699 | void |
766 | void |
700 | warn (const char *msg) |
767 | warn (const char *msg) |
701 | CODE: |
768 | CODE: |
702 | rxvt_warn ("%s", msg); |
769 | rxvt_warn ("%s", msg); |
… | |
… | |
825 | OUTPUT: |
892 | OUTPUT: |
826 | RETVAL |
893 | RETVAL |
827 | |
894 | |
828 | void |
895 | void |
829 | rxvt_term::destroy () |
896 | rxvt_term::destroy () |
|
|
897 | |
|
|
898 | #if ENABLE_PERL_FRILLS |
|
|
899 | |
|
|
900 | void |
|
|
901 | rxvt_term::XListProperties (U32 window) |
|
|
902 | PPCODE: |
|
|
903 | { |
|
|
904 | int count; |
|
|
905 | Atom *props = XListProperties (THIS->display->display, (Window)window, &count); |
|
|
906 | |
|
|
907 | EXTEND (SP, count); |
|
|
908 | while (count--) |
|
|
909 | PUSHs (newSVuv ((U32)props [count])); |
|
|
910 | |
|
|
911 | XFree (props); |
|
|
912 | } |
|
|
913 | |
|
|
914 | void |
|
|
915 | rxvt_term::XGetWindowProperty (U32 window, U32 property) |
|
|
916 | PPCODE: |
|
|
917 | { |
|
|
918 | Atom type; |
|
|
919 | int format; |
|
|
920 | unsigned long nitems; |
|
|
921 | unsigned long bytes_after; |
|
|
922 | unsigned char *prop; |
|
|
923 | XGetWindowProperty (THIS->display->display, (Window)window, (Atom)property, |
|
|
924 | 0, 1<<30, 0, AnyPropertyType, |
|
|
925 | &type, &format, &nitems, &bytes_after, &prop); |
|
|
926 | if (type != None) |
|
|
927 | { |
|
|
928 | EXTEND (SP, 3); |
|
|
929 | PUSHs (newSVuv ((U32)type)); |
|
|
930 | PUSHs (newSViv (format)); |
|
|
931 | PUSHs (newSVpvn ((char *)prop, nitems * format / 8)); |
|
|
932 | XFree (prop); |
|
|
933 | } |
|
|
934 | } |
|
|
935 | |
|
|
936 | void |
|
|
937 | rxvt_term::XChangeWindowProperty (U32 window, U32 property, U32 type, int format, SV *data) |
|
|
938 | CODE: |
|
|
939 | { |
|
|
940 | STRLEN len; |
|
|
941 | char *data_ = SvPVbyte (data, len); |
|
|
942 | |
|
|
943 | XChangeProperty (THIS->display->display, (Window)window, (Atom)property, |
|
|
944 | type, format, PropModeReplace, |
|
|
945 | (unsigned char *)data, len * 8 / format); |
|
|
946 | } |
|
|
947 | |
|
|
948 | void |
|
|
949 | rxvt_term::XDeleteProperty (U32 window, U32 property) |
|
|
950 | CODE: |
|
|
951 | XDeleteProperty (THIS->display->display, (Window)window, (Atom)property); |
|
|
952 | |
|
|
953 | U32 |
|
|
954 | rxvt_term::DefaultRootWindow () |
|
|
955 | CODE: |
|
|
956 | RETVAL = (U32)THIS->display->root; |
|
|
957 | OUTPUT: |
|
|
958 | RETVAL |
|
|
959 | |
|
|
960 | U32 |
|
|
961 | rxvt_term::XCreateSimpleWindow (U32 parent, int x, int y, unsigned int width, unsigned int height) |
|
|
962 | CODE: |
|
|
963 | RETVAL = XCreateSimpleWindow (THIS->display->display, (Window)parent, |
|
|
964 | x, y, width, height, 0, |
|
|
965 | THIS->pix_colors_focused[Color_border], |
|
|
966 | THIS->pix_colors_focused[Color_border]); |
|
|
967 | OUTPUT: |
|
|
968 | RETVAL |
|
|
969 | |
|
|
970 | void |
|
|
971 | rxvt_term::XReparentWindow (U32 window, U32 parent, int x = 0, int y = 0) |
|
|
972 | CODE: |
|
|
973 | XReparentWindow (THIS->display->display, window, parent, x, y); |
|
|
974 | |
|
|
975 | #endif |
|
|
976 | |
|
|
977 | void |
|
|
978 | rxvt_term::set_should_invoke (int htype, int inc) |
|
|
979 | CODE: |
|
|
980 | THIS->perl.should_invoke [htype] += inc; |
830 | |
981 | |
831 | void |
982 | void |
832 | rxvt_term::grab_button (int button, U32 modifiers) |
983 | rxvt_term::grab_button (int button, U32 modifiers) |
833 | CODE: |
984 | CODE: |
834 | XGrabButton (THIS->display->display, button, modifiers, THIS->vt, 1, |
985 | XGrabButton (THIS->display->display, button, modifiers, THIS->vt, 1, |
… | |
… | |
1033 | CODE: |
1184 | CODE: |
1034 | RETVAL = (U32)THIS->vt; |
1185 | RETVAL = (U32)THIS->vt; |
1035 | OUTPUT: |
1186 | OUTPUT: |
1036 | RETVAL |
1187 | RETVAL |
1037 | |
1188 | |
|
|
1189 | void |
|
|
1190 | rxvt_term::vt_emask_add (U32 emask) |
|
|
1191 | CODE: |
|
|
1192 | THIS->vt_emask_perl |= emask; |
|
|
1193 | THIS->vt_select_input (); |
|
|
1194 | |
1038 | U32 |
1195 | U32 |
1039 | rxvt_term::rstyle (U32 new_rstyle = THIS->rstyle) |
1196 | rxvt_term::rstyle (U32 new_rstyle = THIS->rstyle) |
1040 | CODE: |
1197 | CODE: |
1041 | { |
|
|
1042 | RETVAL = THIS->rstyle; |
1198 | RETVAL = THIS->rstyle; |
1043 | THIS->rstyle = new_rstyle; |
1199 | THIS->rstyle = new_rstyle; |
1044 | } |
|
|
1045 | OUTPUT: |
1200 | OUTPUT: |
1046 | RETVAL |
1201 | RETVAL |
1047 | |
1202 | |
1048 | int |
1203 | int |
1049 | rxvt_term::view_start (int newval = -1) |
1204 | rxvt_term::view_start (int newval = -1) |
|
|
1205 | PROTOTYPE: $;$ |
1050 | CODE: |
1206 | CODE: |
1051 | { |
1207 | { |
1052 | RETVAL = THIS->view_start; |
1208 | RETVAL = THIS->view_start; |
1053 | |
1209 | |
1054 | if (newval >= 0) |
1210 | if (newval >= 0) |