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-2014,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 3 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. |
… | |
… | |
1027 | 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--) |
1028 | newCONSTSUB (stash, (char *)civ[-1].name, newSViv (civ[-1].iv)); |
1028 | newCONSTSUB (stash, (char *)civ[-1].name, newSViv (civ[-1].iv)); |
1029 | } |
1029 | } |
1030 | |
1030 | |
1031 | void |
1031 | void |
1032 | log (const char *msg) |
1032 | log (utf8_string msg) |
1033 | CODE: |
1033 | CODE: |
1034 | rxvt_log ("%s", msg); |
1034 | rxvt_log ("%s", msg); |
1035 | |
1035 | |
1036 | void |
1036 | void |
1037 | warn (const char *msg) |
1037 | warn (utf8_string msg) |
1038 | CODE: |
1038 | CODE: |
1039 | rxvt_warn ("%s", msg); |
1039 | rxvt_warn ("%s", msg); |
1040 | |
1040 | |
1041 | void |
1041 | void |
1042 | fatal (const char *msg) |
1042 | fatal (utf8_string msg) |
1043 | CODE: |
1043 | CODE: |
1044 | rxvt_fatal ("%s", msg); |
1044 | rxvt_fatal ("%s", msg); |
1045 | |
1045 | |
1046 | void |
1046 | void |
1047 | _exit (int status) |
1047 | _exit (int status) |
… | |
… | |
1287 | rxvt_term::ungrab () |
1287 | rxvt_term::ungrab () |
1288 | CODE: |
1288 | CODE: |
1289 | ungrab (THIS); |
1289 | ungrab (THIS); |
1290 | |
1290 | |
1291 | int |
1291 | int |
1292 | rxvt_term::XStringToKeysym (char *string) |
1292 | rxvt_term::XStringToKeysym (octet_string string) |
1293 | CODE: |
1293 | CODE: |
1294 | RETVAL = XStringToKeysym (string); |
1294 | RETVAL = XStringToKeysym (string); |
1295 | OUTPUT: RETVAL |
1295 | OUTPUT: RETVAL |
1296 | |
1296 | |
1297 | char * |
1297 | char * |
… | |
… | |
1307 | OUTPUT: RETVAL |
1307 | OUTPUT: RETVAL |
1308 | |
1308 | |
1309 | int |
1309 | int |
1310 | rxvt_term::XKeycodeToKeysym (int code, int index) |
1310 | rxvt_term::XKeycodeToKeysym (int code, int index) |
1311 | CODE: |
1311 | CODE: |
1312 | RETVAL = XKeycodeToKeysym (THIS->dpy, code, index); |
1312 | RETVAL = rxvt_XKeycodeToKeysym (THIS->dpy, code, index); |
1313 | OUTPUT: RETVAL |
1313 | OUTPUT: RETVAL |
1314 | |
1314 | |
1315 | int |
1315 | int |
1316 | rxvt_term::strwidth (SV *str) |
1316 | rxvt_term::strwidth (SV *str) |
1317 | CODE: |
1317 | CODE: |
… | |
… | |
1387 | #define TERM_OFFSET_saveLines TERM_OFFSET(saveLines) |
1387 | #define TERM_OFFSET_saveLines TERM_OFFSET(saveLines) |
1388 | #define TERM_OFFSET_total_rows TERM_OFFSET(total_rows) |
1388 | #define TERM_OFFSET_total_rows TERM_OFFSET(total_rows) |
1389 | #define TERM_OFFSET_top_row TERM_OFFSET(top_row) |
1389 | #define TERM_OFFSET_top_row TERM_OFFSET(top_row) |
1390 | |
1390 | |
1391 | int |
1391 | int |
1392 | rxvt_term::width () |
1392 | rxvt_term::width (int new_value = NO_INIT) |
1393 | ALIAS: |
1393 | ALIAS: |
1394 | width = TERM_OFFSET_width |
1394 | width = TERM_OFFSET_width |
1395 | height = TERM_OFFSET_height |
1395 | height = TERM_OFFSET_height |
1396 | fwidth = TERM_OFFSET_fwidth |
1396 | fwidth = TERM_OFFSET_fwidth |
1397 | fheight = TERM_OFFSET_fheight |
1397 | fheight = TERM_OFFSET_fheight |
… | |
… | |
1407 | saveLines = TERM_OFFSET_saveLines |
1407 | saveLines = TERM_OFFSET_saveLines |
1408 | total_rows = TERM_OFFSET_total_rows |
1408 | total_rows = TERM_OFFSET_total_rows |
1409 | top_row = TERM_OFFSET_top_row |
1409 | top_row = TERM_OFFSET_top_row |
1410 | CODE: |
1410 | CODE: |
1411 | RETVAL = *(int *)((char *)THIS + ix); |
1411 | RETVAL = *(int *)((char *)THIS + ix); |
|
|
1412 | if (items > 1) |
|
|
1413 | *(int *)((char *)THIS + ix) = new_value; |
1412 | OUTPUT: |
1414 | OUTPUT: |
1413 | RETVAL |
1415 | RETVAL |
1414 | |
1416 | |
1415 | unsigned int |
1417 | unsigned int |
1416 | rxvt_term::ModLevel3Mask () |
1418 | rxvt_term::ModLevel3Mask () |
… | |
… | |
1574 | CODE: |
1576 | CODE: |
1575 | THIS->want_refresh = 1; |
1577 | THIS->want_refresh = 1; |
1576 | THIS->refresh_check (); |
1578 | THIS->refresh_check (); |
1577 | |
1579 | |
1578 | void |
1580 | void |
|
|
1581 | rxvt_term::refresh_check () |
|
|
1582 | |
|
|
1583 | void |
1579 | rxvt_term::ROW_t (int row_number, SV *new_text = 0, int start_col = 0, int start_ofs = 0, int max_len = MAX_COLS) |
1584 | rxvt_term::ROW_t (int row_number, SV *new_text = 0, int start_col = 0, int start_ofs = 0, int max_len = MAX_COLS) |
1580 | PPCODE: |
1585 | PPCODE: |
1581 | { |
1586 | { |
1582 | if (!IN_RANGE_EXC (row_number, THIS->top_row, THIS->nrow)) |
1587 | if (!IN_RANGE_EXC (row_number, THIS->top_row, THIS->nrow)) |
1583 | XSRETURN_EMPTY; |
1588 | XSRETURN_EMPTY; |
… | |
… | |
1726 | *r++ = NOCHAR; |
1731 | *r++ = NOCHAR; |
1727 | } |
1732 | } |
1728 | |
1733 | |
1729 | rxvt_pop_locale (); |
1734 | rxvt_pop_locale (); |
1730 | |
1735 | |
|
|
1736 | free (wstr); |
1731 | RETVAL = wcs2sv (rstr, r - rstr); |
1737 | RETVAL = wcs2sv (rstr, r - rstr); |
1732 | } |
1738 | } |
1733 | OUTPUT: |
1739 | OUTPUT: |
1734 | RETVAL |
1740 | RETVAL |
1735 | |
1741 | |
… | |
… | |
1759 | else if (IS_COMPOSE (*s)) |
1765 | else if (IS_COMPOSE (*s)) |
1760 | r += rxvt_composite.expand (*s, r); |
1766 | r += rxvt_composite.expand (*s, r); |
1761 | else |
1767 | else |
1762 | *r++ = *s; |
1768 | *r++ = *s; |
1763 | |
1769 | |
|
|
1770 | free (wstr); |
1764 | RETVAL = wcs2sv (rstr, r - rstr); |
1771 | RETVAL = wcs2sv (rstr, r - rstr); |
1765 | } |
1772 | } |
1766 | OUTPUT: |
1773 | OUTPUT: |
1767 | RETVAL |
1774 | RETVAL |
1768 | |
1775 | |
1769 | void |
1776 | void |
1770 | rxvt_term::_resource (char *name, int index, SV *newval = 0) |
1777 | rxvt_term::_resource (octet_string name, int index, SV *newval = 0) |
1771 | PPCODE: |
1778 | PPCODE: |
1772 | { |
1779 | { |
1773 | static const struct resval { const char *name; int value; } *rs, rslist [] = { |
1780 | static const struct resval { const char *name; int value; } *rs, rslist [] = { |
1774 | # define def(name) { # name, Rs_ ## name }, |
1781 | # define def(name) { # name, Rs_ ## name }, |
1775 | # define reserve(name,count) |
1782 | # define reserve(name,count) |
… | |
… | |
1813 | THIS->rs [index] = 0; |
1820 | THIS->rs [index] = 0; |
1814 | } |
1821 | } |
1815 | } |
1822 | } |
1816 | |
1823 | |
1817 | const char * |
1824 | const char * |
1818 | rxvt_term::x_resource (const char *name) |
1825 | rxvt_term::x_resource (octet_string name) |
1819 | |
1826 | |
1820 | bool |
1827 | bool |
1821 | rxvt_term::option (U8 optval, int set = -1) |
1828 | rxvt_term::option (U8 optval, int set = -1) |
1822 | CODE: |
1829 | CODE: |
1823 | { |
1830 | { |
… | |
… | |
1857 | } |
1864 | } |
1858 | } |
1865 | } |
1859 | OUTPUT: |
1866 | OUTPUT: |
1860 | RETVAL |
1867 | RETVAL |
1861 | |
1868 | |
|
|
1869 | SV * |
|
|
1870 | rxvt_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 | |
1862 | bool |
1879 | bool |
1863 | rxvt_term::bind_action (char *keysym, char *str) |
1880 | rxvt_term::bind_action (octet_string keysym, octet_string action) |
1864 | ALIAS: |
1881 | ALIAS: |
1865 | parse_keysym = 1 |
1882 | parse_keysym = 1 |
1866 | CODE: |
1883 | CODE: |
1867 | RETVAL = 0 < THIS->bind_action (keysym, str); |
1884 | RETVAL = 0 < THIS->bind_action (keysym, action); |
1868 | THIS->keyboard->register_done (); |
1885 | THIS->keyboard->register_done (); |
1869 | OUTPUT: |
1886 | OUTPUT: |
1870 | RETVAL |
1887 | RETVAL |
|
|
1888 | |
|
|
1889 | void |
|
|
1890 | rxvt_term::register_command (int keysym, unsigned int state, SV *str) |
|
|
1891 | CODE: |
|
|
1892 | wchar_t *wstr = sv2wcs (str); |
|
|
1893 | THIS->keyboard->register_action (keysym, state, wstr); |
|
|
1894 | free (wstr); |
1871 | |
1895 | |
1872 | void |
1896 | void |
1873 | rxvt_term::screen_cur (...) |
1897 | rxvt_term::screen_cur (...) |
1874 | PROTOTYPE: $;$$ |
1898 | PROTOTYPE: $;$$ |
1875 | ALIAS: |
1899 | ALIAS: |
… | |
… | |
1986 | |
2010 | |
1987 | void |
2011 | void |
1988 | rxvt_term::scr_bell () |
2012 | rxvt_term::scr_bell () |
1989 | |
2013 | |
1990 | void |
2014 | void |
1991 | rxvt_term::scr_recolour (bool refresh = true); |
2015 | rxvt_term::scr_recolor (bool refresh = true); |
1992 | |
2016 | |
1993 | void |
2017 | void |
1994 | rxvt_term::scr_change_screen (int screen) |
2018 | rxvt_term::scr_change_screen (int screen) |
1995 | |
2019 | |
1996 | void |
2020 | void |
… | |
… | |
2277 | |
2301 | |
2278 | 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]) |
2279 | ->replace (img); |
2303 | ->replace (img); |
2280 | |
2304 | |
2281 | THIS->bg_img = img; |
2305 | THIS->bg_img = img; |
2282 | THIS->bg_flags |= rxvt_term::BG_NEEDS_REFRESH | rxvt_term::BG_INHIBIT_RENDER; |
2306 | THIS->bg_flags |= rxvt_term::BG_NEEDS_REFRESH; |
2283 | |
2307 | |
2284 | if (!border) |
2308 | if (!border) |
2285 | THIS->bg_flags |= rxvt_term::BG_IS_TRANSPARENT; |
2309 | THIS->bg_flags |= rxvt_term::BG_IS_TRANSPARENT; |
2286 | } |
2310 | } |
2287 | |
2311 | |