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.81 by root, Fri Jan 20 13:32:29 2006 UTC vs.
Revision 1.102 by root, Thu Jul 6 23:48:11 2006 UTC

80new_ref (HV *hv, const char *klass) 80new_ref (HV *hv, const char *klass)
81{ 81{
82 return sv_bless (newRV ((SV *)hv), gv_stashpv (klass, 1)); 82 return sv_bless (newRV ((SV *)hv), gv_stashpv (klass, 1));
83} 83}
84 84
85//TODO: use magic
86static SV * 85static SV *
87newSVptr (void *ptr, const char *klass) 86newSVptr (void *ptr, const char *klass)
88{ 87{
89 HV *hv = newHV (); 88 HV *hv = newHV ();
90 sv_magic ((SV *)hv, 0, PERL_MAGIC_ext, (char *)ptr, 0); 89 sv_magic ((SV *)hv, 0, PERL_MAGIC_ext, (char *)ptr, 0);
113 croak ("perl code used %s object, but C++ object is already destroyed, caught", klass); 112 croak ("perl code used %s object, but C++ object is already destroyed, caught", klass);
114 113
115 return (long)mg->mg_ptr; 114 return (long)mg->mg_ptr;
116} 115}
117 116
118#define newSVterm(term) SvREFCNT_inc ((SV *)term->perl.self) 117#define newSVterm(term) SvREFCNT_inc ((SV *)(term)->perl.self)
119#define SvTERM(sv) (rxvt_term *)SvPTR (sv, "urxvt::term") 118#define SvTERM(sv) (rxvt_term *)SvPTR ((sv), "urxvt::term")
120 119
121///////////////////////////////////////////////////////////////////////////// 120/////////////////////////////////////////////////////////////////////////////
122 121
123#define SvWATCHER(sv) (perl_watcher *)SvPTR (sv, "urxvt::watcher") 122#define SvWATCHER(sv) (perl_watcher *)SvPTR (sv, "urxvt::watcher")
124 123
171 170
172 if (SvTRUE (ERRSV)) 171 if (SvTRUE (ERRSV))
173 rxvt_warn ("%s callback evaluation error: %s", type, SvPV_nolen (ERRSV)); 172 rxvt_warn ("%s callback evaluation error: %s", type, SvPV_nolen (ERRSV));
174} 173}
175 174
176#define newSVtimer(timer) new_ref (timer->self, "urxvt::timer") 175#define newSVtimer(timer) new_ref ((timer)->self, "urxvt::timer")
177#define SvTIMER(sv) (timer *)(perl_watcher *)SvPTR (sv, "urxvt::timer") 176#define SvTIMER(sv) (timer *)(perl_watcher *)SvPTR ((sv), "urxvt::timer")
178 177
179struct timer : perl_watcher, time_watcher 178struct timer : perl_watcher, time_watcher
180{ 179{
181 tstamp interval; 180 tstamp interval;
182 181
192 191
193 invoke ("urxvt::timer", newSVtimer (this)); 192 invoke ("urxvt::timer", newSVtimer (this));
194 } 193 }
195}; 194};
196 195
197#define newSViow(iow) new_ref (iow->self, "urxvt::iow") 196#define newSViow(iow) new_ref ((iow)->self, "urxvt::iow")
198#define SvIOW(sv) (iow *)(perl_watcher *)SvPTR (sv, "urxvt::iow") 197#define SvIOW(sv) (iow *)(perl_watcher *)SvPTR ((sv), "urxvt::iow")
199 198
200struct iow : perl_watcher, io_watcher 199struct iow : perl_watcher, io_watcher
201{ 200{
202 iow () 201 iow ()
203 : io_watcher (this, &iow::execute) 202 : io_watcher (this, &iow::execute)
208 { 207 {
209 invoke ("urxvt::iow", newSViow (this), revents); 208 invoke ("urxvt::iow", newSViow (this), revents);
210 } 209 }
211}; 210};
212 211
213#define newSViw(iw) new_ref (iw->self, "urxvt::iw") 212#define newSViw(iw) new_ref ((iw)->self, "urxvt::iw")
214#define SvIW(sv) (iw *)(perl_watcher *)SvPTR (sv, "urxvt::iw") 213#define SvIW(sv) (iw *)(perl_watcher *)SvPTR ((sv), "urxvt::iw")
215 214
216struct iw : perl_watcher, idle_watcher 215struct iw : perl_watcher, idle_watcher
217{ 216{
218 iw () 217 iw ()
219 : idle_watcher (this, &iw::execute) 218 : idle_watcher (this, &iw::execute)
224 { 223 {
225 invoke ("urxvt::iw", newSViw (this)); 224 invoke ("urxvt::iw", newSViw (this));
226 } 225 }
227}; 226};
228 227
229#define newSVpw(pw) new_ref (pw->self, "urxvt::pw") 228#define newSVpw(pw) new_ref ((pw)->self, "urxvt::pw")
230#define SvPW(sv) (pw *)(perl_watcher *)SvPTR (sv, "urxvt::pw") 229#define SvPW(sv) (pw *)(perl_watcher *)SvPTR ((sv), "urxvt::pw")
231 230
232struct pw : perl_watcher, child_watcher 231struct pw : perl_watcher, child_watcher
233{ 232{
234 pw () 233 pw ()
235 : child_watcher (this, &pw::execute) 234 : child_watcher (this, &pw::execute)
244 243
245///////////////////////////////////////////////////////////////////////////// 244/////////////////////////////////////////////////////////////////////////////
246 245
247#define SvOVERLAY(sv) (overlay *)SvPTR (sv, "urxvt::overlay") 246#define SvOVERLAY(sv) (overlay *)SvPTR (sv, "urxvt::overlay")
248 247
249struct overlay { 248class overlay {
250 HV *self;
251 bool visible;
252 rxvt_term *THIS; 249 rxvt_term *THIS;
250 AV *overlay_av;
253 int x, y, w, h; 251 int x, y, w, h;
254 int border; 252 int border;
255 text_t **text; 253 text_t **text;
256 rend_t **rend; 254 rend_t **rend;
257 255
256public:
257 HV *self;
258
258 overlay (rxvt_term *THIS, int x_, int y_, int w_, int h_, rend_t rstyle, int border); 259 overlay (rxvt_term *THIS, int x_, int y_, int w_, int h_, rend_t rstyle, int border);
259 ~overlay (); 260 ~overlay ();
260 261
261 void show (); 262 void show ();
262 void hide (); 263 void hide ();
265 266
266 void set (int x, int y, SV *str, SV *rend); 267 void set (int x, int y, SV *str, SV *rend);
267}; 268};
268 269
269overlay::overlay (rxvt_term *THIS, int x_, int y_, int w_, int h_, rend_t rstyle, int border) 270overlay::overlay (rxvt_term *THIS, int x_, int y_, int w_, int h_, rend_t rstyle, int border)
270: THIS(THIS), x(x_), y(y_), w(w_), h(h_), border(border == 2), visible(false) 271: THIS(THIS), x(x_), y(y_), w(w_), h(h_), border(border == 2), overlay_av (0)
271{ 272{
272 if (border == 2) 273 if (border == 2)
273 { 274 {
274 w += 2; 275 w += 2;
275 h += 2; 276 h += 2;
314 *rp++ = r; 315 *rp++ = r;
315 } 316 }
316 } 317 }
317 318
318 show (); 319 show ();
319 THIS->want_refresh = 1;
320} 320}
321 321
322overlay::~overlay () 322overlay::~overlay ()
323{ 323{
324 hide (); 324 hide ();
329 delete [] rend[y]; 329 delete [] rend[y];
330 } 330 }
331 331
332 delete [] text; 332 delete [] text;
333 delete [] rend; 333 delete [] rend;
334}
335
336void
337overlay::show ()
338{
339 if (overlay_av)
340 return;
341
342 overlay_av = (AV *)SvREFCNT_inc (SvRV (
343 *hv_fetch ((HV *)SvRV ((SV *)THIS->perl.self), "_overlay", 8, 0)
344 ));
345 av_push (overlay_av, newSViv ((long)this));
334 346
335 THIS->want_refresh = 1; 347 THIS->want_refresh = 1;
336} 348}
337 349
338void 350void
339overlay::show () 351overlay::hide ()
340{ 352{
341 if (visible) 353 if (!overlay_av)
342 return; 354 return;
343 355
344 visible = true;
345
346 AV *av = (AV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)THIS->perl.self), "_overlay", 8, 0));
347 av_push (av, newSViv ((long)this));
348}
349
350void
351overlay::hide ()
352{
353 if (!visible)
354 return;
355
356 visible = false;
357
358 AV *av = (AV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)THIS->perl.self), "_overlay", 8, 0));
359
360 int i; 356 int i;
361 357
362 for (i = AvFILL (av); i >= 0; i--) 358 for (i = AvFILL (overlay_av); i >= 0; i--)
363 if (SvIV (*av_fetch (av, i, 1)) == (long)this) 359 if (SvIV (*av_fetch (overlay_av, i, 1)) == (long)this)
364 {
365 av_delete (av, i, G_DISCARD);
366 break; 360 break;
367 }
368 361
369 for (; i < AvFILL (av); i++) 362 for (; i < AvFILL (overlay_av); i++)
370 av_store (av, i, SvREFCNT_inc (*av_fetch (av, i + 1, 0))); 363 av_store (overlay_av, i, SvREFCNT_inc (*av_fetch (overlay_av, i + 1, 0)));
371 364
372 av_pop (av); 365 av_pop (overlay_av);
366
367 SvREFCNT_dec (overlay_av);
368 overlay_av = 0;
369
370 THIS->want_refresh = 1;
373} 371}
374 372
375void overlay::swap () 373void overlay::swap ()
376{ 374{
377 int ov_x = max (0, min (MOD (x, THIS->ncol), THIS->ncol - w)); 375 int ov_x = max (0, min (MOD (x, THIS->ncol), THIS->ncol - w));
492static void 490static void
493ungrab (rxvt_term *THIS) 491ungrab (rxvt_term *THIS)
494{ 492{
495 if (THIS->perl.grabtime) 493 if (THIS->perl.grabtime)
496 { 494 {
497 XUngrabKeyboard (THIS->display->display, THIS->perl.grabtime); 495 XUngrabKeyboard (THIS->dpy, THIS->perl.grabtime);
498 XUngrabPointer (THIS->display->display, THIS->perl.grabtime); 496 XUngrabPointer (THIS->dpy, THIS->perl.grabtime);
499 THIS->perl.grabtime = 0; 497 THIS->perl.grabtime = 0;
500 } 498 }
501} 499}
502 500
503bool 501bool
554 break; 552 break;
555 553
556 case DT_STR_LEN: 554 case DT_STR_LEN:
557 { 555 {
558 char *str = va_arg (ap, char *); 556 char *str = va_arg (ap, char *);
559 int len = va_arg (ap, int); 557 int len = va_arg (ap, int);
560 558
561 XPUSHs (sv_2mortal (newSVpvn (str, len))); 559 XPUSHs (sv_2mortal (newSVpvn (str, len)));
562 } 560 }
563 break; 561 break;
564 562
565 case DT_WCS_LEN: 563 case DT_WCS_LEN:
566 { 564 {
567 wchar_t *wstr = va_arg (ap, wchar_t *); 565 wchar_t *wstr = va_arg (ap, wchar_t *);
568 int wlen = va_arg (ap, int); 566 int wlen = va_arg (ap, int);
569 567
570 XPUSHs (sv_2mortal (wcs2sv (wstr, wlen))); 568 XPUSHs (sv_2mortal (wcs2sv (wstr, wlen)));
569 }
570 break;
571
572 case DT_LCS_LEN:
573 {
574 long *lstr = va_arg (ap, long *);
575 int llen = va_arg (ap, int);
576
577 XPUSHs (sv_2mortal (newSVpvn ((char *)lstr, llen * sizeof (long))));
571 } 578 }
572 break; 579 break;
573 580
574 case DT_XEVENT: 581 case DT_XEVENT:
575 { 582 {
576 XEvent *xe = va_arg (ap, XEvent *); 583 XEvent *xe = va_arg (ap, XEvent *);
577 HV *hv = newHV (); 584 HV *hv = newHV ();
578 585
579# define set(name, sv) hv_store (hv, # name, sizeof (# name) - 1, sv, 0) 586# define set(name, sv) hv_store (hv, # name, sizeof (# name) - 1, sv, 0)
580# define setiv(name, val) hv_store (hv, # name, sizeof (# name) - 1, newSViv (val), 0) 587# define setiv(name, val) hv_store (hv, # name, sizeof (# name) - 1, newSViv (val), 0)
581# define setuv(name, val) hv_store (hv, # name, sizeof (# name) - 1, newSVuv (val), 0) 588# define setuv(name, val) hv_store (hv, # name, sizeof (# name) - 1, newSVuv (val), 0)
582# undef set 589# undef set
583 590
584 setiv (type, xe->type); 591 setiv (type, xe->type);
585 setiv (send_event, xe->xany.send_event); 592 setiv (send_event, xe->xany.send_event);
586 setiv (serial, xe->xany.serial); 593 setiv (serial, xe->xany.serial);
587 594
596 setuv (root, xe->xmotion.root); 603 setuv (root, xe->xmotion.root);
597 setuv (subwindow, xe->xmotion.subwindow); 604 setuv (subwindow, xe->xmotion.subwindow);
598 setuv (time, xe->xmotion.time); 605 setuv (time, xe->xmotion.time);
599 setiv (x, xe->xmotion.x); 606 setiv (x, xe->xmotion.x);
600 setiv (y, xe->xmotion.y); 607 setiv (y, xe->xmotion.y);
601 setiv (row, xe->xmotion.y / term->fheight); 608 setiv (row, xe->xmotion.y / term->fheight + term->view_start);
602 setiv (col, xe->xmotion.x / term->fwidth); 609 setiv (col, xe->xmotion.x / term->fwidth);
603 setiv (x_root, xe->xmotion.x_root); 610 setiv (x_root, xe->xmotion.x_root);
604 setiv (y_root, xe->xmotion.y_root); 611 setiv (y_root, xe->xmotion.y_root);
605 setuv (state, xe->xmotion.state); 612 setuv (state, xe->xmotion.state);
606 613
640 break; 647 break;
641 } 648 }
642 649
643 break; 650 break;
644 651
652 case PropertyNotify:
653 setuv (window, xe->xproperty.window);
654 setuv (atom, xe->xproperty.atom);
655 setuv (time, xe->xproperty.time);
656 setiv (state, xe->xproperty.state);
657 break;
658
645 case ClientMessage: 659 case ClientMessage:
646 setuv (window, xe->xclient.window); 660 setuv (window, xe->xclient.window);
647 setuv (message_type, xe->xclient.message_type); 661 setuv (message_type, xe->xclient.message_type);
648 setuv (format, xe->xclient.format); 662 setuv (format, xe->xclient.format);
649 setuv (l0, xe->xclient.data.l[0]); 663 setuv (l0, xe->xclient.data.l[0]);
650 setuv (l1, xe->xclient.data.l[1]); 664 setuv (l1, xe->xclient.data.l[1]);
651 setuv (l2, xe->xclient.data.l[2]); 665 setuv (l2, xe->xclient.data.l[2]);
652 setuv (l3, xe->xclient.data.l[3]); 666 setuv (l3, xe->xclient.data.l[3]);
653 setuv (l4, xe->xclient.data.l[4]); 667 setuv (l4, xe->xclient.data.l[4]);
668 break;
654 } 669 }
655 670
656 XPUSHs (sv_2mortal (newRV_noinc ((SV *)hv))); 671 XPUSHs (sv_2mortal (newRV_noinc ((SV *)hv)));
657 } 672 }
658 break; 673 break;
708 } 723 }
709 else if (htype == HOOK_DESTROY) 724 else if (htype == HOOK_DESTROY)
710 { 725 {
711 clearSVptr ((SV *)term->perl.self); 726 clearSVptr ((SV *)term->perl.self);
712 SvREFCNT_dec ((SV *)term->perl.self); 727 SvREFCNT_dec ((SV *)term->perl.self);
728
729 // don't allow further calls
730 term->perl.self = 0;
713 } 731 }
714 732
715 swap (perl_environ, environ); 733 swap (perl_environ, environ);
716 734
717 return event_consumed; 735 return event_consumed;
741# include "optinc.h" 759# include "optinc.h"
742# undef nodef 760# undef nodef
743# undef def 761# undef def
744 762
745 HV *stash = gv_stashpv ("urxvt", 1); 763 HV *stash = gv_stashpv ("urxvt", 1);
746 struct { 764 static const struct {
747 const char *name; 765 const char *name;
748 IV iv; 766 IV iv;
749 } *civ, const_iv[] = { 767 } *civ, const_iv[] = {
750# define const_iv(name) { # name, (IV)name } 768# define const_iv(name) { # name, (IV)name }
751 const_iv (DEFAULT_RSTYLE), 769 const_iv (DEFAULT_RSTYLE),
769 const_iv (Button2Mask), 787 const_iv (Button2Mask),
770 const_iv (Button3Mask), 788 const_iv (Button3Mask),
771 const_iv (Button4Mask), 789 const_iv (Button4Mask),
772 const_iv (Button5Mask), 790 const_iv (Button5Mask),
773 const_iv (AnyModifier), 791 const_iv (AnyModifier),
792
793 const_iv (NoSymbol),
794 const_iv (GrabModeSync),
795 const_iv (GrabModeAsync),
774 796
775 const_iv (EVENT_NONE), 797 const_iv (EVENT_NONE),
776 const_iv (EVENT_READ), 798 const_iv (EVENT_READ),
777 const_iv (EVENT_WRITE), 799 const_iv (EVENT_WRITE),
778 800
834 const_iv (SelectionRequest), 856 const_iv (SelectionRequest),
835 const_iv (SelectionNotify), 857 const_iv (SelectionNotify),
836 const_iv (ColormapNotify), 858 const_iv (ColormapNotify),
837 const_iv (ClientMessage), 859 const_iv (ClientMessage),
838 const_iv (MappingNotify), 860 const_iv (MappingNotify),
861# if ENABLE_XIM_ONTHESPOT
862 const_iv (XIMReverse),
863 const_iv (XIMUnderline),
864 const_iv (XIMHighlight),
865 const_iv (XIMPrimary),
866 const_iv (XIMSecondary),
867 const_iv (XIMTertiary),
868 const_iv (XIMVisibleToForward),
869 const_iv (XIMVisibleToBackword),
870 const_iv (XIMVisibleToCenter),
871# if 0
872 const_iv (XIMForwardChar),
873 const_iv (XIMBackwardChar),
874 const_iv (XIMForwardWord),
875 const_iv (XIMBackwardWord),
876 const_iv (XIMCaretUp),
877 const_iv (XIMCaretDown),
878 const_iv (XIMNextLine),
879 const_iv (XIMPreviousLine),
880 const_iv (XIMLineStart),
881 const_iv (XIMLineEnd),
882 const_iv (XIMAbsolutePosition),
883 const_iv (XIMDontChange),
884# endif
885# endif
839 }; 886 };
840 887
841 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); 888 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; )
842 civ-- > const_iv; )
843 newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); 889 newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv));
844} 890}
845 891
846void 892void
847warn (const char *msg) 893warn (const char *msg)
878 RETVAL 924 RETVAL
879 925
880int 926int
881SET_FGCOLOR (int rend, int new_color) 927SET_FGCOLOR (int rend, int new_color)
882 CODE: 928 CODE:
883 RETVAL = SET_FGCOLOR (rend, new_color); 929 RETVAL = SET_FGCOLOR (rend, clamp (new_color, 0, TOTAL_COLORS - 1));
884 OUTPUT: 930 OUTPUT:
885 RETVAL 931 RETVAL
886 932
887int 933int
888SET_BGCOLOR (int rend, int new_color) 934SET_BGCOLOR (int rend, int new_color)
889 CODE: 935 CODE:
890 RETVAL = SET_BGCOLOR (rend, new_color); 936 RETVAL = SET_BGCOLOR (rend, clamp (new_color, 0, TOTAL_COLORS - 1));
891 OUTPUT: 937 OUTPUT:
892 RETVAL 938 RETVAL
893 939
894int 940int
895GET_CUSTOM (int rend) 941GET_CUSTOM (int rend)
909 | ((new_value << RS_customShift) & RS_customMask); 955 | ((new_value << RS_customShift) & RS_customMask);
910} 956}
911 OUTPUT: 957 OUTPUT:
912 RETVAL 958 RETVAL
913 959
960void
961termlist ()
962 PPCODE:
963{
964 EXTEND (SP, rxvt_term::termlist.size ());
965
966 for (rxvt_term **t = rxvt_term::termlist.begin (); t < rxvt_term::termlist.end (); t++)
967 if ((*t)->perl.self)
968 PUSHs (sv_2mortal (newSVterm (*t)));
969}
970
914MODULE = urxvt PACKAGE = urxvt::term 971MODULE = urxvt PACKAGE = urxvt::term
915 972
916SV * 973SV *
917_new (...) 974_new (AV *env, AV *arg)
918 CODE: 975 CODE:
919{ 976{
920 if (items < 1 || !SvROK (ST (0)) || SvTYPE (SvRV (ST (0))) != SVt_PVAV)
921 croak ("first argument to urxvt::term->_new must be arrayref");
922
923 rxvt_term *term = new rxvt_term; 977 rxvt_term *term = new rxvt_term;
924 978
925 term->argv = new stringvec; 979 stringvec *argv = new stringvec;
926 term->envv = new stringvec; 980 stringvec *envv = new stringvec;
927 981
928 for (int i = 1; i < items; i++) 982 for (int i = 0; i <= AvFILL (arg); i++)
929 term->argv->push_back (strdup (SvPVbyte_nolen (ST (i)))); 983 argv->push_back (strdup (SvPVbyte_nolen (*av_fetch (arg, i, 1))));
930 984
931 AV *envv = (AV *)SvRV (ST (0));
932 for (int i = AvFILL (envv) + 1; i--; ) 985 for (int i = AvFILL (env) + 1; i--; )
933 term->envv->push_back (strdup (SvPVbyte_nolen (*av_fetch (envv, i, 1)))); 986 envv->push_back (strdup (SvPVbyte_nolen (*av_fetch (env, i, 1))));
934 987
935 term->envv->push_back (0); 988 envv->push_back (0);
936 989
937 bool success; 990 bool success;
938 991
939 try 992 try
940 { 993 {
941 success = term->init (term->argv->size (), term->argv->begin ()); 994 success = term->init (argv, envv);
942 } 995 }
943 catch (const class rxvt_failure_exception &e) 996 catch (const class rxvt_failure_exception &e)
944 { 997 {
945 success = false; 998 success = false;
946 } 999 }
963void 1016void
964rxvt_term::set_should_invoke (int htype, int inc) 1017rxvt_term::set_should_invoke (int htype, int inc)
965 CODE: 1018 CODE:
966 THIS->perl.should_invoke [htype] += inc; 1019 THIS->perl.should_invoke [htype] += inc;
967 1020
968void 1021int
969rxvt_term::grab_button (int button, U32 modifiers) 1022rxvt_term::grab_button (int button, U32 modifiers, Window window = THIS->vt)
970 CODE: 1023 CODE:
971 XGrabButton (THIS->display->display, button, modifiers, THIS->vt, 1, 1024 RETVAL = XGrabButton (THIS->dpy, button, modifiers, window, 1,
972 ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask, 1025 ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask,
973 GrabModeSync, GrabModeSync, None, GRAB_CURSOR); 1026 GrabModeSync, GrabModeSync, None, GRAB_CURSOR);
1027 OUTPUT: RETVAL
1028
1029int
1030rxvt_term::ungrab_button (int button, U32 modifiers, Window window = THIS->vt)
1031 CODE:
1032 RETVAL = XUngrabButton (THIS->dpy, button, modifiers, window);
1033 OUTPUT: RETVAL
1034
1035void
1036rxvt_term::XGrabKey (int keycode, U32 modifiers, Window window = THIS->vt, \
1037 int owner_events = 1, int pointer_mode = GrabModeAsync, int keyboard_mode = GrabModeAsync)
1038 CODE:
1039 XGrabKey (THIS->dpy, keycode, modifiers, window, owner_events, pointer_mode, keyboard_mode);
1040
1041void
1042rxvt_term::XUngrabKey (int keycode, U32 modifiers, Window window = THIS->vt)
1043 CODE:
1044 XUngrabKey (THIS->dpy, keycode, modifiers, window);
1045
1046void
1047rxvt_term::XUngrabKeyboard (Time eventtime)
1048 CODE:
1049 XUngrabKeyboard (THIS->dpy, eventtime);
974 1050
975bool 1051bool
976rxvt_term::grab (Time eventtime, int sync = 0) 1052rxvt_term::grab (Time eventtime, int sync = 0)
977 CODE: 1053 CODE:
978{ 1054{
979 int mode = sync ? GrabModeSync : GrabModeAsync; 1055 int mode = sync ? GrabModeSync : GrabModeAsync;
980 1056
981 THIS->perl.grabtime = 0; 1057 THIS->perl.grabtime = 0;
982 1058
983 if (!XGrabPointer (THIS->display->display, THIS->vt, 0, 1059 if (!XGrabPointer (THIS->dpy, THIS->vt, 0,
984 ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask, 1060 ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask,
985 mode, mode, None, GRAB_CURSOR, eventtime)) 1061 mode, mode, None, GRAB_CURSOR, eventtime))
986 if (!XGrabKeyboard (THIS->display->display, THIS->vt, 0, mode, mode, eventtime)) 1062 if (!XGrabKeyboard (THIS->dpy, THIS->vt, 0, mode, mode, eventtime))
987 THIS->perl.grabtime = eventtime; 1063 THIS->perl.grabtime = eventtime;
988 else 1064 else
989 XUngrabPointer (THIS->display->display, eventtime); 1065 XUngrabPointer (THIS->dpy, eventtime);
990 1066
991 RETVAL = !!THIS->perl.grabtime; 1067 RETVAL = !!THIS->perl.grabtime;
992} 1068}
993 OUTPUT: 1069 OUTPUT:
994 RETVAL 1070 RETVAL
995 1071
996void 1072void
997rxvt_term::allow_events_async () 1073rxvt_term::allow_events_async ()
998 CODE: 1074 CODE:
999 XAllowEvents (THIS->display->display, AsyncBoth, THIS->perl.grabtime); 1075 XAllowEvents (THIS->dpy, AsyncBoth, THIS->perl.grabtime);
1000 1076
1001void 1077void
1002rxvt_term::allow_events_sync () 1078rxvt_term::allow_events_sync ()
1003 CODE: 1079 CODE:
1004 XAllowEvents (THIS->display->display, SyncBoth, THIS->perl.grabtime); 1080 XAllowEvents (THIS->dpy, SyncBoth, THIS->perl.grabtime);
1005 1081
1006void 1082void
1007rxvt_term::allow_events_replay () 1083rxvt_term::allow_events_replay ()
1008 CODE: 1084 CODE:
1009 XAllowEvents (THIS->display->display, ReplayPointer, THIS->perl.grabtime); 1085 XAllowEvents (THIS->dpy, ReplayPointer, THIS->perl.grabtime);
1010 XAllowEvents (THIS->display->display, ReplayKeyboard, THIS->perl.grabtime); 1086 XAllowEvents (THIS->dpy, ReplayKeyboard, THIS->perl.grabtime);
1011 1087
1012void 1088void
1013rxvt_term::ungrab () 1089rxvt_term::ungrab ()
1014 CODE: 1090 CODE:
1015 ungrab (THIS); 1091 ungrab (THIS);
1092
1093int
1094rxvt_term::XStringToKeysym (char *string)
1095 CODE:
1096 RETVAL = XStringToKeysym (string);
1097 OUTPUT: RETVAL
1098
1099char *
1100rxvt_term::XKeysymToString (int sym)
1101 CODE:
1102 RETVAL = XKeysymToString (sym);
1103 OUTPUT: RETVAL
1104
1105int
1106rxvt_term::XKeysymToKeycode (int sym)
1107 CODE:
1108 RETVAL = XKeysymToKeycode (THIS->dpy, sym);
1109 OUTPUT: RETVAL
1110
1111int
1112rxvt_term::XKeycodeToKeysym (int code, int index)
1113 CODE:
1114 RETVAL = XKeycodeToKeysym (THIS->dpy, code, index);
1115 OUTPUT: RETVAL
1016 1116
1017int 1117int
1018rxvt_term::strwidth (SV *str) 1118rxvt_term::strwidth (SV *str)
1019 CODE: 1119 CODE:
1020{ 1120{
1109rxvt_term::ModLevel3Mask () 1209rxvt_term::ModLevel3Mask ()
1110 ALIAS: 1210 ALIAS:
1111 ModLevel3Mask = 0 1211 ModLevel3Mask = 0
1112 ModMetaMask = 1 1212 ModMetaMask = 1
1113 ModNumLockMask = 2 1213 ModNumLockMask = 2
1214 current_screen = 3
1215 hidden_cursor = 4
1114 CODE: 1216 CODE:
1115 switch (ix) 1217 switch (ix)
1116 { 1218 {
1117 case 0: RETVAL = THIS->ModLevel3Mask; break; 1219 case 0: RETVAL = THIS->ModLevel3Mask; break;
1118 case 1: RETVAL = THIS->ModMetaMask; break; 1220 case 1: RETVAL = THIS->ModMetaMask; break;
1119 case 2: RETVAL = THIS->ModNumLockMask; break; 1221 case 2: RETVAL = THIS->ModNumLockMask; break;
1222 case 3: RETVAL = THIS->current_screen; break;
1223 case 4: RETVAL = THIS->hidden_cursor; break;
1120 } 1224 }
1121 OUTPUT: 1225 OUTPUT:
1122 RETVAL 1226 RETVAL
1123 1227
1124char * 1228char *
1134 } 1238 }
1135 OUTPUT: 1239 OUTPUT:
1136 RETVAL 1240 RETVAL
1137 1241
1138SV * 1242SV *
1139rxvt_term::_env () 1243rxvt_term::envv ()
1244 ALIAS:
1245 argv = 1
1140 CODE: 1246 PPCODE:
1141{ 1247{
1142 if (THIS->envv) 1248 stringvec *vec = ix ? THIS->argv : THIS->envv;
1143 {
1144 AV *av = newAV ();
1145 1249
1250 EXTEND (SP, vec->size ());
1251
1146 for (char **i = THIS->envv->begin (); i != THIS->envv->end (); ++i) 1252 for (char **i = vec->begin (); i != vec->end (); ++i)
1147 if (*i) 1253 if (*i)
1148 av_push (av, newSVpv (*i, 0)); 1254 PUSHs (sv_2mortal (newSVpv (*i, 0)));
1149
1150 RETVAL = newRV_noinc ((SV *)av);
1151 }
1152 else
1153 RETVAL = &PL_sv_undef;
1154} 1255}
1155 OUTPUT:
1156 RETVAL
1157 1256
1158int 1257int
1159rxvt_term::pty_ev_events (int events = EVENT_UNDEF) 1258rxvt_term::pty_ev_events (int events = EVENT_UNDEF)
1160 CODE: 1259 CODE:
1161 RETVAL = THIS->pty_ev.events; 1260 RETVAL = THIS->pty_ev.events;
1162 if (events != EVENT_UNDEF) 1261 if (events != EVENT_UNDEF)
1163 THIS->pty_ev.set (events); 1262 THIS->pty_ev.set (events);
1164 OUTPUT: 1263 OUTPUT:
1165 RETVAL 1264 RETVAL
1166 1265
1266int
1267rxvt_term::pty_fd ()
1268 CODE:
1269 RETVAL = THIS->pty->pty;
1270 OUTPUT:
1271 RETVAL
1272
1167Window 1273Window
1168rxvt_term::parent () 1274rxvt_term::parent ()
1169 CODE: 1275 CODE:
1170 RETVAL = THIS->parent [0]; 1276 RETVAL = THIS->parent [0];
1171 OUTPUT: 1277 OUTPUT:
1204} 1310}
1205 OUTPUT: 1311 OUTPUT:
1206 RETVAL 1312 RETVAL
1207 1313
1208void 1314void
1315rxvt_term::focus_in ()
1316
1317void
1318rxvt_term::focus_out ()
1319
1320void
1321rxvt_term::key_press (unsigned int state, unsigned int keycode, Time time = CurrentTime)
1322 ALIAS:
1323 key_release = 1
1324 CODE:
1325{
1326 XKeyEvent xkey;
1327
1328 memset (&xkey, 0, sizeof (xkey));
1329
1330 xkey.time = time;
1331 xkey.state = state;
1332 xkey.keycode = keycode;
1333
1334 xkey.type = ix ? KeyRelease : KeyPress;
1335 xkey.display = THIS->dpy;
1336 xkey.window = THIS->vt;
1337 xkey.root = THIS->display->root;
1338 xkey.subwindow = THIS->vt;
1339
1340 if (ix)
1341 THIS->key_release (xkey);
1342 else
1343 THIS->key_press (xkey);
1344}
1345
1346void
1209rxvt_term::want_refresh () 1347rxvt_term::want_refresh ()
1210 CODE: 1348 CODE:
1211 THIS->want_refresh = 1; 1349 THIS->want_refresh = 1;
1212 1350
1213void 1351void
1219 1357
1220 line_t &l = ROW(row_number); 1358 line_t &l = ROW(row_number);
1221 1359
1222 if (GIMME_V != G_VOID) 1360 if (GIMME_V != G_VOID)
1223 { 1361 {
1224 wchar_t *wstr = new wchar_t [THIS->ncol]; 1362 wchar_t *wstr = rxvt_temp_buf<wchar_t> (THIS->ncol);
1225 1363
1226 for (int col = 0; col < THIS->ncol; col++) 1364 for (int col = 0; col < THIS->ncol; col++)
1227 wstr [col] = l.t [col]; 1365 wstr [col] = l.t [col];
1228 1366
1229 XPUSHs (sv_2mortal (wcs2sv (wstr, THIS->ncol))); 1367 XPUSHs (sv_2mortal (wcs2sv (wstr, THIS->ncol)));
1230
1231 delete [] wstr;
1232 } 1368 }
1233 1369
1234 if (new_text) 1370 if (new_text)
1235 { 1371 {
1236 wchar_t *wstr = sv2wcs (new_text); 1372 wchar_t *wstr = sv2wcs (new_text);
1237 1373
1238 int len = min (wcslen (wstr) - start_ofs, max_len); 1374 int len = min (wcslen (wstr) - start_ofs, max_len);
1239 1375
1240 if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len)) 1376 if (start_col < 0 || start_col + len > THIS->ncol)
1241 { 1377 {
1242 free (wstr); 1378 free (wstr);
1243 croak ("new_text extends beyond horizontal margins"); 1379 croak ("new_text extends beyond horizontal margins");
1244 } 1380 }
1245 1381
1279 croak ("new_rend must be arrayref"); 1415 croak ("new_rend must be arrayref");
1280 1416
1281 AV *av = (AV *)SvRV (new_rend); 1417 AV *av = (AV *)SvRV (new_rend);
1282 int len = min (AvFILL (av) + 1 - start_ofs, max_len); 1418 int len = min (AvFILL (av) + 1 - start_ofs, max_len);
1283 1419
1284 if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len)) 1420 if (start_col < 0 || start_col + len > THIS->ncol)
1285 croak ("new_rend array extends beyond horizontal margins"); 1421 croak ("new_rend array extends beyond horizontal margins");
1286 1422
1287 for (int col = start_col; col < start_col + len; col++) 1423 for (int col = start_col; col < start_col + len; col++)
1288 { 1424 {
1289 rend_t r = SvIV (*av_fetch (av, start_ofs + col - start_col, 1)) & ~RS_fontMask; 1425 rend_t r = SvIV (*av_fetch (av, start_ofs + col - start_col, 1)) & ~RS_fontMask;
1329rxvt_term::special_encode (SV *string) 1465rxvt_term::special_encode (SV *string)
1330 CODE: 1466 CODE:
1331{ 1467{
1332 wchar_t *wstr = sv2wcs (string); 1468 wchar_t *wstr = sv2wcs (string);
1333 int wlen = wcslen (wstr); 1469 int wlen = wcslen (wstr);
1334 wchar_t *rstr = new wchar_t [wlen]; // cannot become longer 1470 wchar_t *rstr = rxvt_temp_buf<wchar_t> (wlen * 2); // cannot become longer
1335 1471
1336 rxvt_push_locale (THIS->locale); 1472 rxvt_push_locale (THIS->locale);
1337 1473
1338 wchar_t *r = rstr; 1474 wchar_t *r = rstr;
1339 for (wchar_t *s = wstr; *s; s++) 1475 for (wchar_t *s = wstr; *s; s++)
1476 {
1477 int w = WCWIDTH (*s);
1478
1340 if (wcwidth (*s) == 0) 1479 if (w == 0)
1341 { 1480 {
1342 if (r == rstr) 1481 if (r == rstr)
1343 croak ("leading combining character unencodable"); 1482 croak ("leading combining character unencodable");
1344 1483
1345 unicode_t n = rxvt_compose (r[-1], *s); 1484 unicode_t n = rxvt_compose (r[-1], *s);
1346 if (n == NOCHAR) 1485 if (n == NOCHAR)
1347 n = rxvt_composite.compose (r[-1], *s); 1486 n = rxvt_composite.compose (r[-1], *s);
1348 1487
1349 r[-1] = n; 1488 r[-1] = n;
1350 } 1489 }
1351#if !UNICODE_3 1490#if !UNICODE_3
1352 else if (*s >= 0x10000) 1491 else if (*s >= 0x10000)
1353 *r++ = rxvt_composite.compose (*s); 1492 *r++ = rxvt_composite.compose (*s);
1354#endif 1493#endif
1355 else 1494 else
1356 *r++ = *s; 1495 *r++ = *s;
1496
1497 // the *2 above only allows wcwidth <= 2
1498 if (w > 1)
1499 *r++ = NOCHAR;
1500 }
1357 1501
1358 rxvt_pop_locale (); 1502 rxvt_pop_locale ();
1359 1503
1360 RETVAL = wcs2sv (rstr, r - rstr); 1504 RETVAL = wcs2sv (rstr, r - rstr);
1361
1362 delete [] rstr;
1363} 1505}
1364 OUTPUT: 1506 OUTPUT:
1365 RETVAL 1507 RETVAL
1366 1508
1367SV * 1509SV *
1379 else if (IS_COMPOSE (*s)) 1521 else if (IS_COMPOSE (*s))
1380 dlen += rxvt_composite.expand (*s, 0); 1522 dlen += rxvt_composite.expand (*s, 0);
1381 else 1523 else
1382 dlen++; 1524 dlen++;
1383 1525
1384 wchar_t *rstr = new wchar_t [dlen]; 1526 wchar_t *rstr = rxvt_temp_buf<wchar_t> (dlen);
1385 1527
1386 // decode 1528 // decode
1387 wchar_t *r = rstr; 1529 wchar_t *r = rstr;
1388 for (wchar_t *s = wstr; *s; s++) 1530 for (wchar_t *s = wstr; *s; s++)
1389 if (*s == NOCHAR) 1531 if (*s == NOCHAR)
1392 r += rxvt_composite.expand (*s, r); 1534 r += rxvt_composite.expand (*s, r);
1393 else 1535 else
1394 *r++ = *s; 1536 *r++ = *s;
1395 1537
1396 RETVAL = wcs2sv (rstr, r - rstr); 1538 RETVAL = wcs2sv (rstr, r - rstr);
1397
1398 delete [] rstr;
1399} 1539}
1400 OUTPUT: 1540 OUTPUT:
1401 RETVAL 1541 RETVAL
1402 1542
1403void 1543void
1404rxvt_term::_resource (char *name, int index, SV *newval = 0) 1544rxvt_term::_resource (char *name, int index, SV *newval = 0)
1405 PPCODE: 1545 PPCODE:
1406{ 1546{
1407 struct resval { const char *name; int value; } rslist [] = { 1547 static const struct resval { const char *name; int value; } *rs, rslist [] = {
1408# define def(name) { # name, Rs_ ## name }, 1548# define def(name) { # name, Rs_ ## name },
1409# define reserve(name,count) 1549# define reserve(name,count)
1410# include "rsinc.h" 1550# include "rsinc.h"
1411# undef def 1551# undef def
1412# undef reserve 1552# undef reserve
1413 }; 1553 };
1414 1554
1415 struct resval *rs = rslist + sizeof (rslist) / sizeof (rslist [0]); 1555 rs = rslist + sizeof (rslist) / sizeof (rslist [0]);
1416 1556
1417 do { 1557 do {
1418 if (rs-- == rslist) 1558 if (rs-- == rslist)
1419 croak ("no such resource '%s', requested", name); 1559 croak ("no such resource '%s', requested", name);
1420 } while (strcmp (name, rs->name)); 1560 } while (strcmp (name, rs->name));
1513 if (items == 3) 1653 if (items == 3)
1514 { 1654 {
1515 rc.row = SvIV (ST (1)); 1655 rc.row = SvIV (ST (1));
1516 rc.col = SvIV (ST (2)); 1656 rc.col = SvIV (ST (2));
1517 1657
1518 if (ix == 2 && rc.col == 0) 1658 if (ix == 2)
1519 { 1659 {
1660 if (rc.col == 0)
1661 {
1662 // col == 0 means end of previous line
1520 rc.row--; 1663 rc.row--;
1521 rc.col = THIS->ncol; 1664 rc.col = THIS->ncol;
1665 }
1666 else if (IN_RANGE_EXC (rc.row, THIS->top_row, THIS->nrow)
1667 && rc.col > ROW(rc.row).l)
1668 {
1669 // col >= length means while line and add newline
1670 rc.col = THIS->ncol;
1671 }
1522 } 1672 }
1523 1673
1524 clamp_it (rc.col, 0, THIS->ncol); 1674 clamp_it (rc.col, 0, THIS->ncol);
1525 clamp_it (rc.row, THIS->top_row, THIS->nrow - 1); 1675 clamp_it (rc.row, THIS->top_row, THIS->nrow - 1);
1526 1676
1534 CODE: 1684 CODE:
1535 RETVAL = THIS->charsets [THIS->screen.charset]; 1685 RETVAL = THIS->charsets [THIS->screen.charset];
1536 OUTPUT: 1686 OUTPUT:
1537 RETVAL 1687 RETVAL
1538 1688
1539#void 1689void
1540#rxvt_term::selection_clear () 1690rxvt_term::selection_clear ()
1541 1691
1542void 1692void
1543rxvt_term::selection_make (Time eventtime, bool rect = false) 1693rxvt_term::selection_make (Time eventtime, bool rect = false)
1544 CODE: 1694 CODE:
1545 THIS->selection.op = SELECTION_CONT; 1695 THIS->selection.op = SELECTION_CONT;
1573void 1723void
1574rxvt_term::scr_xor_span (int beg_row, int beg_col, int end_row, int end_col, U32 rstyle = RS_RVid) 1724rxvt_term::scr_xor_span (int beg_row, int beg_col, int end_row, int end_col, U32 rstyle = RS_RVid)
1575 1725
1576void 1726void
1577rxvt_term::scr_bell () 1727rxvt_term::scr_bell ()
1728
1729void
1730rxvt_term::scr_change_screen (int screen)
1578 1731
1579void 1732void
1580rxvt_term::scr_add_lines (SV *string) 1733rxvt_term::scr_add_lines (SV *string)
1581 CODE: 1734 CODE:
1582{ 1735{
1632void 1785void
1633rxvt_term::XListProperties (Window window) 1786rxvt_term::XListProperties (Window window)
1634 PPCODE: 1787 PPCODE:
1635{ 1788{
1636 int count; 1789 int count;
1637 Atom *props = XListProperties (THIS->display->display, window, &count); 1790 Atom *props = XListProperties (THIS->dpy, window, &count);
1638 1791
1639 EXTEND (SP, count); 1792 EXTEND (SP, count);
1640 while (count--) 1793 while (count--)
1641 PUSHs (newSVuv ((U32)props [count])); 1794 PUSHs (newSVuv ((U32)props [count]));
1642 1795
1651 int format; 1804 int format;
1652 unsigned long nitems; 1805 unsigned long nitems;
1653 unsigned long bytes_after; 1806 unsigned long bytes_after;
1654 unsigned char *prop; 1807 unsigned char *prop;
1655 1808
1656 XGetWindowProperty (THIS->display->display, window, property, 1809 XGetWindowProperty (THIS->dpy, window, property,
1657 0, 1<<24, 0, AnyPropertyType, 1810 0, 1<<24, 0, AnyPropertyType,
1658 &type, &format, &nitems, &bytes_after, &prop); 1811 &type, &format, &nitems, &bytes_after, &prop);
1659 1812
1660 if (type != None) 1813 if (type != None)
1661 { 1814 {
1680 1833
1681 int elemsize = format == 16 ? sizeof (short) 1834 int elemsize = format == 16 ? sizeof (short)
1682 : format == 32 ? sizeof (long) 1835 : format == 32 ? sizeof (long)
1683 : 1; 1836 : 1;
1684 1837
1685 XChangeProperty (THIS->display->display, window, property, 1838 XChangeProperty (THIS->dpy, window, property,
1686 type, format, PropModeReplace, 1839 type, format, PropModeReplace,
1687 (unsigned char *)data_, len / elemsize); 1840 (unsigned char *)data_, len / elemsize);
1688 XSync (THIS->display->display, 0);
1689} 1841}
1690 1842
1691Atom 1843Atom
1692XInternAtom (rxvt_term *term, char *atom_name, int only_if_exists = FALSE) 1844XInternAtom (rxvt_term *term, char *atom_name, int only_if_exists = FALSE)
1693 C_ARGS: term->display->display, atom_name, only_if_exists 1845 C_ARGS: term->dpy, atom_name, only_if_exists
1694 1846
1695char * 1847char *
1696XGetAtomName (rxvt_term *term, Atom atom) 1848XGetAtomName (rxvt_term *term, Atom atom)
1697 C_ARGS: term->display->display, atom 1849 C_ARGS: term->dpy, atom
1698 CLEANUP: 1850 CLEANUP:
1699 XFree (RETVAL); 1851 XFree (RETVAL);
1700 1852
1701void 1853void
1702XDeleteProperty (rxvt_term *term, Window window, Atom property) 1854XDeleteProperty (rxvt_term *term, Window window, Atom property)
1703 C_ARGS: term->display->display, window, property 1855 C_ARGS: term->dpy, window, property
1704 1856
1705Window 1857Window
1706rxvt_term::DefaultRootWindow () 1858rxvt_term::DefaultRootWindow ()
1707 CODE: 1859 CODE:
1708 RETVAL = THIS->display->root; 1860 RETVAL = THIS->display->root;
1711 1863
1712#if 0 1864#if 0
1713 1865
1714Window 1866Window
1715XCreateSimpleWindow (rxvt_term *term, Window parent, int x, int y, unsigned int width, unsigned int height) 1867XCreateSimpleWindow (rxvt_term *term, Window parent, int x, int y, unsigned int width, unsigned int height)
1716 C_ARGS: term->display->display, (Window)parent, 1868 C_ARGS: term->dpy, (Window)parent,
1717 x, y, width, height, 0, 1869 x, y, width, height, 0,
1718 term->pix_colors_focused[Color_border], 1870 term->pix_colors_focused[Color_border],
1719 term->pix_colors_focused[Color_border] 1871 term->pix_colors_focused[Color_border]
1720 1872
1721#endif 1873#endif
1722 1874
1723void 1875void
1724XReparentWindow (rxvt_term *term, Window window, Window parent, int x = 0, int y = 0) 1876XReparentWindow (rxvt_term *term, Window window, Window parent, int x = 0, int y = 0)
1725 C_ARGS: term->display->display, window, parent, x, y 1877 C_ARGS: term->dpy, window, parent, x, y
1726 1878
1727void 1879void
1728XMapWindow (rxvt_term *term, Window window) 1880XMapWindow (rxvt_term *term, Window window)
1729 C_ARGS: term->display->display, window 1881 C_ARGS: term->dpy, window
1730 1882
1731void 1883void
1732XUnmapWindow (rxvt_term *term, Window window) 1884XUnmapWindow (rxvt_term *term, Window window)
1733 C_ARGS: term->display->display, window 1885 C_ARGS: term->dpy, window
1734 1886
1735void 1887void
1736XMoveResizeWindow (rxvt_term *term, Window window, int x, int y, unsigned int width, unsigned int height) 1888XMoveResizeWindow (rxvt_term *term, Window window, int x, int y, unsigned int width, unsigned int height)
1737 C_ARGS: term->display->display, (Window)window, x, y, width, height 1889 C_ARGS: term->dpy, window, x, y, width, height
1890
1891void
1892rxvt_term::XChangeInput (Window window, U32 add_events, U32 del_events = 0)
1893 CODE:
1894{
1895 XWindowAttributes attr;
1896 XGetWindowAttributes (THIS->dpy, window, &attr);
1897 XSelectInput (THIS->dpy, window, attr.your_event_mask | add_events & ~del_events);
1898}
1899
1900void
1901rxvt_term::XTranslateCoordinates (Window src, Window dst, int x, int y)
1902 PPCODE:
1903{
1904 int dx, dy;
1905 Window child;
1906
1907 if (XTranslateCoordinates (THIS->dpy, src, dst, x, y, &dx, &dy, &child))
1908 {
1909 EXTEND (SP, 3);
1910 PUSHs (newSViv (dx));
1911 PUSHs (newSViv (dy));
1912 PUSHs (newSVuv (child));
1913 }
1914}
1738 1915
1739############################################################################# 1916#############################################################################
1740# urxvt::overlay 1917# urxvt::overlay
1741############################################################################# 1918#############################################################################
1742 1919

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines