… | |
… | |
29 | #include "../config.h" |
29 | #include "../config.h" |
30 | |
30 | |
31 | #include <cstddef> |
31 | #include <cstddef> |
32 | #include <cstdarg> |
32 | #include <cstdarg> |
33 | |
33 | |
|
|
34 | #include "unistd.h" |
|
|
35 | |
34 | #include "iom.h" |
36 | #include "iom.h" |
35 | #include "rxvt.h" |
37 | #include "rxvt.h" |
36 | #include "keyboard.h" |
38 | #include "keyboard.h" |
37 | #include "rxvtutil.h" |
39 | #include "rxvtutil.h" |
38 | #include "rxvtperl.h" |
40 | #include "rxvtperl.h" |
39 | |
41 | |
40 | #include "perlxsi.c" |
42 | #include "perlxsi.c" |
41 | |
43 | |
42 | #if defined(HAVE_SCROLLBARS) || defined(MENUBAR) |
44 | #ifdef HAVE_SCROLLBARS |
43 | # define GRAB_CURSOR THIS->leftptr_cursor |
45 | # define GRAB_CURSOR THIS->leftptr_cursor |
44 | #else |
46 | #else |
45 | # define GRAB_CURSOR None |
47 | # define GRAB_CURSOR None |
46 | #endif |
48 | #endif |
47 | |
49 | |
48 | #undef LINENO |
50 | #undef LINENO |
49 | #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) |
50 | #undef ROW |
52 | #undef ROW |
51 | #define ROW(n) THIS->row_buf [LINENO (n)] |
53 | #define ROW(n) THIS->row_buf [LINENO (n)] |
52 | |
54 | |
|
|
55 | #define ENABLE_PERL_FRILLS 1 |
|
|
56 | |
53 | ///////////////////////////////////////////////////////////////////////////// |
57 | ///////////////////////////////////////////////////////////////////////////// |
54 | |
|
|
55 | static SV * |
|
|
56 | taint (SV *sv) |
|
|
57 | { |
|
|
58 | SvTAINT (sv); |
|
|
59 | return sv; |
|
|
60 | } |
|
|
61 | |
|
|
62 | static SV * |
|
|
63 | taint_if (SV *sv, SV *src) |
|
|
64 | { |
|
|
65 | if (SvTAINTED (src)) |
|
|
66 | SvTAINT (sv); |
|
|
67 | |
|
|
68 | return sv; |
|
|
69 | } |
|
|
70 | |
58 | |
71 | static wchar_t * |
59 | static wchar_t * |
72 | sv2wcs (SV *sv) |
60 | sv2wcs (SV *sv) |
73 | { |
61 | { |
74 | STRLEN len; |
62 | STRLEN len; |
… | |
… | |
345 | for (int y = ov_h; y--; ) |
333 | for (int y = ov_h; y--; ) |
346 | { |
334 | { |
347 | text_t *t1 = text [y]; |
335 | text_t *t1 = text [y]; |
348 | rend_t *r1 = rend [y]; |
336 | rend_t *r1 = rend [y]; |
349 | |
337 | |
350 | text_t *t2 = ROW(y + ov_y - THIS->view_start).t + ov_x; |
338 | text_t *t2 = ROW(y + ov_y + THIS->view_start).t + ov_x; |
351 | rend_t *r2 = ROW(y + ov_y - THIS->view_start).r + ov_x; |
339 | rend_t *r2 = ROW(y + ov_y + THIS->view_start).r + ov_x; |
352 | |
340 | |
353 | for (int x = ov_w; x--; ) |
341 | for (int x = ov_w; x--; ) |
354 | { |
342 | { |
355 | text_t t = *t1; *t1++ = *t2; *t2++ = t; |
343 | text_t t = *t1; *t1++ = *t2; *t2++ = t; |
356 | rend_t r = *r1; *r1++ = *r2; *r2++ = SET_FONT (r, THIS->fontset [GET_STYLE (r)]->find_font (t)); |
344 | rend_t r = *r1; *r1++ = *r2; *r2++ = SET_FONT (r, THIS->fontset [GET_STYLE (r)]->find_font (t)); |
… | |
… | |
393 | |
381 | |
394 | struct rxvt_perl_interp rxvt_perl; |
382 | struct rxvt_perl_interp rxvt_perl; |
395 | |
383 | |
396 | static PerlInterpreter *perl; |
384 | static PerlInterpreter *perl; |
397 | |
385 | |
398 | rxvt_perl_interp::rxvt_perl_interp () |
|
|
399 | { |
|
|
400 | } |
|
|
401 | |
|
|
402 | rxvt_perl_interp::~rxvt_perl_interp () |
386 | rxvt_perl_interp::~rxvt_perl_interp () |
403 | { |
387 | { |
404 | if (perl) |
388 | if (perl) |
405 | { |
389 | { |
406 | perl_destruct (perl); |
390 | perl_destruct (perl); |
407 | perl_free (perl); |
391 | perl_free (perl); |
408 | } |
392 | } |
409 | } |
393 | } |
410 | |
394 | |
411 | void |
395 | void |
412 | rxvt_perl_interp::init () |
396 | rxvt_perl_interp::init (rxvt_term *term) |
413 | { |
397 | { |
414 | if (!perl) |
398 | if (!perl) |
415 | { |
399 | { |
|
|
400 | rxvt_push_locale (""); // perl init destroys current locale |
|
|
401 | |
416 | perl_environ = rxvt_environ; |
402 | perl_environ = rxvt_environ; |
417 | swap (perl_environ, environ); |
403 | swap (perl_environ, environ); |
418 | |
404 | |
419 | char *argv[] = { |
405 | char *argv[] = { |
420 | "", |
406 | "", |
421 | "-T", |
|
|
422 | "-edo '" LIBDIR "/urxvt.pm' or ($@ and die $@) or exit 1", |
407 | "-edo '" LIBDIR "/urxvt.pm' or ($@ and die $@) or exit 1", |
423 | }; |
408 | }; |
424 | |
409 | |
425 | perl = perl_alloc (); |
410 | perl = perl_alloc (); |
426 | perl_construct (perl); |
411 | perl_construct (perl); |
427 | |
412 | |
428 | if (perl_parse (perl, xs_init, 3, argv, (char **)NULL) |
413 | if (perl_parse (perl, xs_init, 2, argv, (char **)NULL) |
429 | || perl_run (perl)) |
414 | || perl_run (perl)) |
430 | { |
415 | { |
431 | rxvt_warn ("unable to initialize perl-interpreter, continuing without.\n"); |
416 | rxvt_warn ("unable to initialize perl-interpreter, continuing without.\n"); |
432 | |
417 | |
433 | perl_destruct (perl); |
418 | perl_destruct (perl); |
434 | perl_free (perl); |
419 | perl_free (perl); |
435 | perl = 0; |
420 | perl = 0; |
436 | } |
421 | } |
437 | |
422 | |
438 | swap (perl_environ, environ); |
423 | swap (perl_environ, environ); |
|
|
424 | |
|
|
425 | rxvt_pop_locale (); |
|
|
426 | } |
|
|
427 | |
|
|
428 | if (perl) |
|
|
429 | { |
|
|
430 | // runs outside of perls ENV |
|
|
431 | 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); |
439 | } |
433 | } |
440 | } |
434 | } |
441 | |
435 | |
442 | static void |
436 | static void |
443 | ungrab (rxvt_term *THIS) |
437 | ungrab (rxvt_term *THIS) |
… | |
… | |
448 | XUngrabPointer (THIS->display->display, THIS->perl.grabtime); |
442 | XUngrabPointer (THIS->display->display, THIS->perl.grabtime); |
449 | THIS->perl.grabtime = 0; |
443 | THIS->perl.grabtime = 0; |
450 | } |
444 | } |
451 | } |
445 | } |
452 | |
446 | |
|
|
447 | static void |
|
|
448 | swap_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 | |
453 | bool |
461 | bool |
454 | rxvt_perl_interp::invoke (rxvt_term *term, hook_type htype, ...) |
462 | rxvt_perl_interp::invoke (rxvt_term *term, hook_type htype, ...) |
455 | { |
463 | { |
456 | if (!perl) |
464 | if (!perl || !term->perl.self) |
457 | return false; |
465 | return false; |
458 | |
466 | |
459 | if (htype == HOOK_INIT) // first hook ever called |
467 | // pre-handling of some events |
460 | { |
468 | if (htype == HOOK_REFRESH_END) |
461 | term->perl.self = (void *)newSVptr ((void *)term, "urxvt::term"); |
469 | swap_overlays (term); |
462 | hv_store ((HV *)SvRV ((SV *)term->perl.self), "_overlay", 8, newRV_noinc ((SV *)newHV ()), 0); |
470 | |
463 | } |
471 | swap (perl_environ, environ); |
464 | else if (!term->perl.self) |
472 | |
465 | return false; // perl not initialized for this instance |
473 | bool event_consumed; |
466 | else if (htype == HOOK_DESTROY) |
474 | |
467 | { |
475 | if (htype == HOOK_INIT || htype == HOOK_DESTROY // must be called always |
468 | // handled later |
476 | || term->perl.should_invoke [htype]) |
469 | } |
477 | try |
470 | else |
|
|
471 | { |
|
|
472 | if (htype == HOOK_REFRESH_BEGIN || htype == HOOK_REFRESH_END) |
|
|
473 | { |
478 | { |
474 | HV *hv = (HV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)term->perl.self), "_overlay", 8, 0)); |
479 | dSP; |
|
|
480 | va_list ap; |
475 | |
481 | |
476 | if (HvKEYS (hv)) |
482 | va_start (ap, htype); |
|
|
483 | |
|
|
484 | ENTER; |
|
|
485 | SAVETMPS; |
|
|
486 | |
|
|
487 | PUSHMARK (SP); |
|
|
488 | |
|
|
489 | XPUSHs (sv_2mortal (newSVterm (term))); |
|
|
490 | XPUSHs (sv_2mortal (newSViv (htype))); |
|
|
491 | |
|
|
492 | for (;;) { |
|
|
493 | data_type dt = (data_type)va_arg (ap, int); |
|
|
494 | |
|
|
495 | switch (dt) |
477 | { |
496 | { |
478 | hv_iterinit (hv); |
|
|
479 | |
|
|
480 | while (HE *he = hv_iternext (hv)) |
|
|
481 | ((overlay *)SvIV (hv_iterval (hv, he)))->swap (); |
|
|
482 | } |
|
|
483 | |
|
|
484 | } |
|
|
485 | |
|
|
486 | if (!should_invoke [htype]) |
|
|
487 | return false; |
|
|
488 | } |
|
|
489 | |
|
|
490 | swap (perl_environ, environ); |
|
|
491 | |
|
|
492 | try |
|
|
493 | { |
|
|
494 | dSP; |
|
|
495 | va_list ap; |
|
|
496 | |
|
|
497 | va_start (ap, htype); |
|
|
498 | |
|
|
499 | ENTER; |
|
|
500 | SAVETMPS; |
|
|
501 | |
|
|
502 | PUSHMARK (SP); |
|
|
503 | |
|
|
504 | XPUSHs (sv_2mortal (newSVterm (term))); |
|
|
505 | XPUSHs (sv_2mortal (newSViv (htype))); |
|
|
506 | |
|
|
507 | for (;;) { |
|
|
508 | data_type dt = (data_type)va_arg (ap, int); |
|
|
509 | |
|
|
510 | switch (dt) |
|
|
511 | { |
|
|
512 | case DT_INT: |
497 | case DT_INT: |
513 | XPUSHs (sv_2mortal (newSViv (va_arg (ap, int)))); |
498 | XPUSHs (sv_2mortal (newSViv (va_arg (ap, int)))); |
514 | break; |
499 | break; |
515 | |
500 | |
516 | case DT_LONG: |
501 | case DT_LONG: |
517 | XPUSHs (sv_2mortal (newSViv (va_arg (ap, long)))); |
502 | XPUSHs (sv_2mortal (newSViv (va_arg (ap, long)))); |
518 | break; |
503 | break; |
519 | |
504 | |
520 | case DT_STR: |
505 | case DT_STR: |
521 | XPUSHs (taint (sv_2mortal (newSVpv (va_arg (ap, char *), 0)))); |
506 | XPUSHs (sv_2mortal (newSVpv (va_arg (ap, char *), 0))); |
522 | break; |
507 | break; |
523 | |
508 | |
524 | case DT_STR_LEN: |
509 | case DT_STR_LEN: |
525 | { |
510 | { |
526 | char *str = va_arg (ap, char *); |
511 | char *str = va_arg (ap, char *); |
527 | int len = va_arg (ap, int); |
512 | int len = va_arg (ap, int); |
528 | |
513 | |
529 | XPUSHs (taint (sv_2mortal (newSVpvn (str, len)))); |
514 | XPUSHs (sv_2mortal (newSVpvn (str, len))); |
530 | } |
515 | } |
531 | break; |
516 | break; |
532 | |
517 | |
533 | case DT_WCS_LEN: |
518 | case DT_WCS_LEN: |
534 | { |
519 | { |
535 | wchar_t *wstr = va_arg (ap, wchar_t *); |
520 | wchar_t *wstr = va_arg (ap, wchar_t *); |
536 | int wlen = va_arg (ap, int); |
521 | int wlen = va_arg (ap, int); |
537 | |
522 | |
538 | XPUSHs (taint (sv_2mortal (wcs2sv (wstr, wlen)))); |
523 | XPUSHs (sv_2mortal (wcs2sv (wstr, wlen))); |
539 | } |
524 | } |
540 | break; |
525 | break; |
541 | |
526 | |
542 | case DT_XEVENT: |
527 | case DT_XEVENT: |
543 | { |
528 | { |
544 | XEvent *xe = va_arg (ap, XEvent *); |
529 | XEvent *xe = va_arg (ap, XEvent *); |
545 | HV *hv = newHV (); |
530 | HV *hv = newHV (); |
546 | |
531 | |
547 | # define set(name, sv) hv_store (hv, # name, sizeof (# name) - 1, sv, 0) |
532 | # define set(name, sv) hv_store (hv, # name, sizeof (# name) - 1, sv, 0) |
548 | # define setiv(name, val) hv_store (hv, # name, sizeof (# name) - 1, newSViv (val), 0) |
533 | # define setiv(name, val) hv_store (hv, # name, sizeof (# name) - 1, newSViv (val), 0) |
549 | # undef set |
534 | # undef set |
550 | |
535 | |
551 | setiv (type, xe->type); |
536 | setiv (type, xe->type); |
552 | setiv (send_event, xe->xany.send_event); |
537 | setiv (send_event, xe->xany.send_event); |
553 | setiv (serial, xe->xany.serial); |
538 | setiv (serial, xe->xany.serial); |
554 | |
539 | |
555 | switch (xe->type) |
540 | switch (xe->type) |
556 | { |
541 | { |
557 | case KeyPress: |
542 | case KeyPress: |
558 | case KeyRelease: |
543 | case KeyRelease: |
559 | case ButtonPress: |
544 | case ButtonPress: |
560 | case ButtonRelease: |
545 | case ButtonRelease: |
561 | case MotionNotify: |
546 | case MotionNotify: |
562 | setiv (time, xe->xmotion.time); |
547 | setiv (time, xe->xmotion.time); |
563 | setiv (x, xe->xmotion.x); |
548 | setiv (x, xe->xmotion.x); |
564 | setiv (y, xe->xmotion.y); |
549 | setiv (y, xe->xmotion.y); |
565 | setiv (row, xe->xmotion.y / term->fheight); |
550 | setiv (row, xe->xmotion.y / term->fheight); |
566 | setiv (col, xe->xmotion.x / term->fwidth); |
551 | setiv (col, xe->xmotion.x / term->fwidth); |
567 | setiv (x_root, xe->xmotion.x_root); |
552 | setiv (x_root, xe->xmotion.x_root); |
568 | setiv (y_root, xe->xmotion.y_root); |
553 | setiv (y_root, xe->xmotion.y_root); |
569 | setiv (state, xe->xmotion.state); |
554 | setiv (state, xe->xmotion.state); |
570 | break; |
555 | break; |
571 | } |
556 | } |
572 | |
557 | |
573 | switch (xe->type) |
558 | switch (xe->type) |
574 | { |
559 | { |
575 | case KeyPress: |
560 | case KeyPress: |
576 | case KeyRelease: |
561 | case KeyRelease: |
577 | setiv (keycode, xe->xkey.keycode); |
562 | setiv (keycode, xe->xkey.keycode); |
578 | break; |
563 | break; |
579 | |
564 | |
580 | case ButtonPress: |
565 | case ButtonPress: |
581 | case ButtonRelease: |
566 | case ButtonRelease: |
582 | setiv (button, xe->xbutton.button); |
567 | setiv (button, xe->xbutton.button); |
583 | break; |
568 | break; |
584 | |
569 | |
585 | case MotionNotify: |
570 | case MotionNotify: |
586 | setiv (is_hint, xe->xmotion.is_hint); |
571 | setiv (is_hint, xe->xmotion.is_hint); |
587 | break; |
572 | break; |
588 | } |
573 | } |
589 | |
574 | |
590 | XPUSHs (sv_2mortal (newRV_noinc ((SV *)hv))); |
575 | XPUSHs (sv_2mortal (newRV_noinc ((SV *)hv))); |
591 | } |
576 | } |
592 | break; |
577 | break; |
593 | |
578 | |
594 | case DT_END: |
579 | case DT_END: |
595 | { |
580 | goto call; |
596 | va_end (ap); |
|
|
597 | |
581 | |
598 | PUTBACK; |
|
|
599 | int count = call_pv ("urxvt::invoke", G_ARRAY | G_EVAL); |
|
|
600 | SPAGAIN; |
|
|
601 | |
|
|
602 | if (count) |
|
|
603 | { |
|
|
604 | SV *status = POPs; |
|
|
605 | count = SvTRUE (status); |
|
|
606 | } |
|
|
607 | |
|
|
608 | PUTBACK; |
|
|
609 | FREETMPS; |
|
|
610 | LEAVE; |
|
|
611 | |
|
|
612 | if (SvTRUE (ERRSV)) |
|
|
613 | { |
|
|
614 | rxvt_warn ("perl hook %d evaluation error: %s", htype, SvPV_nolen (ERRSV)); |
|
|
615 | ungrab (term); // better lose the grab than the session |
|
|
616 | } |
|
|
617 | |
|
|
618 | if (htype == HOOK_DESTROY) |
|
|
619 | { |
|
|
620 | clearSVptr ((SV *)term->perl.self); |
|
|
621 | SvREFCNT_dec ((SV *)term->perl.self); |
|
|
622 | } |
|
|
623 | |
|
|
624 | swap (perl_environ, environ); |
|
|
625 | return count; |
|
|
626 | } |
|
|
627 | |
|
|
628 | default: |
582 | default: |
629 | rxvt_fatal ("FATAL: unable to pass data type %d\n", dt); |
583 | rxvt_fatal ("FATAL: unable to pass data type %d\n", dt); |
630 | } |
584 | } |
|
|
585 | } |
|
|
586 | |
|
|
587 | call: |
|
|
588 | va_end (ap); |
|
|
589 | |
|
|
590 | PUTBACK; |
|
|
591 | int count = call_pv ("urxvt::invoke", G_ARRAY | G_EVAL); |
|
|
592 | SPAGAIN; |
|
|
593 | |
|
|
594 | if (count) |
|
|
595 | { |
|
|
596 | SV *status = POPs; |
|
|
597 | count = SvTRUE (status); |
|
|
598 | } |
|
|
599 | |
|
|
600 | PUTBACK; |
|
|
601 | FREETMPS; |
|
|
602 | LEAVE; |
|
|
603 | |
|
|
604 | if (SvTRUE (ERRSV)) |
|
|
605 | { |
|
|
606 | rxvt_warn ("perl hook %d evaluation error: %s", htype, SvPV_nolen (ERRSV)); |
|
|
607 | ungrab (term); // better lose the grab than the session |
|
|
608 | } |
|
|
609 | |
|
|
610 | event_consumed = !!count; |
631 | } |
611 | } |
|
|
612 | catch (...) |
|
|
613 | { |
|
|
614 | swap (perl_environ, environ); |
|
|
615 | throw; |
|
|
616 | } |
|
|
617 | else |
|
|
618 | event_consumed = false; |
|
|
619 | |
|
|
620 | // post-handling of some events |
|
|
621 | if (htype == HOOK_REFRESH_BEGIN) |
|
|
622 | swap_overlays (term); |
|
|
623 | else if (htype == HOOK_DESTROY) |
|
|
624 | { |
|
|
625 | clearSVptr ((SV *)term->perl.self); |
|
|
626 | SvREFCNT_dec ((SV *)term->perl.self); |
632 | } |
627 | } |
633 | catch (...) |
628 | |
634 | { |
|
|
635 | swap (perl_environ, environ); |
629 | swap (perl_environ, environ); |
636 | throw; |
630 | |
637 | } |
631 | return event_consumed; |
638 | } |
632 | } |
639 | |
633 | |
640 | ///////////////////////////////////////////////////////////////////////////// |
634 | ///////////////////////////////////////////////////////////////////////////// |
641 | |
635 | |
642 | MODULE = urxvt PACKAGE = urxvt |
636 | MODULE = urxvt PACKAGE = urxvt |
… | |
… | |
661 | # include "optinc.h" |
655 | # include "optinc.h" |
662 | # undef nodef |
656 | # undef nodef |
663 | # undef def |
657 | # undef def |
664 | |
658 | |
665 | HV *stash = gv_stashpv ("urxvt", 1); |
659 | HV *stash = gv_stashpv ("urxvt", 1); |
666 | # define export_const_iv(name) newCONSTSUB (stash, # name, newSViv (name)); |
660 | struct { |
|
|
661 | const char *name; |
|
|
662 | IV iv; |
|
|
663 | } *civ, const_iv[] = { |
|
|
664 | # define const_iv(name) { # name, (IV)name } |
667 | export_const_iv (DEFAULT_RSTYLE); |
665 | const_iv (DEFAULT_RSTYLE), |
668 | export_const_iv (OVERLAY_RSTYLE); |
666 | const_iv (OVERLAY_RSTYLE), |
669 | export_const_iv (RS_Bold); |
667 | const_iv (RS_Bold), |
670 | export_const_iv (RS_Italic); |
668 | const_iv (RS_Italic), |
671 | export_const_iv (RS_Blink); |
669 | const_iv (RS_Blink), |
672 | export_const_iv (RS_RVid); |
670 | const_iv (RS_RVid), |
673 | export_const_iv (RS_Uline); |
671 | const_iv (RS_Uline), |
674 | |
672 | |
675 | export_const_iv (CurrentTime); |
673 | const_iv (CurrentTime), |
676 | export_const_iv (ShiftMask); |
674 | const_iv (ShiftMask), |
677 | export_const_iv (LockMask); |
675 | const_iv (LockMask), |
678 | export_const_iv (ControlMask); |
676 | const_iv (ControlMask), |
679 | export_const_iv (Mod1Mask); |
677 | const_iv (Mod1Mask), |
680 | export_const_iv (Mod2Mask); |
678 | const_iv (Mod2Mask), |
681 | export_const_iv (Mod3Mask); |
679 | const_iv (Mod3Mask), |
682 | export_const_iv (Mod4Mask); |
680 | const_iv (Mod4Mask), |
683 | export_const_iv (Mod5Mask); |
681 | const_iv (Mod5Mask), |
684 | export_const_iv (Button1Mask); |
682 | const_iv (Button1Mask), |
685 | export_const_iv (Button2Mask); |
683 | const_iv (Button2Mask), |
686 | export_const_iv (Button3Mask); |
684 | const_iv (Button3Mask), |
687 | export_const_iv (Button4Mask); |
685 | const_iv (Button4Mask), |
688 | export_const_iv (Button5Mask); |
686 | const_iv (Button5Mask), |
689 | export_const_iv (AnyModifier); |
687 | const_iv (AnyModifier), |
690 | |
688 | |
691 | export_const_iv (EVENT_NONE); |
689 | const_iv (EVENT_NONE), |
692 | export_const_iv (EVENT_READ); |
690 | const_iv (EVENT_READ), |
693 | export_const_iv (EVENT_WRITE); |
691 | const_iv (EVENT_WRITE), |
694 | } |
|
|
695 | |
692 | |
696 | void |
693 | const_iv (NoEventMask), |
697 | set_should_invoke (int htype, int value) |
694 | const_iv (KeyPressMask), |
698 | CODE: |
695 | const_iv (KeyReleaseMask), |
699 | rxvt_perl.should_invoke [htype] = value; |
696 | const_iv (ButtonPressMask), |
|
|
697 | const_iv (ButtonReleaseMask), |
|
|
698 | const_iv (EnterWindowMask), |
|
|
699 | const_iv (LeaveWindowMask), |
|
|
700 | const_iv (PointerMotionMask), |
|
|
701 | const_iv (PointerMotionHintMask), |
|
|
702 | const_iv (Button1MotionMask), |
|
|
703 | const_iv (Button2MotionMask), |
|
|
704 | const_iv (Button3MotionMask), |
|
|
705 | const_iv (Button4MotionMask), |
|
|
706 | const_iv (Button5MotionMask), |
|
|
707 | const_iv (ButtonMotionMask), |
|
|
708 | const_iv (KeymapStateMask), |
|
|
709 | const_iv (ExposureMask), |
|
|
710 | const_iv (VisibilityChangeMask), |
|
|
711 | const_iv (StructureNotifyMask), |
|
|
712 | const_iv (ResizeRedirectMask), |
|
|
713 | const_iv (SubstructureNotifyMask), |
|
|
714 | const_iv (SubstructureRedirectMask), |
|
|
715 | const_iv (FocusChangeMask), |
|
|
716 | const_iv (PropertyChangeMask), |
|
|
717 | const_iv (ColormapChangeMask), |
|
|
718 | const_iv (OwnerGrabButtonMask), |
|
|
719 | |
|
|
720 | const_iv (KeyPress), |
|
|
721 | const_iv (KeyRelease), |
|
|
722 | const_iv (ButtonPress), |
|
|
723 | const_iv (ButtonRelease), |
|
|
724 | const_iv (MotionNotify), |
|
|
725 | const_iv (EnterNotify), |
|
|
726 | const_iv (LeaveNotify), |
|
|
727 | const_iv (FocusIn), |
|
|
728 | const_iv (FocusOut), |
|
|
729 | const_iv (KeymapNotify), |
|
|
730 | const_iv (Expose), |
|
|
731 | const_iv (GraphicsExpose), |
|
|
732 | const_iv (NoExpose), |
|
|
733 | const_iv (VisibilityNotify), |
|
|
734 | const_iv (CreateNotify), |
|
|
735 | const_iv (DestroyNotify), |
|
|
736 | const_iv (UnmapNotify), |
|
|
737 | const_iv (MapNotify), |
|
|
738 | const_iv (MapRequest), |
|
|
739 | const_iv (ReparentNotify), |
|
|
740 | const_iv (ConfigureNotify), |
|
|
741 | const_iv (ConfigureRequest), |
|
|
742 | const_iv (GravityNotify), |
|
|
743 | const_iv (ResizeRequest), |
|
|
744 | const_iv (CirculateNotify), |
|
|
745 | const_iv (CirculateRequest), |
|
|
746 | const_iv (PropertyNotify), |
|
|
747 | const_iv (SelectionClear), |
|
|
748 | const_iv (SelectionRequest), |
|
|
749 | const_iv (SelectionNotify), |
|
|
750 | const_iv (ColormapNotify), |
|
|
751 | const_iv (ClientMessage), |
|
|
752 | const_iv (MappingNotify), |
|
|
753 | }; |
|
|
754 | |
|
|
755 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); |
|
|
756 | civ-- > const_iv; ) |
|
|
757 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
|
|
758 | } |
700 | |
759 | |
701 | void |
760 | void |
702 | warn (const char *msg) |
761 | warn (const char *msg) |
703 | CODE: |
762 | CODE: |
704 | rxvt_warn ("%s", msg); |
763 | rxvt_warn ("%s", msg); |
… | |
… | |
706 | void |
765 | void |
707 | fatal (const char *msg) |
766 | fatal (const char *msg) |
708 | CODE: |
767 | CODE: |
709 | rxvt_fatal ("%s", msg); |
768 | rxvt_fatal ("%s", msg); |
710 | |
769 | |
711 | SV * |
770 | void |
712 | untaint (SV *sv) |
771 | _exit (int status) |
713 | CODE: |
|
|
714 | RETVAL = newSVsv (sv); |
|
|
715 | SvTAINTED_off (RETVAL); |
|
|
716 | OUTPUT: |
|
|
717 | RETVAL |
|
|
718 | |
|
|
719 | bool |
|
|
720 | safe () |
|
|
721 | CODE: |
|
|
722 | RETVAL = !rxvt_tainted (); |
|
|
723 | OUTPUT: |
|
|
724 | RETVAL |
|
|
725 | |
772 | |
726 | NV |
773 | NV |
727 | NOW () |
774 | NOW () |
728 | CODE: |
775 | CODE: |
729 | RETVAL = NOW; |
776 | RETVAL = NOW; |
… | |
… | |
824 | OUTPUT: |
871 | OUTPUT: |
825 | RETVAL |
872 | RETVAL |
826 | |
873 | |
827 | void |
874 | void |
828 | rxvt_term::destroy () |
875 | rxvt_term::destroy () |
|
|
876 | |
|
|
877 | #if ENABLE_PERL_FRILLS |
|
|
878 | |
|
|
879 | void |
|
|
880 | rxvt_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 | |
|
|
893 | void |
|
|
894 | rxvt_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 | |
|
|
915 | void |
|
|
916 | rxvt_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 | |
|
|
927 | void |
|
|
928 | rxvt_term::XDeleteProperty (U32 window, U32 property) |
|
|
929 | CODE: |
|
|
930 | XDeleteProperty (THIS->display->display, (Window)window, (Atom)property); |
|
|
931 | |
|
|
932 | U32 |
|
|
933 | rxvt_term::DefaultRootWindow () |
|
|
934 | CODE: |
|
|
935 | RETVAL = (U32)THIS->display->root; |
|
|
936 | OUTPUT: |
|
|
937 | RETVAL |
|
|
938 | |
|
|
939 | U32 |
|
|
940 | rxvt_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 | |
|
|
949 | void |
|
|
950 | rxvt_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 | |
|
|
954 | void |
|
|
955 | rxvt_term::XMapWindow (U32 window) |
|
|
956 | CODE: |
|
|
957 | XMapWindow (THIS->display->display, (Window)window); |
|
|
958 | |
|
|
959 | void |
|
|
960 | rxvt_term::XUnmapWindow (U32 window) |
|
|
961 | CODE: |
|
|
962 | XUnmapWindow (THIS->display->display, (Window)window); |
|
|
963 | |
|
|
964 | #endif |
|
|
965 | |
|
|
966 | void |
|
|
967 | rxvt_term::set_should_invoke (int htype, int inc) |
|
|
968 | CODE: |
|
|
969 | THIS->perl.should_invoke [htype] += inc; |
829 | |
970 | |
830 | void |
971 | void |
831 | rxvt_term::grab_button (int button, U32 modifiers) |
972 | rxvt_term::grab_button (int button, U32 modifiers) |
832 | CODE: |
973 | CODE: |
833 | XGrabButton (THIS->display->display, button, modifiers, THIS->vt, 1, |
974 | XGrabButton (THIS->display->display, button, modifiers, THIS->vt, 1, |
… | |
… | |
901 | char *mbstr = rxvt_wcstombs (wstr); |
1042 | char *mbstr = rxvt_wcstombs (wstr); |
902 | rxvt_pop_locale (); |
1043 | rxvt_pop_locale (); |
903 | |
1044 | |
904 | free (wstr); |
1045 | free (wstr); |
905 | |
1046 | |
906 | RETVAL = taint_if (newSVpv (mbstr, 0), str); |
1047 | RETVAL = newSVpv (mbstr, 0); |
907 | free (mbstr); |
1048 | free (mbstr); |
908 | } |
1049 | } |
909 | OUTPUT: |
1050 | OUTPUT: |
910 | RETVAL |
1051 | RETVAL |
911 | |
1052 | |
… | |
… | |
918 | |
1059 | |
919 | rxvt_push_locale (THIS->locale); |
1060 | rxvt_push_locale (THIS->locale); |
920 | wchar_t *wstr = rxvt_mbstowcs (data, len); |
1061 | wchar_t *wstr = rxvt_mbstowcs (data, len); |
921 | rxvt_pop_locale (); |
1062 | rxvt_pop_locale (); |
922 | |
1063 | |
923 | RETVAL = taint_if (wcs2sv (wstr), octets); |
1064 | RETVAL = wcs2sv (wstr); |
924 | free (wstr); |
1065 | free (wstr); |
925 | } |
1066 | } |
926 | OUTPUT: |
1067 | OUTPUT: |
927 | RETVAL |
1068 | RETVAL |
928 | |
1069 | |
… | |
… | |
937 | #define TERM_OFFSET_ncol TERM_OFFSET(ncol) |
1078 | #define TERM_OFFSET_ncol TERM_OFFSET(ncol) |
938 | #define TERM_OFFSET_focus TERM_OFFSET(focus) |
1079 | #define TERM_OFFSET_focus TERM_OFFSET(focus) |
939 | #define TERM_OFFSET_mapped TERM_OFFSET(mapped) |
1080 | #define TERM_OFFSET_mapped TERM_OFFSET(mapped) |
940 | #define TERM_OFFSET_saveLines TERM_OFFSET(saveLines) |
1081 | #define TERM_OFFSET_saveLines TERM_OFFSET(saveLines) |
941 | #define TERM_OFFSET_total_rows TERM_OFFSET(total_rows) |
1082 | #define TERM_OFFSET_total_rows TERM_OFFSET(total_rows) |
942 | #define TERM_OFFSET_nsaved TERM_OFFSET(nsaved) |
1083 | #define TERM_OFFSET_top_row TERM_OFFSET(top_row) |
943 | |
1084 | |
944 | int |
1085 | int |
945 | rxvt_term::width () |
1086 | rxvt_term::width () |
946 | ALIAS: |
1087 | ALIAS: |
947 | width = TERM_OFFSET_width |
1088 | width = TERM_OFFSET_width |
… | |
… | |
953 | ncol = TERM_OFFSET_ncol |
1094 | ncol = TERM_OFFSET_ncol |
954 | focus = TERM_OFFSET_focus |
1095 | focus = TERM_OFFSET_focus |
955 | mapped = TERM_OFFSET_mapped |
1096 | mapped = TERM_OFFSET_mapped |
956 | saveLines = TERM_OFFSET_saveLines |
1097 | saveLines = TERM_OFFSET_saveLines |
957 | total_rows = TERM_OFFSET_total_rows |
1098 | total_rows = TERM_OFFSET_total_rows |
958 | nsaved = TERM_OFFSET_nsaved |
1099 | top_row = TERM_OFFSET_top_row |
959 | CODE: |
1100 | CODE: |
960 | RETVAL = *(int *)((char *)THIS + ix); |
1101 | RETVAL = *(int *)((char *)THIS + ix); |
961 | OUTPUT: |
1102 | OUTPUT: |
962 | RETVAL |
1103 | RETVAL |
963 | |
1104 | |
… | |
… | |
1032 | CODE: |
1173 | CODE: |
1033 | RETVAL = (U32)THIS->vt; |
1174 | RETVAL = (U32)THIS->vt; |
1034 | OUTPUT: |
1175 | OUTPUT: |
1035 | RETVAL |
1176 | RETVAL |
1036 | |
1177 | |
|
|
1178 | void |
|
|
1179 | rxvt_term::vt_emask_add (U32 emask) |
|
|
1180 | CODE: |
|
|
1181 | THIS->vt_emask_perl |= emask; |
|
|
1182 | THIS->vt_select_input (); |
|
|
1183 | |
1037 | U32 |
1184 | U32 |
1038 | rxvt_term::rstyle (U32 new_rstyle = THIS->rstyle) |
1185 | rxvt_term::rstyle (U32 new_rstyle = THIS->rstyle) |
1039 | CODE: |
1186 | CODE: |
1040 | { |
|
|
1041 | RETVAL = THIS->rstyle; |
1187 | RETVAL = THIS->rstyle; |
1042 | THIS->rstyle = new_rstyle; |
1188 | THIS->rstyle = new_rstyle; |
1043 | } |
|
|
1044 | OUTPUT: |
1189 | OUTPUT: |
1045 | RETVAL |
1190 | RETVAL |
1046 | |
1191 | |
1047 | int |
1192 | int |
1048 | rxvt_term::view_start (int newval = -1) |
1193 | rxvt_term::view_start (int newval = 1) |
|
|
1194 | PROTOTYPE: $;$ |
1049 | CODE: |
1195 | CODE: |
1050 | { |
1196 | { |
1051 | RETVAL = THIS->view_start; |
1197 | RETVAL = THIS->view_start; |
1052 | |
1198 | |
1053 | if (newval >= 0) |
1199 | if (newval <= 0) |
1054 | { |
1200 | THIS->scr_changeview (max (newval, THIS->top_row)); |
1055 | THIS->view_start = min (newval, THIS->nsaved); |
|
|
1056 | THIS->scr_changeview (RETVAL); |
|
|
1057 | } |
|
|
1058 | } |
1201 | } |
1059 | OUTPUT: |
1202 | OUTPUT: |
1060 | RETVAL |
1203 | RETVAL |
1061 | |
1204 | |
1062 | void |
1205 | void |
… | |
… | |
1066 | |
1209 | |
1067 | void |
1210 | void |
1068 | rxvt_term::ROW_t (int row_number, SV *new_text = 0, int start_col = 0, int start_ofs = 0, int max_len = MAX_COLS) |
1211 | rxvt_term::ROW_t (int row_number, SV *new_text = 0, int start_col = 0, int start_ofs = 0, int max_len = MAX_COLS) |
1069 | PPCODE: |
1212 | PPCODE: |
1070 | { |
1213 | { |
1071 | if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
1214 | if (!IN_RANGE_EXC (row_number, THIS->top_row, THIS->nrow)) |
1072 | XSRETURN_EMPTY; |
1215 | XSRETURN_EMPTY; |
1073 | |
1216 | |
1074 | line_t &l = ROW(row_number); |
1217 | line_t &l = ROW(row_number); |
1075 | |
1218 | |
1076 | if (GIMME_V != G_VOID) |
1219 | if (GIMME_V != G_VOID) |
… | |
… | |
1078 | wchar_t *wstr = new wchar_t [THIS->ncol]; |
1221 | wchar_t *wstr = new wchar_t [THIS->ncol]; |
1079 | |
1222 | |
1080 | for (int col = 0; col < THIS->ncol; col++) |
1223 | for (int col = 0; col < THIS->ncol; col++) |
1081 | wstr [col] = l.t [col]; |
1224 | wstr [col] = l.t [col]; |
1082 | |
1225 | |
1083 | XPUSHs (taint (sv_2mortal (wcs2sv (wstr, THIS->ncol)))); |
1226 | XPUSHs (sv_2mortal (wcs2sv (wstr, THIS->ncol))); |
1084 | |
1227 | |
1085 | delete [] wstr; |
1228 | delete [] wstr; |
1086 | } |
1229 | } |
1087 | |
1230 | |
1088 | if (new_text) |
1231 | if (new_text) |
… | |
… | |
1109 | |
1252 | |
1110 | void |
1253 | void |
1111 | rxvt_term::ROW_r (int row_number, SV *new_rend = 0, int start_col = 0, int start_ofs = 0, int max_len = MAX_COLS) |
1254 | rxvt_term::ROW_r (int row_number, SV *new_rend = 0, int start_col = 0, int start_ofs = 0, int max_len = MAX_COLS) |
1112 | PPCODE: |
1255 | PPCODE: |
1113 | { |
1256 | { |
1114 | if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
1257 | if (!IN_RANGE_EXC (row_number, THIS->top_row, THIS->nrow)) |
1115 | XSRETURN_EMPTY; |
1258 | XSRETURN_EMPTY; |
1116 | |
1259 | |
1117 | line_t &l = ROW(row_number); |
1260 | line_t &l = ROW(row_number); |
1118 | |
1261 | |
1119 | if (GIMME_V != G_VOID) |
1262 | if (GIMME_V != G_VOID) |
… | |
… | |
1149 | |
1292 | |
1150 | int |
1293 | int |
1151 | rxvt_term::ROW_l (int row_number, int new_length = -1) |
1294 | rxvt_term::ROW_l (int row_number, int new_length = -1) |
1152 | CODE: |
1295 | CODE: |
1153 | { |
1296 | { |
1154 | if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
1297 | if (!IN_RANGE_EXC (row_number, THIS->top_row, THIS->nrow)) |
1155 | XSRETURN_EMPTY; |
1298 | XSRETURN_EMPTY; |
1156 | |
1299 | |
1157 | line_t &l = ROW(row_number); |
1300 | line_t &l = ROW(row_number); |
1158 | RETVAL = l.l; |
1301 | RETVAL = l.l; |
1159 | |
1302 | |
… | |
… | |
1165 | |
1308 | |
1166 | bool |
1309 | bool |
1167 | rxvt_term::ROW_is_longer (int row_number, int new_is_longer = -1) |
1310 | rxvt_term::ROW_is_longer (int row_number, int new_is_longer = -1) |
1168 | CODE: |
1311 | CODE: |
1169 | { |
1312 | { |
1170 | if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
1313 | if (!IN_RANGE_EXC (row_number, THIS->top_row, THIS->nrow)) |
1171 | XSRETURN_EMPTY; |
1314 | XSRETURN_EMPTY; |
1172 | |
1315 | |
1173 | line_t &l = ROW(row_number); |
1316 | line_t &l = ROW(row_number); |
1174 | RETVAL = l.is_longer (); |
1317 | RETVAL = l.is_longer (); |
1175 | |
1318 | |
… | |
… | |
1209 | else |
1352 | else |
1210 | *r++ = *s; |
1353 | *r++ = *s; |
1211 | |
1354 | |
1212 | rxvt_pop_locale (); |
1355 | rxvt_pop_locale (); |
1213 | |
1356 | |
1214 | RETVAL = taint_if (wcs2sv (rstr, r - rstr), string); |
1357 | RETVAL = wcs2sv (rstr, r - rstr); |
1215 | |
1358 | |
1216 | delete [] rstr; |
1359 | delete [] rstr; |
1217 | } |
1360 | } |
1218 | OUTPUT: |
1361 | OUTPUT: |
1219 | RETVAL |
1362 | RETVAL |
… | |
… | |
1245 | else if (IS_COMPOSE (*s)) |
1388 | else if (IS_COMPOSE (*s)) |
1246 | r += rxvt_composite.expand (*s, r); |
1389 | r += rxvt_composite.expand (*s, r); |
1247 | else |
1390 | else |
1248 | *r++ = *s; |
1391 | *r++ = *s; |
1249 | |
1392 | |
1250 | RETVAL = taint_if (wcs2sv (rstr, r - rstr), text); |
1393 | RETVAL = wcs2sv (rstr, r - rstr); |
1251 | |
1394 | |
1252 | delete [] rstr; |
1395 | delete [] rstr; |
1253 | } |
1396 | } |
1254 | OUTPUT: |
1397 | OUTPUT: |
1255 | RETVAL |
1398 | RETVAL |
… | |
… | |
1277 | |
1420 | |
1278 | if (!IN_RANGE_EXC (index, 0, NUM_RESOURCES)) |
1421 | if (!IN_RANGE_EXC (index, 0, NUM_RESOURCES)) |
1279 | croak ("requested out-of-bound resource %s+%d,", name, index - rs->value); |
1422 | croak ("requested out-of-bound resource %s+%d,", name, index - rs->value); |
1280 | |
1423 | |
1281 | if (GIMME_V != G_VOID) |
1424 | if (GIMME_V != G_VOID) |
1282 | XPUSHs (THIS->rs [index] ? sv_2mortal (taint (newSVpv (THIS->rs [index], 0))) : &PL_sv_undef); |
1425 | XPUSHs (THIS->rs [index] ? sv_2mortal (newSVpv (THIS->rs [index], 0)) : &PL_sv_undef); |
1283 | |
1426 | |
1284 | if (newval) |
1427 | if (newval) |
1285 | { |
1428 | { |
1286 | if (SvOK (newval)) |
1429 | if (SvOK (newval)) |
1287 | { |
1430 | { |
… | |
… | |
1294 | } |
1437 | } |
1295 | } |
1438 | } |
1296 | |
1439 | |
1297 | const char * |
1440 | const char * |
1298 | rxvt_term::x_resource (const char *name) |
1441 | rxvt_term::x_resource (const char *name) |
1299 | CLEANUP: |
|
|
1300 | SvTAINTED_on (ST (0)); |
|
|
1301 | |
1442 | |
1302 | bool |
1443 | bool |
1303 | rxvt_term::option (U32 optval, int set = -1) |
1444 | rxvt_term::option (U32 optval, int set = -1) |
1304 | CODE: |
1445 | CODE: |
1305 | { |
1446 | { |
… | |
… | |
1365 | PUSHs (sv_2mortal (newSViv (rc.col))); |
1506 | PUSHs (sv_2mortal (newSViv (rc.col))); |
1366 | } |
1507 | } |
1367 | |
1508 | |
1368 | if (items == 3) |
1509 | if (items == 3) |
1369 | { |
1510 | { |
1370 | rc.row = clamp (SvIV (ST (1)), -THIS->nsaved, THIS->nrow - 1); |
1511 | rc.row = clamp (SvIV (ST (1)), THIS->top_row, THIS->nrow - 1); |
1371 | rc.col = clamp (SvIV (ST (2)), 0, THIS->ncol - 1); |
1512 | rc.col = clamp (SvIV (ST (2)), 0, THIS->ncol - 1); |
1372 | |
1513 | |
1373 | if (ix) |
1514 | if (ix) |
1374 | THIS->want_refresh = 1; |
1515 | THIS->want_refresh = 1; |
1375 | } |
1516 | } |
… | |
… | |
1380 | CODE: |
1521 | CODE: |
1381 | RETVAL = THIS->charsets [THIS->screen.charset]; |
1522 | RETVAL = THIS->charsets [THIS->screen.charset]; |
1382 | OUTPUT: |
1523 | OUTPUT: |
1383 | RETVAL |
1524 | RETVAL |
1384 | |
1525 | |
|
|
1526 | #void |
|
|
1527 | #rxvt_term::selection_clear () |
|
|
1528 | |
|
|
1529 | void |
|
|
1530 | rxvt_term::selection_make (U32 eventtime, bool rect = false) |
|
|
1531 | CODE: |
|
|
1532 | THIS->selection.op = SELECTION_CONT; |
|
|
1533 | THIS->selection.rect = rect; |
|
|
1534 | THIS->selection_make (eventtime); |
|
|
1535 | |
1385 | int |
1536 | int |
1386 | rxvt_term::selection_grab (U32 eventtime) |
1537 | rxvt_term::selection_grab (U32 eventtime) |
1387 | |
1538 | |
1388 | void |
1539 | void |
1389 | rxvt_term::selection (SV *newtext = 0) |
1540 | rxvt_term::selection (SV *newtext = 0) |
1390 | PPCODE: |
1541 | PPCODE: |
1391 | { |
1542 | { |
1392 | if (GIMME_V != G_VOID) |
1543 | if (GIMME_V != G_VOID) |
1393 | XPUSHs (THIS->selection.text |
1544 | XPUSHs (THIS->selection.text |
1394 | ? taint (sv_2mortal (wcs2sv (THIS->selection.text, THIS->selection.len))) |
1545 | ? sv_2mortal (wcs2sv (THIS->selection.text, THIS->selection.len)) |
1395 | : &PL_sv_undef); |
1546 | : &PL_sv_undef); |
1396 | |
1547 | |
1397 | if (newtext) |
1548 | if (newtext) |
1398 | { |
1549 | { |
1399 | free (THIS->selection.text); |
1550 | free (THIS->selection.text); |