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.73 by root, Wed Jan 18 09:40:53 2006 UTC vs.
Revision 1.79 by root, Fri Jan 20 10:27:08 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}
433 483
434 if (perl) 484 if (perl)
435 { 485 {
436 // runs outside of perls ENV 486 // runs outside of perls ENV
437 term->perl.self = (void *)newSVptr ((void *)term, "urxvt::term"); 487 term->perl.self = (void *)newSVptr ((void *)term, "urxvt::term");
438 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);
439 } 489 }
440} 490}
441 491
442static void 492static void
443ungrab (rxvt_term *THIS) 493ungrab (rxvt_term *THIS)
448 XUngrabPointer (THIS->display->display, THIS->perl.grabtime); 498 XUngrabPointer (THIS->display->display, THIS->perl.grabtime);
449 THIS->perl.grabtime = 0; 499 THIS->perl.grabtime = 0;
450 } 500 }
451} 501}
452 502
453static void
454swap_overlays (rxvt_term *term)
455{
456 HV *hv = (HV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)term->perl.self), "_overlay", 8, 0));
457
458 if (HvKEYS (hv))
459 {
460 hv_iterinit (hv);
461
462 while (HE *he = hv_iternext (hv))
463 ((overlay *)SvIV (hv_iterval (hv, he)))->swap ();
464 }
465}
466
467bool 503bool
468rxvt_perl_interp::invoke (rxvt_term *term, hook_type htype, ...) 504rxvt_perl_interp::invoke (rxvt_term *term, hook_type htype, ...)
469{ 505{
470 if (!perl || !term->perl.self) 506 if (!perl || !term->perl.self)
471 return false; 507 return false;
472 508
473 // pre-handling of some events 509 // pre-handling of some events
474 if (htype == HOOK_REFRESH_END) 510 if (htype == HOOK_REFRESH_END)
475 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 }
476 517
477 swap (perl_environ, environ); 518 swap (perl_environ, environ);
478 519
479 bool event_consumed; 520 bool event_consumed;
480 521
535 XEvent *xe = va_arg (ap, XEvent *); 576 XEvent *xe = va_arg (ap, XEvent *);
536 HV *hv = newHV (); 577 HV *hv = newHV ();
537 578
538# define set(name, sv) hv_store (hv, # name, sizeof (# name) - 1, sv, 0) 579# define set(name, sv) hv_store (hv, # name, sizeof (# name) - 1, sv, 0)
539# define setiv(name, val) hv_store (hv, # name, sizeof (# name) - 1, newSViv (val), 0) 580# 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)
540# undef set 582# undef set
541 583
542 setiv (type, xe->type); 584 setiv (type, xe->type);
543 setiv (send_event, xe->xany.send_event); 585 setiv (send_event, xe->xany.send_event);
544 setiv (serial, xe->xany.serial); 586 setiv (serial, xe->xany.serial);
548 case KeyPress: 590 case KeyPress:
549 case KeyRelease: 591 case KeyRelease:
550 case ButtonPress: 592 case ButtonPress:
551 case ButtonRelease: 593 case ButtonRelease:
552 case MotionNotify: 594 case MotionNotify:
595 setuv (window, xe->xmotion.window);
596 setuv (root, xe->xmotion.root);
597 setuv (subwindow, xe->xmotion.subwindow);
553 setiv (time, xe->xmotion.time); 598 setuv (time, xe->xmotion.time);
554 setiv (x, xe->xmotion.x); 599 setiv (x, xe->xmotion.x);
555 setiv (y, xe->xmotion.y); 600 setiv (y, xe->xmotion.y);
556 setiv (row, xe->xmotion.y / term->fheight); 601 setiv (row, xe->xmotion.y / term->fheight);
557 setiv (col, xe->xmotion.x / term->fwidth); 602 setiv (col, xe->xmotion.x / term->fwidth);
558 setiv (x_root, xe->xmotion.x_root); 603 setiv (x_root, xe->xmotion.x_root);
559 setiv (y_root, xe->xmotion.y_root); 604 setiv (y_root, xe->xmotion.y_root);
560 setiv (state, xe->xmotion.state); 605 setuv (state, xe->xmotion.state);
606
607 switch (xe->type)
608 {
609 case KeyPress:
610 case KeyRelease:
611 setuv (keycode, xe->xkey.keycode);
612 break;
613
614 case ButtonPress:
615 case ButtonRelease:
616 setuv (button, xe->xbutton.button);
617 break;
618
619 case MotionNotify:
620 setiv (is_hint, xe->xmotion.is_hint);
621 break;
622 }
623
561 break; 624 break;
562 }
563 625
626 case MapNotify:
627 case UnmapNotify:
628 case ConfigureNotify:
629 setuv (event, xe->xconfigure.event);
630 setuv (window, xe->xconfigure.window);
631
564 switch (xe->type) 632 switch (xe->type)
565 { 633 {
566 case KeyPress: 634 case ConfigureNotify:
567 case KeyRelease: 635 setiv (x, xe->xconfigure.x);
568 setiv (keycode, xe->xkey.keycode); 636 setiv (y, xe->xconfigure.y);
637 setiv (width, xe->xconfigure.width);
638 setiv (height, xe->xconfigure.height);
639 setuv (above, xe->xconfigure.above);
569 break; 640 break;
570
571 case ButtonPress:
572 case ButtonRelease:
573 setiv (button, xe->xbutton.button);
574 break; 641 }
575 642
576 case MotionNotify:
577 setiv (is_hint, xe->xmotion.is_hint);
578 break; 643 break;
579 } 644 }
580 645
581 XPUSHs (sv_2mortal (newRV_noinc ((SV *)hv))); 646 XPUSHs (sv_2mortal (newRV_noinc ((SV *)hv)));
582 } 647 }
623 else 688 else
624 event_consumed = false; 689 event_consumed = false;
625 690
626 // post-handling of some events 691 // post-handling of some events
627 if (htype == HOOK_REFRESH_BEGIN) 692 if (htype == HOOK_REFRESH_BEGIN)
628 swap_overlays (term); 693 {
694 AV *av = (AV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)term->perl.self), "_overlay", 8, 0));
695
696 for (int i = AvFILL (av); i >= 0; i--)
697 ((overlay *)SvIV (*av_fetch (av, i, 0)))->swap ();
698 }
629 else if (htype == HOOK_DESTROY) 699 else if (htype == HOOK_DESTROY)
630 { 700 {
631 clearSVptr ((SV *)term->perl.self); 701 clearSVptr ((SV *)term->perl.self);
632 SvREFCNT_dec ((SV *)term->perl.self); 702 SvREFCNT_dec ((SV *)term->perl.self);
633 } 703 }
847 917
848 for (int i = 1; i < items; i++) 918 for (int i = 1; i < items; i++)
849 term->argv->push_back (strdup (SvPVbyte_nolen (ST (i)))); 919 term->argv->push_back (strdup (SvPVbyte_nolen (ST (i))));
850 920
851 AV *envv = (AV *)SvRV (ST (0)); 921 AV *envv = (AV *)SvRV (ST (0));
852 for (int i = av_len (envv) + 1; i--; ) 922 for (int i = AvFILL (envv) + 1; i--; )
853 term->envv->push_back (strdup (SvPVbyte_nolen (*av_fetch (envv, i, 1)))); 923 term->envv->push_back (strdup (SvPVbyte_nolen (*av_fetch (envv, i, 1))));
854 924
855 term->envv->push_back (0); 925 term->envv->push_back (0);
856 926
857 bool success; 927 bool success;
878 RETVAL 948 RETVAL
879 949
880void 950void
881rxvt_term::destroy () 951rxvt_term::destroy ()
882 952
883#if ENABLE_PERL_FRILLS
884
885void
886rxvt_term::XListProperties (U32 window)
887 PPCODE:
888{
889 int count;
890 Atom *props = XListProperties (THIS->display->display, (Window)window, &count);
891
892 EXTEND (SP, count);
893 while (count--)
894 PUSHs (newSVuv ((U32)props [count]));
895
896 XFree (props);
897}
898
899void
900rxvt_term::XGetWindowProperty (U32 window, U32 property)
901 PPCODE:
902{
903 Atom type;
904 int format;
905 unsigned long nitems;
906 unsigned long bytes_after;
907 unsigned char *prop;
908 XGetWindowProperty (THIS->display->display, (Window)window, (Atom)property,
909 0, 1<<30, 0, AnyPropertyType,
910 &type, &format, &nitems, &bytes_after, &prop);
911 if (type != None)
912 {
913 EXTEND (SP, 3);
914 PUSHs (newSVuv ((U32)type));
915 PUSHs (newSViv (format));
916 PUSHs (newSVpvn ((char *)prop, nitems * format / 8));
917 XFree (prop);
918 }
919}
920
921void
922rxvt_term::XChangeWindowProperty (U32 window, U32 property, U32 type, int format, SV *data)
923 CODE:
924{
925 STRLEN len;
926 char *data_ = SvPVbyte (data, len);
927
928 XChangeProperty (THIS->display->display, (Window)window, (Atom)property,
929 type, format, PropModeReplace,
930 (unsigned char *)data, len * 8 / format);
931}
932
933void
934rxvt_term::XDeleteProperty (U32 window, U32 property)
935 CODE:
936 XDeleteProperty (THIS->display->display, (Window)window, (Atom)property);
937
938U32
939rxvt_term::DefaultRootWindow ()
940 CODE:
941 RETVAL = (U32)THIS->display->root;
942 OUTPUT:
943 RETVAL
944
945U32
946rxvt_term::XCreateSimpleWindow (U32 parent, int x, int y, unsigned int width, unsigned int height)
947 CODE:
948 RETVAL = XCreateSimpleWindow (THIS->display->display, (Window)parent,
949 x, y, width, height, 0,
950 THIS->pix_colors_focused[Color_border],
951 THIS->pix_colors_focused[Color_border]);
952 OUTPUT:
953 RETVAL
954
955void
956rxvt_term::XReparentWindow (U32 window, U32 parent, int x = 0, int y = 0)
957 CODE:
958 XReparentWindow (THIS->display->display, (Window)window, (Window)parent, x, y);
959
960void
961rxvt_term::XMapWindow (U32 window)
962 CODE:
963 XMapWindow (THIS->display->display, (Window)window);
964
965void
966rxvt_term::XUnmapWindow (U32 window)
967 CODE:
968 XUnmapWindow (THIS->display->display, (Window)window);
969
970#endif
971
972void 953void
973rxvt_term::set_should_invoke (int htype, int inc) 954rxvt_term::set_should_invoke (int htype, int inc)
974 CODE: 955 CODE:
975 THIS->perl.should_invoke [htype] += inc; 956 THIS->perl.should_invoke [htype] += inc;
976 957
980 XGrabButton (THIS->display->display, button, modifiers, THIS->vt, 1, 961 XGrabButton (THIS->display->display, button, modifiers, THIS->vt, 1,
981 ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask, 962 ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask,
982 GrabModeSync, GrabModeSync, None, GRAB_CURSOR); 963 GrabModeSync, GrabModeSync, None, GRAB_CURSOR);
983 964
984bool 965bool
985rxvt_term::grab (U32 eventtime, int sync = 0) 966rxvt_term::grab (Time eventtime, int sync = 0)
986 CODE: 967 CODE:
987{ 968{
988 int mode = sync ? GrabModeSync : GrabModeAsync; 969 int mode = sync ? GrabModeSync : GrabModeAsync;
989 970
990 THIS->perl.grabtime = 0; 971 THIS->perl.grabtime = 0;
1165 if (events != EVENT_UNDEF) 1146 if (events != EVENT_UNDEF)
1166 THIS->pty_ev.set (events); 1147 THIS->pty_ev.set (events);
1167 OUTPUT: 1148 OUTPUT:
1168 RETVAL 1149 RETVAL
1169 1150
1170U32 1151Window
1171rxvt_term::parent () 1152rxvt_term::parent ()
1172 CODE: 1153 CODE:
1173 RETVAL = (U32)THIS->parent [0]; 1154 RETVAL = THIS->parent [0];
1174 OUTPUT: 1155 OUTPUT:
1175 RETVAL 1156 RETVAL
1176 1157
1177U32 1158Window
1178rxvt_term::vt () 1159rxvt_term::vt ()
1179 CODE: 1160 CODE:
1180 RETVAL = (U32)THIS->vt; 1161 RETVAL = THIS->vt;
1181 OUTPUT: 1162 OUTPUT:
1182 RETVAL 1163 RETVAL
1183 1164
1184void 1165void
1185rxvt_term::vt_emask_add (U32 emask) 1166rxvt_term::vt_emask_add (U32 emask)
1280 { 1261 {
1281 if (!SvROK (new_rend) || SvTYPE (SvRV (new_rend)) != SVt_PVAV) 1262 if (!SvROK (new_rend) || SvTYPE (SvRV (new_rend)) != SVt_PVAV)
1282 croak ("new_rend must be arrayref"); 1263 croak ("new_rend must be arrayref");
1283 1264
1284 AV *av = (AV *)SvRV (new_rend); 1265 AV *av = (AV *)SvRV (new_rend);
1285 int len = min (av_len (av) + 1 - start_ofs, max_len); 1266 int len = min (AvFILL (av) + 1 - start_ofs, max_len);
1286 1267
1287 if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len)) 1268 if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len))
1288 croak ("new_rend array extends beyond horizontal margins"); 1269 croak ("new_rend array extends beyond horizontal margins");
1289 1270
1290 for (int col = start_col; col < start_col + len; col++) 1271 for (int col = start_col; col < start_col + len; col++)
1457 if (set) 1438 if (set)
1458 THIS->options |= optval; 1439 THIS->options |= optval;
1459 else 1440 else
1460 THIS->options &= ~optval; 1441 THIS->options &= ~optval;
1461 1442
1443 if (THIS->check_ev.is_active ()) // avoid doing this before START
1462 switch (optval) 1444 switch (optval)
1463 { 1445 {
1464 case Opt_skipBuiltinGlyphs: 1446 case Opt_skipBuiltinGlyphs:
1465 THIS->set_fonts (); 1447 THIS->set_fonts ();
1466 THIS->scr_remap_chars (); 1448 THIS->scr_remap_chars ();
1467 THIS->scr_touch (true); 1449 THIS->scr_touch (true);
1468 THIS->want_refresh = 1; 1450 THIS->want_refresh = 1;
1469 break; 1451 break;
1470 1452
1471 case Opt_cursorUnderline: 1453 case Opt_cursorUnderline:
1472 THIS->want_refresh = 1; 1454 THIS->want_refresh = 1;
1473 break; 1455 break;
1474 1456
1475# case Opt_scrollBar_floating: 1457# case Opt_scrollBar_floating:
1476# case Opt_scrollBar_right: 1458# case Opt_scrollBar_right:
1477# THIS->resize_all_windows (THIS->width, THIS->height, 1); 1459# THIS->resize_all_windows (THIS->width, THIS->height, 1);
1478# break; 1460# break;
1479 } 1461 }
1480 } 1462 }
1481} 1463}
1482 OUTPUT: 1464 OUTPUT:
1483 RETVAL 1465 RETVAL
1484 1466
1540 1522
1541#void 1523#void
1542#rxvt_term::selection_clear () 1524#rxvt_term::selection_clear ()
1543 1525
1544void 1526void
1545rxvt_term::selection_make (U32 eventtime, bool rect = false) 1527rxvt_term::selection_make (Time eventtime, bool rect = false)
1546 CODE: 1528 CODE:
1547 THIS->selection.op = SELECTION_CONT; 1529 THIS->selection.op = SELECTION_CONT;
1548 THIS->selection.rect = rect; 1530 THIS->selection.rect = rect;
1549 THIS->selection_make (eventtime); 1531 THIS->selection_make (eventtime);
1550 1532
1551int 1533int
1552rxvt_term::selection_grab (U32 eventtime) 1534rxvt_term::selection_grab (Time eventtime)
1553 1535
1554void 1536void
1555rxvt_term::selection (SV *newtext = 0) 1537rxvt_term::selection (SV *newtext = 0)
1556 PPCODE: 1538 PPCODE:
1557{ 1539{
1625 o->self = (HV *)SvRV (RETVAL); 1607 o->self = (HV *)SvRV (RETVAL);
1626} 1608}
1627 OUTPUT: 1609 OUTPUT:
1628 RETVAL 1610 RETVAL
1629 1611
1612#############################################################################
1613# Various X Utility Functions
1614#############################################################################
1615
1616void
1617rxvt_term::XListProperties (Window window)
1618 PPCODE:
1619{
1620 int count;
1621 Atom *props = XListProperties (THIS->display->display, window, &count);
1622
1623 EXTEND (SP, count);
1624 while (count--)
1625 PUSHs (newSVuv ((U32)props [count]));
1626
1627 XFree (props);
1628}
1629
1630void
1631rxvt_term::XGetWindowProperty (Window window, Atom property)
1632 PPCODE:
1633{
1634 Atom type;
1635 int format;
1636 unsigned long nitems;
1637 unsigned long bytes_after;
1638 unsigned char *prop;
1639 XGetWindowProperty (THIS->display->display, window, property,
1640 0, 1<<30, 0, AnyPropertyType,
1641 &type, &format, &nitems, &bytes_after, &prop);
1642 if (type != None)
1643 {
1644 EXTEND (SP, 3);
1645 PUSHs (newSVuv ((U32)type));
1646 PUSHs (newSViv (format));
1647 PUSHs (newSVpvn ((char *)prop, nitems * format / 8));
1648 XFree (prop);
1649 }
1650}
1651
1652void
1653rxvt_term::XChangeWindowProperty (Window window, Atom property, Atom type, int format, SV *data)
1654 CODE:
1655{
1656 STRLEN len;
1657 char *data_ = SvPVbyte (data, len);
1658
1659 XChangeProperty (THIS->display->display, window, property,
1660 type, format, PropModeReplace,
1661 (unsigned char *)data, len * 8 / format);
1662}
1663
1664void
1665XDeleteProperty (rxvt_term *term, Window window, Atom property)
1666 C_ARGS: term->display->display, window, property
1667
1668Window
1669rxvt_term::DefaultRootWindow ()
1670 CODE:
1671 RETVAL = THIS->display->root;
1672 OUTPUT:
1673 RETVAL
1674
1675Window
1676XCreateSimpleWindow (rxvt_term *term, Window parent, int x, int y, unsigned int width, unsigned int height)
1677 C_ARGS: term->display->display, (Window)parent,
1678 x, y, width, height, 0,
1679 term->pix_colors_focused[Color_border],
1680 term->pix_colors_focused[Color_border]
1681
1682void
1683XReparentWindow (rxvt_term *term, Window window, Window parent, int x = 0, int y = 0)
1684 C_ARGS: term->display->display, window, parent, x, y
1685
1686void
1687XMapWindow (rxvt_term *term, Window window)
1688 C_ARGS: term->display->display, window
1689
1690void
1691XUnmapWindow (rxvt_term *term, Window window)
1692 C_ARGS: term->display->display, window
1693
1694void
1695XMoveResizeWindow (rxvt_term *term, Window window, int x, int y, unsigned int width, unsigned int height)
1696 C_ARGS: term->display->display, (Window)window, x, y, width, height
1697
1698#############################################################################
1699# urxvt::overlay
1700#############################################################################
1701
1630MODULE = urxvt PACKAGE = urxvt::overlay 1702MODULE = urxvt PACKAGE = urxvt::overlay
1631 1703
1632void 1704void
1633overlay::set (int x, int y, SV *text, SV *rend = 0) 1705overlay::set (int x, int y, SV *text, SV *rend = 0)
1634 1706
1638void 1710void
1639overlay::hide () 1711overlay::hide ()
1640 1712
1641void 1713void
1642overlay::DESTROY () 1714overlay::DESTROY ()
1715
1716#############################################################################
1717# urxvt::watcher
1718#############################################################################
1719
1720MODULE = urxvt PACKAGE = urxvt::watcher
1721
1722CHAINED
1723perl_watcher::cb (SV *cb)
1724 CODE:
1725 THIS->cb (cb);
1726 OUTPUT:
1727 RETVAL
1728
1729#############################################################################
1730# urxvt::timer
1731#############################################################################
1643 1732
1644MODULE = urxvt PACKAGE = urxvt::timer 1733MODULE = urxvt PACKAGE = urxvt::timer
1645 1734
1646SV * 1735SV *
1647timer::new () 1736timer::new ()
1648 CODE: 1737 CODE:
1649 timer *w = new timer; 1738 timer *w = new timer;
1650 w->start (NOW); 1739 w->start (NOW);
1651 RETVAL = newSVptr ((void *)w, "urxvt::timer"); 1740 RETVAL = newSVptr ((void *)(perl_watcher *)w, "urxvt::timer");
1652 w->self = (HV *)SvRV (RETVAL); 1741 w->self = (HV *)SvRV (RETVAL);
1653 OUTPUT:
1654 RETVAL
1655
1656timer *
1657timer::cb (SV *cb)
1658 CODE:
1659 THIS->cb (cb);
1660 RETVAL = THIS;
1661 OUTPUT: 1742 OUTPUT:
1662 RETVAL 1743 RETVAL
1663 1744
1664NV 1745NV
1665timer::at () 1746timer::at ()
1666 CODE: 1747 CODE:
1667 RETVAL = THIS->at; 1748 RETVAL = THIS->at;
1668 OUTPUT: 1749 OUTPUT:
1669 RETVAL 1750 RETVAL
1670 1751
1671timer * 1752CHAINED
1672timer::interval (NV interval) 1753timer::interval (NV interval)
1673 CODE: 1754 CODE:
1674 THIS->interval = interval; 1755 THIS->interval = interval;
1756 OUTPUT:
1675 RETVAL = THIS; 1757 RETVAL
1676 OUTPUT:
1677 RETVAL
1678 1758
1679timer * 1759CHAINED
1680timer::set (NV tstamp) 1760timer::set (NV tstamp)
1681 CODE: 1761 CODE:
1682 THIS->set (tstamp); 1762 THIS->set (tstamp);
1763 OUTPUT:
1683 RETVAL = THIS; 1764 RETVAL
1684 OUTPUT:
1685 RETVAL
1686 1765
1687timer * 1766CHAINED
1688timer::start (NV tstamp = THIS->at) 1767timer::start (NV tstamp = THIS->at)
1689 CODE: 1768 CODE:
1690 THIS->start (tstamp); 1769 THIS->start (tstamp);
1770 OUTPUT:
1691 RETVAL = THIS; 1771 RETVAL
1692 OUTPUT:
1693 RETVAL
1694 1772
1695timer * 1773CHAINED
1774timer::after (NV delay)
1775 CODE:
1776 THIS->start (NOW + delay);
1777 OUTPUT:
1778 RETVAL
1779
1780CHAINED
1696timer::stop () 1781timer::stop ()
1697 CODE: 1782 CODE:
1698 THIS->stop (); 1783 THIS->stop ();
1699 RETVAL = THIS;
1700 OUTPUT: 1784 OUTPUT:
1701 RETVAL 1785 RETVAL
1702 1786
1703void 1787void
1704timer::DESTROY () 1788timer::DESTROY ()
1789
1790#############################################################################
1791# urxvt::iow
1792#############################################################################
1705 1793
1706MODULE = urxvt PACKAGE = urxvt::iow 1794MODULE = urxvt PACKAGE = urxvt::iow
1707 1795
1708SV * 1796SV *
1709iow::new () 1797iow::new ()
1710 CODE: 1798 CODE:
1711 iow *w = new iow; 1799 iow *w = new iow;
1712 RETVAL = newSVptr ((void *)w, "urxvt::iow"); 1800 RETVAL = newSVptr ((void *)(perl_watcher *)w, "urxvt::iow");
1713 w->self = (HV *)SvRV (RETVAL); 1801 w->self = (HV *)SvRV (RETVAL);
1714 OUTPUT: 1802 OUTPUT:
1715 RETVAL 1803 RETVAL
1716 1804
1717iow * 1805CHAINED
1718iow::cb (SV *cb)
1719 CODE:
1720 THIS->cb (cb);
1721 RETVAL = THIS;
1722 OUTPUT:
1723 RETVAL
1724
1725iow *
1726iow::fd (int fd) 1806iow::fd (int fd)
1727 CODE: 1807 CODE:
1728 THIS->fd = fd; 1808 THIS->fd = fd;
1809 OUTPUT:
1729 RETVAL = THIS; 1810 RETVAL
1730 OUTPUT:
1731 RETVAL
1732 1811
1733iow * 1812CHAINED
1734iow::events (short events) 1813iow::events (short events)
1735 CODE: 1814 CODE:
1736 THIS->events = events; 1815 THIS->events = events;
1816 OUTPUT:
1737 RETVAL = THIS; 1817 RETVAL
1738 OUTPUT:
1739 RETVAL
1740 1818
1741iow * 1819CHAINED
1742iow::start () 1820iow::start ()
1743 CODE: 1821 CODE:
1744 THIS->start (); 1822 THIS->start ();
1823 OUTPUT:
1745 RETVAL = THIS; 1824 RETVAL
1746 OUTPUT:
1747 RETVAL
1748 1825
1749iow * 1826CHAINED
1750iow::stop () 1827iow::stop ()
1751 CODE: 1828 CODE:
1752 THIS->stop (); 1829 THIS->stop ();
1753 RETVAL = THIS;
1754 OUTPUT: 1830 OUTPUT:
1755 RETVAL 1831 RETVAL
1756 1832
1757void 1833void
1758iow::DESTROY () 1834iow::DESTROY ()
1759 1835
1836#############################################################################
1837# urxvt::iw
1838#############################################################################
1760 1839
1840MODULE = urxvt PACKAGE = urxvt::iw
1841
1842SV *
1843iw::new ()
1844 CODE:
1845 iw *w = new iw;
1846 RETVAL = newSVptr ((void *)(perl_watcher *)w, "urxvt::iw");
1847 w->self = (HV *)SvRV (RETVAL);
1848 OUTPUT:
1849 RETVAL
1850
1851CHAINED
1852iow::start ()
1853 CODE:
1854 THIS->start ();
1855 OUTPUT:
1856 RETVAL
1857
1858CHAINED
1859iow::stop ()
1860 CODE:
1861 THIS->stop ();
1862 OUTPUT:
1863 RETVAL
1864
1865void
1866iw::DESTROY ()
1867
1868#############################################################################
1869# urxvt::pw
1870#############################################################################
1871
1872MODULE = urxvt PACKAGE = urxvt::pw
1873
1874SV *
1875pw::new ()
1876 CODE:
1877 pw *w = new pw;
1878 RETVAL = newSVptr ((void *)(perl_watcher *)w, "urxvt::pw");
1879 w->self = (HV *)SvRV (RETVAL);
1880 OUTPUT:
1881 RETVAL
1882
1883CHAINED
1884pw::start (int pid)
1885 CODE:
1886 THIS->start (pid);
1887 OUTPUT:
1888 RETVAL
1889
1890CHAINED
1891iow::stop ()
1892 CODE:
1893 THIS->stop ();
1894 OUTPUT:
1895 RETVAL
1896
1897void
1898pw::DESTROY ()
1899
1900

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines