… | |
… | |
26 | #include <XSUB.h> |
26 | #include <XSUB.h> |
27 | #undef line_t |
27 | #undef line_t |
28 | |
28 | |
29 | #include "../config.h" |
29 | #include "../config.h" |
30 | |
30 | |
|
|
31 | #include <cstddef> |
31 | #include <cstdarg> |
32 | #include <cstdarg> |
32 | |
33 | |
33 | #include "rxvt.h" |
34 | #include "rxvt.h" |
34 | #include "iom.h" |
35 | #include "iom.h" |
35 | #include "rxvtutil.h" |
36 | #include "rxvtutil.h" |
36 | #include "rxvtperl.h" |
37 | #include "rxvtperl.h" |
37 | |
38 | |
38 | #include "perlxsi.c" |
39 | #include "perlxsi.c" |
|
|
40 | |
|
|
41 | #if defined(HAVE_SCROLLBARS) || defined(MENUBAR) |
|
|
42 | # define GRAB_CURSOR THIS->leftptr_cursor |
|
|
43 | #else |
|
|
44 | # define GRAB_CURSOR None |
|
|
45 | #endif |
39 | |
46 | |
40 | #undef LINENO |
47 | #undef LINENO |
41 | #define LINENO(n) MOD (THIS->term_start + int(n), THIS->total_rows) |
48 | #define LINENO(n) MOD (THIS->term_start + int(n), THIS->total_rows) |
42 | #undef ROW |
49 | #undef ROW |
43 | #define ROW(n) THIS->row_buf [LINENO (n)] |
50 | #define ROW(n) THIS->row_buf [LINENO (n)] |
… | |
… | |
583 | |
590 | |
584 | PROTOTYPES: ENABLE |
591 | PROTOTYPES: ENABLE |
585 | |
592 | |
586 | BOOT: |
593 | BOOT: |
587 | { |
594 | { |
588 | HV *stash = gv_stashpv ("urxvt", 1); |
595 | sv_setsv (get_sv ("urxvt::LIBDIR", 1), newSVpvn (LIBDIR, sizeof (LIBDIR) - 1)); |
589 | # define export_const_iv(name) newCONSTSUB (stash, # name, newSViv (name)); |
|
|
590 | |
596 | |
591 | AV *hookname = get_av ("urxvt::HOOKNAME", 1); |
597 | AV *hookname = get_av ("urxvt::HOOKNAME", 1); |
592 | # define def(sym) av_store (hookname, HOOK_ ## sym, newSVpv (# sym, 0)); |
598 | # define def(sym) av_store (hookname, HOOK_ ## sym, newSVpv (# sym, 0)); |
593 | # include "hookinc.h" |
599 | # include "hookinc.h" |
594 | # undef def |
600 | # undef def |
595 | |
601 | |
596 | |
602 | HV *option = get_hv ("urxvt::OPTION", 1); |
|
|
603 | # define def(name,val) hv_store (option, # name, sizeof (# name) - 1, newSVuv (Opt_ ## name), 0); |
|
|
604 | # define nodef(name) |
|
|
605 | # include "optinc.h" |
|
|
606 | # undef nodef |
|
|
607 | # undef def |
|
|
608 | |
|
|
609 | HV *stash = gv_stashpv ("urxvt", 1); |
|
|
610 | # define export_const_iv(name) newCONSTSUB (stash, # name, newSViv (name)); |
597 | export_const_iv (DEFAULT_RSTYLE); |
611 | export_const_iv (DEFAULT_RSTYLE); |
598 | export_const_iv (OVERLAY_RSTYLE); |
612 | export_const_iv (OVERLAY_RSTYLE); |
599 | export_const_iv (RS_Bold); |
613 | export_const_iv (RS_Bold); |
600 | export_const_iv (RS_Italic); |
614 | export_const_iv (RS_Italic); |
601 | export_const_iv (RS_Blink); |
615 | export_const_iv (RS_Blink); |
602 | export_const_iv (RS_RVid); |
616 | export_const_iv (RS_RVid); |
603 | export_const_iv (RS_Uline); |
617 | export_const_iv (RS_Uline); |
|
|
618 | |
604 | export_const_iv (CurrentTime); |
619 | export_const_iv (CurrentTime); |
605 | |
620 | export_const_iv (ShiftMask); |
606 | sv_setsv (get_sv ("urxvt::LIBDIR", 1), newSVpvn (LIBDIR, sizeof (LIBDIR) - 1)); |
621 | export_const_iv (LockMask); |
|
|
622 | export_const_iv (ControlMask); |
|
|
623 | export_const_iv (Mod1Mask); |
|
|
624 | export_const_iv (Mod2Mask); |
|
|
625 | export_const_iv (Mod3Mask); |
|
|
626 | export_const_iv (Mod4Mask); |
|
|
627 | export_const_iv (Mod5Mask); |
|
|
628 | export_const_iv (Button1Mask); |
|
|
629 | export_const_iv (Button2Mask); |
|
|
630 | export_const_iv (Button3Mask); |
|
|
631 | export_const_iv (Button4Mask); |
|
|
632 | export_const_iv (Button5Mask); |
|
|
633 | export_const_iv (AnyModifier); |
607 | } |
634 | } |
608 | |
635 | |
609 | SV * |
636 | SV * |
610 | new (...) |
637 | new (...) |
611 | CODE: |
638 | CODE: |
… | |
… | |
714 | void |
741 | void |
715 | rxvt_term::grab_button (int button, U32 modifiers) |
742 | rxvt_term::grab_button (int button, U32 modifiers) |
716 | CODE: |
743 | CODE: |
717 | XGrabButton (THIS->display->display, button, modifiers, THIS->vt, 1, |
744 | XGrabButton (THIS->display->display, button, modifiers, THIS->vt, 1, |
718 | ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask, |
745 | ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask, |
719 | GrabModeSync, GrabModeSync, None, None); |
746 | GrabModeSync, GrabModeSync, None, GRAB_CURSOR); |
720 | |
747 | |
721 | bool |
748 | bool |
722 | rxvt_term::grab (U32 eventtime, int sync = 0) |
749 | rxvt_term::grab (U32 eventtime, int sync = 0) |
723 | CODE: |
750 | CODE: |
724 | { |
751 | { |
… | |
… | |
726 | |
753 | |
727 | THIS->perl.grabtime = 0; |
754 | THIS->perl.grabtime = 0; |
728 | |
755 | |
729 | if (!XGrabPointer (THIS->display->display, THIS->vt, 0, |
756 | if (!XGrabPointer (THIS->display->display, THIS->vt, 0, |
730 | ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask, |
757 | ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask, |
731 | mode, mode, None, None, eventtime)) |
758 | mode, mode, None, GRAB_CURSOR, eventtime)) |
732 | if (!XGrabKeyboard (THIS->display->display, THIS->vt, 0, mode, mode, eventtime)) |
759 | if (!XGrabKeyboard (THIS->display->display, THIS->vt, 0, mode, mode, eventtime)) |
733 | THIS->perl.grabtime = eventtime; |
760 | THIS->perl.grabtime = eventtime; |
734 | else |
761 | else |
735 | XUngrabPointer (THIS->display->display, eventtime); |
762 | XUngrabPointer (THIS->display->display, eventtime); |
736 | |
763 | |
… | |
… | |
810 | free (wstr); |
837 | free (wstr); |
811 | } |
838 | } |
812 | OUTPUT: |
839 | OUTPUT: |
813 | RETVAL |
840 | RETVAL |
814 | |
841 | |
815 | # very portable, especially on objects as opposed to pods |
842 | #define TERM_OFFSET(sym) offsetof (TermWin_t, sym) |
816 | #define TERM_OFFSET(sym) (((char *)&((TermWin_t *)0)->sym) - (char *)(TermWin_t *)0) |
|
|
817 | |
843 | |
818 | #define TERM_OFFSET_width TERM_OFFSET(width) |
844 | #define TERM_OFFSET_width TERM_OFFSET(width) |
819 | #define TERM_OFFSET_height TERM_OFFSET(height) |
845 | #define TERM_OFFSET_height TERM_OFFSET(height) |
820 | #define TERM_OFFSET_fwidth TERM_OFFSET(fwidth) |
846 | #define TERM_OFFSET_fwidth TERM_OFFSET(fwidth) |
821 | #define TERM_OFFSET_fheight TERM_OFFSET(fheight) |
847 | #define TERM_OFFSET_fheight TERM_OFFSET(fheight) |
… | |
… | |
846 | CODE: |
872 | CODE: |
847 | RETVAL = *(int *)((char *)THIS + ix); |
873 | RETVAL = *(int *)((char *)THIS + ix); |
848 | OUTPUT: |
874 | OUTPUT: |
849 | RETVAL |
875 | RETVAL |
850 | |
876 | |
|
|
877 | unsigned int |
|
|
878 | rxvt_term::ModLevel3Mask () |
|
|
879 | ALIAS: |
|
|
880 | ModLevel3Mask = 0 |
|
|
881 | ModMetaMask = 1 |
|
|
882 | ModNumLockMask = 2 |
|
|
883 | CODE: |
|
|
884 | switch (ix) |
|
|
885 | { |
|
|
886 | case 0: RETVAL = THIS->ModLevel3Mask; break; |
|
|
887 | case 1: RETVAL = THIS->ModMetaMask; break; |
|
|
888 | case 2: RETVAL = THIS->ModNumLockMask; break; |
|
|
889 | } |
|
|
890 | OUTPUT: |
|
|
891 | RETVAL |
|
|
892 | |
851 | U32 |
893 | U32 |
852 | rxvt_term::parent () |
894 | rxvt_term::parent () |
853 | CODE: |
895 | CODE: |
854 | RETVAL = (U32)THIS->parent [0]; |
896 | RETVAL = (U32)THIS->parent [0]; |
855 | OUTPUT: |
897 | OUTPUT: |
… | |
… | |
1120 | else |
1162 | else |
1121 | THIS->rs [index] = 0; |
1163 | THIS->rs [index] = 0; |
1122 | } |
1164 | } |
1123 | } |
1165 | } |
1124 | |
1166 | |
|
|
1167 | bool |
|
|
1168 | rxvt_term::option (U32 optval, int set = -1) |
|
|
1169 | CODE: |
|
|
1170 | { |
|
|
1171 | RETVAL = THIS->options & optval; |
|
|
1172 | |
|
|
1173 | if (set >= 0) |
|
|
1174 | { |
|
|
1175 | if (set) |
|
|
1176 | THIS->options |= optval; |
|
|
1177 | else |
|
|
1178 | THIS->options &= ~optval; |
|
|
1179 | |
|
|
1180 | switch (optval) |
|
|
1181 | { |
|
|
1182 | case Opt_skipBuiltinGlyphs: |
|
|
1183 | THIS->set_fonts (); |
|
|
1184 | THIS->scr_remap_chars (); |
|
|
1185 | THIS->scr_touch (true); |
|
|
1186 | THIS->want_refresh = 1; |
|
|
1187 | break; |
|
|
1188 | |
|
|
1189 | case Opt_cursorUnderline: |
|
|
1190 | THIS->want_refresh = 1; |
|
|
1191 | break; |
|
|
1192 | |
|
|
1193 | # case Opt_scrollBar_floating: |
|
|
1194 | # case Opt_scrollBar_right: |
|
|
1195 | # THIS->resize_all_windows (THIS->width, THIS->height, 1); |
|
|
1196 | # break; |
|
|
1197 | } |
|
|
1198 | } |
|
|
1199 | } |
|
|
1200 | OUTPUT: |
|
|
1201 | RETVAL |
|
|
1202 | |
1125 | void |
1203 | void |
1126 | rxvt_term::cur (...) |
1204 | rxvt_term::cur (...) |
1127 | PROTOTYPE: $;$$ |
1205 | PROTOTYPE: $;$$ |
1128 | ALIAS: |
1206 | ALIAS: |
1129 | screen_cur = 0 |
1207 | screen_cur = 0 |