ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/rxvtperl.xs
(Generate patch)

Comparing rxvt-unicode/src/rxvtperl.xs (file contents):
Revision 1.36 by root, Sat Jan 7 19:29:17 2006 UTC vs.
Revision 1.41 by root, Sun Jan 8 03:07:05 2006 UTC

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
584PROTOTYPES: ENABLE 591PROTOTYPES: ENABLE
585 592
586BOOT: 593BOOT:
587{ 594{
588# define export_const(name) newCONSTSUB (gv_stashpv ("urxvt", 1), # name, newSViv (name)); 595 sv_setsv (get_sv ("urxvt::LIBDIR", 1), newSVpvn (LIBDIR, sizeof (LIBDIR) - 1));
596
589 AV *hookname = get_av ("urxvt::HOOKNAME", 1); 597 AV *hookname = get_av ("urxvt::HOOKNAME", 1);
590# define def(sym) av_store (hookname, HOOK_ ## sym, newSVpv (# sym, 0)); 598# define def(sym) av_store (hookname, HOOK_ ## sym, newSVpv (# sym, 0));
591# include "hookinc.h" 599# include "hookinc.h"
592# undef def 600# undef def
593 601
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));
594 export_const (DEFAULT_RSTYLE); 611 export_const_iv (DEFAULT_RSTYLE);
595 export_const (OVERLAY_RSTYLE); 612 export_const_iv (OVERLAY_RSTYLE);
596 export_const (RS_Bold); 613 export_const_iv (RS_Bold);
597 export_const (RS_Italic); 614 export_const_iv (RS_Italic);
598 export_const (RS_Blink); 615 export_const_iv (RS_Blink);
599 export_const (RS_RVid); 616 export_const_iv (RS_RVid);
600 export_const (RS_Uline); 617 export_const_iv (RS_Uline);
618
601 export_const (CurrentTime); 619 export_const_iv (CurrentTime);
602 620 export_const_iv (ShiftMask);
603 sv_setpv (get_sv ("urxvt::LIBDIR", 1), LIBDIR); 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);
604} 634}
605 635
606SV * 636SV *
607new (...) 637new (...)
608 CODE: 638 CODE:
711void 741void
712rxvt_term::grab_button (int button, U32 modifiers) 742rxvt_term::grab_button (int button, U32 modifiers)
713 CODE: 743 CODE:
714 XGrabButton (THIS->display->display, button, modifiers, THIS->vt, 1, 744 XGrabButton (THIS->display->display, button, modifiers, THIS->vt, 1,
715 ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask, 745 ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask,
716 GrabModeSync, GrabModeSync, None, None); 746 GrabModeSync, GrabModeSync, None, GRAB_CURSOR);
717 747
718bool 748bool
719rxvt_term::grab (U32 eventtime, int sync = 0) 749rxvt_term::grab (U32 eventtime, int sync = 0)
720 CODE: 750 CODE:
721{ 751{
723 753
724 THIS->perl.grabtime = 0; 754 THIS->perl.grabtime = 0;
725 755
726 if (!XGrabPointer (THIS->display->display, THIS->vt, 0, 756 if (!XGrabPointer (THIS->display->display, THIS->vt, 0,
727 ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask, 757 ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask,
728 mode, mode, None, None, eventtime)) 758 mode, mode, None, GRAB_CURSOR, eventtime))
729 if (!XGrabKeyboard (THIS->display->display, THIS->vt, 0, mode, mode, eventtime)) 759 if (!XGrabKeyboard (THIS->display->display, THIS->vt, 0, mode, mode, eventtime))
730 THIS->perl.grabtime = eventtime; 760 THIS->perl.grabtime = eventtime;
731 else 761 else
732 XUngrabPointer (THIS->display->display, eventtime); 762 XUngrabPointer (THIS->display->display, eventtime);
733 763
807 free (wstr); 837 free (wstr);
808} 838}
809 OUTPUT: 839 OUTPUT:
810 RETVAL 840 RETVAL
811 841
812# very portable, especially on objects as opposed to pods 842#define TERM_OFFSET(sym) offsetof (TermWin_t, sym)
813#define TERM_OFFSET(sym) (((char *)&((TermWin_t *)0)->sym) - (char *)(TermWin_t *)0)
814 843
815#define TERM_OFFSET_width TERM_OFFSET(width) 844#define TERM_OFFSET_width TERM_OFFSET(width)
816#define TERM_OFFSET_height TERM_OFFSET(height) 845#define TERM_OFFSET_height TERM_OFFSET(height)
817#define TERM_OFFSET_fwidth TERM_OFFSET(fwidth) 846#define TERM_OFFSET_fwidth TERM_OFFSET(fwidth)
818#define TERM_OFFSET_fheight TERM_OFFSET(fheight) 847#define TERM_OFFSET_fheight TERM_OFFSET(fheight)
843 CODE: 872 CODE:
844 RETVAL = *(int *)((char *)THIS + ix); 873 RETVAL = *(int *)((char *)THIS + ix);
845 OUTPUT: 874 OUTPUT:
846 RETVAL 875 RETVAL
847 876
877unsigned int
878rxvt_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
848U32 893U32
849rxvt_term::parent () 894rxvt_term::parent ()
850 CODE: 895 CODE:
851 RETVAL = (U32)THIS->parent [0]; 896 RETVAL = (U32)THIS->parent [0];
852 OUTPUT: 897 OUTPUT:
1117 else 1162 else
1118 THIS->rs [index] = 0; 1163 THIS->rs [index] = 0;
1119 } 1164 }
1120} 1165}
1121 1166
1167bool
1168rxvt_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
1122void 1203void
1123rxvt_term::cur (...) 1204rxvt_term::cur (...)
1124 PROTOTYPE: $;$$ 1205 PROTOTYPE: $;$$
1125 ALIAS: 1206 ALIAS:
1126 screen_cur = 0 1207 screen_cur = 0

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines