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-2005 Marc Lehmann <pcg@goof.com> |
6 | * Copyright (c) 2005-2006 Marc Lehmann <pcg@goof.com> |
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. |
… | |
… | |
469 | |
469 | |
470 | case DT_STRING: |
470 | case DT_STRING: |
471 | XPUSHs (sv_2mortal (newSVpv (va_arg (ap, char *), 0))); |
471 | XPUSHs (sv_2mortal (newSVpv (va_arg (ap, char *), 0))); |
472 | break; |
472 | break; |
473 | |
473 | |
|
|
474 | case DT_STRING_LEN: |
|
|
475 | { |
|
|
476 | char *str = va_arg (ap, char *); |
|
|
477 | int len = va_arg (ap, int); |
|
|
478 | |
|
|
479 | XPUSHs (sv_2mortal (newSVpvn (str, len))); |
|
|
480 | } |
|
|
481 | break; |
|
|
482 | |
|
|
483 | case DT_XEVENT: |
|
|
484 | { |
|
|
485 | XEvent *xe = va_arg (ap, XEvent *); |
|
|
486 | HV *hv = newHV (); |
|
|
487 | |
|
|
488 | # define set(name, sv) hv_store (hv, # name, sizeof (# name) - 1, sv, 0) |
|
|
489 | # define setiv(name, val) hv_store (hv, # name, sizeof (# name) - 1, newSViv (val), 0) |
|
|
490 | # undef set |
|
|
491 | |
|
|
492 | setiv (type, xe->type); |
|
|
493 | setiv (send_event, xe->xany.send_event); |
|
|
494 | setiv (serial, xe->xany.serial); |
|
|
495 | |
|
|
496 | switch (xe->type) |
|
|
497 | { |
|
|
498 | case KeyPress: |
|
|
499 | case KeyRelease: |
|
|
500 | case ButtonPress: |
|
|
501 | case ButtonRelease: |
|
|
502 | case MotionNotify: |
|
|
503 | setiv (time, xe->xmotion.time); |
|
|
504 | setiv (x, xe->xmotion.x); |
|
|
505 | setiv (y, xe->xmotion.y); |
|
|
506 | setiv (row, xe->xmotion.y / term->fheight); |
|
|
507 | setiv (col, xe->xmotion.x / term->fwidth); |
|
|
508 | setiv (x_root, xe->xmotion.x_root); |
|
|
509 | setiv (y_root, xe->xmotion.y_root); |
|
|
510 | setiv (state, xe->xmotion.state); |
|
|
511 | break; |
|
|
512 | } |
|
|
513 | |
|
|
514 | switch (xe->type) |
|
|
515 | { |
|
|
516 | case KeyPress: |
|
|
517 | case KeyRelease: |
|
|
518 | setiv (keycode, xe->xkey.keycode); |
|
|
519 | break; |
|
|
520 | |
|
|
521 | case ButtonPress: |
|
|
522 | case ButtonRelease: |
|
|
523 | setiv (button, xe->xbutton.button); |
|
|
524 | break; |
|
|
525 | |
|
|
526 | case MotionNotify: |
|
|
527 | setiv (is_hint, xe->xmotion.is_hint); |
|
|
528 | break; |
|
|
529 | } |
|
|
530 | |
|
|
531 | XPUSHs (sv_2mortal (newRV_noinc ((SV *)hv))); |
|
|
532 | } |
|
|
533 | break; |
|
|
534 | |
474 | case DT_USTRING_LEN: |
535 | case DT_USTRING_LEN: |
475 | { |
536 | { |
476 | unicode_t *ustr = va_arg (ap, unicode_t *); |
537 | unicode_t *ustr = va_arg (ap, unicode_t *); |
477 | int ulen = va_arg (ap, int); |
538 | int ulen = va_arg (ap, int); |
478 | wchar_t *wstr = new wchar_t [ulen]; |
539 | wchar_t *wstr = new wchar_t [ulen]; |
… | |
… | |
736 | RETVAL = *(int *)((char *)THIS + ix); |
797 | RETVAL = *(int *)((char *)THIS + ix); |
737 | OUTPUT: |
798 | OUTPUT: |
738 | RETVAL |
799 | RETVAL |
739 | |
800 | |
740 | U32 |
801 | U32 |
|
|
802 | rxvt_term::parent () |
|
|
803 | CODE: |
|
|
804 | RETVAL = (U32)THIS->parent [0]; |
|
|
805 | OUTPUT: |
|
|
806 | RETVAL |
|
|
807 | |
|
|
808 | U32 |
|
|
809 | rxvt_term::vt () |
|
|
810 | CODE: |
|
|
811 | RETVAL = (U32)THIS->vt; |
|
|
812 | OUTPUT: |
|
|
813 | RETVAL |
|
|
814 | |
|
|
815 | U32 |
741 | rxvt_term::rstyle (U32 new_rstyle = THIS->rstyle) |
816 | rxvt_term::rstyle (U32 new_rstyle = THIS->rstyle) |
742 | CODE: |
817 | CODE: |
743 | { |
818 | { |
744 | RETVAL = THIS->rstyle; |
819 | RETVAL = THIS->rstyle; |
745 | THIS->rstyle = new_rstyle; |
820 | THIS->rstyle = new_rstyle; |