… | |
… | |
35 | #include "rxvtutil.h" |
35 | #include "rxvtutil.h" |
36 | #include "rxvtperl.h" |
36 | #include "rxvtperl.h" |
37 | |
37 | |
38 | #include "perlxsi.c" |
38 | #include "perlxsi.c" |
39 | |
39 | |
|
|
40 | #undef LINENO |
|
|
41 | #define LINENO(n) MOD (THIS->term_start + int(n), THIS->total_rows) |
|
|
42 | #undef ROW |
|
|
43 | #define ROW(n) THIS->row_buf [LINENO (n)] |
|
|
44 | |
40 | ///////////////////////////////////////////////////////////////////////////// |
45 | ///////////////////////////////////////////////////////////////////////////// |
41 | |
46 | |
42 | static wchar_t * |
47 | static wchar_t * |
43 | sv2wcs (SV *sv) |
48 | sv2wcs (SV *sv) |
44 | { |
49 | { |
… | |
… | |
134 | #define newSVtimer(timer) new_ref (timer->self, "urxvt::timer") |
139 | #define newSVtimer(timer) new_ref (timer->self, "urxvt::timer") |
135 | #define SvTIMER(sv) (timer *)SvPTR (sv, "urxvt::timer") |
140 | #define SvTIMER(sv) (timer *)SvPTR (sv, "urxvt::timer") |
136 | |
141 | |
137 | struct timer : time_watcher, perl_watcher |
142 | struct timer : time_watcher, perl_watcher |
138 | { |
143 | { |
|
|
144 | tstamp interval; |
|
|
145 | |
139 | timer () |
146 | timer () |
140 | : time_watcher (this, &timer::execute) |
147 | : time_watcher (this, &timer::execute) |
141 | { |
148 | { |
142 | } |
149 | } |
143 | |
150 | |
144 | void execute (time_watcher &w) |
151 | void execute (time_watcher &w) |
145 | { |
152 | { |
|
|
153 | if (interval) |
|
|
154 | start (at + interval); |
|
|
155 | |
146 | invoke ("urxvt::timer", newSVtimer (this)); |
156 | invoke ("urxvt::timer", newSVtimer (this)); |
147 | } |
157 | } |
148 | }; |
158 | }; |
149 | |
159 | |
150 | #define newSViow(iow) new_ref (iow->self, "urxvt::iow") |
160 | #define newSViow(iow) new_ref (iow->self, "urxvt::iow") |
… | |
… | |
160 | void execute (io_watcher &w, short revents) |
170 | void execute (io_watcher &w, short revents) |
161 | { |
171 | { |
162 | invoke ("urxvt::iow", newSViow (this), revents); |
172 | invoke ("urxvt::iow", newSViow (this), revents); |
163 | } |
173 | } |
164 | }; |
174 | }; |
|
|
175 | |
|
|
176 | ///////////////////////////////////////////////////////////////////////////// |
|
|
177 | |
|
|
178 | #define SvOVERLAY(sv) (overlay *)SvPTR (sv, "urxvt::overlay") |
|
|
179 | |
|
|
180 | struct overlay { |
|
|
181 | HV *self; |
|
|
182 | rxvt_term *THIS; |
|
|
183 | int x, y, w, h; |
|
|
184 | int border; |
|
|
185 | text_t **text; |
|
|
186 | rend_t **rend; |
|
|
187 | |
|
|
188 | overlay (rxvt_term *THIS, int x_, int y_, int w_, int h_, rend_t rstyle, int border); |
|
|
189 | ~overlay (); |
|
|
190 | |
|
|
191 | void swap (); |
|
|
192 | |
|
|
193 | void set (int x, int y, SV *str, SV *rend); |
|
|
194 | }; |
|
|
195 | |
|
|
196 | overlay::overlay (rxvt_term *THIS, int x_, int y_, int w_, int h_, rend_t rstyle, int border) |
|
|
197 | : THIS(THIS), x(x_), y(y_), w(w_), h(h_), border(border == 2) |
|
|
198 | { |
|
|
199 | if (border == 2) |
|
|
200 | { |
|
|
201 | w += 2; |
|
|
202 | h += 2; |
|
|
203 | } |
|
|
204 | |
|
|
205 | text = new text_t *[h]; |
|
|
206 | rend = new rend_t *[h]; |
|
|
207 | |
|
|
208 | for (int y = 0; y < h; y++) |
|
|
209 | { |
|
|
210 | text_t *tp = text[y] = new text_t[w]; |
|
|
211 | rend_t *rp = rend[y] = new rend_t[w]; |
|
|
212 | |
|
|
213 | text_t t0, t1, t2; |
|
|
214 | rend_t r = rstyle; |
|
|
215 | |
|
|
216 | if (border == 2) |
|
|
217 | { |
|
|
218 | if (y == 0) |
|
|
219 | t0 = 0x2554, t1 = 0x2550, t2 = 0x2557; |
|
|
220 | else if (y < h - 1) |
|
|
221 | t0 = 0x2551, t1 = 0x0020, t2 = 0x2551; |
|
|
222 | else |
|
|
223 | t0 = 0x255a, t1 = 0x2550, t2 = 0x255d; |
|
|
224 | |
|
|
225 | *tp++ = t0; |
|
|
226 | *rp++ = r; |
|
|
227 | |
|
|
228 | for (int x = w - 2; x-- > 0; ) |
|
|
229 | { |
|
|
230 | *tp++ = t1; |
|
|
231 | *rp++ = r; |
|
|
232 | } |
|
|
233 | |
|
|
234 | *tp = t2; |
|
|
235 | *rp = r; |
|
|
236 | } |
|
|
237 | else |
|
|
238 | for (int x = w; x-- > 0; ) |
|
|
239 | { |
|
|
240 | *tp++ = 0x0020; |
|
|
241 | *rp++ = r; |
|
|
242 | } |
|
|
243 | } |
|
|
244 | |
|
|
245 | THIS->want_refresh = 1; |
|
|
246 | } |
|
|
247 | |
|
|
248 | overlay::~overlay () |
|
|
249 | { |
|
|
250 | for (int y = h; y--; ) |
|
|
251 | { |
|
|
252 | delete [] text[y]; |
|
|
253 | delete [] rend[y]; |
|
|
254 | } |
|
|
255 | |
|
|
256 | delete [] text; |
|
|
257 | delete [] rend; |
|
|
258 | |
|
|
259 | THIS->want_refresh = 1; |
|
|
260 | } |
|
|
261 | |
|
|
262 | void overlay::swap () |
|
|
263 | { |
|
|
264 | int ov_x = max (0, min (MOD (x, THIS->ncol), THIS->ncol - w)); |
|
|
265 | int ov_y = max (0, min (MOD (y, THIS->nrow), THIS->nrow - h)); |
|
|
266 | |
|
|
267 | int ov_w = min (w, THIS->ncol - ov_x); |
|
|
268 | int ov_h = min (h, THIS->nrow - ov_y); |
|
|
269 | |
|
|
270 | for (int y = ov_h; y--; ) |
|
|
271 | { |
|
|
272 | text_t *t1 = text [y]; |
|
|
273 | rend_t *r1 = rend [y]; |
|
|
274 | |
|
|
275 | text_t *t2 = ROW(y + ov_y - THIS->view_start).t + ov_x; |
|
|
276 | rend_t *r2 = ROW(y + ov_y - THIS->view_start).r + ov_x; |
|
|
277 | |
|
|
278 | for (int x = ov_w; x--; ) |
|
|
279 | { |
|
|
280 | text_t t = *t1; *t1++ = *t2; *t2++ = t; |
|
|
281 | rend_t r = *r1; *r1++ = *r2; *r2++ = SET_FONT (r, THIS->fontset [GET_STYLE (r)]->find_font (t)); |
|
|
282 | } |
|
|
283 | } |
|
|
284 | |
|
|
285 | } |
|
|
286 | |
|
|
287 | void overlay::set (int x, int y, SV *text, SV *rend) |
|
|
288 | { |
|
|
289 | x += border; |
|
|
290 | y += border; |
|
|
291 | |
|
|
292 | if (!IN_RANGE_EXC (y, 0, h - border)) |
|
|
293 | return; |
|
|
294 | |
|
|
295 | wchar_t *wtext = sv2wcs (text); |
|
|
296 | |
|
|
297 | for (int col = min (wcslen (wtext), w - x - border); col--; ) |
|
|
298 | this->text [y][x + col] = wtext [col]; |
|
|
299 | |
|
|
300 | free (wtext); |
|
|
301 | |
|
|
302 | if (rend) |
|
|
303 | { |
|
|
304 | if (!SvROK (rend) || SvTYPE (SvRV (rend)) != SVt_PVAV) |
|
|
305 | croak ("rend must be arrayref"); |
|
|
306 | |
|
|
307 | AV *av = (AV *)SvRV (rend); |
|
|
308 | |
|
|
309 | for (int col = min (av_len (av) + 1, w - x - border); col--; ) |
|
|
310 | this->rend [y][x + col] = SvIV (*av_fetch (av, col, 1)); |
|
|
311 | } |
|
|
312 | |
|
|
313 | THIS->want_refresh = 1; |
|
|
314 | } |
|
|
315 | |
165 | |
316 | |
166 | ///////////////////////////////////////////////////////////////////////////// |
317 | ///////////////////////////////////////////////////////////////////////////// |
167 | |
318 | |
168 | struct rxvt_perl_interp rxvt_perl; |
319 | struct rxvt_perl_interp rxvt_perl; |
169 | |
320 | |
… | |
… | |
210 | bool |
361 | bool |
211 | rxvt_perl_interp::invoke (rxvt_term *term, hook_type htype, ...) |
362 | rxvt_perl_interp::invoke (rxvt_term *term, hook_type htype, ...) |
212 | { |
363 | { |
213 | if (!perl) |
364 | if (!perl) |
214 | return false; |
365 | return false; |
215 | |
366 | |
216 | if (htype == HOOK_INIT) // first hook ever called |
367 | if (htype == HOOK_INIT) // first hook ever called |
|
|
368 | { |
217 | term->self = (void *)newSVptr ((void *)term, "urxvt::term"); |
369 | term->self = (void *)newSVptr ((void *)term, "urxvt::term"); |
|
|
370 | hv_store ((HV *)SvRV ((SV *)term->self), "_overlay", 8, newRV_noinc ((SV *)newHV ()), 0); |
|
|
371 | } |
|
|
372 | else if (!term->self) |
|
|
373 | return false; // perl not initialized for this instance |
218 | else if (htype == HOOK_DESTROY) |
374 | else if (htype == HOOK_DESTROY) |
219 | { |
375 | { |
220 | // TODO: clear magic |
376 | // handled later |
221 | hv_clear ((HV *)SvRV ((SV *)term->self)); |
|
|
222 | SvREFCNT_dec ((SV *)term->self); |
|
|
223 | } |
377 | } |
|
|
378 | else if (htype == HOOK_REFRESH_BEGIN || htype == HOOK_REFRESH_END) |
|
|
379 | { |
|
|
380 | HV *hv = (HV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)term->self), "_overlay", 8, 0)); |
224 | |
381 | |
|
|
382 | if (HvKEYS (hv)) |
|
|
383 | { |
|
|
384 | hv_iterinit (hv); |
|
|
385 | |
|
|
386 | while (HE *he = hv_iternext (hv)) |
|
|
387 | ((overlay *)SvIV (hv_iterval (hv, he)))->swap (); |
|
|
388 | } |
|
|
389 | } |
225 | if (!should_invoke [htype]) |
390 | else if (!should_invoke [htype]) |
226 | return false; |
391 | return false; |
227 | |
392 | |
228 | dSP; |
393 | dSP; |
229 | va_list ap; |
394 | va_list ap; |
230 | |
395 | |
231 | va_start (ap, htype); |
396 | va_start (ap, htype); |
232 | |
397 | |
… | |
… | |
249 | |
414 | |
250 | case DT_LONG: |
415 | case DT_LONG: |
251 | XPUSHs (sv_2mortal (newSViv (va_arg (ap, long)))); |
416 | XPUSHs (sv_2mortal (newSViv (va_arg (ap, long)))); |
252 | break; |
417 | break; |
253 | |
418 | |
|
|
419 | case DT_STRING: |
|
|
420 | XPUSHs (sv_2mortal (newSVpv (va_arg (ap, char *), 0))); |
|
|
421 | break; |
|
|
422 | |
254 | case DT_END: |
423 | case DT_END: |
255 | { |
424 | { |
256 | va_end (ap); |
425 | va_end (ap); |
257 | |
426 | |
258 | PUTBACK; |
427 | PUTBACK; |
… | |
… | |
270 | LEAVE; |
439 | LEAVE; |
271 | |
440 | |
272 | if (SvTRUE (ERRSV)) |
441 | if (SvTRUE (ERRSV)) |
273 | rxvt_warn ("perl hook %d evaluation error: %s", htype, SvPV_nolen (ERRSV)); |
442 | rxvt_warn ("perl hook %d evaluation error: %s", htype, SvPV_nolen (ERRSV)); |
274 | |
443 | |
|
|
444 | if (htype == HOOK_DESTROY) |
|
|
445 | { |
|
|
446 | // TODO: clear magic |
|
|
447 | hv_clear ((HV *)SvRV ((SV *)term->self)); |
|
|
448 | SvREFCNT_dec ((SV *)term->self); |
|
|
449 | } |
|
|
450 | |
275 | return count; |
451 | return count; |
276 | } |
452 | } |
277 | |
453 | |
278 | default: |
454 | default: |
279 | rxvt_fatal ("FATAL: unable to pass data type %d\n", dt); |
455 | rxvt_fatal ("FATAL: unable to pass data type %d\n", dt); |
… | |
… | |
288 | PROTOTYPES: ENABLE |
464 | PROTOTYPES: ENABLE |
289 | |
465 | |
290 | BOOT: |
466 | BOOT: |
291 | { |
467 | { |
292 | # define set_hookname(sym) av_store (hookname, PP_CONCAT(HOOK_, sym), newSVpv (PP_STRINGIFY(sym), 0)) |
468 | # define set_hookname(sym) av_store (hookname, PP_CONCAT(HOOK_, sym), newSVpv (PP_STRINGIFY(sym), 0)) |
|
|
469 | # define export_const(name) newCONSTSUB (gv_stashpv ("urxvt", 1), #name, newSViv (name)); |
293 | AV *hookname = get_av ("urxvt::HOOKNAME", 1); |
470 | AV *hookname = get_av ("urxvt::HOOKNAME", 1); |
294 | set_hookname (LOAD); |
|
|
295 | set_hookname (INIT); |
471 | set_hookname (INIT); |
296 | set_hookname (RESET); |
472 | set_hookname (RESET); |
297 | set_hookname (START); |
473 | set_hookname (START); |
298 | set_hookname (DESTROY); |
474 | set_hookname (DESTROY); |
299 | set_hookname (SEL_BEGIN); |
475 | set_hookname (SEL_BEGIN); |
… | |
… | |
305 | set_hookname (VIEW_CHANGE); |
481 | set_hookname (VIEW_CHANGE); |
306 | set_hookname (SCROLL_BACK); |
482 | set_hookname (SCROLL_BACK); |
307 | set_hookname (TTY_ACTIVITY); |
483 | set_hookname (TTY_ACTIVITY); |
308 | set_hookname (REFRESH_BEGIN); |
484 | set_hookname (REFRESH_BEGIN); |
309 | set_hookname (REFRESH_END); |
485 | set_hookname (REFRESH_END); |
|
|
486 | set_hookname (KEYBOARD_COMMAND); |
|
|
487 | |
|
|
488 | export_const (DEFAULT_RSTYLE); |
|
|
489 | export_const (OVERLAY_RSTYLE); |
|
|
490 | export_const (RS_Bold); |
|
|
491 | export_const (RS_Italic); |
|
|
492 | export_const (RS_Blink); |
|
|
493 | export_const (RS_RVid); |
|
|
494 | export_const (RS_Uline); |
310 | |
495 | |
311 | sv_setpv (get_sv ("urxvt::LIBDIR", 1), LIBDIR); |
496 | sv_setpv (get_sv ("urxvt::LIBDIR", 1), LIBDIR); |
312 | } |
497 | } |
313 | |
498 | |
314 | void |
499 | void |
… | |
… | |
329 | NV |
514 | NV |
330 | NOW () |
515 | NOW () |
331 | CODE: |
516 | CODE: |
332 | RETVAL = NOW; |
517 | RETVAL = NOW; |
333 | OUTPUT: |
518 | OUTPUT: |
|
|
519 | RETVAL |
|
|
520 | |
|
|
521 | int |
|
|
522 | GET_BASEFG (int rend) |
|
|
523 | CODE: |
|
|
524 | RETVAL = GET_BASEFG (rend); |
|
|
525 | OUTPUT: |
|
|
526 | RETVAL |
|
|
527 | |
|
|
528 | int |
|
|
529 | GET_BASEBG (int rend) |
|
|
530 | CODE: |
|
|
531 | RETVAL = GET_BASEBG (rend); |
|
|
532 | OUTPUT: |
|
|
533 | RETVAL |
|
|
534 | |
|
|
535 | int |
|
|
536 | SET_FGCOLOR (int rend, int new_color) |
|
|
537 | CODE: |
|
|
538 | RETVAL = SET_FGCOLOR (rend, new_color); |
|
|
539 | OUTPUT: |
|
|
540 | RETVAL |
|
|
541 | |
|
|
542 | int |
|
|
543 | SET_BGCOLOR (int rend, int new_color) |
|
|
544 | CODE: |
|
|
545 | RETVAL = SET_BGCOLOR (rend, new_color); |
|
|
546 | OUTPUT: |
|
|
547 | RETVAL |
|
|
548 | |
|
|
549 | int |
|
|
550 | GET_CUSTOM (int rend) |
|
|
551 | CODE: |
|
|
552 | RETVAL = (rend && RS_customMask) >> RS_customShift; |
|
|
553 | OUTPUT: |
|
|
554 | RETVAL |
|
|
555 | |
|
|
556 | int |
|
|
557 | SET_CUSTOM (int rend, int new_value) |
|
|
558 | CODE: |
|
|
559 | { |
|
|
560 | if (!IN_RANGE_EXC (new_value, 0, RS_customCount)) |
|
|
561 | croak ("custom value out of range, must be 0..%d", RS_customCount - 1); |
|
|
562 | |
|
|
563 | RETVAL = (rend & ~RS_customMask) |
|
|
564 | | ((new_value << RS_customShift) & RS_customMask); |
|
|
565 | } |
|
|
566 | OUTPUT: |
334 | RETVAL |
567 | RETVAL |
335 | |
568 | |
336 | MODULE = urxvt PACKAGE = urxvt::term |
569 | MODULE = urxvt PACKAGE = urxvt::term |
337 | |
570 | |
338 | int |
571 | int |
… | |
… | |
386 | SvUTF8_on (RETVAL); |
619 | SvUTF8_on (RETVAL); |
387 | free (str); |
620 | free (str); |
388 | } |
621 | } |
389 | OUTPUT: |
622 | OUTPUT: |
390 | RETVAL |
623 | RETVAL |
|
|
624 | |
|
|
625 | int |
|
|
626 | rxvt_term::nsaved () |
|
|
627 | CODE: |
|
|
628 | RETVAL = THIS->nsaved; |
|
|
629 | OUTPUT: |
|
|
630 | RETVAL |
|
|
631 | |
|
|
632 | int |
|
|
633 | rxvt_term::view_start (int newval = -1) |
|
|
634 | CODE: |
|
|
635 | { |
|
|
636 | RETVAL = THIS->view_start; |
|
|
637 | |
|
|
638 | if (newval >= 0) |
|
|
639 | { |
|
|
640 | THIS->view_start = min (newval, THIS->nsaved); |
|
|
641 | THIS->scr_changeview (RETVAL); |
|
|
642 | } |
|
|
643 | } |
|
|
644 | OUTPUT: |
|
|
645 | RETVAL |
|
|
646 | |
|
|
647 | int |
|
|
648 | rxvt_term::nrow () |
|
|
649 | CODE: |
|
|
650 | RETVAL = THIS->nrow; |
|
|
651 | OUTPUT: |
|
|
652 | RETVAL |
|
|
653 | |
|
|
654 | int |
|
|
655 | rxvt_term::ncol () |
|
|
656 | CODE: |
|
|
657 | RETVAL = THIS->ncol; |
|
|
658 | OUTPUT: |
|
|
659 | RETVAL |
|
|
660 | |
|
|
661 | void |
|
|
662 | rxvt_term::want_refresh () |
|
|
663 | CODE: |
|
|
664 | THIS->want_refresh = 1; |
|
|
665 | |
|
|
666 | void |
|
|
667 | rxvt_term::ROW_t (int row_number, SV *new_text = 0, int start_col = 0) |
|
|
668 | PPCODE: |
|
|
669 | { |
|
|
670 | if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
|
|
671 | croak ("row_number number of out range"); |
|
|
672 | |
|
|
673 | line_t &l = ROW(row_number); |
|
|
674 | |
|
|
675 | if (GIMME_V != G_VOID) |
|
|
676 | { |
|
|
677 | wchar_t *wstr = new wchar_t [THIS->ncol]; |
|
|
678 | |
|
|
679 | for (int col = 0; col <THIS->ncol; col++) |
|
|
680 | wstr [col] = l.t [col]; |
|
|
681 | |
|
|
682 | char *str = rxvt_wcstoutf8 (wstr, THIS->ncol); |
|
|
683 | free (wstr); |
|
|
684 | |
|
|
685 | SV *sv = newSVpv (str, 0); |
|
|
686 | SvUTF8_on (sv); |
|
|
687 | XPUSHs (sv_2mortal (sv)); |
|
|
688 | free (str); |
|
|
689 | } |
|
|
690 | |
|
|
691 | if (new_text) |
|
|
692 | { |
|
|
693 | wchar_t *wstr = sv2wcs (new_text); |
|
|
694 | |
|
|
695 | int len = wcslen (wstr); |
|
|
696 | |
|
|
697 | if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len)) |
|
|
698 | { |
|
|
699 | free (wstr); |
|
|
700 | croak ("new_text extends beyond horizontal margins"); |
|
|
701 | } |
|
|
702 | |
|
|
703 | for (int col = start_col; col < start_col + len; col++) |
|
|
704 | { |
|
|
705 | l.t [col] = wstr [col - start_col]; |
|
|
706 | l.r [col] = SET_FONT (l.r [col], THIS->fontset [GET_STYLE (l.r [col])]->find_font (l.t [col])); |
|
|
707 | } |
|
|
708 | |
|
|
709 | free (wstr); |
|
|
710 | } |
|
|
711 | } |
|
|
712 | |
|
|
713 | void |
|
|
714 | rxvt_term::ROW_r (int row_number, SV *new_rend = 0, int start_col = 0) |
|
|
715 | PPCODE: |
|
|
716 | { |
|
|
717 | if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
|
|
718 | croak ("row_number number of out range"); |
|
|
719 | |
|
|
720 | line_t &l = ROW(row_number); |
|
|
721 | |
|
|
722 | if (GIMME_V != G_VOID) |
|
|
723 | { |
|
|
724 | AV *av = newAV (); |
|
|
725 | |
|
|
726 | av_extend (av, THIS->ncol - 1); |
|
|
727 | for (int col = 0; col < THIS->ncol; col++) |
|
|
728 | av_store (av, col, newSViv (l.r [col])); |
|
|
729 | |
|
|
730 | XPUSHs (sv_2mortal (newRV_noinc ((SV *)av))); |
|
|
731 | } |
|
|
732 | |
|
|
733 | if (new_rend) |
|
|
734 | { |
|
|
735 | if (!SvROK (new_rend) || SvTYPE (SvRV (new_rend)) != SVt_PVAV) |
|
|
736 | croak ("new_rend must be arrayref"); |
|
|
737 | |
|
|
738 | AV *av = (AV *)SvRV (new_rend); |
|
|
739 | int len = av_len (av) + 1; |
|
|
740 | |
|
|
741 | if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len)) |
|
|
742 | croak ("new_rend array extends beyond horizontal margins"); |
|
|
743 | |
|
|
744 | for (int col = start_col; col < start_col + len; col++) |
|
|
745 | { |
|
|
746 | rend_t r = SvIV (*av_fetch (av, col - start_col, 1)) & ~RS_fontMask; |
|
|
747 | |
|
|
748 | l.r [col] = SET_FONT (r, THIS->fontset [GET_STYLE (r)]->find_font (l.t [col])); |
|
|
749 | } |
|
|
750 | } |
|
|
751 | } |
|
|
752 | |
|
|
753 | int |
|
|
754 | rxvt_term::ROW_l (int row_number, int new_length = -2) |
|
|
755 | CODE: |
|
|
756 | { |
|
|
757 | if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
|
|
758 | croak ("row_number number of out range"); |
|
|
759 | |
|
|
760 | line_t &l = ROW(row_number); |
|
|
761 | RETVAL = l.l; |
|
|
762 | |
|
|
763 | if (new_length >= -1) |
|
|
764 | l.l = new_length; |
|
|
765 | } |
|
|
766 | OUTPUT: |
|
|
767 | RETVAL |
|
|
768 | |
|
|
769 | SV * |
|
|
770 | rxvt_term::special_encode (SV *str) |
|
|
771 | CODE: |
|
|
772 | abort ();//TODO |
|
|
773 | |
|
|
774 | SV * |
|
|
775 | rxvt_term::special_decode (SV *str) |
|
|
776 | CODE: |
|
|
777 | abort ();//TODO |
391 | |
778 | |
392 | void |
779 | void |
393 | rxvt_term::_resource (char *name, int index, SV *newval = 0) |
780 | rxvt_term::_resource (char *name, int index, SV *newval = 0) |
394 | PPCODE: |
781 | PPCODE: |
395 | { |
782 | { |
… | |
… | |
457 | THIS->want_refresh = 1; |
844 | THIS->want_refresh = 1; |
458 | } |
845 | } |
459 | } |
846 | } |
460 | |
847 | |
461 | int |
848 | int |
462 | rxvt_term::selection_grab (int eventtime) |
849 | rxvt_term::selection_grab (int eventtime = CurrentTime) |
463 | |
850 | |
464 | void |
851 | void |
465 | rxvt_term::selection (SV *newtext = 0) |
852 | rxvt_term::selection (SV *newtext = 0) |
466 | PPCODE: |
853 | PPCODE: |
467 | { |
854 | { |
… | |
… | |
481 | THIS->selection.text = sv2wcs (newtext); |
868 | THIS->selection.text = sv2wcs (newtext); |
482 | THIS->selection.len = wcslen (THIS->selection.text); |
869 | THIS->selection.len = wcslen (THIS->selection.text); |
483 | } |
870 | } |
484 | } |
871 | } |
485 | |
872 | |
486 | void |
|
|
487 | rxvt_term::scr_overlay_new (int x, int y, int w, int h) |
|
|
488 | |
|
|
489 | void |
|
|
490 | rxvt_term::scr_overlay_off () |
|
|
491 | |
|
|
492 | void |
|
|
493 | rxvt_term::scr_overlay_set_char (int x, int y, U32 text, U32 rend = OVERLAY_RSTYLE) |
|
|
494 | CODE: |
|
|
495 | THIS->scr_overlay_set (x, y, text, rend); |
|
|
496 | |
|
|
497 | void |
|
|
498 | rxvt_term::scr_overlay_set (int x, int y, SV *text) |
|
|
499 | CODE: |
|
|
500 | { |
|
|
501 | wchar_t *wtext = sv2wcs (text); |
|
|
502 | THIS->scr_overlay_set (x, y, wtext); |
|
|
503 | free (wtext); |
|
|
504 | } |
|
|
505 | |
|
|
506 | void |
873 | void |
507 | rxvt_term::tt_write (SV *octets) |
874 | rxvt_term::tt_write (SV *octets) |
508 | INIT: |
875 | INIT: |
509 | STRLEN len; |
876 | STRLEN len; |
510 | char *str = SvPVbyte (octets, len); |
877 | char *str = SvPVbyte (octets, len); |
511 | C_ARGS: |
878 | C_ARGS: |
512 | (unsigned char *)str, len |
879 | (unsigned char *)str, len |
513 | |
880 | |
|
|
881 | SV * |
|
|
882 | rxvt_term::overlay (int x, int y, int w, int h, int rstyle = OVERLAY_RSTYLE, int border = 2) |
|
|
883 | CODE: |
|
|
884 | { |
|
|
885 | overlay *o = new overlay (THIS, x, y, w, h, rstyle, border); |
|
|
886 | RETVAL = newSVptr ((void *)o, "urxvt::overlay"); |
|
|
887 | o->self = (HV *)SvRV (RETVAL); |
|
|
888 | |
|
|
889 | HV *hv = (HV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)THIS->self), "_overlay", 8, 0)); |
|
|
890 | char key[33]; sprintf (key, "%32lx", (long)o); |
|
|
891 | hv_store (hv, key, 32, newSViv ((long)o), 0); |
|
|
892 | } |
|
|
893 | OUTPUT: |
|
|
894 | RETVAL |
|
|
895 | |
|
|
896 | MODULE = urxvt PACKAGE = urxvt::overlay |
|
|
897 | |
|
|
898 | void |
|
|
899 | overlay::set (int x, int y, SV *text, SV *rend = 0) |
|
|
900 | |
|
|
901 | void |
|
|
902 | overlay::DESTROY () |
|
|
903 | CODE: |
|
|
904 | { |
|
|
905 | SV **ovs = hv_fetch ((HV *)SvRV ((SV *)THIS->THIS->self), "_overlay", 8, 0); |
|
|
906 | if (ovs) |
|
|
907 | { |
|
|
908 | HV *hv = (HV *)SvRV (*ovs); |
|
|
909 | char key[33]; sprintf (key, "%32lx", (long)THIS); |
|
|
910 | hv_delete (hv, key, 32, G_DISCARD); |
|
|
911 | } |
|
|
912 | |
|
|
913 | delete THIS; |
|
|
914 | } |
|
|
915 | |
514 | MODULE = urxvt PACKAGE = urxvt::timer |
916 | MODULE = urxvt PACKAGE = urxvt::timer |
515 | |
917 | |
516 | SV * |
918 | SV * |
517 | timer::new () |
919 | timer::new () |
518 | CODE: |
920 | CODE: |
519 | timer *w = new timer; |
921 | timer *w = new timer; |
|
|
922 | w->start (NOW); |
520 | RETVAL = newSVptr ((void *)w, "urxvt::timer"); |
923 | RETVAL = newSVptr ((void *)w, "urxvt::timer"); |
521 | w->self = (HV *)SvRV (RETVAL); |
924 | w->self = (HV *)SvRV (RETVAL); |
522 | OUTPUT: |
925 | OUTPUT: |
523 | RETVAL |
926 | RETVAL |
524 | |
927 | |
… | |
… | |
532 | |
935 | |
533 | NV |
936 | NV |
534 | timer::at () |
937 | timer::at () |
535 | CODE: |
938 | CODE: |
536 | RETVAL = THIS->at; |
939 | RETVAL = THIS->at; |
|
|
940 | OUTPUT: |
|
|
941 | RETVAL |
|
|
942 | |
|
|
943 | timer * |
|
|
944 | timer::interval (NV interval) |
|
|
945 | CODE: |
|
|
946 | THIS->interval = interval; |
|
|
947 | RETVAL = THIS; |
537 | OUTPUT: |
948 | OUTPUT: |
538 | RETVAL |
949 | RETVAL |
539 | |
950 | |
540 | timer * |
951 | timer * |
541 | timer::set (NV tstamp) |
952 | timer::set (NV tstamp) |