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.71 by root, Tue Jan 17 16:22:41 2006 UTC vs.
Revision 1.91 by root, Wed Jan 25 00:42:21 2006 UTC

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 1 55typedef int CHAINED UNUSED;
56 56
57///////////////////////////////////////////////////////////////////////////// 57/////////////////////////////////////////////////////////////////////////////
58 58
59static wchar_t * 59static wchar_t *
60sv2wcs (SV *sv) 60sv2wcs (SV *sv)
118#define newSVterm(term) SvREFCNT_inc ((SV *)term->perl.self) 118#define newSVterm(term) SvREFCNT_inc ((SV *)term->perl.self)
119#define SvTERM(sv) (rxvt_term *)SvPTR (sv, "urxvt::term") 119#define SvTERM(sv) (rxvt_term *)SvPTR (sv, "urxvt::term")
120 120
121///////////////////////////////////////////////////////////////////////////// 121/////////////////////////////////////////////////////////////////////////////
122 122
123#define SvWATCHER(sv) (perl_watcher *)SvPTR (sv, "urxvt::watcher")
124
123struct perl_watcher 125struct perl_watcher
124{ 126{
125 SV *cbsv; 127 SV *cbsv;
126 HV *self; 128 HV *self;
127 129
128 perl_watcher () 130 perl_watcher ()
129 : cbsv (newSV (0)) 131 : cbsv (0)
130 { 132 {
131 } 133 }
132 134
133 ~perl_watcher () 135 ~perl_watcher ()
134 { 136 {
135 SvREFCNT_dec (cbsv); 137 SvREFCNT_dec (cbsv);
136 } 138 }
137 139
138 void cb (SV *cb) 140 void cb (SV *cb)
139 { 141 {
140 sv_setsv (cbsv, cb); 142 SvREFCNT_dec (cbsv);
143 cbsv = newSVsv (cb);
141 } 144 }
142 145
143 void invoke (const char *type, SV *self, int arg = -1); 146 void invoke (const char *type, SV *self, int arg = -1);
144}; 147};
145 148
169 if (SvTRUE (ERRSV)) 172 if (SvTRUE (ERRSV))
170 rxvt_warn ("%s callback evaluation error: %s", type, SvPV_nolen (ERRSV)); 173 rxvt_warn ("%s callback evaluation error: %s", type, SvPV_nolen (ERRSV));
171} 174}
172 175
173#define newSVtimer(timer) new_ref (timer->self, "urxvt::timer") 176#define newSVtimer(timer) new_ref (timer->self, "urxvt::timer")
174#define SvTIMER(sv) (timer *)SvPTR (sv, "urxvt::timer") 177#define SvTIMER(sv) (timer *)(perl_watcher *)SvPTR (sv, "urxvt::timer")
175 178
176struct timer : time_watcher, perl_watcher 179struct timer : perl_watcher, time_watcher
177{ 180{
178 tstamp interval; 181 tstamp interval;
179 182
180 timer () 183 timer ()
181 : time_watcher (this, &timer::execute) 184 : time_watcher (this, &timer::execute)
190 invoke ("urxvt::timer", newSVtimer (this)); 193 invoke ("urxvt::timer", newSVtimer (this));
191 } 194 }
192}; 195};
193 196
194#define newSViow(iow) new_ref (iow->self, "urxvt::iow") 197#define newSViow(iow) new_ref (iow->self, "urxvt::iow")
195#define SvIOW(sv) (iow *)SvPTR (sv, "urxvt::iow") 198#define SvIOW(sv) (iow *)(perl_watcher *)SvPTR (sv, "urxvt::iow")
196 199
197struct iow : io_watcher, perl_watcher 200struct iow : perl_watcher, io_watcher
198{ 201{
199 iow () 202 iow ()
200 : io_watcher (this, &iow::execute) 203 : io_watcher (this, &iow::execute)
201 { 204 {
202 } 205 }
205 { 208 {
206 invoke ("urxvt::iow", newSViow (this), revents); 209 invoke ("urxvt::iow", newSViow (this), revents);
207 } 210 }
208}; 211};
209 212
213#define newSViw(iw) new_ref (iw->self, "urxvt::iw")
214#define SvIW(sv) (iw *)(perl_watcher *)SvPTR (sv, "urxvt::iw")
215
216struct iw : perl_watcher, idle_watcher
217{
218 iw ()
219 : idle_watcher (this, &iw::execute)
220 {
221 }
222
223 void execute (idle_watcher &w)
224 {
225 invoke ("urxvt::iw", newSViw (this));
226 }
227};
228
229#define newSVpw(pw) new_ref (pw->self, "urxvt::pw")
230#define SvPW(sv) (pw *)(perl_watcher *)SvPTR (sv, "urxvt::pw")
231
232struct pw : perl_watcher, child_watcher
233{
234 pw ()
235 : child_watcher (this, &pw::execute)
236 {
237 }
238
239 void execute (child_watcher &w, int status)
240 {
241 invoke ("urxvt::pw", newSVpw (this), status);
242 }
243};
244
210///////////////////////////////////////////////////////////////////////////// 245/////////////////////////////////////////////////////////////////////////////
211 246
212#define SvOVERLAY(sv) (overlay *)SvPTR (sv, "urxvt::overlay") 247#define SvOVERLAY(sv) (overlay *)SvPTR (sv, "urxvt::overlay")
213 248
214struct overlay { 249struct overlay {
215 HV *self; 250 HV *self;
251 bool visible;
216 rxvt_term *THIS; 252 rxvt_term *THIS;
217 int x, y, w, h; 253 int x, y, w, h;
218 int border; 254 int border;
219 text_t **text; 255 text_t **text;
220 rend_t **rend; 256 rend_t **rend;
229 265
230 void set (int x, int y, SV *str, SV *rend); 266 void set (int x, int y, SV *str, SV *rend);
231}; 267};
232 268
233overlay::overlay (rxvt_term *THIS, int x_, int y_, int w_, int h_, rend_t rstyle, int border) 269overlay::overlay (rxvt_term *THIS, int x_, int y_, int w_, int h_, rend_t rstyle, int border)
234: THIS(THIS), x(x_), y(y_), w(w_), h(h_), border(border == 2) 270: THIS(THIS), x(x_), y(y_), w(w_), h(h_), border(border == 2), visible(false)
235{ 271{
236 if (border == 2) 272 if (border == 2)
237 { 273 {
238 w += 2; 274 w += 2;
239 h += 2; 275 h += 2;
300} 336}
301 337
302void 338void
303overlay::show () 339overlay::show ()
304{ 340{
305 char key[33]; sprintf (key, "%32lx", (long)this); 341 if (visible)
342 return;
306 343
344 visible = true;
345
307 HV *hv = (HV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)THIS->perl.self), "_overlay", 8, 0)); 346 AV *av = (AV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)THIS->perl.self), "_overlay", 8, 0));
308 hv_store (hv, key, 32, newSViv ((long)this), 0); 347 av_push (av, newSViv ((long)this));
309} 348}
310 349
311void 350void
312overlay::hide () 351overlay::hide ()
313{ 352{
353 if (!visible)
354 return;
355
356 visible = false;
357
314 SV **ovs = hv_fetch ((HV *)SvRV ((SV *)THIS->perl.self), "_overlay", 8, 0); 358 AV *av = (AV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)THIS->perl.self), "_overlay", 8, 0));
315 359
316 if (ovs) 360 int i;
361
362 for (i = AvFILL (av); i >= 0; i--)
363 if (SvIV (*av_fetch (av, i, 1)) == (long)this)
317 { 364 {
318 char key[33]; sprintf (key, "%32lx", (long)this);
319
320 HV *hv = (HV *)SvRV (*ovs);
321 hv_delete (hv, key, 32, G_DISCARD); 365 av_delete (av, i, G_DISCARD);
366 break;
322 } 367 }
368
369 for (; i < AvFILL (av); i++)
370 av_store (av, i, SvREFCNT_inc (*av_fetch (av, i + 1, 0)));
371
372 av_pop (av);
323} 373}
324 374
325void overlay::swap () 375void overlay::swap ()
326{ 376{
327 int ov_x = max (0, min (MOD (x, THIS->ncol), THIS->ncol - w)); 377 int ov_x = max (0, min (MOD (x, THIS->ncol), THIS->ncol - w));
367 if (!SvROK (rend) || SvTYPE (SvRV (rend)) != SVt_PVAV) 417 if (!SvROK (rend) || SvTYPE (SvRV (rend)) != SVt_PVAV)
368 croak ("rend must be arrayref"); 418 croak ("rend must be arrayref");
369 419
370 AV *av = (AV *)SvRV (rend); 420 AV *av = (AV *)SvRV (rend);
371 421
372 for (int col = min (av_len (av) + 1, w - x - border); col--; ) 422 for (int col = min (AvFILL (av) + 1, w - x - border); col--; )
373 this->rend [y][x + col] = SvIV (*av_fetch (av, col, 1)); 423 this->rend [y][x + col] = SvIV (*av_fetch (av, col, 1));
374 } 424 }
375 425
376 THIS->want_refresh = 1; 426 THIS->want_refresh = 1;
377} 427}
402 perl_environ = rxvt_environ; 452 perl_environ = rxvt_environ;
403 swap (perl_environ, environ); 453 swap (perl_environ, environ);
404 454
405 char *argv[] = { 455 char *argv[] = {
406 "", 456 "",
407 "-edo '" LIBDIR "/urxvt.pm' or ($@ and die $@) or exit 1", 457 "-e"
458 "BEGIN {"
459 " urxvt->bootstrap;"
460 " unshift @INC, '" LIBDIR "';"
461 "}"
462 ""
463 "use urxvt;"
408 }; 464 };
409 465
410 perl = perl_alloc (); 466 perl = perl_alloc ();
411 perl_construct (perl); 467 perl_construct (perl);
412 468
427 483
428 if (perl) 484 if (perl)
429 { 485 {
430 // runs outside of perls ENV 486 // runs outside of perls ENV
431 term->perl.self = (void *)newSVptr ((void *)term, "urxvt::term"); 487 term->perl.self = (void *)newSVptr ((void *)term, "urxvt::term");
432 hv_store ((HV *)SvRV ((SV *)term->perl.self), "_overlay", 8, newRV_noinc ((SV *)newHV ()), 0); 488 hv_store ((HV *)SvRV ((SV *)term->perl.self), "_overlay", 8, newRV_noinc ((SV *)newAV ()), 0);
433 } 489 }
434} 490}
435 491
436static void 492static void
437ungrab (rxvt_term *THIS) 493ungrab (rxvt_term *THIS)
442 XUngrabPointer (THIS->display->display, THIS->perl.grabtime); 498 XUngrabPointer (THIS->display->display, THIS->perl.grabtime);
443 THIS->perl.grabtime = 0; 499 THIS->perl.grabtime = 0;
444 } 500 }
445} 501}
446 502
447static void
448swap_overlays (rxvt_term *term)
449{
450 HV *hv = (HV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)term->perl.self), "_overlay", 8, 0));
451
452 if (HvKEYS (hv))
453 {
454 hv_iterinit (hv);
455
456 while (HE *he = hv_iternext (hv))
457 ((overlay *)SvIV (hv_iterval (hv, he)))->swap ();
458 }
459}
460
461bool 503bool
462rxvt_perl_interp::invoke (rxvt_term *term, hook_type htype, ...) 504rxvt_perl_interp::invoke (rxvt_term *term, hook_type htype, ...)
463{ 505{
464 if (!perl || !term->perl.self) 506 if (!perl || !term->perl.self)
465 return false; 507 return false;
466 508
467 // pre-handling of some events 509 // pre-handling of some events
468 if (htype == HOOK_REFRESH_END) 510 if (htype == HOOK_REFRESH_END)
469 swap_overlays (term); 511 {
512 AV *av = (AV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)term->perl.self), "_overlay", 8, 0));
513
514 for (int i = 0; i <= AvFILL (av); i++)
515 ((overlay *)SvIV (*av_fetch (av, i, 0)))->swap ();
516 }
470 517
471 swap (perl_environ, environ); 518 swap (perl_environ, environ);
472 519
473 bool event_consumed; 520 bool event_consumed;
474 521
507 break; 554 break;
508 555
509 case DT_STR_LEN: 556 case DT_STR_LEN:
510 { 557 {
511 char *str = va_arg (ap, char *); 558 char *str = va_arg (ap, char *);
512 int len = va_arg (ap, int); 559 int len = va_arg (ap, int);
513 560
561 printf ("pushing str %p:%d\n", str,len);//D
514 XPUSHs (sv_2mortal (newSVpvn (str, len))); 562 XPUSHs (sv_2mortal (newSVpvn (str, len)));
515 } 563 }
516 break; 564 break;
517 565
518 case DT_WCS_LEN: 566 case DT_WCS_LEN:
519 { 567 {
520 wchar_t *wstr = va_arg (ap, wchar_t *); 568 wchar_t *wstr = va_arg (ap, wchar_t *);
521 int wlen = va_arg (ap, int); 569 int wlen = va_arg (ap, int);
522 570
523 XPUSHs (sv_2mortal (wcs2sv (wstr, wlen))); 571 XPUSHs (sv_2mortal (wcs2sv (wstr, wlen)));
572 }
573 break;
574
575 case DT_LCS_LEN:
576 {
577 long *lstr = va_arg (ap, long *);
578 int llen = va_arg (ap, int);
579
580 XPUSHs (sv_2mortal (newSVpvn ((char *)lstr, llen * sizeof (long))));
524 } 581 }
525 break; 582 break;
526 583
527 case DT_XEVENT: 584 case DT_XEVENT:
528 { 585 {
529 XEvent *xe = va_arg (ap, XEvent *); 586 XEvent *xe = va_arg (ap, XEvent *);
530 HV *hv = newHV (); 587 HV *hv = newHV ();
531 588
532# define set(name, sv) hv_store (hv, # name, sizeof (# name) - 1, sv, 0) 589# define set(name, sv) hv_store (hv, # name, sizeof (# name) - 1, sv, 0)
533# define setiv(name, val) hv_store (hv, # name, sizeof (# name) - 1, newSViv (val), 0) 590# define setiv(name, val) hv_store (hv, # name, sizeof (# name) - 1, newSViv (val), 0)
591# define setuv(name, val) hv_store (hv, # name, sizeof (# name) - 1, newSVuv (val), 0)
534# undef set 592# undef set
535 593
536 setiv (type, xe->type); 594 setiv (type, xe->type);
537 setiv (send_event, xe->xany.send_event); 595 setiv (send_event, xe->xany.send_event);
538 setiv (serial, xe->xany.serial); 596 setiv (serial, xe->xany.serial);
539 597
542 case KeyPress: 600 case KeyPress:
543 case KeyRelease: 601 case KeyRelease:
544 case ButtonPress: 602 case ButtonPress:
545 case ButtonRelease: 603 case ButtonRelease:
546 case MotionNotify: 604 case MotionNotify:
605 setuv (window, xe->xmotion.window);
606 setuv (root, xe->xmotion.root);
607 setuv (subwindow, xe->xmotion.subwindow);
547 setiv (time, xe->xmotion.time); 608 setuv (time, xe->xmotion.time);
548 setiv (x, xe->xmotion.x); 609 setiv (x, xe->xmotion.x);
549 setiv (y, xe->xmotion.y); 610 setiv (y, xe->xmotion.y);
550 setiv (row, xe->xmotion.y / term->fheight); 611 setiv (row, xe->xmotion.y / term->fheight + term->view_start);
551 setiv (col, xe->xmotion.x / term->fwidth); 612 setiv (col, xe->xmotion.x / term->fwidth);
552 setiv (x_root, xe->xmotion.x_root); 613 setiv (x_root, xe->xmotion.x_root);
553 setiv (y_root, xe->xmotion.y_root); 614 setiv (y_root, xe->xmotion.y_root);
554 setiv (state, xe->xmotion.state); 615 setuv (state, xe->xmotion.state);
616
617 switch (xe->type)
618 {
619 case KeyPress:
620 case KeyRelease:
621 setuv (keycode, xe->xkey.keycode);
622 break;
623
624 case ButtonPress:
625 case ButtonRelease:
626 setuv (button, xe->xbutton.button);
627 break;
628
629 case MotionNotify:
630 setiv (is_hint, xe->xmotion.is_hint);
631 break;
632 }
633
555 break; 634 break;
556 }
557 635
636 case MapNotify:
637 case UnmapNotify:
638 case ConfigureNotify:
639 setuv (event, xe->xconfigure.event);
640 setuv (window, xe->xconfigure.window);
641
558 switch (xe->type) 642 switch (xe->type)
559 { 643 {
560 case KeyPress: 644 case ConfigureNotify:
561 case KeyRelease: 645 setiv (x, xe->xconfigure.x);
562 setiv (keycode, xe->xkey.keycode); 646 setiv (y, xe->xconfigure.y);
647 setiv (width, xe->xconfigure.width);
648 setiv (height, xe->xconfigure.height);
649 setuv (above, xe->xconfigure.above);
650 break;
651 }
652
563 break; 653 break;
564 654
565 case ButtonPress: 655 case PropertyNotify:
566 case ButtonRelease: 656 setuv (window, xe->xproperty.window);
567 setiv (button, xe->xbutton.button); 657 setuv (atom, xe->xproperty.atom);
658 setuv (time, xe->xproperty.time);
659 setiv (state, xe->xproperty.state);
568 break; 660 break;
569 661
570 case MotionNotify: 662 case ClientMessage:
571 setiv (is_hint, xe->xmotion.is_hint); 663 setuv (window, xe->xclient.window);
664 setuv (message_type, xe->xclient.message_type);
665 setuv (format, xe->xclient.format);
666 setuv (l0, xe->xclient.data.l[0]);
667 setuv (l1, xe->xclient.data.l[1]);
668 setuv (l2, xe->xclient.data.l[2]);
669 setuv (l3, xe->xclient.data.l[3]);
670 setuv (l4, xe->xclient.data.l[4]);
572 break; 671 break;
573 } 672 }
574 673
575 XPUSHs (sv_2mortal (newRV_noinc ((SV *)hv))); 674 XPUSHs (sv_2mortal (newRV_noinc ((SV *)hv)));
576 } 675 }
617 else 716 else
618 event_consumed = false; 717 event_consumed = false;
619 718
620 // post-handling of some events 719 // post-handling of some events
621 if (htype == HOOK_REFRESH_BEGIN) 720 if (htype == HOOK_REFRESH_BEGIN)
622 swap_overlays (term); 721 {
722 AV *av = (AV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)term->perl.self), "_overlay", 8, 0));
723
724 for (int i = AvFILL (av); i >= 0; i--)
725 ((overlay *)SvIV (*av_fetch (av, i, 0)))->swap ();
726 }
623 else if (htype == HOOK_DESTROY) 727 else if (htype == HOOK_DESTROY)
624 { 728 {
625 clearSVptr ((SV *)term->perl.self); 729 clearSVptr ((SV *)term->perl.self);
626 SvREFCNT_dec ((SV *)term->perl.self); 730 SvREFCNT_dec ((SV *)term->perl.self);
731
732 // don't allow further calls
733 term->perl.self = 0;
627 } 734 }
628 735
629 swap (perl_environ, environ); 736 swap (perl_environ, environ);
630 737
631 return event_consumed; 738 return event_consumed;
748 const_iv (SelectionRequest), 855 const_iv (SelectionRequest),
749 const_iv (SelectionNotify), 856 const_iv (SelectionNotify),
750 const_iv (ColormapNotify), 857 const_iv (ColormapNotify),
751 const_iv (ClientMessage), 858 const_iv (ClientMessage),
752 const_iv (MappingNotify), 859 const_iv (MappingNotify),
860# if ENABLE_XIM_ONTHESPOT
861 const_iv (XIMReverse),
862 const_iv (XIMUnderline),
863 const_iv (XIMHighlight),
864 const_iv (XIMPrimary),
865 const_iv (XIMSecondary),
866 const_iv (XIMTertiary),
867 const_iv (XIMVisibleToForward),
868 const_iv (XIMVisibleToBackword),
869 const_iv (XIMVisibleToCenter),
870
871 const_iv (XIMForwardChar),
872 const_iv (XIMBackwardChar),
873 const_iv (XIMForwardWord),
874 const_iv (XIMBackwardWord),
875 const_iv (XIMCaretUp),
876 const_iv (XIMCaretDown),
877 const_iv (XIMNextLine),
878 const_iv (XIMPreviousLine),
879 const_iv (XIMLineStart),
880 const_iv (XIMLineEnd),
881 const_iv (XIMAbsolutePosition),
882 const_iv (XIMDontChange),
883# endif
753 }; 884 };
754 885
755 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); 886 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]);
756 civ-- > const_iv; ) 887 civ-- > const_iv; )
757 newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); 888 newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv));
834 if (items < 1 || !SvROK (ST (0)) || SvTYPE (SvRV (ST (0))) != SVt_PVAV) 965 if (items < 1 || !SvROK (ST (0)) || SvTYPE (SvRV (ST (0))) != SVt_PVAV)
835 croak ("first argument to urxvt::term->_new must be arrayref"); 966 croak ("first argument to urxvt::term->_new must be arrayref");
836 967
837 rxvt_term *term = new rxvt_term; 968 rxvt_term *term = new rxvt_term;
838 969
839 term->argv = new stringvec; 970 stringvec *argv = new stringvec;
840 term->envv = new stringvec; 971 stringvec *envv = new stringvec;
841 972
842 for (int i = 1; i < items; i++) 973 for (int i = 1; i < items; i++)
843 term->argv->push_back (strdup (SvPVbyte_nolen (ST (i)))); 974 argv->push_back (strdup (SvPVbyte_nolen (ST (i))));
844 975
845 AV *envv = (AV *)SvRV (ST (0)); 976 AV *env = (AV *)SvRV (ST (0));
846 for (int i = av_len (envv) + 1; i--; ) 977 for (int i = AvFILL (env) + 1; i--; )
847 term->envv->push_back (strdup (SvPVbyte_nolen (*av_fetch (envv, i, 1)))); 978 envv->push_back (strdup (SvPVbyte_nolen (*av_fetch (env, i, 1))));
848 979
849 term->envv->push_back (0); 980 envv->push_back (0);
850 981
851 bool success; 982 bool success;
852 983
853 try 984 try
854 { 985 {
855 success = term->init (term->argv->size (), term->argv->begin ()); 986 success = term->init (argv, envv);
856 } 987 }
857 catch (const class rxvt_failure_exception &e) 988 catch (const class rxvt_failure_exception &e)
858 { 989 {
859 success = false; 990 success = false;
860 } 991 }
872 RETVAL 1003 RETVAL
873 1004
874void 1005void
875rxvt_term::destroy () 1006rxvt_term::destroy ()
876 1007
877#if ENABLE_PERL_FRILLS
878
879void
880rxvt_term::XListProperties (U32 window)
881 PPCODE:
882{
883 int count;
884 Atom *props = XListProperties (THIS->display->display, (Window)window, &count);
885
886 EXTEND (SP, count);
887 while (count--)
888 PUSHs (newSVuv ((U32)props [count]));
889
890 XFree (props);
891}
892
893void
894rxvt_term::XGetWindowProperty (U32 window, U32 property)
895 PPCODE:
896{
897 Atom type;
898 int format;
899 unsigned long nitems;
900 unsigned long bytes_after;
901 unsigned char *prop;
902 XGetWindowProperty (THIS->display->display, (Window)window, (Atom)property,
903 0, 1<<30, 0, AnyPropertyType,
904 &type, &format, &nitems, &bytes_after, &prop);
905 if (type != None)
906 {
907 EXTEND (SP, 3);
908 PUSHs (newSVuv ((U32)type));
909 PUSHs (newSViv (format));
910 PUSHs (newSVpvn ((char *)prop, nitems * format / 8));
911 XFree (prop);
912 }
913}
914
915void
916rxvt_term::XChangeWindowProperty (U32 window, U32 property, U32 type, int format, SV *data)
917 CODE:
918{
919 STRLEN len;
920 char *data_ = SvPVbyte (data, len);
921
922 XChangeProperty (THIS->display->display, (Window)window, (Atom)property,
923 type, format, PropModeReplace,
924 (unsigned char *)data, len * 8 / format);
925}
926
927void
928rxvt_term::XDeleteProperty (U32 window, U32 property)
929 CODE:
930 XDeleteProperty (THIS->display->display, (Window)window, (Atom)property);
931
932U32
933rxvt_term::DefaultRootWindow ()
934 CODE:
935 RETVAL = (U32)THIS->display->root;
936 OUTPUT:
937 RETVAL
938
939U32
940rxvt_term::XCreateSimpleWindow (U32 parent, int x, int y, unsigned int width, unsigned int height)
941 CODE:
942 RETVAL = XCreateSimpleWindow (THIS->display->display, (Window)parent,
943 x, y, width, height, 0,
944 THIS->pix_colors_focused[Color_border],
945 THIS->pix_colors_focused[Color_border]);
946 OUTPUT:
947 RETVAL
948
949void
950rxvt_term::XReparentWindow (U32 window, U32 parent, int x = 0, int y = 0)
951 CODE:
952 XReparentWindow (THIS->display->display, (Window)window, (Window)parent, x, y);
953
954void
955rxvt_term::XMapWindow (U32 window)
956 CODE:
957 XMapWindow (THIS->display->display, (Window)window);
958
959void
960rxvt_term::XUnmapWindow (U32 window)
961 CODE:
962 XUnmapWindow (THIS->display->display, (Window)window);
963
964#endif
965
966void 1008void
967rxvt_term::set_should_invoke (int htype, int inc) 1009rxvt_term::set_should_invoke (int htype, int inc)
968 CODE: 1010 CODE:
969 THIS->perl.should_invoke [htype] += inc; 1011 THIS->perl.should_invoke [htype] += inc;
970 1012
974 XGrabButton (THIS->display->display, button, modifiers, THIS->vt, 1, 1016 XGrabButton (THIS->display->display, button, modifiers, THIS->vt, 1,
975 ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask, 1017 ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask,
976 GrabModeSync, GrabModeSync, None, GRAB_CURSOR); 1018 GrabModeSync, GrabModeSync, None, GRAB_CURSOR);
977 1019
978bool 1020bool
979rxvt_term::grab (U32 eventtime, int sync = 0) 1021rxvt_term::grab (Time eventtime, int sync = 0)
980 CODE: 1022 CODE:
981{ 1023{
982 int mode = sync ? GrabModeSync : GrabModeAsync; 1024 int mode = sync ? GrabModeSync : GrabModeAsync;
983 1025
984 THIS->perl.grabtime = 0; 1026 THIS->perl.grabtime = 0;
1076#define TERM_OFFSET_fbase TERM_OFFSET(fbase) 1118#define TERM_OFFSET_fbase TERM_OFFSET(fbase)
1077#define TERM_OFFSET_nrow TERM_OFFSET(nrow) 1119#define TERM_OFFSET_nrow TERM_OFFSET(nrow)
1078#define TERM_OFFSET_ncol TERM_OFFSET(ncol) 1120#define TERM_OFFSET_ncol TERM_OFFSET(ncol)
1079#define TERM_OFFSET_focus TERM_OFFSET(focus) 1121#define TERM_OFFSET_focus TERM_OFFSET(focus)
1080#define TERM_OFFSET_mapped TERM_OFFSET(mapped) 1122#define TERM_OFFSET_mapped TERM_OFFSET(mapped)
1123#define TERM_OFFSET_int_bwidth TERM_OFFSET(int_bwidth)
1124#define TERM_OFFSET_ext_bwidth TERM_OFFSET(ext_bwidth)
1125#define TERM_OFFSET_lineSpace TERM_OFFSET(lineSpace)
1081#define TERM_OFFSET_saveLines TERM_OFFSET(saveLines) 1126#define TERM_OFFSET_saveLines TERM_OFFSET(saveLines)
1082#define TERM_OFFSET_total_rows TERM_OFFSET(total_rows) 1127#define TERM_OFFSET_total_rows TERM_OFFSET(total_rows)
1083#define TERM_OFFSET_top_row TERM_OFFSET(top_row) 1128#define TERM_OFFSET_top_row TERM_OFFSET(top_row)
1084 1129
1085int 1130int
1092 fbase = TERM_OFFSET_fbase 1137 fbase = TERM_OFFSET_fbase
1093 nrow = TERM_OFFSET_nrow 1138 nrow = TERM_OFFSET_nrow
1094 ncol = TERM_OFFSET_ncol 1139 ncol = TERM_OFFSET_ncol
1095 focus = TERM_OFFSET_focus 1140 focus = TERM_OFFSET_focus
1096 mapped = TERM_OFFSET_mapped 1141 mapped = TERM_OFFSET_mapped
1142 int_bwidth = TERM_OFFSET_int_bwidth
1143 ext_bwidth = TERM_OFFSET_ext_bwidth
1144 lineSpace = TERM_OFFSET_lineSpace
1097 saveLines = TERM_OFFSET_saveLines 1145 saveLines = TERM_OFFSET_saveLines
1098 total_rows = TERM_OFFSET_total_rows 1146 total_rows = TERM_OFFSET_total_rows
1099 top_row = TERM_OFFSET_top_row 1147 top_row = TERM_OFFSET_top_row
1100 CODE: 1148 CODE:
1101 RETVAL = *(int *)((char *)THIS + ix); 1149 RETVAL = *(int *)((char *)THIS + ix);
1106rxvt_term::ModLevel3Mask () 1154rxvt_term::ModLevel3Mask ()
1107 ALIAS: 1155 ALIAS:
1108 ModLevel3Mask = 0 1156 ModLevel3Mask = 0
1109 ModMetaMask = 1 1157 ModMetaMask = 1
1110 ModNumLockMask = 2 1158 ModNumLockMask = 2
1159 current_screen = 3
1160 hidden_cursor = 4
1111 CODE: 1161 CODE:
1112 switch (ix) 1162 switch (ix)
1113 { 1163 {
1114 case 0: RETVAL = THIS->ModLevel3Mask; break; 1164 case 0: RETVAL = THIS->ModLevel3Mask; break;
1115 case 1: RETVAL = THIS->ModMetaMask; break; 1165 case 1: RETVAL = THIS->ModMetaMask; break;
1116 case 2: RETVAL = THIS->ModNumLockMask; break; 1166 case 2: RETVAL = THIS->ModNumLockMask; break;
1167 case 3: RETVAL = THIS->current_screen; break;
1168 case 4: RETVAL = THIS->hidden_cursor; break;
1117 } 1169 }
1118 OUTPUT: 1170 OUTPUT:
1119 RETVAL 1171 RETVAL
1120 1172
1121char * 1173char *
1159 if (events != EVENT_UNDEF) 1211 if (events != EVENT_UNDEF)
1160 THIS->pty_ev.set (events); 1212 THIS->pty_ev.set (events);
1161 OUTPUT: 1213 OUTPUT:
1162 RETVAL 1214 RETVAL
1163 1215
1164U32 1216int
1217rxvt_term::pty_fd ()
1218 CODE:
1219 RETVAL = THIS->pty->pty;
1220 OUTPUT:
1221 RETVAL
1222
1223Window
1165rxvt_term::parent () 1224rxvt_term::parent ()
1166 CODE: 1225 CODE:
1167 RETVAL = (U32)THIS->parent [0]; 1226 RETVAL = THIS->parent [0];
1168 OUTPUT: 1227 OUTPUT:
1169 RETVAL 1228 RETVAL
1170 1229
1171U32 1230Window
1172rxvt_term::vt () 1231rxvt_term::vt ()
1173 CODE: 1232 CODE:
1174 RETVAL = (U32)THIS->vt; 1233 RETVAL = THIS->vt;
1175 OUTPUT: 1234 OUTPUT:
1176 RETVAL 1235 RETVAL
1177 1236
1178void 1237void
1179rxvt_term::vt_emask_add (U32 emask) 1238rxvt_term::vt_emask_add (U32 emask)
1201} 1260}
1202 OUTPUT: 1261 OUTPUT:
1203 RETVAL 1262 RETVAL
1204 1263
1205void 1264void
1265rxvt_term::focus_in ()
1266
1267void
1268rxvt_term::focus_out ()
1269
1270void
1206rxvt_term::want_refresh () 1271rxvt_term::want_refresh ()
1207 CODE: 1272 CODE:
1208 THIS->want_refresh = 1; 1273 THIS->want_refresh = 1;
1209 1274
1210void 1275void
1216 1281
1217 line_t &l = ROW(row_number); 1282 line_t &l = ROW(row_number);
1218 1283
1219 if (GIMME_V != G_VOID) 1284 if (GIMME_V != G_VOID)
1220 { 1285 {
1221 wchar_t *wstr = new wchar_t [THIS->ncol]; 1286 wchar_t *wstr = rxvt_temp_buf<wchar_t> (THIS->ncol);
1222 1287
1223 for (int col = 0; col < THIS->ncol; col++) 1288 for (int col = 0; col < THIS->ncol; col++)
1224 wstr [col] = l.t [col]; 1289 wstr [col] = l.t [col];
1225 1290
1226 XPUSHs (sv_2mortal (wcs2sv (wstr, THIS->ncol))); 1291 XPUSHs (sv_2mortal (wcs2sv (wstr, THIS->ncol)));
1227
1228 delete [] wstr;
1229 } 1292 }
1230 1293
1231 if (new_text) 1294 if (new_text)
1232 { 1295 {
1233 wchar_t *wstr = sv2wcs (new_text); 1296 wchar_t *wstr = sv2wcs (new_text);
1234 1297
1235 int len = min (wcslen (wstr) - start_ofs, max_len); 1298 int len = min (wcslen (wstr) - start_ofs, max_len);
1236 1299
1237 if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len)) 1300 if (start_col < 0 || start_col + len > THIS->ncol)
1238 { 1301 {
1239 free (wstr); 1302 free (wstr);
1240 croak ("new_text extends beyond horizontal margins"); 1303 croak ("new_text extends beyond horizontal margins");
1241 } 1304 }
1242 1305
1274 { 1337 {
1275 if (!SvROK (new_rend) || SvTYPE (SvRV (new_rend)) != SVt_PVAV) 1338 if (!SvROK (new_rend) || SvTYPE (SvRV (new_rend)) != SVt_PVAV)
1276 croak ("new_rend must be arrayref"); 1339 croak ("new_rend must be arrayref");
1277 1340
1278 AV *av = (AV *)SvRV (new_rend); 1341 AV *av = (AV *)SvRV (new_rend);
1279 int len = min (av_len (av) + 1 - start_ofs, max_len); 1342 int len = min (AvFILL (av) + 1 - start_ofs, max_len);
1280 1343
1281 if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len)) 1344 if (start_col < 0 || start_col + len > THIS->ncol)
1282 croak ("new_rend array extends beyond horizontal margins"); 1345 croak ("new_rend array extends beyond horizontal margins");
1283 1346
1284 for (int col = start_col; col < start_col + len; col++) 1347 for (int col = start_col; col < start_col + len; col++)
1285 { 1348 {
1286 rend_t r = SvIV (*av_fetch (av, start_ofs + col - start_col, 1)) & ~RS_fontMask; 1349 rend_t r = SvIV (*av_fetch (av, start_ofs + col - start_col, 1)) & ~RS_fontMask;
1326rxvt_term::special_encode (SV *string) 1389rxvt_term::special_encode (SV *string)
1327 CODE: 1390 CODE:
1328{ 1391{
1329 wchar_t *wstr = sv2wcs (string); 1392 wchar_t *wstr = sv2wcs (string);
1330 int wlen = wcslen (wstr); 1393 int wlen = wcslen (wstr);
1331 wchar_t *rstr = new wchar_t [wlen]; // cannot become longer 1394 wchar_t *rstr = rxvt_temp_buf<wchar_t> (wlen * 2); // cannot become longer
1332 1395
1333 rxvt_push_locale (THIS->locale); 1396 rxvt_push_locale (THIS->locale);
1334 1397
1335 wchar_t *r = rstr; 1398 wchar_t *r = rstr;
1336 for (wchar_t *s = wstr; *s; s++) 1399 for (wchar_t *s = wstr; *s; s++)
1400 {
1401 int w = WCWIDTH (*s);
1402
1337 if (wcwidth (*s) == 0) 1403 if (w == 0)
1338 { 1404 {
1339 if (r == rstr) 1405 if (r == rstr)
1340 croak ("leading combining character unencodable"); 1406 croak ("leading combining character unencodable");
1341 1407
1342 unicode_t n = rxvt_compose (r[-1], *s); 1408 unicode_t n = rxvt_compose (r[-1], *s);
1343 if (n == NOCHAR) 1409 if (n == NOCHAR)
1344 n = rxvt_composite.compose (r[-1], *s); 1410 n = rxvt_composite.compose (r[-1], *s);
1345 1411
1346 r[-1] = n; 1412 r[-1] = n;
1347 } 1413 }
1348#if !UNICODE_3 1414#if !UNICODE_3
1349 else if (*s >= 0x10000) 1415 else if (*s >= 0x10000)
1350 *r++ = rxvt_composite.compose (*s); 1416 *r++ = rxvt_composite.compose (*s);
1351#endif 1417#endif
1352 else 1418 else
1353 *r++ = *s; 1419 *r++ = *s;
1420
1421 // the *2 above only allows wcwidth <= 2
1422 if (w > 1)
1423 *r++ = NOCHAR;
1424 }
1354 1425
1355 rxvt_pop_locale (); 1426 rxvt_pop_locale ();
1356 1427
1357 RETVAL = wcs2sv (rstr, r - rstr); 1428 RETVAL = wcs2sv (rstr, r - rstr);
1358
1359 delete [] rstr;
1360} 1429}
1361 OUTPUT: 1430 OUTPUT:
1362 RETVAL 1431 RETVAL
1363 1432
1364SV * 1433SV *
1376 else if (IS_COMPOSE (*s)) 1445 else if (IS_COMPOSE (*s))
1377 dlen += rxvt_composite.expand (*s, 0); 1446 dlen += rxvt_composite.expand (*s, 0);
1378 else 1447 else
1379 dlen++; 1448 dlen++;
1380 1449
1381 wchar_t *rstr = new wchar_t [dlen]; 1450 wchar_t *rstr = rxvt_temp_buf<wchar_t> (dlen);
1382 1451
1383 // decode 1452 // decode
1384 wchar_t *r = rstr; 1453 wchar_t *r = rstr;
1385 for (wchar_t *s = wstr; *s; s++) 1454 for (wchar_t *s = wstr; *s; s++)
1386 if (*s == NOCHAR) 1455 if (*s == NOCHAR)
1389 r += rxvt_composite.expand (*s, r); 1458 r += rxvt_composite.expand (*s, r);
1390 else 1459 else
1391 *r++ = *s; 1460 *r++ = *s;
1392 1461
1393 RETVAL = wcs2sv (rstr, r - rstr); 1462 RETVAL = wcs2sv (rstr, r - rstr);
1394
1395 delete [] rstr;
1396} 1463}
1397 OUTPUT: 1464 OUTPUT:
1398 RETVAL 1465 RETVAL
1399 1466
1400void 1467void
1451 if (set) 1518 if (set)
1452 THIS->options |= optval; 1519 THIS->options |= optval;
1453 else 1520 else
1454 THIS->options &= ~optval; 1521 THIS->options &= ~optval;
1455 1522
1523 if (THIS->check_ev.is_active ()) // avoid doing this before START
1456 switch (optval) 1524 switch (optval)
1457 { 1525 {
1458 case Opt_skipBuiltinGlyphs: 1526 case Opt_skipBuiltinGlyphs:
1459 THIS->set_fonts (); 1527 THIS->set_fonts ();
1460 THIS->scr_remap_chars (); 1528 THIS->scr_remap_chars ();
1461 THIS->scr_touch (true); 1529 THIS->scr_touch (true);
1462 THIS->want_refresh = 1; 1530 THIS->want_refresh = 1;
1463 break; 1531 break;
1464 1532
1465 case Opt_cursorUnderline: 1533 case Opt_cursorUnderline:
1466 THIS->want_refresh = 1; 1534 THIS->want_refresh = 1;
1467 break; 1535 break;
1468 1536
1469# case Opt_scrollBar_floating: 1537# case Opt_scrollBar_floating:
1470# case Opt_scrollBar_right: 1538# case Opt_scrollBar_right:
1471# THIS->resize_all_windows (THIS->width, THIS->height, 1); 1539# THIS->resize_all_windows (THIS->width, THIS->height, 1);
1472# break; 1540# break;
1473 } 1541 }
1474 } 1542 }
1475} 1543}
1476 OUTPUT: 1544 OUTPUT:
1477 RETVAL 1545 RETVAL
1478 1546
1506 PUSHs (sv_2mortal (newSViv (rc.col))); 1574 PUSHs (sv_2mortal (newSViv (rc.col)));
1507 } 1575 }
1508 1576
1509 if (items == 3) 1577 if (items == 3)
1510 { 1578 {
1579 rc.row = SvIV (ST (1));
1580 rc.col = SvIV (ST (2));
1581
1582 if (ix == 2)
1583 {
1584 if (rc.col == 0)
1585 {
1586 // col == 0 means end of previous line
1587 rc.row--;
1588 rc.col = THIS->ncol;
1589 }
1590 else if (IN_RANGE_EXC (rc.row, THIS->top_row, THIS->nrow)
1591 && rc.col > ROW(rc.row).l)
1592 {
1593 // col >= length means while line and add newline
1594 rc.col = THIS->ncol;
1595 }
1596 }
1597
1598 clamp_it (rc.col, 0, THIS->ncol);
1511 rc.row = clamp (SvIV (ST (1)), THIS->top_row, THIS->nrow - 1); 1599 clamp_it (rc.row, THIS->top_row, THIS->nrow - 1);
1512 rc.col = clamp (SvIV (ST (2)), 0, THIS->ncol - 1);
1513 1600
1514 if (ix) 1601 if (ix)
1515 THIS->want_refresh = 1; 1602 THIS->want_refresh = 1;
1516 } 1603 }
1517} 1604}
1525 1612
1526#void 1613#void
1527#rxvt_term::selection_clear () 1614#rxvt_term::selection_clear ()
1528 1615
1529void 1616void
1530rxvt_term::selection_make (U32 eventtime, bool rect = false) 1617rxvt_term::selection_make (Time eventtime, bool rect = false)
1531 CODE: 1618 CODE:
1532 THIS->selection.op = SELECTION_CONT; 1619 THIS->selection.op = SELECTION_CONT;
1533 THIS->selection.rect = rect; 1620 THIS->selection.rect = rect;
1534 THIS->selection_make (eventtime); 1621 THIS->selection_make (eventtime);
1535 1622
1536int 1623int
1537rxvt_term::selection_grab (U32 eventtime) 1624rxvt_term::selection_grab (Time eventtime)
1538 1625
1539void 1626void
1540rxvt_term::selection (SV *newtext = 0) 1627rxvt_term::selection (SV *newtext = 0)
1541 PPCODE: 1628 PPCODE:
1542{ 1629{
1560void 1647void
1561rxvt_term::scr_xor_span (int beg_row, int beg_col, int end_row, int end_col, U32 rstyle = RS_RVid) 1648rxvt_term::scr_xor_span (int beg_row, int beg_col, int end_row, int end_col, U32 rstyle = RS_RVid)
1562 1649
1563void 1650void
1564rxvt_term::scr_bell () 1651rxvt_term::scr_bell ()
1652
1653void
1654rxvt_term::scr_change_screen (int screen)
1565 1655
1566void 1656void
1567rxvt_term::scr_add_lines (SV *string) 1657rxvt_term::scr_add_lines (SV *string)
1568 CODE: 1658 CODE:
1569{ 1659{
1610 o->self = (HV *)SvRV (RETVAL); 1700 o->self = (HV *)SvRV (RETVAL);
1611} 1701}
1612 OUTPUT: 1702 OUTPUT:
1613 RETVAL 1703 RETVAL
1614 1704
1705#############################################################################
1706# Various X Utility Functions
1707#############################################################################
1708
1709void
1710rxvt_term::XListProperties (Window window)
1711 PPCODE:
1712{
1713 int count;
1714 Atom *props = XListProperties (THIS->display->display, window, &count);
1715
1716 EXTEND (SP, count);
1717 while (count--)
1718 PUSHs (newSVuv ((U32)props [count]));
1719
1720 XFree (props);
1721}
1722
1723void
1724rxvt_term::XGetWindowProperty (Window window, Atom property)
1725 PPCODE:
1726{
1727 Atom type;
1728 int format;
1729 unsigned long nitems;
1730 unsigned long bytes_after;
1731 unsigned char *prop;
1732
1733 XGetWindowProperty (THIS->display->display, window, property,
1734 0, 1<<24, 0, AnyPropertyType,
1735 &type, &format, &nitems, &bytes_after, &prop);
1736
1737 if (type != None)
1738 {
1739 int elemsize = format == 16 ? sizeof (short)
1740 : format == 32 ? sizeof (long)
1741 : 1;
1742
1743 EXTEND (SP, 3);
1744 PUSHs (newSVuv ((U32)type));
1745 PUSHs (newSViv (format));
1746 PUSHs (newSVpvn ((char *)prop, nitems * elemsize));
1747 XFree (prop);
1748 }
1749}
1750
1751void
1752rxvt_term::XChangeWindowProperty (Window window, Atom property, Atom type, int format, SV *data)
1753 CODE:
1754{
1755 STRLEN len;
1756 char *data_ = SvPVbyte (data, len);
1757
1758 int elemsize = format == 16 ? sizeof (short)
1759 : format == 32 ? sizeof (long)
1760 : 1;
1761
1762 XChangeProperty (THIS->display->display, window, property,
1763 type, format, PropModeReplace,
1764 (unsigned char *)data_, len / elemsize);
1765 XSync (THIS->display->display, 0);
1766}
1767
1768Atom
1769XInternAtom (rxvt_term *term, char *atom_name, int only_if_exists = FALSE)
1770 C_ARGS: term->display->display, atom_name, only_if_exists
1771
1772char *
1773XGetAtomName (rxvt_term *term, Atom atom)
1774 C_ARGS: term->display->display, atom
1775 CLEANUP:
1776 XFree (RETVAL);
1777
1778void
1779XDeleteProperty (rxvt_term *term, Window window, Atom property)
1780 C_ARGS: term->display->display, window, property
1781
1782Window
1783rxvt_term::DefaultRootWindow ()
1784 CODE:
1785 RETVAL = THIS->display->root;
1786 OUTPUT:
1787 RETVAL
1788
1789#if 0
1790
1791Window
1792XCreateSimpleWindow (rxvt_term *term, Window parent, int x, int y, unsigned int width, unsigned int height)
1793 C_ARGS: term->display->display, (Window)parent,
1794 x, y, width, height, 0,
1795 term->pix_colors_focused[Color_border],
1796 term->pix_colors_focused[Color_border]
1797
1798#endif
1799
1800void
1801XReparentWindow (rxvt_term *term, Window window, Window parent, int x = 0, int y = 0)
1802 C_ARGS: term->display->display, window, parent, x, y
1803
1804void
1805XMapWindow (rxvt_term *term, Window window)
1806 C_ARGS: term->display->display, window
1807
1808void
1809XUnmapWindow (rxvt_term *term, Window window)
1810 C_ARGS: term->display->display, window
1811
1812void
1813XMoveResizeWindow (rxvt_term *term, Window window, int x, int y, unsigned int width, unsigned int height)
1814 C_ARGS: term->display->display, window, x, y, width, height
1815
1816void
1817rxvt_term::XChangeInput (Window window, U32 add_events, U32 del_events = 0)
1818 CODE:
1819{
1820 XWindowAttributes attr;
1821 XGetWindowAttributes (THIS->display->display, window, &attr);
1822 XSelectInput (THIS->display->display, window, attr.your_event_mask | add_events & ~del_events);
1823}
1824
1825void
1826rxvt_term::XTranslateCoordinates (Window src, Window dst, int x, int y)
1827 PPCODE:
1828{
1829 int dx, dy;
1830 Window child;
1831
1832 if (XTranslateCoordinates (THIS->display->display, src, dst, x, y, &dx, &dy, &child))
1833 {
1834 EXTEND (SP, 3);
1835 PUSHs (newSViv (dx));
1836 PUSHs (newSViv (dy));
1837 PUSHs (newSVuv (child));
1838 }
1839}
1840
1841#############################################################################
1842# urxvt::overlay
1843#############################################################################
1844
1615MODULE = urxvt PACKAGE = urxvt::overlay 1845MODULE = urxvt PACKAGE = urxvt::overlay
1616 1846
1617void 1847void
1618overlay::set (int x, int y, SV *text, SV *rend = 0) 1848overlay::set (int x, int y, SV *text, SV *rend = 0)
1619 1849
1623void 1853void
1624overlay::hide () 1854overlay::hide ()
1625 1855
1626void 1856void
1627overlay::DESTROY () 1857overlay::DESTROY ()
1858
1859#############################################################################
1860# urxvt::watcher
1861#############################################################################
1862
1863MODULE = urxvt PACKAGE = urxvt::watcher
1864
1865CHAINED
1866perl_watcher::cb (SV *cb)
1867 CODE:
1868 THIS->cb (cb);
1869 OUTPUT:
1870 RETVAL
1871
1872#############################################################################
1873# urxvt::timer
1874#############################################################################
1628 1875
1629MODULE = urxvt PACKAGE = urxvt::timer 1876MODULE = urxvt PACKAGE = urxvt::timer
1630 1877
1631SV * 1878SV *
1632timer::new () 1879timer::new ()
1633 CODE: 1880 CODE:
1634 timer *w = new timer; 1881 timer *w = new timer;
1635 w->start (NOW); 1882 w->start (NOW);
1636 RETVAL = newSVptr ((void *)w, "urxvt::timer"); 1883 RETVAL = newSVptr ((void *)(perl_watcher *)w, "urxvt::timer");
1637 w->self = (HV *)SvRV (RETVAL); 1884 w->self = (HV *)SvRV (RETVAL);
1638 OUTPUT:
1639 RETVAL
1640
1641timer *
1642timer::cb (SV *cb)
1643 CODE:
1644 THIS->cb (cb);
1645 RETVAL = THIS;
1646 OUTPUT: 1885 OUTPUT:
1647 RETVAL 1886 RETVAL
1648 1887
1649NV 1888NV
1650timer::at () 1889timer::at ()
1651 CODE: 1890 CODE:
1652 RETVAL = THIS->at; 1891 RETVAL = THIS->at;
1653 OUTPUT: 1892 OUTPUT:
1654 RETVAL 1893 RETVAL
1655 1894
1656timer * 1895CHAINED
1657timer::interval (NV interval) 1896timer::interval (NV interval)
1658 CODE: 1897 CODE:
1659 THIS->interval = interval; 1898 THIS->interval = interval;
1899 OUTPUT:
1660 RETVAL = THIS; 1900 RETVAL
1661 OUTPUT:
1662 RETVAL
1663 1901
1664timer * 1902CHAINED
1665timer::set (NV tstamp) 1903timer::set (NV tstamp)
1666 CODE: 1904 CODE:
1667 THIS->set (tstamp); 1905 THIS->set (tstamp);
1906 OUTPUT:
1668 RETVAL = THIS; 1907 RETVAL
1669 OUTPUT:
1670 RETVAL
1671 1908
1672timer * 1909CHAINED
1673timer::start (NV tstamp = THIS->at) 1910timer::start (NV tstamp = THIS->at)
1674 CODE: 1911 CODE:
1675 THIS->start (tstamp); 1912 THIS->start (tstamp);
1913 OUTPUT:
1676 RETVAL = THIS; 1914 RETVAL
1677 OUTPUT:
1678 RETVAL
1679 1915
1680timer * 1916CHAINED
1917timer::after (NV delay)
1918 CODE:
1919 THIS->start (NOW + delay);
1920 OUTPUT:
1921 RETVAL
1922
1923CHAINED
1681timer::stop () 1924timer::stop ()
1682 CODE: 1925 CODE:
1683 THIS->stop (); 1926 THIS->stop ();
1684 RETVAL = THIS;
1685 OUTPUT: 1927 OUTPUT:
1686 RETVAL 1928 RETVAL
1687 1929
1688void 1930void
1689timer::DESTROY () 1931timer::DESTROY ()
1932
1933#############################################################################
1934# urxvt::iow
1935#############################################################################
1690 1936
1691MODULE = urxvt PACKAGE = urxvt::iow 1937MODULE = urxvt PACKAGE = urxvt::iow
1692 1938
1693SV * 1939SV *
1694iow::new () 1940iow::new ()
1695 CODE: 1941 CODE:
1696 iow *w = new iow; 1942 iow *w = new iow;
1697 RETVAL = newSVptr ((void *)w, "urxvt::iow"); 1943 RETVAL = newSVptr ((void *)(perl_watcher *)w, "urxvt::iow");
1698 w->self = (HV *)SvRV (RETVAL); 1944 w->self = (HV *)SvRV (RETVAL);
1699 OUTPUT: 1945 OUTPUT:
1700 RETVAL 1946 RETVAL
1701 1947
1702iow * 1948CHAINED
1703iow::cb (SV *cb)
1704 CODE:
1705 THIS->cb (cb);
1706 RETVAL = THIS;
1707 OUTPUT:
1708 RETVAL
1709
1710iow *
1711iow::fd (int fd) 1949iow::fd (int fd)
1712 CODE: 1950 CODE:
1713 THIS->fd = fd; 1951 THIS->fd = fd;
1952 OUTPUT:
1714 RETVAL = THIS; 1953 RETVAL
1715 OUTPUT:
1716 RETVAL
1717 1954
1718iow * 1955CHAINED
1719iow::events (short events) 1956iow::events (short events)
1720 CODE: 1957 CODE:
1721 THIS->events = events; 1958 THIS->events = events;
1959 OUTPUT:
1722 RETVAL = THIS; 1960 RETVAL
1723 OUTPUT:
1724 RETVAL
1725 1961
1726iow * 1962CHAINED
1727iow::start () 1963iow::start ()
1728 CODE: 1964 CODE:
1729 THIS->start (); 1965 THIS->start ();
1966 OUTPUT:
1730 RETVAL = THIS; 1967 RETVAL
1731 OUTPUT:
1732 RETVAL
1733 1968
1734iow * 1969CHAINED
1735iow::stop () 1970iow::stop ()
1736 CODE: 1971 CODE:
1737 THIS->stop (); 1972 THIS->stop ();
1738 RETVAL = THIS;
1739 OUTPUT: 1973 OUTPUT:
1740 RETVAL 1974 RETVAL
1741 1975
1742void 1976void
1743iow::DESTROY () 1977iow::DESTROY ()
1744 1978
1979#############################################################################
1980# urxvt::iw
1981#############################################################################
1745 1982
1983MODULE = urxvt PACKAGE = urxvt::iw
1984
1985SV *
1986iw::new ()
1987 CODE:
1988 iw *w = new iw;
1989 RETVAL = newSVptr ((void *)(perl_watcher *)w, "urxvt::iw");
1990 w->self = (HV *)SvRV (RETVAL);
1991 OUTPUT:
1992 RETVAL
1993
1994CHAINED
1995iw::start ()
1996 CODE:
1997 THIS->start ();
1998 OUTPUT:
1999 RETVAL
2000
2001CHAINED
2002iw::stop ()
2003 CODE:
2004 THIS->stop ();
2005 OUTPUT:
2006 RETVAL
2007
2008void
2009iw::DESTROY ()
2010
2011#############################################################################
2012# urxvt::pw
2013#############################################################################
2014
2015MODULE = urxvt PACKAGE = urxvt::pw
2016
2017SV *
2018pw::new ()
2019 CODE:
2020 pw *w = new pw;
2021 RETVAL = newSVptr ((void *)(perl_watcher *)w, "urxvt::pw");
2022 w->self = (HV *)SvRV (RETVAL);
2023 OUTPUT:
2024 RETVAL
2025
2026CHAINED
2027pw::start (int pid)
2028 CODE:
2029 THIS->start (pid);
2030 OUTPUT:
2031 RETVAL
2032
2033CHAINED
2034pw::stop ()
2035 CODE:
2036 THIS->stop ();
2037 OUTPUT:
2038 RETVAL
2039
2040void
2041pw::DESTROY ()
2042
2043

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines