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.58 by root, Thu Jan 12 01:38:37 2006 UTC vs.
Revision 1.66 by root, Sat Jan 14 09:28:57 2006 UTC

29#include "../config.h" 29#include "../config.h"
30 30
31#include <cstddef> 31#include <cstddef>
32#include <cstdarg> 32#include <cstdarg>
33 33
34#include "unistd.h"
35
34#include "iom.h" 36#include "iom.h"
35#include "rxvt.h" 37#include "rxvt.h"
36#include "keyboard.h" 38#include "keyboard.h"
37#include "rxvtutil.h" 39#include "rxvtutil.h"
38#include "rxvtperl.h" 40#include "rxvtperl.h"
47 49
48#undef LINENO 50#undef LINENO
49#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)
50#undef ROW 52#undef ROW
51#define ROW(n) THIS->row_buf [LINENO (n)] 53#define ROW(n) THIS->row_buf [LINENO (n)]
54
55#define ENABLE_PERL_FRILLS 1
52 56
53///////////////////////////////////////////////////////////////////////////// 57/////////////////////////////////////////////////////////////////////////////
54 58
55static SV * 59static SV *
56taint (SV *sv) 60taint (SV *sv)
477 ((overlay *)SvIV (hv_iterval (hv, he)))->swap (); 481 ((overlay *)SvIV (hv_iterval (hv, he)))->swap ();
478 } 482 }
479 483
480 } 484 }
481 485
482 if (!should_invoke [htype]) 486 if (!term->perl.should_invoke [htype])
483 return false; 487 return false;
484 } 488 }
485 489
486 swap (perl_environ, environ); 490 swap (perl_environ, environ);
487 491
657# include "optinc.h" 661# include "optinc.h"
658# undef nodef 662# undef nodef
659# undef def 663# undef def
660 664
661 HV *stash = gv_stashpv ("urxvt", 1); 665 HV *stash = gv_stashpv ("urxvt", 1);
662# 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 }
663 export_const_iv (DEFAULT_RSTYLE); 671 const_iv (DEFAULT_RSTYLE),
664 export_const_iv (OVERLAY_RSTYLE); 672 const_iv (OVERLAY_RSTYLE),
665 export_const_iv (RS_Bold); 673 const_iv (RS_Bold),
666 export_const_iv (RS_Italic); 674 const_iv (RS_Italic),
667 export_const_iv (RS_Blink); 675 const_iv (RS_Blink),
668 export_const_iv (RS_RVid); 676 const_iv (RS_RVid),
669 export_const_iv (RS_Uline); 677 const_iv (RS_Uline),
670 678
671 export_const_iv (CurrentTime); 679 const_iv (CurrentTime),
672 export_const_iv (ShiftMask); 680 const_iv (ShiftMask),
673 export_const_iv (LockMask); 681 const_iv (LockMask),
674 export_const_iv (ControlMask); 682 const_iv (ControlMask),
675 export_const_iv (Mod1Mask); 683 const_iv (Mod1Mask),
676 export_const_iv (Mod2Mask); 684 const_iv (Mod2Mask),
677 export_const_iv (Mod3Mask); 685 const_iv (Mod3Mask),
678 export_const_iv (Mod4Mask); 686 const_iv (Mod4Mask),
679 export_const_iv (Mod5Mask); 687 const_iv (Mod5Mask),
680 export_const_iv (Button1Mask); 688 const_iv (Button1Mask),
681 export_const_iv (Button2Mask); 689 const_iv (Button2Mask),
682 export_const_iv (Button3Mask); 690 const_iv (Button3Mask),
683 export_const_iv (Button4Mask); 691 const_iv (Button4Mask),
684 export_const_iv (Button5Mask); 692 const_iv (Button5Mask),
685 export_const_iv (AnyModifier); 693 const_iv (AnyModifier),
686 694
687 export_const_iv (EVENT_NONE); 695 const_iv (EVENT_NONE),
688 export_const_iv (EVENT_READ); 696 const_iv (EVENT_READ),
689 export_const_iv (EVENT_WRITE); 697 const_iv (EVENT_WRITE),
690}
691 698
692void 699 const_iv (NoEventMask),
693set_should_invoke (int htype, int value) 700 const_iv (KeyPressMask),
694 CODE: 701 const_iv (KeyReleaseMask),
695 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}
696 765
697void 766void
698warn (const char *msg) 767warn (const char *msg)
699 CODE: 768 CODE:
700 rxvt_warn ("%s", msg); 769 rxvt_warn ("%s", msg);
709 CODE: 778 CODE:
710 RETVAL = newSVsv (sv); 779 RETVAL = newSVsv (sv);
711 SvTAINTED_off (RETVAL); 780 SvTAINTED_off (RETVAL);
712 OUTPUT: 781 OUTPUT:
713 RETVAL 782 RETVAL
783
784void
785_exit (int status)
714 786
715bool 787bool
716safe () 788safe ()
717 CODE: 789 CODE:
718 RETVAL = !rxvt_tainted (); 790 RETVAL = !rxvt_tainted ();
820 OUTPUT: 892 OUTPUT:
821 RETVAL 893 RETVAL
822 894
823void 895void
824rxvt_term::destroy () 896rxvt_term::destroy ()
897
898#if ENABLE_PERL_FRILLS
899
900void
901rxvt_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
914void
915rxvt_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
936void
937rxvt_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
948void
949rxvt_term::XDeleteProperty (U32 window, U32 property)
950 CODE:
951 XDeleteProperty (THIS->display->display, (Window)window, (Atom)property);
952
953U32
954rxvt_term::DefaultRootWindow ()
955 CODE:
956 RETVAL = (U32)THIS->display->root;
957 OUTPUT:
958 RETVAL
959
960U32
961rxvt_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
970void
971rxvt_term::XReparentWindow (U32 window, U32 parent, int x = 0, int y = 0)
972 CODE:
973 XReparentWindow (THIS->display->display, (Window)window, (Window)parent, x, y);
974
975void
976rxvt_term::XMapWindow (U32 window)
977 CODE:
978 XMapWindow (THIS->display->display, (Window)window);
979
980void
981rxvt_term::XUnmapWindow (U32 window)
982 CODE:
983 XUnmapWindow (THIS->display->display, (Window)window);
984
985#endif
986
987void
988rxvt_term::set_should_invoke (int htype, int inc)
989 CODE:
990 THIS->perl.should_invoke [htype] += inc;
825 991
826void 992void
827rxvt_term::grab_button (int button, U32 modifiers) 993rxvt_term::grab_button (int button, U32 modifiers)
828 CODE: 994 CODE:
829 XGrabButton (THIS->display->display, button, modifiers, THIS->vt, 1, 995 XGrabButton (THIS->display->display, button, modifiers, THIS->vt, 1,
1028 CODE: 1194 CODE:
1029 RETVAL = (U32)THIS->vt; 1195 RETVAL = (U32)THIS->vt;
1030 OUTPUT: 1196 OUTPUT:
1031 RETVAL 1197 RETVAL
1032 1198
1199void
1200rxvt_term::vt_emask_add (U32 emask)
1201 CODE:
1202 THIS->vt_emask_perl |= emask;
1203 THIS->vt_select_input ();
1204
1033U32 1205U32
1034rxvt_term::rstyle (U32 new_rstyle = THIS->rstyle) 1206rxvt_term::rstyle (U32 new_rstyle = THIS->rstyle)
1035 CODE: 1207 CODE:
1036{
1037 RETVAL = THIS->rstyle; 1208 RETVAL = THIS->rstyle;
1038 THIS->rstyle = new_rstyle; 1209 THIS->rstyle = new_rstyle;
1039}
1040 OUTPUT: 1210 OUTPUT:
1041 RETVAL 1211 RETVAL
1042 1212
1043int 1213int
1044rxvt_term::view_start (int newval = -1) 1214rxvt_term::view_start (int newval = -1)
1215 PROTOTYPE: $;$
1045 CODE: 1216 CODE:
1046{ 1217{
1047 RETVAL = THIS->view_start; 1218 RETVAL = THIS->view_start;
1048 1219
1049 if (newval >= 0) 1220 if (newval >= 0)
1376 CODE: 1547 CODE:
1377 RETVAL = THIS->charsets [THIS->screen.charset]; 1548 RETVAL = THIS->charsets [THIS->screen.charset];
1378 OUTPUT: 1549 OUTPUT:
1379 RETVAL 1550 RETVAL
1380 1551
1552#void
1553#rxvt_term::selection_clear ()
1554
1555void
1556rxvt_term::selection_make (U32 eventtime, bool rect = false)
1557 CODE:
1558 THIS->selection.op = SELECTION_CONT;
1559 THIS->selection.rect = rect;
1560 THIS->selection_make (eventtime);
1561
1381int 1562int
1382rxvt_term::selection_grab (U32 eventtime) 1563rxvt_term::selection_grab (U32 eventtime)
1383 1564
1384void 1565void
1385rxvt_term::selection (SV *newtext = 0) 1566rxvt_term::selection (SV *newtext = 0)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines