ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/rxvtperl.xs
(Generate patch)

Comparing rxvt-unicode/src/rxvtperl.xs (file contents):
Revision 1.218 by root, Sat Apr 26 20:51:12 2014 UTC vs.
Revision 1.232 by root, Sat Dec 27 18:57:34 2014 UTC

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
497static 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
510static void
511_keysym_resources (rxvt_term *term)
512{
513 term->enumerate_keysym_resources (_keysym_resource_push);
495} 514}
496 515
497static void 516static void
498ungrab (rxvt_term *THIS) 517ungrab (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),
1008 for (civ = const_iv + ecb_array_length (const_iv); civ > const_iv; civ--) 1027 for (civ = const_iv + ecb_array_length (const_iv); civ > const_iv; civ--)
1009 newCONSTSUB (stash, (char *)civ[-1].name, newSViv (civ[-1].iv)); 1028 newCONSTSUB (stash, (char *)civ[-1].name, newSViv (civ[-1].iv));
1010} 1029}
1011 1030
1012void 1031void
1013log (const char *msg) 1032log (utf8_string msg)
1014 CODE: 1033 CODE:
1015 rxvt_log ("%s", msg); 1034 rxvt_log ("%s", msg);
1016 1035
1017void 1036void
1018warn (const char *msg) 1037warn (utf8_string msg)
1019 CODE: 1038 CODE:
1020 rxvt_warn ("%s", msg); 1039 rxvt_warn ("%s", msg);
1021 1040
1022void 1041void
1023fatal (const char *msg) 1042fatal (utf8_string msg)
1024 CODE: 1043 CODE:
1025 rxvt_fatal ("%s", msg); 1044 rxvt_fatal ("%s", msg);
1026 1045
1027void 1046void
1028_exit (int status) 1047_exit (int status)
1193void 1212void
1194rxvt_term::put_option_db (octet_string specifier, octet_string value) 1213rxvt_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
1217void
1218rxvt_term::_keysym_resources ()
1219 PPCODE:
1220 PUTBACK;
1221 _keysym_resources (THIS);
1222 SPAGAIN;
1223
1198int 1224int
1199rxvt_term::grab_button (int button, U32 modifiers, Window window = THIS->vt) 1225rxvt_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,
1261rxvt_term::ungrab () 1287rxvt_term::ungrab ()
1262 CODE: 1288 CODE:
1263 ungrab (THIS); 1289 ungrab (THIS);
1264 1290
1265int 1291int
1266rxvt_term::XStringToKeysym (char *string) 1292rxvt_term::XStringToKeysym (octet_string string)
1267 CODE: 1293 CODE:
1268 RETVAL = XStringToKeysym (string); 1294 RETVAL = XStringToKeysym (string);
1269 OUTPUT: RETVAL 1295 OUTPUT: RETVAL
1270 1296
1271char * 1297char *
1281 OUTPUT: RETVAL 1307 OUTPUT: RETVAL
1282 1308
1283int 1309int
1284rxvt_term::XKeycodeToKeysym (int code, int index) 1310rxvt_term::XKeycodeToKeysym (int code, int index)
1285 CODE: 1311 CODE:
1286 RETVAL = XKeycodeToKeysym (THIS->dpy, code, index); 1312 RETVAL = rxvt_XKeycodeToKeysym (THIS->dpy, code, index);
1287 OUTPUT: RETVAL 1313 OUTPUT: RETVAL
1288 1314
1289int 1315int
1290rxvt_term::strwidth (SV *str) 1316rxvt_term::strwidth (SV *str)
1291 CODE: 1317 CODE:
1700 *r++ = NOCHAR; 1726 *r++ = NOCHAR;
1701 } 1727 }
1702 1728
1703 rxvt_pop_locale (); 1729 rxvt_pop_locale ();
1704 1730
1731 free (wstr);
1705 RETVAL = wcs2sv (rstr, r - rstr); 1732 RETVAL = wcs2sv (rstr, r - rstr);
1706} 1733}
1707 OUTPUT: 1734 OUTPUT:
1708 RETVAL 1735 RETVAL
1709 1736
1733 else if (IS_COMPOSE (*s)) 1760 else if (IS_COMPOSE (*s))
1734 r += rxvt_composite.expand (*s, r); 1761 r += rxvt_composite.expand (*s, r);
1735 else 1762 else
1736 *r++ = *s; 1763 *r++ = *s;
1737 1764
1765 free (wstr);
1738 RETVAL = wcs2sv (rstr, r - rstr); 1766 RETVAL = wcs2sv (rstr, r - rstr);
1739} 1767}
1740 OUTPUT: 1768 OUTPUT:
1741 RETVAL 1769 RETVAL
1742 1770
1743void 1771void
1744rxvt_term::_resource (char *name, int index, SV *newval = 0) 1772rxvt_term::_resource (octet_string name, int index, SV *newval = 0)
1745 PPCODE: 1773 PPCODE:
1746{ 1774{
1747 static const struct resval { const char *name; int value; } *rs, rslist [] = { 1775 static const struct resval { const char *name; int value; } *rs, rslist [] = {
1748# define def(name) { # name, Rs_ ## name }, 1776# define def(name) { # name, Rs_ ## name },
1749# define reserve(name,count) 1777# define reserve(name,count)
1787 THIS->rs [index] = 0; 1815 THIS->rs [index] = 0;
1788 } 1816 }
1789} 1817}
1790 1818
1791const char * 1819const char *
1792rxvt_term::x_resource (const char *name) 1820rxvt_term::x_resource (octet_string name)
1793 1821
1794bool 1822bool
1795rxvt_term::option (U8 optval, int set = -1) 1823rxvt_term::option (U8 optval, int set = -1)
1796 CODE: 1824 CODE:
1797{ 1825{
1816 THIS->cursor_blink_reset (); 1844 THIS->cursor_blink_reset ();
1817 break; 1845 break;
1818#endif 1846#endif
1819 1847
1820 case Opt_cursorUnderline: 1848 case Opt_cursorUnderline:
1849 THIS->cursor_type = set ? 1 : 0;
1821 THIS->want_refresh = 1; 1850 THIS->want_refresh = 1;
1822 THIS->refresh_check (); 1851 THIS->refresh_check ();
1823 break; 1852 break;
1824 1853
1825# case Opt_scrollBar_floating: 1854# case Opt_scrollBar_floating:
1831} 1860}
1832 OUTPUT: 1861 OUTPUT:
1833 RETVAL 1862 RETVAL
1834 1863
1835bool 1864bool
1836rxvt_term::parse_keysym (char *keysym, char *str) 1865rxvt_term::bind_action (octet_string keysym, utf8_string action)
1866 ALIAS:
1867 parse_keysym = 1
1837 CODE: 1868 CODE:
1838 RETVAL = 0 < THIS->parse_keysym (keysym, str); 1869 RETVAL = 0 < THIS->bind_action (keysym, action);
1839 THIS->keyboard->register_done (); 1870 THIS->keyboard->register_done ();
1840 OUTPUT: 1871 OUTPUT:
1841 RETVAL 1872 RETVAL
1842 1873
1843void 1874void
1844rxvt_term::register_command (int keysym, unsigned int state, SV *str) 1875rxvt_term::register_command (int keysym, unsigned int state, SV *str)
1845 CODE: 1876 CODE:
1846 wchar_t *wstr = sv2wcs (str); 1877 wchar_t *wstr = sv2wcs (str);
1847 THIS->keyboard->register_user_translation (keysym, state, wstr); 1878 THIS->keyboard->register_action (keysym, state, wstr);
1848 free (wstr); 1879 free (wstr);
1849 1880
1850void 1881void
1851rxvt_term::screen_cur (...) 1882rxvt_term::screen_cur (...)
1852 PROTOTYPE: $;$$ 1883 PROTOTYPE: $;$$
1964 1995
1965void 1996void
1966rxvt_term::scr_bell () 1997rxvt_term::scr_bell ()
1967 1998
1968void 1999void
1969rxvt_term::scr_recolour (bool refresh = true); 2000rxvt_term::scr_recolor (bool refresh = true);
1970 2001
1971void 2002void
1972rxvt_term::scr_change_screen (int screen) 2003rxvt_term::scr_change_screen (int screen)
1973 2004
1974void 2005void
1977{ 2008{
1978 wchar_t *wstr = sv2wcs (string); 2009 wchar_t *wstr = sv2wcs (string);
1979 THIS->scr_add_lines (wstr, wcslen (wstr)); 2010 THIS->scr_add_lines (wstr, wcslen (wstr));
1980 free (wstr); 2011 free (wstr);
1981} 2012}
2013
2014void
2015rxvt_term::tt_write_user_input (SV *octets)
2016 INIT:
2017 STRLEN len;
2018 char *str = SvPVbyte (octets, len);
2019 C_ARGS:
2020 str, len
1982 2021
1983void 2022void
1984rxvt_term::tt_write (SV *octets) 2023rxvt_term::tt_write (SV *octets)
1985 INIT: 2024 INIT:
1986 STRLEN len; 2025 STRLEN len;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines