… | |
… | |
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 | { |
416 | temp_environ temp_environ(rxvt_environ); |
400 | rxvt_push_locale (""); // perl init destroys current locale |
|
|
401 | |
|
|
402 | perl_environ = rxvt_environ; |
|
|
403 | swap (perl_environ, environ); |
417 | |
404 | |
418 | char *argv[] = { |
405 | char *argv[] = { |
419 | "", |
406 | "", |
420 | "-T", |
407 | "-e" |
421 | "-edo '" LIBDIR "/urxvt.pm' or ($@ and die $@) or exit 1", |
408 | "BEGIN {" |
|
|
409 | " urxvt->bootstrap;" |
|
|
410 | " unshift @INC, '" LIBDIR "';" |
|
|
411 | "}" |
|
|
412 | "" |
|
|
413 | "use urxvt;" |
422 | }; |
414 | }; |
423 | |
415 | |
424 | perl = perl_alloc (); |
416 | perl = perl_alloc (); |
425 | perl_construct (perl); |
417 | perl_construct (perl); |
426 | |
418 | |
427 | if (perl_parse (perl, xs_init, 3, argv, (char **)NULL) |
419 | if (perl_parse (perl, xs_init, 2, argv, (char **)NULL) |
428 | || perl_run (perl)) |
420 | || perl_run (perl)) |
429 | { |
421 | { |
430 | rxvt_warn ("unable to initialize perl-interpreter, continuing without.\n"); |
422 | rxvt_warn ("unable to initialize perl-interpreter, continuing without.\n"); |
431 | |
423 | |
432 | perl_destruct (perl); |
424 | perl_destruct (perl); |
433 | perl_free (perl); |
425 | perl_free (perl); |
434 | perl = 0; |
426 | perl = 0; |
435 | } |
427 | } |
|
|
428 | |
|
|
429 | swap (perl_environ, environ); |
|
|
430 | |
|
|
431 | rxvt_pop_locale (); |
|
|
432 | } |
|
|
433 | |
|
|
434 | if (perl) |
|
|
435 | { |
|
|
436 | // runs outside of perls ENV |
|
|
437 | 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); |
436 | } |
439 | } |
437 | } |
440 | } |
438 | |
441 | |
439 | static void |
442 | static void |
440 | ungrab (rxvt_term *THIS) |
443 | ungrab (rxvt_term *THIS) |
… | |
… | |
445 | XUngrabPointer (THIS->display->display, THIS->perl.grabtime); |
448 | XUngrabPointer (THIS->display->display, THIS->perl.grabtime); |
446 | THIS->perl.grabtime = 0; |
449 | THIS->perl.grabtime = 0; |
447 | } |
450 | } |
448 | } |
451 | } |
449 | |
452 | |
|
|
453 | static void |
|
|
454 | swap_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 | |
450 | bool |
467 | bool |
451 | rxvt_perl_interp::invoke (rxvt_term *term, hook_type htype, ...) |
468 | rxvt_perl_interp::invoke (rxvt_term *term, hook_type htype, ...) |
452 | { |
469 | { |
453 | if (!perl) |
470 | if (!perl || !term->perl.self) |
454 | return false; |
471 | return false; |
455 | |
472 | |
456 | if (htype == HOOK_INIT) // first hook ever called |
473 | // pre-handling of some events |
457 | { |
474 | if (htype == HOOK_REFRESH_END) |
458 | term->perl.self = (void *)newSVptr ((void *)term, "urxvt::term"); |
475 | swap_overlays (term); |
459 | hv_store ((HV *)SvRV ((SV *)term->perl.self), "_overlay", 8, newRV_noinc ((SV *)newHV ()), 0); |
476 | |
460 | } |
477 | swap (perl_environ, environ); |
461 | else if (!term->perl.self) |
478 | |
462 | return false; // perl not initialized for this instance |
479 | bool event_consumed; |
463 | else if (htype == HOOK_DESTROY) |
480 | |
464 | { |
481 | if (htype == HOOK_INIT || htype == HOOK_DESTROY // must be called always |
465 | // handled later |
482 | || term->perl.should_invoke [htype]) |
466 | } |
483 | try |
467 | else |
|
|
468 | { |
|
|
469 | if (htype == HOOK_REFRESH_BEGIN || htype == HOOK_REFRESH_END) |
|
|
470 | { |
484 | { |
471 | HV *hv = (HV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)term->perl.self), "_overlay", 8, 0)); |
485 | dSP; |
|
|
486 | va_list ap; |
472 | |
487 | |
473 | if (HvKEYS (hv)) |
488 | va_start (ap, htype); |
|
|
489 | |
|
|
490 | ENTER; |
|
|
491 | SAVETMPS; |
|
|
492 | |
|
|
493 | PUSHMARK (SP); |
|
|
494 | |
|
|
495 | XPUSHs (sv_2mortal (newSVterm (term))); |
|
|
496 | XPUSHs (sv_2mortal (newSViv (htype))); |
|
|
497 | |
|
|
498 | for (;;) { |
|
|
499 | data_type dt = (data_type)va_arg (ap, int); |
|
|
500 | |
|
|
501 | switch (dt) |
474 | { |
502 | { |
475 | hv_iterinit (hv); |
|
|
476 | |
|
|
477 | while (HE *he = hv_iternext (hv)) |
|
|
478 | ((overlay *)SvIV (hv_iterval (hv, he)))->swap (); |
|
|
479 | } |
|
|
480 | |
|
|
481 | } |
|
|
482 | |
|
|
483 | if (!should_invoke [htype]) |
|
|
484 | return false; |
|
|
485 | } |
|
|
486 | |
|
|
487 | temp_environ temp_environ(rxvt_environ); |
|
|
488 | |
|
|
489 | dSP; |
|
|
490 | va_list ap; |
|
|
491 | |
|
|
492 | va_start (ap, htype); |
|
|
493 | |
|
|
494 | ENTER; |
|
|
495 | SAVETMPS; |
|
|
496 | |
|
|
497 | PUSHMARK (SP); |
|
|
498 | |
|
|
499 | XPUSHs (sv_2mortal (newSVterm (term))); |
|
|
500 | XPUSHs (sv_2mortal (newSViv (htype))); |
|
|
501 | |
|
|
502 | for (;;) { |
|
|
503 | data_type dt = (data_type)va_arg (ap, int); |
|
|
504 | |
|
|
505 | switch (dt) |
|
|
506 | { |
|
|
507 | case DT_INT: |
503 | case DT_INT: |
508 | XPUSHs (sv_2mortal (newSViv (va_arg (ap, int)))); |
504 | XPUSHs (sv_2mortal (newSViv (va_arg (ap, int)))); |
509 | break; |
505 | break; |
510 | |
506 | |
511 | case DT_LONG: |
507 | case DT_LONG: |
512 | XPUSHs (sv_2mortal (newSViv (va_arg (ap, long)))); |
508 | XPUSHs (sv_2mortal (newSViv (va_arg (ap, long)))); |
513 | break; |
509 | break; |
514 | |
510 | |
515 | case DT_STR: |
511 | case DT_STR: |
516 | XPUSHs (taint (sv_2mortal (newSVpv (va_arg (ap, char *), 0)))); |
512 | XPUSHs (sv_2mortal (newSVpv (va_arg (ap, char *), 0))); |
517 | break; |
513 | break; |
518 | |
514 | |
519 | case DT_STR_LEN: |
515 | case DT_STR_LEN: |
520 | { |
516 | { |
521 | char *str = va_arg (ap, char *); |
517 | char *str = va_arg (ap, char *); |
522 | int len = va_arg (ap, int); |
518 | int len = va_arg (ap, int); |
523 | |
519 | |
524 | XPUSHs (taint (sv_2mortal (newSVpvn (str, len)))); |
520 | XPUSHs (sv_2mortal (newSVpvn (str, len))); |
525 | } |
521 | } |
526 | break; |
522 | break; |
527 | |
523 | |
528 | case DT_WCS_LEN: |
524 | case DT_WCS_LEN: |
529 | { |
525 | { |
530 | wchar_t *wstr = va_arg (ap, wchar_t *); |
526 | wchar_t *wstr = va_arg (ap, wchar_t *); |
531 | int wlen = va_arg (ap, int); |
527 | int wlen = va_arg (ap, int); |
532 | |
528 | |
533 | XPUSHs (taint (sv_2mortal (wcs2sv (wstr, wlen)))); |
529 | XPUSHs (sv_2mortal (wcs2sv (wstr, wlen))); |
534 | } |
530 | } |
535 | break; |
531 | break; |
536 | |
532 | |
537 | case DT_XEVENT: |
533 | case DT_XEVENT: |
538 | { |
534 | { |
539 | XEvent *xe = va_arg (ap, XEvent *); |
535 | XEvent *xe = va_arg (ap, XEvent *); |
540 | HV *hv = newHV (); |
536 | HV *hv = newHV (); |
541 | |
537 | |
542 | # define set(name, sv) hv_store (hv, # name, sizeof (# name) - 1, sv, 0) |
538 | # define set(name, sv) hv_store (hv, # name, sizeof (# name) - 1, sv, 0) |
543 | # define setiv(name, val) hv_store (hv, # name, sizeof (# name) - 1, newSViv (val), 0) |
539 | # define setiv(name, val) hv_store (hv, # name, sizeof (# name) - 1, newSViv (val), 0) |
544 | # undef set |
540 | # undef set |
545 | |
541 | |
546 | setiv (type, xe->type); |
542 | setiv (type, xe->type); |
547 | setiv (send_event, xe->xany.send_event); |
543 | setiv (send_event, xe->xany.send_event); |
548 | setiv (serial, xe->xany.serial); |
544 | setiv (serial, xe->xany.serial); |
549 | |
545 | |
550 | switch (xe->type) |
546 | switch (xe->type) |
551 | { |
547 | { |
552 | case KeyPress: |
548 | case KeyPress: |
553 | case KeyRelease: |
549 | case KeyRelease: |
554 | case ButtonPress: |
550 | case ButtonPress: |
555 | case ButtonRelease: |
551 | case ButtonRelease: |
556 | case MotionNotify: |
552 | case MotionNotify: |
557 | setiv (time, xe->xmotion.time); |
553 | setiv (time, xe->xmotion.time); |
558 | setiv (x, xe->xmotion.x); |
554 | setiv (x, xe->xmotion.x); |
559 | setiv (y, xe->xmotion.y); |
555 | setiv (y, xe->xmotion.y); |
560 | setiv (row, xe->xmotion.y / term->fheight); |
556 | setiv (row, xe->xmotion.y / term->fheight); |
561 | setiv (col, xe->xmotion.x / term->fwidth); |
557 | setiv (col, xe->xmotion.x / term->fwidth); |
562 | setiv (x_root, xe->xmotion.x_root); |
558 | setiv (x_root, xe->xmotion.x_root); |
563 | setiv (y_root, xe->xmotion.y_root); |
559 | setiv (y_root, xe->xmotion.y_root); |
564 | setiv (state, xe->xmotion.state); |
560 | setiv (state, xe->xmotion.state); |
|
|
561 | break; |
|
|
562 | } |
|
|
563 | |
|
|
564 | switch (xe->type) |
|
|
565 | { |
|
|
566 | case KeyPress: |
|
|
567 | case KeyRelease: |
|
|
568 | setiv (keycode, xe->xkey.keycode); |
|
|
569 | break; |
|
|
570 | |
|
|
571 | case ButtonPress: |
|
|
572 | case ButtonRelease: |
|
|
573 | setiv (button, xe->xbutton.button); |
|
|
574 | break; |
|
|
575 | |
|
|
576 | case MotionNotify: |
|
|
577 | setiv (is_hint, xe->xmotion.is_hint); |
|
|
578 | break; |
|
|
579 | } |
|
|
580 | |
|
|
581 | XPUSHs (sv_2mortal (newRV_noinc ((SV *)hv))); |
|
|
582 | } |
565 | break; |
583 | break; |
|
|
584 | |
|
|
585 | case DT_END: |
|
|
586 | goto call; |
|
|
587 | |
|
|
588 | default: |
|
|
589 | rxvt_fatal ("FATAL: unable to pass data type %d\n", dt); |
566 | } |
590 | } |
567 | |
|
|
568 | switch (xe->type) |
|
|
569 | { |
|
|
570 | case KeyPress: |
|
|
571 | case KeyRelease: |
|
|
572 | setiv (keycode, xe->xkey.keycode); |
|
|
573 | break; |
|
|
574 | |
|
|
575 | case ButtonPress: |
|
|
576 | case ButtonRelease: |
|
|
577 | setiv (button, xe->xbutton.button); |
|
|
578 | break; |
|
|
579 | |
|
|
580 | case MotionNotify: |
|
|
581 | setiv (is_hint, xe->xmotion.is_hint); |
|
|
582 | break; |
|
|
583 | } |
|
|
584 | |
|
|
585 | XPUSHs (sv_2mortal (newRV_noinc ((SV *)hv))); |
|
|
586 | } |
591 | } |
587 | break; |
|
|
588 | |
592 | |
589 | case DT_END: |
593 | call: |
590 | { |
|
|
591 | va_end (ap); |
594 | va_end (ap); |
592 | |
595 | |
593 | PUTBACK; |
596 | PUTBACK; |
594 | int count = call_pv ("urxvt::invoke", G_ARRAY | G_EVAL); |
597 | int count = call_pv ("urxvt::invoke", G_ARRAY | G_EVAL); |
595 | SPAGAIN; |
598 | SPAGAIN; |
596 | |
599 | |
597 | if (count) |
600 | if (count) |
598 | { |
601 | { |
599 | SV *status = POPs; |
602 | SV *status = POPs; |
600 | count = SvTRUE (status); |
603 | count = SvTRUE (status); |
601 | } |
604 | } |
602 | |
605 | |
603 | PUTBACK; |
606 | PUTBACK; |
604 | FREETMPS; |
607 | FREETMPS; |
605 | LEAVE; |
608 | LEAVE; |
606 | |
609 | |
607 | if (SvTRUE (ERRSV)) |
610 | if (SvTRUE (ERRSV)) |
608 | { |
611 | { |
609 | rxvt_warn ("perl hook %d evaluation error: %s", htype, SvPV_nolen (ERRSV)); |
612 | rxvt_warn ("perl hook %d evaluation error: %s", htype, SvPV_nolen (ERRSV)); |
610 | ungrab (term); // better lose the grab than the session |
613 | ungrab (term); // better lose the grab than the session |
611 | } |
614 | } |
612 | |
615 | |
613 | if (htype == HOOK_DESTROY) |
616 | event_consumed = !!count; |
614 | { |
|
|
615 | clearSVptr ((SV *)term->perl.self); |
|
|
616 | SvREFCNT_dec ((SV *)term->perl.self); |
|
|
617 | } |
|
|
618 | |
|
|
619 | return count; |
|
|
620 | } |
|
|
621 | |
|
|
622 | default: |
|
|
623 | rxvt_fatal ("FATAL: unable to pass data type %d\n", dt); |
|
|
624 | } |
617 | } |
|
|
618 | catch (...) |
|
|
619 | { |
|
|
620 | swap (perl_environ, environ); |
|
|
621 | throw; |
|
|
622 | } |
|
|
623 | else |
|
|
624 | event_consumed = false; |
|
|
625 | |
|
|
626 | // post-handling of some events |
|
|
627 | if (htype == HOOK_REFRESH_BEGIN) |
|
|
628 | swap_overlays (term); |
|
|
629 | else if (htype == HOOK_DESTROY) |
|
|
630 | { |
|
|
631 | clearSVptr ((SV *)term->perl.self); |
|
|
632 | SvREFCNT_dec ((SV *)term->perl.self); |
625 | } |
633 | } |
|
|
634 | |
|
|
635 | swap (perl_environ, environ); |
|
|
636 | |
|
|
637 | return event_consumed; |
626 | } |
638 | } |
627 | |
639 | |
628 | ///////////////////////////////////////////////////////////////////////////// |
640 | ///////////////////////////////////////////////////////////////////////////// |
629 | |
641 | |
630 | MODULE = urxvt PACKAGE = urxvt |
642 | MODULE = urxvt PACKAGE = urxvt |
… | |
… | |
649 | # include "optinc.h" |
661 | # include "optinc.h" |
650 | # undef nodef |
662 | # undef nodef |
651 | # undef def |
663 | # undef def |
652 | |
664 | |
653 | HV *stash = gv_stashpv ("urxvt", 1); |
665 | HV *stash = gv_stashpv ("urxvt", 1); |
654 | # define export_const_iv(name) newCONSTSUB (stash, # name, newSViv (name)); |
666 | struct { |
|
|
667 | const char *name; |
|
|
668 | IV iv; |
|
|
669 | } *civ, const_iv[] = { |
|
|
670 | # define const_iv(name) { # name, (IV)name } |
655 | export_const_iv (DEFAULT_RSTYLE); |
671 | const_iv (DEFAULT_RSTYLE), |
656 | export_const_iv (OVERLAY_RSTYLE); |
672 | const_iv (OVERLAY_RSTYLE), |
657 | export_const_iv (RS_Bold); |
673 | const_iv (RS_Bold), |
658 | export_const_iv (RS_Italic); |
674 | const_iv (RS_Italic), |
659 | export_const_iv (RS_Blink); |
675 | const_iv (RS_Blink), |
660 | export_const_iv (RS_RVid); |
676 | const_iv (RS_RVid), |
661 | export_const_iv (RS_Uline); |
677 | const_iv (RS_Uline), |
662 | |
678 | |
663 | export_const_iv (CurrentTime); |
679 | const_iv (CurrentTime), |
664 | export_const_iv (ShiftMask); |
680 | const_iv (ShiftMask), |
665 | export_const_iv (LockMask); |
681 | const_iv (LockMask), |
666 | export_const_iv (ControlMask); |
682 | const_iv (ControlMask), |
667 | export_const_iv (Mod1Mask); |
683 | const_iv (Mod1Mask), |
668 | export_const_iv (Mod2Mask); |
684 | const_iv (Mod2Mask), |
669 | export_const_iv (Mod3Mask); |
685 | const_iv (Mod3Mask), |
670 | export_const_iv (Mod4Mask); |
686 | const_iv (Mod4Mask), |
671 | export_const_iv (Mod5Mask); |
687 | const_iv (Mod5Mask), |
672 | export_const_iv (Button1Mask); |
688 | const_iv (Button1Mask), |
673 | export_const_iv (Button2Mask); |
689 | const_iv (Button2Mask), |
674 | export_const_iv (Button3Mask); |
690 | const_iv (Button3Mask), |
675 | export_const_iv (Button4Mask); |
691 | const_iv (Button4Mask), |
676 | export_const_iv (Button5Mask); |
692 | const_iv (Button5Mask), |
677 | export_const_iv (AnyModifier); |
693 | const_iv (AnyModifier), |
678 | |
694 | |
679 | export_const_iv (EVENT_NONE); |
695 | const_iv (EVENT_NONE), |
680 | export_const_iv (EVENT_READ); |
696 | const_iv (EVENT_READ), |
681 | export_const_iv (EVENT_WRITE); |
697 | const_iv (EVENT_WRITE), |
682 | } |
|
|
683 | |
698 | |
684 | void |
699 | const_iv (NoEventMask), |
685 | set_should_invoke (int htype, int value) |
700 | const_iv (KeyPressMask), |
686 | CODE: |
701 | const_iv (KeyReleaseMask), |
687 | rxvt_perl.should_invoke [htype] = value; |
702 | const_iv (ButtonPressMask), |
|
|
703 | const_iv (ButtonReleaseMask), |
|
|
704 | const_iv (EnterWindowMask), |
|
|
705 | const_iv (LeaveWindowMask), |
|
|
706 | const_iv (PointerMotionMask), |
|
|
707 | const_iv (PointerMotionHintMask), |
|
|
708 | const_iv (Button1MotionMask), |
|
|
709 | const_iv (Button2MotionMask), |
|
|
710 | const_iv (Button3MotionMask), |
|
|
711 | const_iv (Button4MotionMask), |
|
|
712 | const_iv (Button5MotionMask), |
|
|
713 | const_iv (ButtonMotionMask), |
|
|
714 | const_iv (KeymapStateMask), |
|
|
715 | const_iv (ExposureMask), |
|
|
716 | const_iv (VisibilityChangeMask), |
|
|
717 | const_iv (StructureNotifyMask), |
|
|
718 | const_iv (ResizeRedirectMask), |
|
|
719 | const_iv (SubstructureNotifyMask), |
|
|
720 | const_iv (SubstructureRedirectMask), |
|
|
721 | const_iv (FocusChangeMask), |
|
|
722 | const_iv (PropertyChangeMask), |
|
|
723 | const_iv (ColormapChangeMask), |
|
|
724 | const_iv (OwnerGrabButtonMask), |
|
|
725 | |
|
|
726 | const_iv (KeyPress), |
|
|
727 | const_iv (KeyRelease), |
|
|
728 | const_iv (ButtonPress), |
|
|
729 | const_iv (ButtonRelease), |
|
|
730 | const_iv (MotionNotify), |
|
|
731 | const_iv (EnterNotify), |
|
|
732 | const_iv (LeaveNotify), |
|
|
733 | const_iv (FocusIn), |
|
|
734 | const_iv (FocusOut), |
|
|
735 | const_iv (KeymapNotify), |
|
|
736 | const_iv (Expose), |
|
|
737 | const_iv (GraphicsExpose), |
|
|
738 | const_iv (NoExpose), |
|
|
739 | const_iv (VisibilityNotify), |
|
|
740 | const_iv (CreateNotify), |
|
|
741 | const_iv (DestroyNotify), |
|
|
742 | const_iv (UnmapNotify), |
|
|
743 | const_iv (MapNotify), |
|
|
744 | const_iv (MapRequest), |
|
|
745 | const_iv (ReparentNotify), |
|
|
746 | const_iv (ConfigureNotify), |
|
|
747 | const_iv (ConfigureRequest), |
|
|
748 | const_iv (GravityNotify), |
|
|
749 | const_iv (ResizeRequest), |
|
|
750 | const_iv (CirculateNotify), |
|
|
751 | const_iv (CirculateRequest), |
|
|
752 | const_iv (PropertyNotify), |
|
|
753 | const_iv (SelectionClear), |
|
|
754 | const_iv (SelectionRequest), |
|
|
755 | const_iv (SelectionNotify), |
|
|
756 | const_iv (ColormapNotify), |
|
|
757 | const_iv (ClientMessage), |
|
|
758 | const_iv (MappingNotify), |
|
|
759 | }; |
|
|
760 | |
|
|
761 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); |
|
|
762 | civ-- > const_iv; ) |
|
|
763 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
|
|
764 | } |
688 | |
765 | |
689 | void |
766 | void |
690 | warn (const char *msg) |
767 | warn (const char *msg) |
691 | CODE: |
768 | CODE: |
692 | rxvt_warn ("%s", msg); |
769 | rxvt_warn ("%s", msg); |
… | |
… | |
694 | void |
771 | void |
695 | fatal (const char *msg) |
772 | fatal (const char *msg) |
696 | CODE: |
773 | CODE: |
697 | rxvt_fatal ("%s", msg); |
774 | rxvt_fatal ("%s", msg); |
698 | |
775 | |
699 | SV * |
776 | void |
700 | untaint (SV *sv) |
777 | _exit (int status) |
701 | CODE: |
|
|
702 | RETVAL = newSVsv (sv); |
|
|
703 | SvTAINTED_off (RETVAL); |
|
|
704 | OUTPUT: |
|
|
705 | RETVAL |
|
|
706 | |
|
|
707 | bool |
|
|
708 | safe () |
|
|
709 | CODE: |
|
|
710 | RETVAL = !rxvt_tainted (); |
|
|
711 | OUTPUT: |
|
|
712 | RETVAL |
|
|
713 | |
778 | |
714 | NV |
779 | NV |
715 | NOW () |
780 | NOW () |
716 | CODE: |
781 | CODE: |
717 | RETVAL = NOW; |
782 | RETVAL = NOW; |
… | |
… | |
812 | OUTPUT: |
877 | OUTPUT: |
813 | RETVAL |
878 | RETVAL |
814 | |
879 | |
815 | void |
880 | void |
816 | rxvt_term::destroy () |
881 | rxvt_term::destroy () |
|
|
882 | |
|
|
883 | #if ENABLE_PERL_FRILLS |
|
|
884 | |
|
|
885 | void |
|
|
886 | rxvt_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 | |
|
|
899 | void |
|
|
900 | rxvt_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 | |
|
|
921 | void |
|
|
922 | rxvt_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 | |
|
|
933 | void |
|
|
934 | rxvt_term::XDeleteProperty (U32 window, U32 property) |
|
|
935 | CODE: |
|
|
936 | XDeleteProperty (THIS->display->display, (Window)window, (Atom)property); |
|
|
937 | |
|
|
938 | U32 |
|
|
939 | rxvt_term::DefaultRootWindow () |
|
|
940 | CODE: |
|
|
941 | RETVAL = (U32)THIS->display->root; |
|
|
942 | OUTPUT: |
|
|
943 | RETVAL |
|
|
944 | |
|
|
945 | U32 |
|
|
946 | rxvt_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 | |
|
|
955 | void |
|
|
956 | rxvt_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 | |
|
|
960 | void |
|
|
961 | rxvt_term::XMapWindow (U32 window) |
|
|
962 | CODE: |
|
|
963 | XMapWindow (THIS->display->display, (Window)window); |
|
|
964 | |
|
|
965 | void |
|
|
966 | rxvt_term::XUnmapWindow (U32 window) |
|
|
967 | CODE: |
|
|
968 | XUnmapWindow (THIS->display->display, (Window)window); |
|
|
969 | |
|
|
970 | #endif |
|
|
971 | |
|
|
972 | void |
|
|
973 | rxvt_term::set_should_invoke (int htype, int inc) |
|
|
974 | CODE: |
|
|
975 | THIS->perl.should_invoke [htype] += inc; |
817 | |
976 | |
818 | void |
977 | void |
819 | rxvt_term::grab_button (int button, U32 modifiers) |
978 | rxvt_term::grab_button (int button, U32 modifiers) |
820 | CODE: |
979 | CODE: |
821 | XGrabButton (THIS->display->display, button, modifiers, THIS->vt, 1, |
980 | XGrabButton (THIS->display->display, button, modifiers, THIS->vt, 1, |
… | |
… | |
889 | char *mbstr = rxvt_wcstombs (wstr); |
1048 | char *mbstr = rxvt_wcstombs (wstr); |
890 | rxvt_pop_locale (); |
1049 | rxvt_pop_locale (); |
891 | |
1050 | |
892 | free (wstr); |
1051 | free (wstr); |
893 | |
1052 | |
894 | RETVAL = taint_if (newSVpv (mbstr, 0), str); |
1053 | RETVAL = newSVpv (mbstr, 0); |
895 | free (mbstr); |
1054 | free (mbstr); |
896 | } |
1055 | } |
897 | OUTPUT: |
1056 | OUTPUT: |
898 | RETVAL |
1057 | RETVAL |
899 | |
1058 | |
… | |
… | |
906 | |
1065 | |
907 | rxvt_push_locale (THIS->locale); |
1066 | rxvt_push_locale (THIS->locale); |
908 | wchar_t *wstr = rxvt_mbstowcs (data, len); |
1067 | wchar_t *wstr = rxvt_mbstowcs (data, len); |
909 | rxvt_pop_locale (); |
1068 | rxvt_pop_locale (); |
910 | |
1069 | |
911 | RETVAL = taint_if (wcs2sv (wstr), octets); |
1070 | RETVAL = wcs2sv (wstr); |
912 | free (wstr); |
1071 | free (wstr); |
913 | } |
1072 | } |
914 | OUTPUT: |
1073 | OUTPUT: |
915 | RETVAL |
1074 | RETVAL |
916 | |
1075 | |
… | |
… | |
925 | #define TERM_OFFSET_ncol TERM_OFFSET(ncol) |
1084 | #define TERM_OFFSET_ncol TERM_OFFSET(ncol) |
926 | #define TERM_OFFSET_focus TERM_OFFSET(focus) |
1085 | #define TERM_OFFSET_focus TERM_OFFSET(focus) |
927 | #define TERM_OFFSET_mapped TERM_OFFSET(mapped) |
1086 | #define TERM_OFFSET_mapped TERM_OFFSET(mapped) |
928 | #define TERM_OFFSET_saveLines TERM_OFFSET(saveLines) |
1087 | #define TERM_OFFSET_saveLines TERM_OFFSET(saveLines) |
929 | #define TERM_OFFSET_total_rows TERM_OFFSET(total_rows) |
1088 | #define TERM_OFFSET_total_rows TERM_OFFSET(total_rows) |
930 | #define TERM_OFFSET_nsaved TERM_OFFSET(nsaved) |
1089 | #define TERM_OFFSET_top_row TERM_OFFSET(top_row) |
931 | |
1090 | |
932 | int |
1091 | int |
933 | rxvt_term::width () |
1092 | rxvt_term::width () |
934 | ALIAS: |
1093 | ALIAS: |
935 | width = TERM_OFFSET_width |
1094 | width = TERM_OFFSET_width |
… | |
… | |
941 | ncol = TERM_OFFSET_ncol |
1100 | ncol = TERM_OFFSET_ncol |
942 | focus = TERM_OFFSET_focus |
1101 | focus = TERM_OFFSET_focus |
943 | mapped = TERM_OFFSET_mapped |
1102 | mapped = TERM_OFFSET_mapped |
944 | saveLines = TERM_OFFSET_saveLines |
1103 | saveLines = TERM_OFFSET_saveLines |
945 | total_rows = TERM_OFFSET_total_rows |
1104 | total_rows = TERM_OFFSET_total_rows |
946 | nsaved = TERM_OFFSET_nsaved |
1105 | top_row = TERM_OFFSET_top_row |
947 | CODE: |
1106 | CODE: |
948 | RETVAL = *(int *)((char *)THIS + ix); |
1107 | RETVAL = *(int *)((char *)THIS + ix); |
949 | OUTPUT: |
1108 | OUTPUT: |
950 | RETVAL |
1109 | RETVAL |
951 | |
1110 | |
… | |
… | |
1020 | CODE: |
1179 | CODE: |
1021 | RETVAL = (U32)THIS->vt; |
1180 | RETVAL = (U32)THIS->vt; |
1022 | OUTPUT: |
1181 | OUTPUT: |
1023 | RETVAL |
1182 | RETVAL |
1024 | |
1183 | |
|
|
1184 | void |
|
|
1185 | rxvt_term::vt_emask_add (U32 emask) |
|
|
1186 | CODE: |
|
|
1187 | THIS->vt_emask_perl |= emask; |
|
|
1188 | THIS->vt_select_input (); |
|
|
1189 | |
1025 | U32 |
1190 | U32 |
1026 | rxvt_term::rstyle (U32 new_rstyle = THIS->rstyle) |
1191 | rxvt_term::rstyle (U32 new_rstyle = THIS->rstyle) |
1027 | CODE: |
1192 | CODE: |
1028 | { |
|
|
1029 | RETVAL = THIS->rstyle; |
1193 | RETVAL = THIS->rstyle; |
1030 | THIS->rstyle = new_rstyle; |
1194 | THIS->rstyle = new_rstyle; |
1031 | } |
|
|
1032 | OUTPUT: |
1195 | OUTPUT: |
1033 | RETVAL |
1196 | RETVAL |
1034 | |
1197 | |
1035 | int |
1198 | int |
1036 | rxvt_term::view_start (int newval = -1) |
1199 | rxvt_term::view_start (int newval = 1) |
|
|
1200 | PROTOTYPE: $;$ |
1037 | CODE: |
1201 | CODE: |
1038 | { |
1202 | { |
1039 | RETVAL = THIS->view_start; |
1203 | RETVAL = THIS->view_start; |
1040 | |
1204 | |
1041 | if (newval >= 0) |
1205 | if (newval <= 0) |
1042 | { |
1206 | THIS->scr_changeview (max (newval, THIS->top_row)); |
1043 | THIS->view_start = min (newval, THIS->nsaved); |
|
|
1044 | THIS->scr_changeview (RETVAL); |
|
|
1045 | } |
|
|
1046 | } |
1207 | } |
1047 | OUTPUT: |
1208 | OUTPUT: |
1048 | RETVAL |
1209 | RETVAL |
1049 | |
1210 | |
1050 | void |
1211 | void |
… | |
… | |
1054 | |
1215 | |
1055 | void |
1216 | void |
1056 | rxvt_term::ROW_t (int row_number, SV *new_text = 0, int start_col = 0, int start_ofs = 0, int max_len = MAX_COLS) |
1217 | rxvt_term::ROW_t (int row_number, SV *new_text = 0, int start_col = 0, int start_ofs = 0, int max_len = MAX_COLS) |
1057 | PPCODE: |
1218 | PPCODE: |
1058 | { |
1219 | { |
1059 | if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
1220 | if (!IN_RANGE_EXC (row_number, THIS->top_row, THIS->nrow)) |
1060 | XSRETURN_EMPTY; |
1221 | XSRETURN_EMPTY; |
1061 | |
1222 | |
1062 | line_t &l = ROW(row_number); |
1223 | line_t &l = ROW(row_number); |
1063 | |
1224 | |
1064 | if (GIMME_V != G_VOID) |
1225 | if (GIMME_V != G_VOID) |
… | |
… | |
1066 | wchar_t *wstr = new wchar_t [THIS->ncol]; |
1227 | wchar_t *wstr = new wchar_t [THIS->ncol]; |
1067 | |
1228 | |
1068 | for (int col = 0; col < THIS->ncol; col++) |
1229 | for (int col = 0; col < THIS->ncol; col++) |
1069 | wstr [col] = l.t [col]; |
1230 | wstr [col] = l.t [col]; |
1070 | |
1231 | |
1071 | XPUSHs (taint (sv_2mortal (wcs2sv (wstr, THIS->ncol)))); |
1232 | XPUSHs (sv_2mortal (wcs2sv (wstr, THIS->ncol))); |
1072 | |
1233 | |
1073 | delete [] wstr; |
1234 | delete [] wstr; |
1074 | } |
1235 | } |
1075 | |
1236 | |
1076 | if (new_text) |
1237 | if (new_text) |
… | |
… | |
1097 | |
1258 | |
1098 | void |
1259 | void |
1099 | rxvt_term::ROW_r (int row_number, SV *new_rend = 0, int start_col = 0, int start_ofs = 0, int max_len = MAX_COLS) |
1260 | rxvt_term::ROW_r (int row_number, SV *new_rend = 0, int start_col = 0, int start_ofs = 0, int max_len = MAX_COLS) |
1100 | PPCODE: |
1261 | PPCODE: |
1101 | { |
1262 | { |
1102 | if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
1263 | if (!IN_RANGE_EXC (row_number, THIS->top_row, THIS->nrow)) |
1103 | XSRETURN_EMPTY; |
1264 | XSRETURN_EMPTY; |
1104 | |
1265 | |
1105 | line_t &l = ROW(row_number); |
1266 | line_t &l = ROW(row_number); |
1106 | |
1267 | |
1107 | if (GIMME_V != G_VOID) |
1268 | if (GIMME_V != G_VOID) |
… | |
… | |
1137 | |
1298 | |
1138 | int |
1299 | int |
1139 | rxvt_term::ROW_l (int row_number, int new_length = -1) |
1300 | rxvt_term::ROW_l (int row_number, int new_length = -1) |
1140 | CODE: |
1301 | CODE: |
1141 | { |
1302 | { |
1142 | if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
1303 | if (!IN_RANGE_EXC (row_number, THIS->top_row, THIS->nrow)) |
1143 | XSRETURN_EMPTY; |
1304 | XSRETURN_EMPTY; |
1144 | |
1305 | |
1145 | line_t &l = ROW(row_number); |
1306 | line_t &l = ROW(row_number); |
1146 | RETVAL = l.l; |
1307 | RETVAL = l.l; |
1147 | |
1308 | |
… | |
… | |
1153 | |
1314 | |
1154 | bool |
1315 | bool |
1155 | rxvt_term::ROW_is_longer (int row_number, int new_is_longer = -1) |
1316 | rxvt_term::ROW_is_longer (int row_number, int new_is_longer = -1) |
1156 | CODE: |
1317 | CODE: |
1157 | { |
1318 | { |
1158 | if (!IN_RANGE_EXC (row_number, -THIS->nsaved, THIS->nrow)) |
1319 | if (!IN_RANGE_EXC (row_number, THIS->top_row, THIS->nrow)) |
1159 | XSRETURN_EMPTY; |
1320 | XSRETURN_EMPTY; |
1160 | |
1321 | |
1161 | line_t &l = ROW(row_number); |
1322 | line_t &l = ROW(row_number); |
1162 | RETVAL = l.is_longer (); |
1323 | RETVAL = l.is_longer (); |
1163 | |
1324 | |
… | |
… | |
1197 | else |
1358 | else |
1198 | *r++ = *s; |
1359 | *r++ = *s; |
1199 | |
1360 | |
1200 | rxvt_pop_locale (); |
1361 | rxvt_pop_locale (); |
1201 | |
1362 | |
1202 | RETVAL = taint_if (wcs2sv (rstr, r - rstr), string); |
1363 | RETVAL = wcs2sv (rstr, r - rstr); |
1203 | |
1364 | |
1204 | delete [] rstr; |
1365 | delete [] rstr; |
1205 | } |
1366 | } |
1206 | OUTPUT: |
1367 | OUTPUT: |
1207 | RETVAL |
1368 | RETVAL |
… | |
… | |
1233 | else if (IS_COMPOSE (*s)) |
1394 | else if (IS_COMPOSE (*s)) |
1234 | r += rxvt_composite.expand (*s, r); |
1395 | r += rxvt_composite.expand (*s, r); |
1235 | else |
1396 | else |
1236 | *r++ = *s; |
1397 | *r++ = *s; |
1237 | |
1398 | |
1238 | RETVAL = taint_if (wcs2sv (rstr, r - rstr), text); |
1399 | RETVAL = wcs2sv (rstr, r - rstr); |
1239 | |
1400 | |
1240 | delete [] rstr; |
1401 | delete [] rstr; |
1241 | } |
1402 | } |
1242 | OUTPUT: |
1403 | OUTPUT: |
1243 | RETVAL |
1404 | RETVAL |
… | |
… | |
1265 | |
1426 | |
1266 | if (!IN_RANGE_EXC (index, 0, NUM_RESOURCES)) |
1427 | if (!IN_RANGE_EXC (index, 0, NUM_RESOURCES)) |
1267 | croak ("requested out-of-bound resource %s+%d,", name, index - rs->value); |
1428 | croak ("requested out-of-bound resource %s+%d,", name, index - rs->value); |
1268 | |
1429 | |
1269 | if (GIMME_V != G_VOID) |
1430 | if (GIMME_V != G_VOID) |
1270 | XPUSHs (THIS->rs [index] ? sv_2mortal (taint (newSVpv (THIS->rs [index], 0))) : &PL_sv_undef); |
1431 | XPUSHs (THIS->rs [index] ? sv_2mortal (newSVpv (THIS->rs [index], 0)) : &PL_sv_undef); |
1271 | |
1432 | |
1272 | if (newval) |
1433 | if (newval) |
1273 | { |
1434 | { |
1274 | if (SvOK (newval)) |
1435 | if (SvOK (newval)) |
1275 | { |
1436 | { |
… | |
… | |
1282 | } |
1443 | } |
1283 | } |
1444 | } |
1284 | |
1445 | |
1285 | const char * |
1446 | const char * |
1286 | rxvt_term::x_resource (const char *name) |
1447 | rxvt_term::x_resource (const char *name) |
1287 | CLEANUP: |
|
|
1288 | SvTAINTED_on (ST (0)); |
|
|
1289 | |
1448 | |
1290 | bool |
1449 | bool |
1291 | rxvt_term::option (U32 optval, int set = -1) |
1450 | rxvt_term::option (U32 optval, int set = -1) |
1292 | CODE: |
1451 | CODE: |
1293 | { |
1452 | { |
… | |
… | |
1353 | PUSHs (sv_2mortal (newSViv (rc.col))); |
1512 | PUSHs (sv_2mortal (newSViv (rc.col))); |
1354 | } |
1513 | } |
1355 | |
1514 | |
1356 | if (items == 3) |
1515 | if (items == 3) |
1357 | { |
1516 | { |
1358 | rc.row = clamp (SvIV (ST (1)), -THIS->nsaved, THIS->nrow - 1); |
1517 | rc.row = SvIV (ST (1)); |
1359 | rc.col = clamp (SvIV (ST (2)), 0, THIS->ncol - 1); |
1518 | rc.col = SvIV (ST (2)); |
|
|
1519 | |
|
|
1520 | if (ix == 2 && rc.col == 0) |
|
|
1521 | { |
|
|
1522 | rc.row--; |
|
|
1523 | rc.col = THIS->ncol; |
|
|
1524 | } |
|
|
1525 | |
|
|
1526 | clamp_it (rc.col, 0, THIS->ncol); |
|
|
1527 | clamp_it (rc.row, THIS->top_row, THIS->nrow - 1); |
1360 | |
1528 | |
1361 | if (ix) |
1529 | if (ix) |
1362 | THIS->want_refresh = 1; |
1530 | THIS->want_refresh = 1; |
1363 | } |
1531 | } |
1364 | } |
1532 | } |
… | |
… | |
1368 | CODE: |
1536 | CODE: |
1369 | RETVAL = THIS->charsets [THIS->screen.charset]; |
1537 | RETVAL = THIS->charsets [THIS->screen.charset]; |
1370 | OUTPUT: |
1538 | OUTPUT: |
1371 | RETVAL |
1539 | RETVAL |
1372 | |
1540 | |
|
|
1541 | #void |
|
|
1542 | #rxvt_term::selection_clear () |
|
|
1543 | |
|
|
1544 | void |
|
|
1545 | rxvt_term::selection_make (U32 eventtime, bool rect = false) |
|
|
1546 | CODE: |
|
|
1547 | THIS->selection.op = SELECTION_CONT; |
|
|
1548 | THIS->selection.rect = rect; |
|
|
1549 | THIS->selection_make (eventtime); |
|
|
1550 | |
1373 | int |
1551 | int |
1374 | rxvt_term::selection_grab (U32 eventtime) |
1552 | rxvt_term::selection_grab (U32 eventtime) |
1375 | |
1553 | |
1376 | void |
1554 | void |
1377 | rxvt_term::selection (SV *newtext = 0) |
1555 | rxvt_term::selection (SV *newtext = 0) |
1378 | PPCODE: |
1556 | PPCODE: |
1379 | { |
1557 | { |
1380 | if (GIMME_V != G_VOID) |
1558 | if (GIMME_V != G_VOID) |
1381 | XPUSHs (THIS->selection.text |
1559 | XPUSHs (THIS->selection.text |
1382 | ? taint (sv_2mortal (wcs2sv (THIS->selection.text, THIS->selection.len))) |
1560 | ? sv_2mortal (wcs2sv (THIS->selection.text, THIS->selection.len)) |
1383 | : &PL_sv_undef); |
1561 | : &PL_sv_undef); |
1384 | |
1562 | |
1385 | if (newtext) |
1563 | if (newtext) |
1386 | { |
1564 | { |
1387 | free (THIS->selection.text); |
1565 | free (THIS->selection.text); |