… | |
… | |
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 | |
… | |
… | |
208 | } |
359 | } |
209 | |
360 | |
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 | || (!should_invoke [htype] && htype != HOOK_INIT && htype != HOOK_DESTROY)) |
|
|
215 | return false; |
365 | return false; |
216 | |
366 | |
217 | if (htype == HOOK_INIT) // first hook ever called |
367 | if (htype == HOOK_INIT) // first hook ever called |
|
|
368 | { |
218 | 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 (htype == HOOK_DESTROY) |
|
|
373 | { |
|
|
374 | // handled later |
|
|
375 | } |
|
|
376 | else if (htype == HOOK_REFRESH_BEGIN || htype == HOOK_REFRESH_END) |
|
|
377 | { |
|
|
378 | HV *hv = (HV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)term->self), "_overlay", 8, 0)); |
|
|
379 | |
|
|
380 | if (HvKEYS (hv)) |
|
|
381 | { |
|
|
382 | hv_iterinit (hv); |
|
|
383 | |
|
|
384 | while (HE *he = hv_iternext (hv)) |
|
|
385 | ((overlay *)SvIV (hv_iterval (hv, he)))->swap (); |
|
|
386 | } |
|
|
387 | } |
|
|
388 | else if (!should_invoke [htype]) |
|
|
389 | return false; |
219 | |
390 | |
220 | dSP; |
391 | dSP; |
221 | va_list ap; |
392 | va_list ap; |
222 | |
393 | |
223 | va_start (ap, htype); |
394 | va_start (ap, htype); |
… | |
… | |
291 | PROTOTYPES: ENABLE |
462 | PROTOTYPES: ENABLE |
292 | |
463 | |
293 | BOOT: |
464 | BOOT: |
294 | { |
465 | { |
295 | # define set_hookname(sym) av_store (hookname, PP_CONCAT(HOOK_, sym), newSVpv (PP_STRINGIFY(sym), 0)) |
466 | # define set_hookname(sym) av_store (hookname, PP_CONCAT(HOOK_, sym), newSVpv (PP_STRINGIFY(sym), 0)) |
|
|
467 | # define export_const(name) newCONSTSUB (gv_stashpv ("urxvt", 1), #name, newSViv (name)); |
296 | AV *hookname = get_av ("urxvt::HOOKNAME", 1); |
468 | AV *hookname = get_av ("urxvt::HOOKNAME", 1); |
297 | set_hookname (INIT); |
469 | set_hookname (INIT); |
298 | set_hookname (RESET); |
470 | set_hookname (RESET); |
299 | set_hookname (START); |
471 | set_hookname (START); |
300 | set_hookname (DESTROY); |
472 | set_hookname (DESTROY); |
301 | set_hookname (SEL_BEGIN); |
473 | set_hookname (SEL_BEGIN); |
302 | set_hookname (SEL_EXTEND); |
474 | set_hookname (SEL_EXTEND); |
303 | set_hookname (SEL_MAKE); |
475 | set_hookname (SEL_MAKE); |
304 | set_hookname (SEL_GRAB); |
476 | set_hookname (SEL_GRAB); |
|
|
477 | set_hookname (SEL_CLICK); |
305 | set_hookname (FOCUS_IN); |
478 | set_hookname (FOCUS_IN); |
306 | set_hookname (FOCUS_OUT); |
479 | set_hookname (FOCUS_OUT); |
307 | set_hookname (VIEW_CHANGE); |
480 | set_hookname (VIEW_CHANGE); |
308 | set_hookname (SCROLL_BACK); |
481 | set_hookname (SCROLL_BACK); |
309 | set_hookname (TTY_ACTIVITY); |
482 | set_hookname (TTY_ACTIVITY); |
310 | set_hookname (REFRESH_BEGIN); |
483 | set_hookname (REFRESH_BEGIN); |
311 | set_hookname (REFRESH_END); |
484 | set_hookname (REFRESH_END); |
312 | set_hookname (KEYBOARD_COMMAND); |
485 | set_hookname (KEYBOARD_COMMAND); |
|
|
486 | set_hookname (MOUSE_CLICK); |
|
|
487 | set_hookname (MOUSE_MOVE); |
|
|
488 | |
|
|
489 | export_const (DEFAULT_RSTYLE); |
|
|
490 | export_const (OVERLAY_RSTYLE); |
|
|
491 | export_const (RS_Bold); |
|
|
492 | export_const (RS_Italic); |
|
|
493 | export_const (RS_Blink); |
|
|
494 | export_const (RS_RVid); |
|
|
495 | export_const (RS_Uline); |
313 | |
496 | |
314 | sv_setpv (get_sv ("urxvt::LIBDIR", 1), LIBDIR); |
497 | sv_setpv (get_sv ("urxvt::LIBDIR", 1), LIBDIR); |
315 | } |
498 | } |
316 | |
499 | |
317 | void |
500 | void |
… | |
… | |
332 | NV |
515 | NV |
333 | NOW () |
516 | NOW () |
334 | CODE: |
517 | CODE: |
335 | RETVAL = NOW; |
518 | RETVAL = NOW; |
336 | OUTPUT: |
519 | OUTPUT: |
|
|
520 | RETVAL |
|
|
521 | |
|
|
522 | int |
|
|
523 | GET_BASEFG (int rend) |
|
|
524 | CODE: |
|
|
525 | RETVAL = GET_BASEFG (rend); |
|
|
526 | OUTPUT: |
|
|
527 | RETVAL |
|
|
528 | |
|
|
529 | int |
|
|
530 | GET_BASEBG (int rend) |
|
|
531 | CODE: |
|
|
532 | RETVAL = GET_BASEBG (rend); |
|
|
533 | OUTPUT: |
|
|
534 | RETVAL |
|
|
535 | |
|
|
536 | int |
|
|
537 | SET_FGCOLOR (int rend, int new_color) |
|
|
538 | CODE: |
|
|
539 | RETVAL = SET_FGCOLOR (rend, new_color); |
|
|
540 | OUTPUT: |
|
|
541 | RETVAL |
|
|
542 | |
|
|
543 | int |
|
|
544 | SET_BGCOLOR (int rend, int new_color) |
|
|
545 | CODE: |
|
|
546 | RETVAL = SET_BGCOLOR (rend, new_color); |
|
|
547 | OUTPUT: |
|
|
548 | RETVAL |
|
|
549 | |
|
|
550 | int |
|
|
551 | GET_CUSTOM (int rend) |
|
|
552 | CODE: |
|
|
553 | RETVAL = (rend && RS_customMask) >> RS_customShift; |
|
|
554 | OUTPUT: |
|
|
555 | RETVAL |
|
|
556 | |
|
|
557 | int |
|
|
558 | SET_CUSTOM (int rend, int new_value) |
|
|
559 | CODE: |
|
|
560 | { |
|
|
561 | if (!IN_RANGE_EXC (new_value, 0, RS_customCount)) |
|
|
562 | croak ("custom value out of range, must be 0..%d", RS_customCount - 1); |
|
|
563 | |
|
|
564 | RETVAL = (rend & ~RS_customMask) |
|
|
565 | | ((new_value << RS_customShift) & RS_customMask); |
|
|
566 | } |
|
|
567 | OUTPUT: |
337 | RETVAL |
568 | RETVAL |
338 | |
569 | |
339 | MODULE = urxvt PACKAGE = urxvt::term |
570 | MODULE = urxvt PACKAGE = urxvt::term |
340 | |
571 | |
341 | int |
572 | int |
… | |
… | |
389 | SvUTF8_on (RETVAL); |
620 | SvUTF8_on (RETVAL); |
390 | free (str); |
621 | free (str); |
391 | } |
622 | } |
392 | OUTPUT: |
623 | OUTPUT: |
393 | RETVAL |
624 | RETVAL |
|
|
625 | |
|
|
626 | int |
|
|
627 | rxvt_term::nsaved () |
|
|
628 | CODE: |
|
|
629 | RETVAL = THIS->nsaved; |
|
|
630 | OUTPUT: |
|
|
631 | RETVAL |
|
|
632 | |
|
|
633 | int |
|
|
634 | rxvt_term::view_start (int newval = -1) |
|
|
635 | CODE: |
|
|
636 | { |
|
|
637 | RETVAL = THIS->view_start; |
|
|
638 | |
|
|
639 | if (newval >= 0) |
|
|
640 | { |
|
|
641 | THIS->view_start = min (newval, THIS->nsaved); |
|
|
642 | THIS->scr_changeview (RETVAL); |
|
|
643 | } |
|
|
644 | } |
|
|
645 | OUTPUT: |
|
|
646 | RETVAL |
|
|
647 | |
|
|
648 | int |
|
|
649 | rxvt_term::nrow () |
|
|
650 | CODE: |
|
|
651 | RETVAL = THIS->nrow; |
|
|
652 | OUTPUT: |
|
|
653 | RETVAL |
|
|
654 | |
|
|
655 | int |
|
|
656 | rxvt_term::ncol () |
|
|
657 | CODE: |
|
|
658 | RETVAL = THIS->ncol; |
|
|
659 | OUTPUT: |
|
|
660 | RETVAL |
|
|
661 | |
|
|
662 | void |
|
|
663 | rxvt_term::want_refresh () |
|
|
664 | CODE: |
|
|
665 | THIS->want_refresh = 1; |
|
|
666 | |
|
|
667 | void |
|
|
668 | rxvt_term::ROW_t (int row_number, SV *new_text = 0, int start_col = 0) |
|
|
669 | PPCODE: |
|
|
670 | { |
|
|
671 | if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
|
|
672 | croak ("row_number number of out range"); |
|
|
673 | |
|
|
674 | line_t &l = ROW(row_number); |
|
|
675 | |
|
|
676 | if (GIMME_V != G_VOID) |
|
|
677 | { |
|
|
678 | wchar_t *wstr = new wchar_t [THIS->ncol]; |
|
|
679 | |
|
|
680 | for (int col = 0; col <THIS->ncol; col++) |
|
|
681 | wstr [col] = l.t [col]; |
|
|
682 | |
|
|
683 | char *str = rxvt_wcstoutf8 (wstr, THIS->ncol); |
|
|
684 | free (wstr); |
|
|
685 | |
|
|
686 | SV *sv = newSVpv (str, 0); |
|
|
687 | SvUTF8_on (sv); |
|
|
688 | XPUSHs (sv_2mortal (sv)); |
|
|
689 | free (str); |
|
|
690 | } |
|
|
691 | |
|
|
692 | if (new_text) |
|
|
693 | { |
|
|
694 | wchar_t *wstr = sv2wcs (new_text); |
|
|
695 | |
|
|
696 | int len = wcslen (wstr); |
|
|
697 | |
|
|
698 | if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len)) |
|
|
699 | { |
|
|
700 | free (wstr); |
|
|
701 | croak ("new_text extends beyond horizontal margins"); |
|
|
702 | } |
|
|
703 | |
|
|
704 | for (int col = start_col; col < start_col + len; col++) |
|
|
705 | { |
|
|
706 | l.t [col] = wstr [col - start_col]; |
|
|
707 | l.r [col] = SET_FONT (l.r [col], THIS->fontset [GET_STYLE (l.r [col])]->find_font (l.t [col])); |
|
|
708 | } |
|
|
709 | |
|
|
710 | free (wstr); |
|
|
711 | } |
|
|
712 | } |
|
|
713 | |
|
|
714 | void |
|
|
715 | rxvt_term::ROW_r (int row_number, SV *new_rend = 0, int start_col = 0) |
|
|
716 | PPCODE: |
|
|
717 | { |
|
|
718 | if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
|
|
719 | croak ("row_number number of out range"); |
|
|
720 | |
|
|
721 | line_t &l = ROW(row_number); |
|
|
722 | |
|
|
723 | if (GIMME_V != G_VOID) |
|
|
724 | { |
|
|
725 | AV *av = newAV (); |
|
|
726 | |
|
|
727 | av_extend (av, THIS->ncol - 1); |
|
|
728 | for (int col = 0; col < THIS->ncol; col++) |
|
|
729 | av_store (av, col, newSViv (l.r [col])); |
|
|
730 | |
|
|
731 | XPUSHs (sv_2mortal (newRV_noinc ((SV *)av))); |
|
|
732 | } |
|
|
733 | |
|
|
734 | if (new_rend) |
|
|
735 | { |
|
|
736 | if (!SvROK (new_rend) || SvTYPE (SvRV (new_rend)) != SVt_PVAV) |
|
|
737 | croak ("new_rend must be arrayref"); |
|
|
738 | |
|
|
739 | AV *av = (AV *)SvRV (new_rend); |
|
|
740 | int len = av_len (av) + 1; |
|
|
741 | |
|
|
742 | if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len)) |
|
|
743 | croak ("new_rend array extends beyond horizontal margins"); |
|
|
744 | |
|
|
745 | for (int col = start_col; col < start_col + len; col++) |
|
|
746 | { |
|
|
747 | rend_t r = SvIV (*av_fetch (av, col - start_col, 1)) & ~RS_fontMask; |
|
|
748 | |
|
|
749 | l.r [col] = SET_FONT (r, THIS->fontset [GET_STYLE (r)]->find_font (l.t [col])); |
|
|
750 | } |
|
|
751 | } |
|
|
752 | } |
|
|
753 | |
|
|
754 | int |
|
|
755 | rxvt_term::ROW_l (int row_number, int new_length = -2) |
|
|
756 | CODE: |
|
|
757 | { |
|
|
758 | if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
|
|
759 | croak ("row_number number of out range"); |
|
|
760 | |
|
|
761 | line_t &l = ROW(row_number); |
|
|
762 | RETVAL = l.l; |
|
|
763 | |
|
|
764 | if (new_length >= -1) |
|
|
765 | l.l = new_length; |
|
|
766 | } |
|
|
767 | OUTPUT: |
|
|
768 | RETVAL |
|
|
769 | |
|
|
770 | SV * |
|
|
771 | rxvt_term::special_encode (SV *str) |
|
|
772 | CODE: |
|
|
773 | abort ();//TODO |
|
|
774 | |
|
|
775 | SV * |
|
|
776 | rxvt_term::special_decode (SV *str) |
|
|
777 | CODE: |
|
|
778 | abort ();//TODO |
394 | |
779 | |
395 | void |
780 | void |
396 | rxvt_term::_resource (char *name, int index, SV *newval = 0) |
781 | rxvt_term::_resource (char *name, int index, SV *newval = 0) |
397 | PPCODE: |
782 | PPCODE: |
398 | { |
783 | { |
… | |
… | |
460 | THIS->want_refresh = 1; |
845 | THIS->want_refresh = 1; |
461 | } |
846 | } |
462 | } |
847 | } |
463 | |
848 | |
464 | int |
849 | int |
465 | rxvt_term::selection_grab (int eventtime) |
850 | rxvt_term::selection_grab (int eventtime = CurrentTime) |
466 | |
851 | |
467 | void |
852 | void |
468 | rxvt_term::selection (SV *newtext = 0) |
853 | rxvt_term::selection (SV *newtext = 0) |
469 | PPCODE: |
854 | PPCODE: |
470 | { |
855 | { |
… | |
… | |
484 | THIS->selection.text = sv2wcs (newtext); |
869 | THIS->selection.text = sv2wcs (newtext); |
485 | THIS->selection.len = wcslen (THIS->selection.text); |
870 | THIS->selection.len = wcslen (THIS->selection.text); |
486 | } |
871 | } |
487 | } |
872 | } |
488 | |
873 | |
489 | void |
|
|
490 | rxvt_term::scr_overlay_new (int x, int y, int w, int h) |
|
|
491 | |
|
|
492 | void |
|
|
493 | rxvt_term::scr_overlay_off () |
|
|
494 | |
|
|
495 | void |
|
|
496 | rxvt_term::scr_overlay_set_char (int x, int y, U32 text, U32 rend = OVERLAY_RSTYLE) |
|
|
497 | CODE: |
|
|
498 | THIS->scr_overlay_set (x, y, text, rend); |
|
|
499 | |
|
|
500 | void |
|
|
501 | rxvt_term::scr_overlay_set (int x, int y, SV *text) |
|
|
502 | CODE: |
|
|
503 | { |
|
|
504 | wchar_t *wtext = sv2wcs (text); |
|
|
505 | THIS->scr_overlay_set (x, y, wtext); |
|
|
506 | free (wtext); |
|
|
507 | } |
|
|
508 | |
|
|
509 | void |
874 | void |
510 | rxvt_term::tt_write (SV *octets) |
875 | rxvt_term::tt_write (SV *octets) |
511 | INIT: |
876 | INIT: |
512 | STRLEN len; |
877 | STRLEN len; |
513 | char *str = SvPVbyte (octets, len); |
878 | char *str = SvPVbyte (octets, len); |
514 | C_ARGS: |
879 | C_ARGS: |
515 | (unsigned char *)str, len |
880 | (unsigned char *)str, len |
516 | |
881 | |
|
|
882 | SV * |
|
|
883 | rxvt_term::overlay (int x, int y, int w, int h, int rstyle = OVERLAY_RSTYLE, int border = 2) |
|
|
884 | CODE: |
|
|
885 | { |
|
|
886 | overlay *o = new overlay (THIS, x, y, w, h, rstyle, border); |
|
|
887 | RETVAL = newSVptr ((void *)o, "urxvt::overlay"); |
|
|
888 | o->self = (HV *)SvRV (RETVAL); |
|
|
889 | |
|
|
890 | HV *hv = (HV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)THIS->self), "_overlay", 8, 0)); |
|
|
891 | char key[33]; sprintf (key, "%32lx", (long)o); |
|
|
892 | hv_store (hv, key, 32, newSViv ((long)o), 0); |
|
|
893 | } |
|
|
894 | OUTPUT: |
|
|
895 | RETVAL |
|
|
896 | |
|
|
897 | MODULE = urxvt PACKAGE = urxvt::overlay |
|
|
898 | |
|
|
899 | void |
|
|
900 | overlay::set (int x, int y, SV *text, SV *rend = 0) |
|
|
901 | |
|
|
902 | void |
|
|
903 | overlay::DESTROY () |
|
|
904 | CODE: |
|
|
905 | { |
|
|
906 | SV **ovs = hv_fetch ((HV *)SvRV ((SV *)THIS->THIS->self), "_overlay", 8, 0); |
|
|
907 | if (ovs) |
|
|
908 | { |
|
|
909 | HV *hv = (HV *)SvRV (*ovs); |
|
|
910 | char key[33]; sprintf (key, "%32lx", (long)THIS); |
|
|
911 | hv_delete (hv, key, 32, G_DISCARD); |
|
|
912 | } |
|
|
913 | |
|
|
914 | delete THIS; |
|
|
915 | } |
|
|
916 | |
517 | MODULE = urxvt PACKAGE = urxvt::timer |
917 | MODULE = urxvt PACKAGE = urxvt::timer |
518 | |
918 | |
519 | SV * |
919 | SV * |
520 | timer::new () |
920 | timer::new () |
521 | CODE: |
921 | CODE: |
522 | timer *w = new timer; |
922 | timer *w = new timer; |
|
|
923 | w->start (NOW); |
523 | RETVAL = newSVptr ((void *)w, "urxvt::timer"); |
924 | RETVAL = newSVptr ((void *)w, "urxvt::timer"); |
524 | w->self = (HV *)SvRV (RETVAL); |
925 | w->self = (HV *)SvRV (RETVAL); |
525 | OUTPUT: |
926 | OUTPUT: |
526 | RETVAL |
927 | RETVAL |
527 | |
928 | |
… | |
… | |
535 | |
936 | |
536 | NV |
937 | NV |
537 | timer::at () |
938 | timer::at () |
538 | CODE: |
939 | CODE: |
539 | RETVAL = THIS->at; |
940 | RETVAL = THIS->at; |
|
|
941 | OUTPUT: |
|
|
942 | RETVAL |
|
|
943 | |
|
|
944 | timer * |
|
|
945 | timer::interval (NV interval) |
|
|
946 | CODE: |
|
|
947 | THIS->interval = interval; |
|
|
948 | RETVAL = THIS; |
540 | OUTPUT: |
949 | OUTPUT: |
541 | RETVAL |
950 | RETVAL |
542 | |
951 | |
543 | timer * |
952 | timer * |
544 | timer::set (NV tstamp) |
953 | timer::set (NV tstamp) |