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.217 by sf-exg, Sat Nov 2 10:32:25 2013 UTC vs.
Revision 1.238 by sf-exg, Thu Jul 14 05:33:26 2016 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 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{
793 static const struct { 812 static const struct {
794 const char *name; 813 const char *name;
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 }
817 const_iv (HOOK_INIT),
818 const_iv (HOOK_DESTROY),
819 const_iv (HOOK_ACTION),
820
798 const_iv (NUM_RESOURCES), 821 const_iv (NUM_RESOURCES),
799 const_iv (DEFAULT_RSTYLE), 822 const_iv (DEFAULT_RSTYLE),
800 const_iv (OVERLAY_RSTYLE), 823 const_iv (OVERLAY_RSTYLE),
801 const_iv (Color_Bits), 824 const_iv (Color_Bits),
802 const_iv (RS_bgShift), const_iv (RS_bgMask), 825 const_iv (RS_bgShift), const_iv (RS_bgMask),
1004 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--)
1005 newCONSTSUB (stash, (char *)civ[-1].name, newSViv (civ[-1].iv)); 1028 newCONSTSUB (stash, (char *)civ[-1].name, newSViv (civ[-1].iv));
1006} 1029}
1007 1030
1008void 1031void
1009log (const char *msg) 1032log (utf8_string msg)
1010 CODE: 1033 CODE:
1011 rxvt_log ("%s", msg); 1034 rxvt_log ("%s", msg);
1012 1035
1013void 1036void
1014warn (const char *msg) 1037warn (utf8_string msg)
1015 CODE: 1038 CODE:
1016 rxvt_warn ("%s", msg); 1039 rxvt_warn ("%s", msg);
1017 1040
1018void 1041void
1019fatal (const char *msg) 1042fatal (utf8_string msg)
1020 CODE: 1043 CODE:
1021 rxvt_fatal ("%s", msg); 1044 rxvt_fatal ("%s", msg);
1022 1045
1023void 1046void
1024_exit (int status) 1047_exit (int status)
1189void 1212void
1190rxvt_term::put_option_db (octet_string specifier, octet_string value) 1213rxvt_term::put_option_db (octet_string specifier, octet_string value)
1191 CODE: 1214 CODE:
1192 XrmPutStringResource (&THIS->option_db, specifier, value); 1215 XrmPutStringResource (&THIS->option_db, specifier, value);
1193 1216
1217void
1218rxvt_term::_keysym_resources ()
1219 PPCODE:
1220 PUTBACK;
1221 _keysym_resources (THIS);
1222 SPAGAIN;
1223
1194int 1224int
1195rxvt_term::grab_button (int button, U32 modifiers, Window window = THIS->vt) 1225rxvt_term::grab_button (int button, U32 modifiers, Window window = THIS->vt)
1196 CODE: 1226 CODE:
1197 RETVAL = XGrabButton (THIS->dpy, button, modifiers, window, 1, 1227 RETVAL = XGrabButton (THIS->dpy, button, modifiers, window, 1,
1198 ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask, 1228 ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask,
1257rxvt_term::ungrab () 1287rxvt_term::ungrab ()
1258 CODE: 1288 CODE:
1259 ungrab (THIS); 1289 ungrab (THIS);
1260 1290
1261int 1291int
1262rxvt_term::XStringToKeysym (char *string) 1292rxvt_term::XStringToKeysym (octet_string string)
1263 CODE: 1293 CODE:
1264 RETVAL = XStringToKeysym (string); 1294 RETVAL = XStringToKeysym (string);
1265 OUTPUT: RETVAL 1295 OUTPUT: RETVAL
1266 1296
1267char * 1297char *
1277 OUTPUT: RETVAL 1307 OUTPUT: RETVAL
1278 1308
1279int 1309int
1280rxvt_term::XKeycodeToKeysym (int code, int index) 1310rxvt_term::XKeycodeToKeysym (int code, int index)
1281 CODE: 1311 CODE:
1282 RETVAL = XKeycodeToKeysym (THIS->dpy, code, index); 1312 RETVAL = rxvt_XKeycodeToKeysym (THIS->dpy, code, index);
1283 OUTPUT: RETVAL 1313 OUTPUT: RETVAL
1284 1314
1285int 1315int
1286rxvt_term::strwidth (SV *str) 1316rxvt_term::strwidth (SV *str)
1287 CODE: 1317 CODE:
1357#define TERM_OFFSET_saveLines TERM_OFFSET(saveLines) 1387#define TERM_OFFSET_saveLines TERM_OFFSET(saveLines)
1358#define TERM_OFFSET_total_rows TERM_OFFSET(total_rows) 1388#define TERM_OFFSET_total_rows TERM_OFFSET(total_rows)
1359#define TERM_OFFSET_top_row TERM_OFFSET(top_row) 1389#define TERM_OFFSET_top_row TERM_OFFSET(top_row)
1360 1390
1361int 1391int
1362rxvt_term::width () 1392rxvt_term::width (int new_value = NO_INIT)
1363 ALIAS: 1393 ALIAS:
1364 width = TERM_OFFSET_width 1394 width = TERM_OFFSET_width
1365 height = TERM_OFFSET_height 1395 height = TERM_OFFSET_height
1366 fwidth = TERM_OFFSET_fwidth 1396 fwidth = TERM_OFFSET_fwidth
1367 fheight = TERM_OFFSET_fheight 1397 fheight = TERM_OFFSET_fheight
1377 saveLines = TERM_OFFSET_saveLines 1407 saveLines = TERM_OFFSET_saveLines
1378 total_rows = TERM_OFFSET_total_rows 1408 total_rows = TERM_OFFSET_total_rows
1379 top_row = TERM_OFFSET_top_row 1409 top_row = TERM_OFFSET_top_row
1380 CODE: 1410 CODE:
1381 RETVAL = *(int *)((char *)THIS + ix); 1411 RETVAL = *(int *)((char *)THIS + ix);
1412 if (items > 1)
1413 *(int *)((char *)THIS + ix) = new_value;
1382 OUTPUT: 1414 OUTPUT:
1383 RETVAL 1415 RETVAL
1384 1416
1385unsigned int 1417unsigned int
1386rxvt_term::ModLevel3Mask () 1418rxvt_term::ModLevel3Mask ()
1544 CODE: 1576 CODE:
1545 THIS->want_refresh = 1; 1577 THIS->want_refresh = 1;
1546 THIS->refresh_check (); 1578 THIS->refresh_check ();
1547 1579
1548void 1580void
1581rxvt_term::refresh_check ()
1582
1583void
1549rxvt_term::ROW_t (int row_number, SV *new_text = 0, int start_col = 0, int start_ofs = 0, int max_len = MAX_COLS) 1584rxvt_term::ROW_t (int row_number, SV *new_text = 0, int start_col = 0, int start_ofs = 0, int max_len = MAX_COLS)
1550 PPCODE: 1585 PPCODE:
1551{ 1586{
1552 if (!IN_RANGE_EXC (row_number, THIS->top_row, THIS->nrow)) 1587 if (!IN_RANGE_EXC (row_number, THIS->top_row, THIS->nrow))
1553 XSRETURN_EMPTY; 1588 XSRETURN_EMPTY;
1696 *r++ = NOCHAR; 1731 *r++ = NOCHAR;
1697 } 1732 }
1698 1733
1699 rxvt_pop_locale (); 1734 rxvt_pop_locale ();
1700 1735
1736 free (wstr);
1701 RETVAL = wcs2sv (rstr, r - rstr); 1737 RETVAL = wcs2sv (rstr, r - rstr);
1702} 1738}
1703 OUTPUT: 1739 OUTPUT:
1704 RETVAL 1740 RETVAL
1705 1741
1729 else if (IS_COMPOSE (*s)) 1765 else if (IS_COMPOSE (*s))
1730 r += rxvt_composite.expand (*s, r); 1766 r += rxvt_composite.expand (*s, r);
1731 else 1767 else
1732 *r++ = *s; 1768 *r++ = *s;
1733 1769
1770 free (wstr);
1734 RETVAL = wcs2sv (rstr, r - rstr); 1771 RETVAL = wcs2sv (rstr, r - rstr);
1735} 1772}
1736 OUTPUT: 1773 OUTPUT:
1737 RETVAL 1774 RETVAL
1738 1775
1739void 1776void
1740rxvt_term::_resource (char *name, int index, SV *newval = 0) 1777rxvt_term::_resource (octet_string name, int index, SV *newval = 0)
1741 PPCODE: 1778 PPCODE:
1742{ 1779{
1743 static const struct resval { const char *name; int value; } *rs, rslist [] = { 1780 static const struct resval { const char *name; int value; } *rs, rslist [] = {
1744# define def(name) { # name, Rs_ ## name }, 1781# define def(name) { # name, Rs_ ## name },
1745# define reserve(name,count) 1782# define reserve(name,count)
1783 THIS->rs [index] = 0; 1820 THIS->rs [index] = 0;
1784 } 1821 }
1785} 1822}
1786 1823
1787const char * 1824const char *
1788rxvt_term::x_resource (const char *name) 1825rxvt_term::x_resource (octet_string name)
1789 1826
1790bool 1827bool
1791rxvt_term::option (U8 optval, int set = -1) 1828rxvt_term::option (U8 optval, int set = -1)
1792 CODE: 1829 CODE:
1793{ 1830{
1812 THIS->cursor_blink_reset (); 1849 THIS->cursor_blink_reset ();
1813 break; 1850 break;
1814#endif 1851#endif
1815 1852
1816 case Opt_cursorUnderline: 1853 case Opt_cursorUnderline:
1854 THIS->cursor_type = set ? 1 : 0;
1817 THIS->want_refresh = 1; 1855 THIS->want_refresh = 1;
1818 THIS->refresh_check (); 1856 THIS->refresh_check ();
1819 break; 1857 break;
1820 1858
1821# case Opt_scrollBar_floating: 1859# case Opt_scrollBar_floating:
1826 } 1864 }
1827} 1865}
1828 OUTPUT: 1866 OUTPUT:
1829 RETVAL 1867 RETVAL
1830 1868
1869SV *
1870rxvt_term::lookup_keysym (int keysym, unsigned int state)
1871 CODE:
1872{
1873 keysym_t *key = THIS->keyboard->lookup_keysym (THIS, keysym, state);
1874 RETVAL = key ? sv_2mortal (newSVpv (key->str, 0)) : &PL_sv_undef;
1875}
1876 OUTPUT:
1877 RETVAL
1878
1831bool 1879bool
1832rxvt_term::parse_keysym (char *keysym, char *str) 1880rxvt_term::bind_action (octet_string keysym, octet_string action)
1881 ALIAS:
1882 parse_keysym = 1
1833 CODE: 1883 CODE:
1834 RETVAL = 0 < THIS->parse_keysym (keysym, str); 1884 RETVAL = 0 < THIS->bind_action (keysym, action);
1835 THIS->keyboard->register_done (); 1885 THIS->keyboard->register_done ();
1836 OUTPUT: 1886 OUTPUT:
1837 RETVAL 1887 RETVAL
1838 1888
1839void 1889void
1840rxvt_term::register_command (int keysym, unsigned int state, SV *str) 1890rxvt_term::register_command (int keysym, unsigned int state, SV *str)
1841 CODE: 1891 CODE:
1842 wchar_t *wstr = sv2wcs (str); 1892 wchar_t *wstr = sv2wcs (str);
1843 THIS->keyboard->register_user_translation (keysym, state, wstr); 1893 THIS->keyboard->register_action (keysym, state, wstr);
1844 free (wstr); 1894 free (wstr);
1845 1895
1846void 1896void
1847rxvt_term::screen_cur (...) 1897rxvt_term::screen_cur (...)
1848 PROTOTYPE: $;$$ 1898 PROTOTYPE: $;$$
1960 2010
1961void 2011void
1962rxvt_term::scr_bell () 2012rxvt_term::scr_bell ()
1963 2013
1964void 2014void
1965rxvt_term::scr_recolour (bool refresh = true); 2015rxvt_term::scr_recolor (bool refresh = true);
1966 2016
1967void 2017void
1968rxvt_term::scr_change_screen (int screen) 2018rxvt_term::scr_change_screen (int screen)
1969 2019
1970void 2020void
1973{ 2023{
1974 wchar_t *wstr = sv2wcs (string); 2024 wchar_t *wstr = sv2wcs (string);
1975 THIS->scr_add_lines (wstr, wcslen (wstr)); 2025 THIS->scr_add_lines (wstr, wcslen (wstr));
1976 free (wstr); 2026 free (wstr);
1977} 2027}
2028
2029void
2030rxvt_term::tt_write_user_input (SV *octets)
2031 INIT:
2032 STRLEN len;
2033 char *str = SvPVbyte (octets, len);
2034 C_ARGS:
2035 str, len
1978 2036
1979void 2037void
1980rxvt_term::tt_write (SV *octets) 2038rxvt_term::tt_write (SV *octets)
1981 INIT: 2039 INIT:
1982 STRLEN len; 2040 STRLEN len;
2243 2301
2244 img->convert_format (XRenderFindVisualFormat (THIS->dpy, THIS->visual), THIS->pix_colors [Color_bg]) 2302 img->convert_format (XRenderFindVisualFormat (THIS->dpy, THIS->visual), THIS->pix_colors [Color_bg])
2245 ->replace (img); 2303 ->replace (img);
2246 2304
2247 THIS->bg_img = img; 2305 THIS->bg_img = img;
2248 THIS->bg_flags |= rxvt_term::BG_NEEDS_REFRESH | rxvt_term::BG_INHIBIT_RENDER; 2306 THIS->bg_flags |= rxvt_term::BG_NEEDS_REFRESH;
2249 2307
2250 if (!border) 2308 if (!border)
2251 THIS->bg_flags |= rxvt_term::BG_IS_TRANSPARENT; 2309 THIS->bg_flags |= rxvt_term::BG_IS_TRANSPARENT;
2252 } 2310 }
2253 2311

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines