1 | /*----------------------------------------------------------------------* |
1 | /*----------------------------------------------------------------------* |
2 | * File: rxvtperl.xs |
2 | * File: rxvtperl.xs |
3 | *----------------------------------------------------------------------* |
3 | *----------------------------------------------------------------------* |
4 | * |
4 | * |
5 | * All portions of code are copyright by their respective author/s. |
5 | * All portions of code are copyright by their respective author/s. |
6 | * Copyright (c) 2005-2008 Marc Lehmann <pcg@goof.com> |
6 | * Copyright (c) 2005-2008,2011 Marc Lehmann <schmorp@schmorp.de> |
7 | * |
7 | * |
8 | * This program is free software; you can redistribute it and/or modify |
8 | * This program is free software; you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License as published by |
9 | * it under the terms of the GNU General Public License as published by |
10 | * the Free Software Foundation; either version 2 of the License, or |
10 | * the Free Software Foundation; either version 2 of the License, or |
11 | * (at your option) any later version. |
11 | * (at your option) any later version. |
… | |
… | |
413 | ENTER; |
413 | ENTER; |
414 | SAVETMPS; |
414 | SAVETMPS; |
415 | |
415 | |
416 | PUSHMARK (SP); |
416 | PUSHMARK (SP); |
417 | |
417 | |
|
|
418 | EXTEND (SP, 2); |
418 | XPUSHs (sv_2mortal (newSVterm (term))); |
419 | PUSHs (sv_2mortal (newSVterm (term))); |
419 | XPUSHs (sv_2mortal (newSViv (htype))); |
420 | PUSHs (sv_2mortal (newSViv (htype))); |
420 | |
421 | |
421 | for (;;) { |
422 | for (;;) { |
422 | data_type dt = (data_type)va_arg (ap, int); |
423 | data_type dt = (data_type)va_arg (ap, int); |
423 | |
424 | |
424 | switch (dt) |
425 | switch (dt) |
… | |
… | |
581 | FREETMPS; |
582 | FREETMPS; |
582 | LEAVE; |
583 | LEAVE; |
583 | |
584 | |
584 | if (SvTRUE (ERRSV)) |
585 | if (SvTRUE (ERRSV)) |
585 | { |
586 | { |
586 | rxvt_warn ("perl hook %d evaluation error: %s", htype, SvPV_nolen (ERRSV)); |
587 | rxvt_warn ("perl hook %d evaluation error: %s", htype, SvPVbyte_nolen (ERRSV)); |
587 | ungrab (term); // better lose the grab than the session |
588 | ungrab (term); // better lose the grab than the session |
588 | } |
589 | } |
589 | |
590 | |
590 | event_consumed = !!count; |
591 | event_consumed = !!count; |
591 | } |
592 | } |
… | |
… | |
608 | // don't allow further calls |
609 | // don't allow further calls |
609 | term->perl.self = 0; |
610 | term->perl.self = 0; |
610 | } |
611 | } |
611 | |
612 | |
612 | return event_consumed; |
613 | return event_consumed; |
|
|
614 | } |
|
|
615 | |
|
|
616 | void |
|
|
617 | rxvt_perl_interp::selection_finish (rxvt_selection *sel, char *data, unsigned int len) |
|
|
618 | { |
|
|
619 | localise_env set_environ (perl_environ); |
|
|
620 | |
|
|
621 | ENTER; |
|
|
622 | SAVETMPS; |
|
|
623 | |
|
|
624 | dSP; |
|
|
625 | XPUSHs (sv_2mortal (newSVpvn (data, len))); |
|
|
626 | call_sv ((SV *)sel->cb_sv, G_VOID | G_DISCARD | G_EVAL); |
|
|
627 | |
|
|
628 | if (SvTRUE (ERRSV)) |
|
|
629 | rxvt_warn ("perl selection callback evaluation error: %s", SvPVbyte_nolen (ERRSV)); |
|
|
630 | |
|
|
631 | FREETMPS; |
|
|
632 | LEAVE; |
613 | } |
633 | } |
614 | |
634 | |
615 | ///////////////////////////////////////////////////////////////////////////// |
635 | ///////////////////////////////////////////////////////////////////////////// |
616 | |
636 | |
617 | MODULE = urxvt PACKAGE = urxvt |
637 | MODULE = urxvt PACKAGE = urxvt |
… | |
… | |
851 | for (rxvt_term **t = rxvt_term::termlist.begin (); t < rxvt_term::termlist.end (); t++) |
871 | for (rxvt_term **t = rxvt_term::termlist.begin (); t < rxvt_term::termlist.end (); t++) |
852 | if ((*t)->perl.self) |
872 | if ((*t)->perl.self) |
853 | PUSHs (sv_2mortal (newSVterm (*t))); |
873 | PUSHs (sv_2mortal (newSVterm (*t))); |
854 | } |
874 | } |
855 | |
875 | |
|
|
876 | IV |
|
|
877 | _new_selection_request (rxvt_term *term, int selnum, Time tm, Window win, Atom prop, SV *cb) |
|
|
878 | CODE: |
|
|
879 | rxvt_selection *req = new rxvt_selection (term->display, selnum, tm, win, prop, term); |
|
|
880 | req->cb_sv = newSVsv (cb); |
|
|
881 | RETVAL = (IV)req; |
|
|
882 | OUTPUT: |
|
|
883 | RETVAL |
|
|
884 | |
|
|
885 | void |
|
|
886 | _delete_selection_request (IV req_) |
|
|
887 | CODE: |
|
|
888 | rxvt_selection *req = (rxvt_selection *)req_; |
|
|
889 | delete req; |
|
|
890 | |
856 | MODULE = urxvt PACKAGE = urxvt::term |
891 | MODULE = urxvt PACKAGE = urxvt::term |
857 | |
892 | |
858 | SV * |
893 | SV * |
859 | _new (AV *env, AV *arg) |
894 | _new (AV *env, AV *arg) |
860 | CODE: |
895 | CODE: |
… | |
… | |
1167 | RETVAL |
1202 | RETVAL |
1168 | |
1203 | |
1169 | Window |
1204 | Window |
1170 | rxvt_term::parent () |
1205 | rxvt_term::parent () |
1171 | CODE: |
1206 | CODE: |
1172 | RETVAL = THIS->parent [0]; |
1207 | RETVAL = THIS->parent; |
1173 | OUTPUT: |
1208 | OUTPUT: |
1174 | RETVAL |
1209 | RETVAL |
1175 | |
1210 | |
1176 | Window |
1211 | Window |
1177 | rxvt_term::vt () |
1212 | rxvt_term::vt () |