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.92 by root, Wed Jan 25 00:57:57 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# if 0
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
884# endif
753 }; 885 };
754 886
755 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); 887 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]);
756 civ-- > const_iv; ) 888 civ-- > const_iv; )
757 newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); 889 newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv));
834 if (items < 1 || !SvROK (ST (0)) || SvTYPE (SvRV (ST (0))) != SVt_PVAV) 966 if (items < 1 || !SvROK (ST (0)) || SvTYPE (SvRV (ST (0))) != SVt_PVAV)
835 croak ("first argument to urxvt::term->_new must be arrayref"); 967 croak ("first argument to urxvt::term->_new must be arrayref");
836 968
837 rxvt_term *term = new rxvt_term; 969 rxvt_term *term = new rxvt_term;
838 970
839 term->argv = new stringvec; 971 stringvec *argv = new stringvec;
840 term->envv = new stringvec; 972 stringvec *envv = new stringvec;
841 973
842 for (int i = 1; i < items; i++) 974 for (int i = 1; i < items; i++)
843 term->argv->push_back (strdup (SvPVbyte_nolen (ST (i)))); 975 argv->push_back (strdup (SvPVbyte_nolen (ST (i))));
844 976
845 AV *envv = (AV *)SvRV (ST (0)); 977 AV *env = (AV *)SvRV (ST (0));
846 for (int i = av_len (envv) + 1; i--; ) 978 for (int i = AvFILL (env) + 1; i--; )
847 term->envv->push_back (strdup (SvPVbyte_nolen (*av_fetch (envv, i, 1)))); 979 envv->push_back (strdup (SvPVbyte_nolen (*av_fetch (env, i, 1))));
848 980
849 term->envv->push_back (0); 981 envv->push_back (0);
850 982
851 bool success; 983 bool success;
852 984
853 try 985 try
854 { 986 {
855 success = term->init (term->argv->size (), term->argv->begin ()); 987 success = term->init (argv, envv);
856 } 988 }
857 catch (const class rxvt_failure_exception &e) 989 catch (const class rxvt_failure_exception &e)
858 { 990 {
859 success = false; 991 success = false;
860 } 992 }
872 RETVAL 1004 RETVAL
873 1005
874void 1006void
875rxvt_term::destroy () 1007rxvt_term::destroy ()
876 1008
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 1009void
967rxvt_term::set_should_invoke (int htype, int inc) 1010rxvt_term::set_should_invoke (int htype, int inc)
968 CODE: 1011 CODE:
969 THIS->perl.should_invoke [htype] += inc; 1012 THIS->perl.should_invoke [htype] += inc;
970 1013
974 XGrabButton (THIS->display->display, button, modifiers, THIS->vt, 1, 1017 XGrabButton (THIS->display->display, button, modifiers, THIS->vt, 1,
975 ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask, 1018 ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask,
976 GrabModeSync, GrabModeSync, None, GRAB_CURSOR); 1019 GrabModeSync, GrabModeSync, None, GRAB_CURSOR);
977 1020
978bool 1021bool
979rxvt_term::grab (U32 eventtime, int sync = 0) 1022rxvt_term::grab (Time eventtime, int sync = 0)
980 CODE: 1023 CODE:
981{ 1024{
982 int mode = sync ? GrabModeSync : GrabModeAsync; 1025 int mode = sync ? GrabModeSync : GrabModeAsync;
983 1026
984 THIS->perl.grabtime = 0; 1027 THIS->perl.grabtime = 0;
1076#define TERM_OFFSET_fbase TERM_OFFSET(fbase) 1119#define TERM_OFFSET_fbase TERM_OFFSET(fbase)
1077#define TERM_OFFSET_nrow TERM_OFFSET(nrow) 1120#define TERM_OFFSET_nrow TERM_OFFSET(nrow)
1078#define TERM_OFFSET_ncol TERM_OFFSET(ncol) 1121#define TERM_OFFSET_ncol TERM_OFFSET(ncol)
1079#define TERM_OFFSET_focus TERM_OFFSET(focus) 1122#define TERM_OFFSET_focus TERM_OFFSET(focus)
1080#define TERM_OFFSET_mapped TERM_OFFSET(mapped) 1123#define TERM_OFFSET_mapped TERM_OFFSET(mapped)
1124#define TERM_OFFSET_int_bwidth TERM_OFFSET(int_bwidth)
1125#define TERM_OFFSET_ext_bwidth TERM_OFFSET(ext_bwidth)
1126#define TERM_OFFSET_lineSpace TERM_OFFSET(lineSpace)
1081#define TERM_OFFSET_saveLines TERM_OFFSET(saveLines) 1127#define TERM_OFFSET_saveLines TERM_OFFSET(saveLines)
1082#define TERM_OFFSET_total_rows TERM_OFFSET(total_rows) 1128#define TERM_OFFSET_total_rows TERM_OFFSET(total_rows)
1083#define TERM_OFFSET_top_row TERM_OFFSET(top_row) 1129#define TERM_OFFSET_top_row TERM_OFFSET(top_row)
1084 1130
1085int 1131int
1092 fbase = TERM_OFFSET_fbase 1138 fbase = TERM_OFFSET_fbase
1093 nrow = TERM_OFFSET_nrow 1139 nrow = TERM_OFFSET_nrow
1094 ncol = TERM_OFFSET_ncol 1140 ncol = TERM_OFFSET_ncol
1095 focus = TERM_OFFSET_focus 1141 focus = TERM_OFFSET_focus
1096 mapped = TERM_OFFSET_mapped 1142 mapped = TERM_OFFSET_mapped
1143 int_bwidth = TERM_OFFSET_int_bwidth
1144 ext_bwidth = TERM_OFFSET_ext_bwidth
1145 lineSpace = TERM_OFFSET_lineSpace
1097 saveLines = TERM_OFFSET_saveLines 1146 saveLines = TERM_OFFSET_saveLines
1098 total_rows = TERM_OFFSET_total_rows 1147 total_rows = TERM_OFFSET_total_rows
1099 top_row = TERM_OFFSET_top_row 1148 top_row = TERM_OFFSET_top_row
1100 CODE: 1149 CODE:
1101 RETVAL = *(int *)((char *)THIS + ix); 1150 RETVAL = *(int *)((char *)THIS + ix);
1106rxvt_term::ModLevel3Mask () 1155rxvt_term::ModLevel3Mask ()
1107 ALIAS: 1156 ALIAS:
1108 ModLevel3Mask = 0 1157 ModLevel3Mask = 0
1109 ModMetaMask = 1 1158 ModMetaMask = 1
1110 ModNumLockMask = 2 1159 ModNumLockMask = 2
1160 current_screen = 3
1161 hidden_cursor = 4
1111 CODE: 1162 CODE:
1112 switch (ix) 1163 switch (ix)
1113 { 1164 {
1114 case 0: RETVAL = THIS->ModLevel3Mask; break; 1165 case 0: RETVAL = THIS->ModLevel3Mask; break;
1115 case 1: RETVAL = THIS->ModMetaMask; break; 1166 case 1: RETVAL = THIS->ModMetaMask; break;
1116 case 2: RETVAL = THIS->ModNumLockMask; break; 1167 case 2: RETVAL = THIS->ModNumLockMask; break;
1168 case 3: RETVAL = THIS->current_screen; break;
1169 case 4: RETVAL = THIS->hidden_cursor; break;
1117 } 1170 }
1118 OUTPUT: 1171 OUTPUT:
1119 RETVAL 1172 RETVAL
1120 1173
1121char * 1174char *
1159 if (events != EVENT_UNDEF) 1212 if (events != EVENT_UNDEF)
1160 THIS->pty_ev.set (events); 1213 THIS->pty_ev.set (events);
1161 OUTPUT: 1214 OUTPUT:
1162 RETVAL 1215 RETVAL
1163 1216
1164U32 1217int
1218rxvt_term::pty_fd ()
1219 CODE:
1220 RETVAL = THIS->pty->pty;
1221 OUTPUT:
1222 RETVAL
1223
1224Window
1165rxvt_term::parent () 1225rxvt_term::parent ()
1166 CODE: 1226 CODE:
1167 RETVAL = (U32)THIS->parent [0]; 1227 RETVAL = THIS->parent [0];
1168 OUTPUT: 1228 OUTPUT:
1169 RETVAL 1229 RETVAL
1170 1230
1171U32 1231Window
1172rxvt_term::vt () 1232rxvt_term::vt ()
1173 CODE: 1233 CODE:
1174 RETVAL = (U32)THIS->vt; 1234 RETVAL = THIS->vt;
1175 OUTPUT: 1235 OUTPUT:
1176 RETVAL 1236 RETVAL
1177 1237
1178void 1238void
1179rxvt_term::vt_emask_add (U32 emask) 1239rxvt_term::vt_emask_add (U32 emask)
1201} 1261}
1202 OUTPUT: 1262 OUTPUT:
1203 RETVAL 1263 RETVAL
1204 1264
1205void 1265void
1266rxvt_term::focus_in ()
1267
1268void
1269rxvt_term::focus_out ()
1270
1271void
1206rxvt_term::want_refresh () 1272rxvt_term::want_refresh ()
1207 CODE: 1273 CODE:
1208 THIS->want_refresh = 1; 1274 THIS->want_refresh = 1;
1209 1275
1210void 1276void
1216 1282
1217 line_t &l = ROW(row_number); 1283 line_t &l = ROW(row_number);
1218 1284
1219 if (GIMME_V != G_VOID) 1285 if (GIMME_V != G_VOID)
1220 { 1286 {
1221 wchar_t *wstr = new wchar_t [THIS->ncol]; 1287 wchar_t *wstr = rxvt_temp_buf<wchar_t> (THIS->ncol);
1222 1288
1223 for (int col = 0; col < THIS->ncol; col++) 1289 for (int col = 0; col < THIS->ncol; col++)
1224 wstr [col] = l.t [col]; 1290 wstr [col] = l.t [col];
1225 1291
1226 XPUSHs (sv_2mortal (wcs2sv (wstr, THIS->ncol))); 1292 XPUSHs (sv_2mortal (wcs2sv (wstr, THIS->ncol)));
1227
1228 delete [] wstr;
1229 } 1293 }
1230 1294
1231 if (new_text) 1295 if (new_text)
1232 { 1296 {
1233 wchar_t *wstr = sv2wcs (new_text); 1297 wchar_t *wstr = sv2wcs (new_text);
1234 1298
1235 int len = min (wcslen (wstr) - start_ofs, max_len); 1299 int len = min (wcslen (wstr) - start_ofs, max_len);
1236 1300
1237 if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len)) 1301 if (start_col < 0 || start_col + len > THIS->ncol)
1238 { 1302 {
1239 free (wstr); 1303 free (wstr);
1240 croak ("new_text extends beyond horizontal margins"); 1304 croak ("new_text extends beyond horizontal margins");
1241 } 1305 }
1242 1306
1274 { 1338 {
1275 if (!SvROK (new_rend) || SvTYPE (SvRV (new_rend)) != SVt_PVAV) 1339 if (!SvROK (new_rend) || SvTYPE (SvRV (new_rend)) != SVt_PVAV)
1276 croak ("new_rend must be arrayref"); 1340 croak ("new_rend must be arrayref");
1277 1341
1278 AV *av = (AV *)SvRV (new_rend); 1342 AV *av = (AV *)SvRV (new_rend);
1279 int len = min (av_len (av) + 1 - start_ofs, max_len); 1343 int len = min (AvFILL (av) + 1 - start_ofs, max_len);
1280 1344
1281 if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len)) 1345 if (start_col < 0 || start_col + len > THIS->ncol)
1282 croak ("new_rend array extends beyond horizontal margins"); 1346 croak ("new_rend array extends beyond horizontal margins");
1283 1347
1284 for (int col = start_col; col < start_col + len; col++) 1348 for (int col = start_col; col < start_col + len; col++)
1285 { 1349 {
1286 rend_t r = SvIV (*av_fetch (av, start_ofs + col - start_col, 1)) & ~RS_fontMask; 1350 rend_t r = SvIV (*av_fetch (av, start_ofs + col - start_col, 1)) & ~RS_fontMask;
1326rxvt_term::special_encode (SV *string) 1390rxvt_term::special_encode (SV *string)
1327 CODE: 1391 CODE:
1328{ 1392{
1329 wchar_t *wstr = sv2wcs (string); 1393 wchar_t *wstr = sv2wcs (string);
1330 int wlen = wcslen (wstr); 1394 int wlen = wcslen (wstr);
1331 wchar_t *rstr = new wchar_t [wlen]; // cannot become longer 1395 wchar_t *rstr = rxvt_temp_buf<wchar_t> (wlen * 2); // cannot become longer
1332 1396
1333 rxvt_push_locale (THIS->locale); 1397 rxvt_push_locale (THIS->locale);
1334 1398
1335 wchar_t *r = rstr; 1399 wchar_t *r = rstr;
1336 for (wchar_t *s = wstr; *s; s++) 1400 for (wchar_t *s = wstr; *s; s++)
1401 {
1402 int w = WCWIDTH (*s);
1403
1337 if (wcwidth (*s) == 0) 1404 if (w == 0)
1338 { 1405 {
1339 if (r == rstr) 1406 if (r == rstr)
1340 croak ("leading combining character unencodable"); 1407 croak ("leading combining character unencodable");
1341 1408
1342 unicode_t n = rxvt_compose (r[-1], *s); 1409 unicode_t n = rxvt_compose (r[-1], *s);
1343 if (n == NOCHAR) 1410 if (n == NOCHAR)
1344 n = rxvt_composite.compose (r[-1], *s); 1411 n = rxvt_composite.compose (r[-1], *s);
1345 1412
1346 r[-1] = n; 1413 r[-1] = n;
1347 } 1414 }
1348#if !UNICODE_3 1415#if !UNICODE_3
1349 else if (*s >= 0x10000) 1416 else if (*s >= 0x10000)
1350 *r++ = rxvt_composite.compose (*s); 1417 *r++ = rxvt_composite.compose (*s);
1351#endif 1418#endif
1352 else 1419 else
1353 *r++ = *s; 1420 *r++ = *s;
1421
1422 // the *2 above only allows wcwidth <= 2
1423 if (w > 1)
1424 *r++ = NOCHAR;
1425 }
1354 1426
1355 rxvt_pop_locale (); 1427 rxvt_pop_locale ();
1356 1428
1357 RETVAL = wcs2sv (rstr, r - rstr); 1429 RETVAL = wcs2sv (rstr, r - rstr);
1358
1359 delete [] rstr;
1360} 1430}
1361 OUTPUT: 1431 OUTPUT:
1362 RETVAL 1432 RETVAL
1363 1433
1364SV * 1434SV *
1376 else if (IS_COMPOSE (*s)) 1446 else if (IS_COMPOSE (*s))
1377 dlen += rxvt_composite.expand (*s, 0); 1447 dlen += rxvt_composite.expand (*s, 0);
1378 else 1448 else
1379 dlen++; 1449 dlen++;
1380 1450
1381 wchar_t *rstr = new wchar_t [dlen]; 1451 wchar_t *rstr = rxvt_temp_buf<wchar_t> (dlen);
1382 1452
1383 // decode 1453 // decode
1384 wchar_t *r = rstr; 1454 wchar_t *r = rstr;
1385 for (wchar_t *s = wstr; *s; s++) 1455 for (wchar_t *s = wstr; *s; s++)
1386 if (*s == NOCHAR) 1456 if (*s == NOCHAR)
1389 r += rxvt_composite.expand (*s, r); 1459 r += rxvt_composite.expand (*s, r);
1390 else 1460 else
1391 *r++ = *s; 1461 *r++ = *s;
1392 1462
1393 RETVAL = wcs2sv (rstr, r - rstr); 1463 RETVAL = wcs2sv (rstr, r - rstr);
1394
1395 delete [] rstr;
1396} 1464}
1397 OUTPUT: 1465 OUTPUT:
1398 RETVAL 1466 RETVAL
1399 1467
1400void 1468void
1451 if (set) 1519 if (set)
1452 THIS->options |= optval; 1520 THIS->options |= optval;
1453 else 1521 else
1454 THIS->options &= ~optval; 1522 THIS->options &= ~optval;
1455 1523
1524 if (THIS->check_ev.is_active ()) // avoid doing this before START
1456 switch (optval) 1525 switch (optval)
1457 { 1526 {
1458 case Opt_skipBuiltinGlyphs: 1527 case Opt_skipBuiltinGlyphs:
1459 THIS->set_fonts (); 1528 THIS->set_fonts ();
1460 THIS->scr_remap_chars (); 1529 THIS->scr_remap_chars ();
1461 THIS->scr_touch (true); 1530 THIS->scr_touch (true);
1462 THIS->want_refresh = 1; 1531 THIS->want_refresh = 1;
1463 break; 1532 break;
1464 1533
1465 case Opt_cursorUnderline: 1534 case Opt_cursorUnderline:
1466 THIS->want_refresh = 1; 1535 THIS->want_refresh = 1;
1467 break; 1536 break;
1468 1537
1469# case Opt_scrollBar_floating: 1538# case Opt_scrollBar_floating:
1470# case Opt_scrollBar_right: 1539# case Opt_scrollBar_right:
1471# THIS->resize_all_windows (THIS->width, THIS->height, 1); 1540# THIS->resize_all_windows (THIS->width, THIS->height, 1);
1472# break; 1541# break;
1473 } 1542 }
1474 } 1543 }
1475} 1544}
1476 OUTPUT: 1545 OUTPUT:
1477 RETVAL 1546 RETVAL
1478 1547
1506 PUSHs (sv_2mortal (newSViv (rc.col))); 1575 PUSHs (sv_2mortal (newSViv (rc.col)));
1507 } 1576 }
1508 1577
1509 if (items == 3) 1578 if (items == 3)
1510 { 1579 {
1580 rc.row = SvIV (ST (1));
1581 rc.col = SvIV (ST (2));
1582
1583 if (ix == 2)
1584 {
1585 if (rc.col == 0)
1586 {
1587 // col == 0 means end of previous line
1588 rc.row--;
1589 rc.col = THIS->ncol;
1590 }
1591 else if (IN_RANGE_EXC (rc.row, THIS->top_row, THIS->nrow)
1592 && rc.col > ROW(rc.row).l)
1593 {
1594 // col >= length means while line and add newline
1595 rc.col = THIS->ncol;
1596 }
1597 }
1598
1599 clamp_it (rc.col, 0, THIS->ncol);
1511 rc.row = clamp (SvIV (ST (1)), THIS->top_row, THIS->nrow - 1); 1600 clamp_it (rc.row, THIS->top_row, THIS->nrow - 1);
1512 rc.col = clamp (SvIV (ST (2)), 0, THIS->ncol - 1);
1513 1601
1514 if (ix) 1602 if (ix)
1515 THIS->want_refresh = 1; 1603 THIS->want_refresh = 1;
1516 } 1604 }
1517} 1605}
1525 1613
1526#void 1614#void
1527#rxvt_term::selection_clear () 1615#rxvt_term::selection_clear ()
1528 1616
1529void 1617void
1530rxvt_term::selection_make (U32 eventtime, bool rect = false) 1618rxvt_term::selection_make (Time eventtime, bool rect = false)
1531 CODE: 1619 CODE:
1532 THIS->selection.op = SELECTION_CONT; 1620 THIS->selection.op = SELECTION_CONT;
1533 THIS->selection.rect = rect; 1621 THIS->selection.rect = rect;
1534 THIS->selection_make (eventtime); 1622 THIS->selection_make (eventtime);
1535 1623
1536int 1624int
1537rxvt_term::selection_grab (U32 eventtime) 1625rxvt_term::selection_grab (Time eventtime)
1538 1626
1539void 1627void
1540rxvt_term::selection (SV *newtext = 0) 1628rxvt_term::selection (SV *newtext = 0)
1541 PPCODE: 1629 PPCODE:
1542{ 1630{
1560void 1648void
1561rxvt_term::scr_xor_span (int beg_row, int beg_col, int end_row, int end_col, U32 rstyle = RS_RVid) 1649rxvt_term::scr_xor_span (int beg_row, int beg_col, int end_row, int end_col, U32 rstyle = RS_RVid)
1562 1650
1563void 1651void
1564rxvt_term::scr_bell () 1652rxvt_term::scr_bell ()
1653
1654void
1655rxvt_term::scr_change_screen (int screen)
1565 1656
1566void 1657void
1567rxvt_term::scr_add_lines (SV *string) 1658rxvt_term::scr_add_lines (SV *string)
1568 CODE: 1659 CODE:
1569{ 1660{
1610 o->self = (HV *)SvRV (RETVAL); 1701 o->self = (HV *)SvRV (RETVAL);
1611} 1702}
1612 OUTPUT: 1703 OUTPUT:
1613 RETVAL 1704 RETVAL
1614 1705
1706#############################################################################
1707# Various X Utility Functions
1708#############################################################################
1709
1710void
1711rxvt_term::XListProperties (Window window)
1712 PPCODE:
1713{
1714 int count;
1715 Atom *props = XListProperties (THIS->display->display, window, &count);
1716
1717 EXTEND (SP, count);
1718 while (count--)
1719 PUSHs (newSVuv ((U32)props [count]));
1720
1721 XFree (props);
1722}
1723
1724void
1725rxvt_term::XGetWindowProperty (Window window, Atom property)
1726 PPCODE:
1727{
1728 Atom type;
1729 int format;
1730 unsigned long nitems;
1731 unsigned long bytes_after;
1732 unsigned char *prop;
1733
1734 XGetWindowProperty (THIS->display->display, window, property,
1735 0, 1<<24, 0, AnyPropertyType,
1736 &type, &format, &nitems, &bytes_after, &prop);
1737
1738 if (type != None)
1739 {
1740 int elemsize = format == 16 ? sizeof (short)
1741 : format == 32 ? sizeof (long)
1742 : 1;
1743
1744 EXTEND (SP, 3);
1745 PUSHs (newSVuv ((U32)type));
1746 PUSHs (newSViv (format));
1747 PUSHs (newSVpvn ((char *)prop, nitems * elemsize));
1748 XFree (prop);
1749 }
1750}
1751
1752void
1753rxvt_term::XChangeWindowProperty (Window window, Atom property, Atom type, int format, SV *data)
1754 CODE:
1755{
1756 STRLEN len;
1757 char *data_ = SvPVbyte (data, len);
1758
1759 int elemsize = format == 16 ? sizeof (short)
1760 : format == 32 ? sizeof (long)
1761 : 1;
1762
1763 XChangeProperty (THIS->display->display, window, property,
1764 type, format, PropModeReplace,
1765 (unsigned char *)data_, len / elemsize);
1766 XSync (THIS->display->display, 0);
1767}
1768
1769Atom
1770XInternAtom (rxvt_term *term, char *atom_name, int only_if_exists = FALSE)
1771 C_ARGS: term->display->display, atom_name, only_if_exists
1772
1773char *
1774XGetAtomName (rxvt_term *term, Atom atom)
1775 C_ARGS: term->display->display, atom
1776 CLEANUP:
1777 XFree (RETVAL);
1778
1779void
1780XDeleteProperty (rxvt_term *term, Window window, Atom property)
1781 C_ARGS: term->display->display, window, property
1782
1783Window
1784rxvt_term::DefaultRootWindow ()
1785 CODE:
1786 RETVAL = THIS->display->root;
1787 OUTPUT:
1788 RETVAL
1789
1790#if 0
1791
1792Window
1793XCreateSimpleWindow (rxvt_term *term, Window parent, int x, int y, unsigned int width, unsigned int height)
1794 C_ARGS: term->display->display, (Window)parent,
1795 x, y, width, height, 0,
1796 term->pix_colors_focused[Color_border],
1797 term->pix_colors_focused[Color_border]
1798
1799#endif
1800
1801void
1802XReparentWindow (rxvt_term *term, Window window, Window parent, int x = 0, int y = 0)
1803 C_ARGS: term->display->display, window, parent, x, y
1804
1805void
1806XMapWindow (rxvt_term *term, Window window)
1807 C_ARGS: term->display->display, window
1808
1809void
1810XUnmapWindow (rxvt_term *term, Window window)
1811 C_ARGS: term->display->display, window
1812
1813void
1814XMoveResizeWindow (rxvt_term *term, Window window, int x, int y, unsigned int width, unsigned int height)
1815 C_ARGS: term->display->display, window, x, y, width, height
1816
1817void
1818rxvt_term::XChangeInput (Window window, U32 add_events, U32 del_events = 0)
1819 CODE:
1820{
1821 XWindowAttributes attr;
1822 XGetWindowAttributes (THIS->display->display, window, &attr);
1823 XSelectInput (THIS->display->display, window, attr.your_event_mask | add_events & ~del_events);
1824}
1825
1826void
1827rxvt_term::XTranslateCoordinates (Window src, Window dst, int x, int y)
1828 PPCODE:
1829{
1830 int dx, dy;
1831 Window child;
1832
1833 if (XTranslateCoordinates (THIS->display->display, src, dst, x, y, &dx, &dy, &child))
1834 {
1835 EXTEND (SP, 3);
1836 PUSHs (newSViv (dx));
1837 PUSHs (newSViv (dy));
1838 PUSHs (newSVuv (child));
1839 }
1840}
1841
1842#############################################################################
1843# urxvt::overlay
1844#############################################################################
1845
1615MODULE = urxvt PACKAGE = urxvt::overlay 1846MODULE = urxvt PACKAGE = urxvt::overlay
1616 1847
1617void 1848void
1618overlay::set (int x, int y, SV *text, SV *rend = 0) 1849overlay::set (int x, int y, SV *text, SV *rend = 0)
1619 1850
1623void 1854void
1624overlay::hide () 1855overlay::hide ()
1625 1856
1626void 1857void
1627overlay::DESTROY () 1858overlay::DESTROY ()
1859
1860#############################################################################
1861# urxvt::watcher
1862#############################################################################
1863
1864MODULE = urxvt PACKAGE = urxvt::watcher
1865
1866CHAINED
1867perl_watcher::cb (SV *cb)
1868 CODE:
1869 THIS->cb (cb);
1870 OUTPUT:
1871 RETVAL
1872
1873#############################################################################
1874# urxvt::timer
1875#############################################################################
1628 1876
1629MODULE = urxvt PACKAGE = urxvt::timer 1877MODULE = urxvt PACKAGE = urxvt::timer
1630 1878
1631SV * 1879SV *
1632timer::new () 1880timer::new ()
1633 CODE: 1881 CODE:
1634 timer *w = new timer; 1882 timer *w = new timer;
1635 w->start (NOW); 1883 w->start (NOW);
1636 RETVAL = newSVptr ((void *)w, "urxvt::timer"); 1884 RETVAL = newSVptr ((void *)(perl_watcher *)w, "urxvt::timer");
1637 w->self = (HV *)SvRV (RETVAL); 1885 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: 1886 OUTPUT:
1647 RETVAL 1887 RETVAL
1648 1888
1649NV 1889NV
1650timer::at () 1890timer::at ()
1651 CODE: 1891 CODE:
1652 RETVAL = THIS->at; 1892 RETVAL = THIS->at;
1653 OUTPUT: 1893 OUTPUT:
1654 RETVAL 1894 RETVAL
1655 1895
1656timer * 1896CHAINED
1657timer::interval (NV interval) 1897timer::interval (NV interval)
1658 CODE: 1898 CODE:
1659 THIS->interval = interval; 1899 THIS->interval = interval;
1900 OUTPUT:
1660 RETVAL = THIS; 1901 RETVAL
1661 OUTPUT:
1662 RETVAL
1663 1902
1664timer * 1903CHAINED
1665timer::set (NV tstamp) 1904timer::set (NV tstamp)
1666 CODE: 1905 CODE:
1667 THIS->set (tstamp); 1906 THIS->set (tstamp);
1907 OUTPUT:
1668 RETVAL = THIS; 1908 RETVAL
1669 OUTPUT:
1670 RETVAL
1671 1909
1672timer * 1910CHAINED
1673timer::start (NV tstamp = THIS->at) 1911timer::start (NV tstamp = THIS->at)
1674 CODE: 1912 CODE:
1675 THIS->start (tstamp); 1913 THIS->start (tstamp);
1914 OUTPUT:
1676 RETVAL = THIS; 1915 RETVAL
1677 OUTPUT:
1678 RETVAL
1679 1916
1680timer * 1917CHAINED
1918timer::after (NV delay)
1919 CODE:
1920 THIS->start (NOW + delay);
1921 OUTPUT:
1922 RETVAL
1923
1924CHAINED
1681timer::stop () 1925timer::stop ()
1682 CODE: 1926 CODE:
1683 THIS->stop (); 1927 THIS->stop ();
1684 RETVAL = THIS;
1685 OUTPUT: 1928 OUTPUT:
1686 RETVAL 1929 RETVAL
1687 1930
1688void 1931void
1689timer::DESTROY () 1932timer::DESTROY ()
1933
1934#############################################################################
1935# urxvt::iow
1936#############################################################################
1690 1937
1691MODULE = urxvt PACKAGE = urxvt::iow 1938MODULE = urxvt PACKAGE = urxvt::iow
1692 1939
1693SV * 1940SV *
1694iow::new () 1941iow::new ()
1695 CODE: 1942 CODE:
1696 iow *w = new iow; 1943 iow *w = new iow;
1697 RETVAL = newSVptr ((void *)w, "urxvt::iow"); 1944 RETVAL = newSVptr ((void *)(perl_watcher *)w, "urxvt::iow");
1698 w->self = (HV *)SvRV (RETVAL); 1945 w->self = (HV *)SvRV (RETVAL);
1699 OUTPUT: 1946 OUTPUT:
1700 RETVAL 1947 RETVAL
1701 1948
1702iow * 1949CHAINED
1703iow::cb (SV *cb)
1704 CODE:
1705 THIS->cb (cb);
1706 RETVAL = THIS;
1707 OUTPUT:
1708 RETVAL
1709
1710iow *
1711iow::fd (int fd) 1950iow::fd (int fd)
1712 CODE: 1951 CODE:
1713 THIS->fd = fd; 1952 THIS->fd = fd;
1953 OUTPUT:
1714 RETVAL = THIS; 1954 RETVAL
1715 OUTPUT:
1716 RETVAL
1717 1955
1718iow * 1956CHAINED
1719iow::events (short events) 1957iow::events (short events)
1720 CODE: 1958 CODE:
1721 THIS->events = events; 1959 THIS->events = events;
1960 OUTPUT:
1722 RETVAL = THIS; 1961 RETVAL
1723 OUTPUT:
1724 RETVAL
1725 1962
1726iow * 1963CHAINED
1727iow::start () 1964iow::start ()
1728 CODE: 1965 CODE:
1729 THIS->start (); 1966 THIS->start ();
1967 OUTPUT:
1730 RETVAL = THIS; 1968 RETVAL
1731 OUTPUT:
1732 RETVAL
1733 1969
1734iow * 1970CHAINED
1735iow::stop () 1971iow::stop ()
1736 CODE: 1972 CODE:
1737 THIS->stop (); 1973 THIS->stop ();
1738 RETVAL = THIS;
1739 OUTPUT: 1974 OUTPUT:
1740 RETVAL 1975 RETVAL
1741 1976
1742void 1977void
1743iow::DESTROY () 1978iow::DESTROY ()
1744 1979
1980#############################################################################
1981# urxvt::iw
1982#############################################################################
1745 1983
1984MODULE = urxvt PACKAGE = urxvt::iw
1985
1986SV *
1987iw::new ()
1988 CODE:
1989 iw *w = new iw;
1990 RETVAL = newSVptr ((void *)(perl_watcher *)w, "urxvt::iw");
1991 w->self = (HV *)SvRV (RETVAL);
1992 OUTPUT:
1993 RETVAL
1994
1995CHAINED
1996iw::start ()
1997 CODE:
1998 THIS->start ();
1999 OUTPUT:
2000 RETVAL
2001
2002CHAINED
2003iw::stop ()
2004 CODE:
2005 THIS->stop ();
2006 OUTPUT:
2007 RETVAL
2008
2009void
2010iw::DESTROY ()
2011
2012#############################################################################
2013# urxvt::pw
2014#############################################################################
2015
2016MODULE = urxvt PACKAGE = urxvt::pw
2017
2018SV *
2019pw::new ()
2020 CODE:
2021 pw *w = new pw;
2022 RETVAL = newSVptr ((void *)(perl_watcher *)w, "urxvt::pw");
2023 w->self = (HV *)SvRV (RETVAL);
2024 OUTPUT:
2025 RETVAL
2026
2027CHAINED
2028pw::start (int pid)
2029 CODE:
2030 THIS->start (pid);
2031 OUTPUT:
2032 RETVAL
2033
2034CHAINED
2035pw::stop ()
2036 CODE:
2037 THIS->stop ();
2038 OUTPUT:
2039 RETVAL
2040
2041void
2042pw::DESTROY ()
2043
2044

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines