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,2011 Marc Lehmann <schmorp@schmorp.de> |
6 | * Copyright (c) 2005-2014,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 3 of the License, or |
11 | * (at your option) any later version. |
11 | * (at your option) any later version. |
12 | * |
12 | * |
13 | * This program is distributed in the hope that it will be useful, |
13 | * This program is distributed in the hope that it will be useful, |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
… | |
… | |
490 | |
490 | |
491 | FREETMPS; |
491 | FREETMPS; |
492 | LEAVE; |
492 | LEAVE; |
493 | |
493 | |
494 | return ret; |
494 | return ret; |
|
|
495 | } |
|
|
496 | |
|
|
497 | static void |
|
|
498 | _keysym_resource_push (rxvt_term *term, const char *k, const char *v) |
|
|
499 | { |
|
|
500 | unsigned int state; |
|
|
501 | |
|
|
502 | if (term->parse_keysym (k, state) == -1) |
|
|
503 | return; |
|
|
504 | |
|
|
505 | dSP; |
|
|
506 | XPUSHs (sv_2mortal (newSVpv (v, 0))); |
|
|
507 | PUTBACK; |
|
|
508 | } |
|
|
509 | |
|
|
510 | static void |
|
|
511 | _keysym_resources (rxvt_term *term) |
|
|
512 | { |
|
|
513 | term->enumerate_keysym_resources (_keysym_resource_push); |
495 | } |
514 | } |
496 | |
515 | |
497 | static void |
516 | static void |
498 | ungrab (rxvt_term *THIS) |
517 | ungrab (rxvt_term *THIS) |
499 | { |
518 | { |
… | |
… | |
795 | IV iv; |
814 | IV iv; |
796 | } *civ, const_iv[] = { |
815 | } *civ, const_iv[] = { |
797 | # define const_iv(name) { # name, (IV)name } |
816 | # define const_iv(name) { # name, (IV)name } |
798 | const_iv (HOOK_INIT), |
817 | const_iv (HOOK_INIT), |
799 | const_iv (HOOK_DESTROY), |
818 | const_iv (HOOK_DESTROY), |
800 | const_iv (HOOK_KEYBOARD_DISPATCH), |
819 | const_iv (HOOK_ACTION), |
801 | |
820 | |
802 | const_iv (NUM_RESOURCES), |
821 | const_iv (NUM_RESOURCES), |
803 | const_iv (DEFAULT_RSTYLE), |
822 | const_iv (DEFAULT_RSTYLE), |
804 | const_iv (OVERLAY_RSTYLE), |
823 | const_iv (OVERLAY_RSTYLE), |
805 | const_iv (Color_Bits), |
824 | const_iv (Color_Bits), |
… | |
… | |
1193 | void |
1212 | void |
1194 | rxvt_term::put_option_db (octet_string specifier, octet_string value) |
1213 | rxvt_term::put_option_db (octet_string specifier, octet_string value) |
1195 | CODE: |
1214 | CODE: |
1196 | XrmPutStringResource (&THIS->option_db, specifier, value); |
1215 | XrmPutStringResource (&THIS->option_db, specifier, value); |
1197 | |
1216 | |
|
|
1217 | void |
|
|
1218 | rxvt_term::_keysym_resources () |
|
|
1219 | PPCODE: |
|
|
1220 | PUTBACK; |
|
|
1221 | _keysym_resources (THIS); |
|
|
1222 | SPAGAIN; |
|
|
1223 | |
1198 | int |
1224 | int |
1199 | rxvt_term::grab_button (int button, U32 modifiers, Window window = THIS->vt) |
1225 | rxvt_term::grab_button (int button, U32 modifiers, Window window = THIS->vt) |
1200 | CODE: |
1226 | CODE: |
1201 | RETVAL = XGrabButton (THIS->dpy, button, modifiers, window, 1, |
1227 | RETVAL = XGrabButton (THIS->dpy, button, modifiers, window, 1, |
1202 | ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask, |
1228 | ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask, |
… | |
… | |
1816 | THIS->cursor_blink_reset (); |
1842 | THIS->cursor_blink_reset (); |
1817 | break; |
1843 | break; |
1818 | #endif |
1844 | #endif |
1819 | |
1845 | |
1820 | case Opt_cursorUnderline: |
1846 | case Opt_cursorUnderline: |
|
|
1847 | THIS->cursor_type = set ? 1 : 0; |
1821 | THIS->want_refresh = 1; |
1848 | THIS->want_refresh = 1; |
1822 | THIS->refresh_check (); |
1849 | THIS->refresh_check (); |
1823 | break; |
1850 | break; |
1824 | |
1851 | |
1825 | # case Opt_scrollBar_floating: |
1852 | # case Opt_scrollBar_floating: |
… | |
… | |
1831 | } |
1858 | } |
1832 | OUTPUT: |
1859 | OUTPUT: |
1833 | RETVAL |
1860 | RETVAL |
1834 | |
1861 | |
1835 | bool |
1862 | bool |
1836 | rxvt_term::parse_keysym (char *keysym, char *str) |
1863 | rxvt_term::bind_action (char *keysym, char *str) |
|
|
1864 | ALIAS: |
|
|
1865 | parse_keysym = 1 |
1837 | CODE: |
1866 | CODE: |
1838 | RETVAL = 0 < THIS->parse_keysym (keysym, str); |
1867 | RETVAL = 0 < THIS->bind_action (keysym, str); |
1839 | THIS->keyboard->register_done (); |
1868 | THIS->keyboard->register_done (); |
1840 | OUTPUT: |
1869 | OUTPUT: |
1841 | RETVAL |
1870 | RETVAL |
1842 | |
|
|
1843 | void |
|
|
1844 | rxvt_term::register_command (int keysym, unsigned int state, SV *str) |
|
|
1845 | CODE: |
|
|
1846 | wchar_t *wstr = sv2wcs (str); |
|
|
1847 | THIS->keyboard->register_user_translation (keysym, state, wstr); |
|
|
1848 | free (wstr); |
|
|
1849 | |
1871 | |
1850 | void |
1872 | void |
1851 | rxvt_term::screen_cur (...) |
1873 | rxvt_term::screen_cur (...) |
1852 | PROTOTYPE: $;$$ |
1874 | PROTOTYPE: $;$$ |
1853 | ALIAS: |
1875 | ALIAS: |
… | |
… | |
1979 | THIS->scr_add_lines (wstr, wcslen (wstr)); |
2001 | THIS->scr_add_lines (wstr, wcslen (wstr)); |
1980 | free (wstr); |
2002 | free (wstr); |
1981 | } |
2003 | } |
1982 | |
2004 | |
1983 | void |
2005 | void |
|
|
2006 | rxvt_term::tt_write_user_input (SV *octets) |
|
|
2007 | INIT: |
|
|
2008 | STRLEN len; |
|
|
2009 | char *str = SvPVbyte (octets, len); |
|
|
2010 | C_ARGS: |
|
|
2011 | str, len |
|
|
2012 | |
|
|
2013 | void |
1984 | rxvt_term::tt_write (SV *octets) |
2014 | rxvt_term::tt_write (SV *octets) |
1985 | INIT: |
2015 | INIT: |
1986 | STRLEN len; |
2016 | STRLEN len; |
1987 | char *str = SvPVbyte (octets, len); |
2017 | char *str = SvPVbyte (octets, len); |
1988 | C_ARGS: |
2018 | C_ARGS: |