… | |
… | |
596 | setuv (root, xe->xmotion.root); |
596 | setuv (root, xe->xmotion.root); |
597 | setuv (subwindow, xe->xmotion.subwindow); |
597 | setuv (subwindow, xe->xmotion.subwindow); |
598 | setuv (time, xe->xmotion.time); |
598 | setuv (time, xe->xmotion.time); |
599 | setiv (x, xe->xmotion.x); |
599 | setiv (x, xe->xmotion.x); |
600 | setiv (y, xe->xmotion.y); |
600 | setiv (y, xe->xmotion.y); |
601 | setiv (row, xe->xmotion.y / term->fheight); |
601 | setiv (row, xe->xmotion.y / term->fheight + term->view_start); |
602 | setiv (col, xe->xmotion.x / term->fwidth); |
602 | setiv (col, xe->xmotion.x / term->fwidth); |
603 | setiv (x_root, xe->xmotion.x_root); |
603 | setiv (x_root, xe->xmotion.x_root); |
604 | setiv (y_root, xe->xmotion.y_root); |
604 | setiv (y_root, xe->xmotion.y_root); |
605 | setuv (state, xe->xmotion.state); |
605 | setuv (state, xe->xmotion.state); |
606 | |
606 | |
… | |
… | |
640 | break; |
640 | break; |
641 | } |
641 | } |
642 | |
642 | |
643 | break; |
643 | break; |
644 | |
644 | |
|
|
645 | case PropertyNotify: |
|
|
646 | setuv (window, xe->xproperty.window); |
|
|
647 | setuv (atom, xe->xproperty.atom); |
|
|
648 | setuv (time, xe->xproperty.time); |
|
|
649 | setiv (state, xe->xproperty.state); |
|
|
650 | break; |
|
|
651 | |
645 | case ClientMessage: |
652 | case ClientMessage: |
646 | setuv (window, xe->xclient.window); |
653 | setuv (window, xe->xclient.window); |
647 | setuv (message_type, xe->xclient.message_type); |
654 | setuv (message_type, xe->xclient.message_type); |
648 | setuv (format, xe->xclient.format); |
655 | setuv (format, xe->xclient.format); |
649 | setuv (l0, xe->xclient.data.l[0]); |
656 | setuv (l0, xe->xclient.data.l[0]); |
650 | setuv (l1, xe->xclient.data.l[1]); |
657 | setuv (l1, xe->xclient.data.l[1]); |
651 | setuv (l2, xe->xclient.data.l[2]); |
658 | setuv (l2, xe->xclient.data.l[2]); |
652 | setuv (l3, xe->xclient.data.l[3]); |
659 | setuv (l3, xe->xclient.data.l[3]); |
653 | setuv (l4, xe->xclient.data.l[4]); |
660 | setuv (l4, xe->xclient.data.l[4]); |
|
|
661 | break; |
654 | } |
662 | } |
655 | |
663 | |
656 | XPUSHs (sv_2mortal (newRV_noinc ((SV *)hv))); |
664 | XPUSHs (sv_2mortal (newRV_noinc ((SV *)hv))); |
657 | } |
665 | } |
658 | break; |
666 | break; |
… | |
… | |
920 | if (items < 1 || !SvROK (ST (0)) || SvTYPE (SvRV (ST (0))) != SVt_PVAV) |
928 | if (items < 1 || !SvROK (ST (0)) || SvTYPE (SvRV (ST (0))) != SVt_PVAV) |
921 | croak ("first argument to urxvt::term->_new must be arrayref"); |
929 | croak ("first argument to urxvt::term->_new must be arrayref"); |
922 | |
930 | |
923 | rxvt_term *term = new rxvt_term; |
931 | rxvt_term *term = new rxvt_term; |
924 | |
932 | |
925 | term->argv = new stringvec; |
933 | stringvec *argv = new stringvec; |
926 | term->envv = new stringvec; |
934 | stringvec *envv = new stringvec; |
927 | |
935 | |
928 | for (int i = 1; i < items; i++) |
936 | for (int i = 1; i < items; i++) |
929 | term->argv->push_back (strdup (SvPVbyte_nolen (ST (i)))); |
937 | argv->push_back (strdup (SvPVbyte_nolen (ST (i)))); |
930 | |
938 | |
931 | AV *envv = (AV *)SvRV (ST (0)); |
939 | AV *env = (AV *)SvRV (ST (0)); |
932 | for (int i = AvFILL (envv) + 1; i--; ) |
940 | for (int i = AvFILL (env) + 1; i--; ) |
933 | term->envv->push_back (strdup (SvPVbyte_nolen (*av_fetch (envv, i, 1)))); |
941 | envv->push_back (strdup (SvPVbyte_nolen (*av_fetch (env, i, 1)))); |
934 | |
942 | |
935 | term->envv->push_back (0); |
943 | envv->push_back (0); |
936 | |
944 | |
937 | bool success; |
945 | bool success; |
938 | |
946 | |
939 | try |
947 | try |
940 | { |
948 | { |
941 | success = term->init (term->argv->size (), term->argv->begin ()); |
949 | success = term->init (argv, envv); |
942 | } |
950 | } |
943 | catch (const class rxvt_failure_exception &e) |
951 | catch (const class rxvt_failure_exception &e) |
944 | { |
952 | { |
945 | success = false; |
953 | success = false; |
946 | } |
954 | } |
… | |
… | |
1109 | rxvt_term::ModLevel3Mask () |
1117 | rxvt_term::ModLevel3Mask () |
1110 | ALIAS: |
1118 | ALIAS: |
1111 | ModLevel3Mask = 0 |
1119 | ModLevel3Mask = 0 |
1112 | ModMetaMask = 1 |
1120 | ModMetaMask = 1 |
1113 | ModNumLockMask = 2 |
1121 | ModNumLockMask = 2 |
|
|
1122 | current_screen = 3 |
|
|
1123 | hidden_cursor = 4 |
1114 | CODE: |
1124 | CODE: |
1115 | switch (ix) |
1125 | switch (ix) |
1116 | { |
1126 | { |
1117 | case 0: RETVAL = THIS->ModLevel3Mask; break; |
1127 | case 0: RETVAL = THIS->ModLevel3Mask; break; |
1118 | case 1: RETVAL = THIS->ModMetaMask; break; |
1128 | case 1: RETVAL = THIS->ModMetaMask; break; |
1119 | case 2: RETVAL = THIS->ModNumLockMask; break; |
1129 | case 2: RETVAL = THIS->ModNumLockMask; break; |
|
|
1130 | case 3: RETVAL = THIS->current_screen; break; |
|
|
1131 | case 4: RETVAL = THIS->hidden_cursor; break; |
1120 | } |
1132 | } |
1121 | OUTPUT: |
1133 | OUTPUT: |
1122 | RETVAL |
1134 | RETVAL |
1123 | |
1135 | |
1124 | char * |
1136 | char * |
… | |
… | |
1204 | } |
1216 | } |
1205 | OUTPUT: |
1217 | OUTPUT: |
1206 | RETVAL |
1218 | RETVAL |
1207 | |
1219 | |
1208 | void |
1220 | void |
|
|
1221 | rxvt_term::focus_in () |
|
|
1222 | |
|
|
1223 | void |
|
|
1224 | rxvt_term::focus_out () |
|
|
1225 | |
|
|
1226 | void |
1209 | rxvt_term::want_refresh () |
1227 | rxvt_term::want_refresh () |
1210 | CODE: |
1228 | CODE: |
1211 | THIS->want_refresh = 1; |
1229 | THIS->want_refresh = 1; |
1212 | |
1230 | |
1213 | void |
1231 | void |
… | |
… | |
1235 | { |
1253 | { |
1236 | wchar_t *wstr = sv2wcs (new_text); |
1254 | wchar_t *wstr = sv2wcs (new_text); |
1237 | |
1255 | |
1238 | int len = min (wcslen (wstr) - start_ofs, max_len); |
1256 | int len = min (wcslen (wstr) - start_ofs, max_len); |
1239 | |
1257 | |
1240 | if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len)) |
1258 | if (start_col < 0 || start_col + len > THIS->ncol) |
1241 | { |
1259 | { |
1242 | free (wstr); |
1260 | free (wstr); |
1243 | croak ("new_text extends beyond horizontal margins"); |
1261 | croak ("new_text extends beyond horizontal margins"); |
1244 | } |
1262 | } |
1245 | |
1263 | |
… | |
… | |
1279 | croak ("new_rend must be arrayref"); |
1297 | croak ("new_rend must be arrayref"); |
1280 | |
1298 | |
1281 | AV *av = (AV *)SvRV (new_rend); |
1299 | AV *av = (AV *)SvRV (new_rend); |
1282 | int len = min (AvFILL (av) + 1 - start_ofs, max_len); |
1300 | int len = min (AvFILL (av) + 1 - start_ofs, max_len); |
1283 | |
1301 | |
1284 | if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len)) |
1302 | if (start_col < 0 || start_col + len > THIS->ncol) |
1285 | croak ("new_rend array extends beyond horizontal margins"); |
1303 | croak ("new_rend array extends beyond horizontal margins"); |
1286 | |
1304 | |
1287 | for (int col = start_col; col < start_col + len; col++) |
1305 | for (int col = start_col; col < start_col + len; col++) |
1288 | { |
1306 | { |
1289 | rend_t r = SvIV (*av_fetch (av, start_ofs + col - start_col, 1)) & ~RS_fontMask; |
1307 | rend_t r = SvIV (*av_fetch (av, start_ofs + col - start_col, 1)) & ~RS_fontMask; |
… | |
… | |
1513 | if (items == 3) |
1531 | if (items == 3) |
1514 | { |
1532 | { |
1515 | rc.row = SvIV (ST (1)); |
1533 | rc.row = SvIV (ST (1)); |
1516 | rc.col = SvIV (ST (2)); |
1534 | rc.col = SvIV (ST (2)); |
1517 | |
1535 | |
1518 | if (ix == 2 && rc.col == 0) |
1536 | if (ix == 2) |
1519 | { |
1537 | { |
|
|
1538 | if (rc.col == 0) |
|
|
1539 | { |
|
|
1540 | // col == 0 means end of previous line |
1520 | rc.row--; |
1541 | rc.row--; |
1521 | rc.col = THIS->ncol; |
1542 | rc.col = THIS->ncol; |
|
|
1543 | } |
|
|
1544 | else if (IN_RANGE_EXC (rc.row, THIS->top_row, THIS->nrow) |
|
|
1545 | && rc.col > ROW(rc.row).l) |
|
|
1546 | { |
|
|
1547 | // col >= length means while line and add newline |
|
|
1548 | rc.col = THIS->ncol; |
|
|
1549 | } |
1522 | } |
1550 | } |
1523 | |
1551 | |
1524 | clamp_it (rc.col, 0, THIS->ncol); |
1552 | clamp_it (rc.col, 0, THIS->ncol); |
1525 | clamp_it (rc.row, THIS->top_row, THIS->nrow - 1); |
1553 | clamp_it (rc.row, THIS->top_row, THIS->nrow - 1); |
1526 | |
1554 | |
… | |
… | |
1573 | void |
1601 | void |
1574 | rxvt_term::scr_xor_span (int beg_row, int beg_col, int end_row, int end_col, U32 rstyle = RS_RVid) |
1602 | rxvt_term::scr_xor_span (int beg_row, int beg_col, int end_row, int end_col, U32 rstyle = RS_RVid) |
1575 | |
1603 | |
1576 | void |
1604 | void |
1577 | rxvt_term::scr_bell () |
1605 | rxvt_term::scr_bell () |
|
|
1606 | |
|
|
1607 | void |
|
|
1608 | rxvt_term::scr_change_screen (int screen) |
1578 | |
1609 | |
1579 | void |
1610 | void |
1580 | rxvt_term::scr_add_lines (SV *string) |
1611 | rxvt_term::scr_add_lines (SV *string) |
1581 | CODE: |
1612 | CODE: |
1582 | { |
1613 | { |
… | |
… | |
1650 | Atom type; |
1681 | Atom type; |
1651 | int format; |
1682 | int format; |
1652 | unsigned long nitems; |
1683 | unsigned long nitems; |
1653 | unsigned long bytes_after; |
1684 | unsigned long bytes_after; |
1654 | unsigned char *prop; |
1685 | unsigned char *prop; |
|
|
1686 | |
1655 | XGetWindowProperty (THIS->display->display, window, property, |
1687 | XGetWindowProperty (THIS->display->display, window, property, |
1656 | 0, 1<<30, 0, AnyPropertyType, |
1688 | 0, 1<<24, 0, AnyPropertyType, |
1657 | &type, &format, &nitems, &bytes_after, &prop); |
1689 | &type, &format, &nitems, &bytes_after, &prop); |
|
|
1690 | |
1658 | if (type != None) |
1691 | if (type != None) |
1659 | { |
1692 | { |
|
|
1693 | int elemsize = format == 16 ? sizeof (short) |
|
|
1694 | : format == 32 ? sizeof (long) |
|
|
1695 | : 1; |
|
|
1696 | |
1660 | EXTEND (SP, 3); |
1697 | EXTEND (SP, 3); |
1661 | PUSHs (newSVuv ((U32)type)); |
1698 | PUSHs (newSVuv ((U32)type)); |
1662 | PUSHs (newSViv (format)); |
1699 | PUSHs (newSViv (format)); |
1663 | PUSHs (newSVpvn ((char *)prop, nitems * format / 8)); |
1700 | PUSHs (newSVpvn ((char *)prop, nitems * elemsize)); |
1664 | XFree (prop); |
1701 | XFree (prop); |
1665 | } |
1702 | } |
1666 | } |
1703 | } |
1667 | |
1704 | |
1668 | void |
1705 | void |
… | |
… | |
1670 | CODE: |
1707 | CODE: |
1671 | { |
1708 | { |
1672 | STRLEN len; |
1709 | STRLEN len; |
1673 | char *data_ = SvPVbyte (data, len); |
1710 | char *data_ = SvPVbyte (data, len); |
1674 | |
1711 | |
|
|
1712 | int elemsize = format == 16 ? sizeof (short) |
|
|
1713 | : format == 32 ? sizeof (long) |
|
|
1714 | : 1; |
|
|
1715 | |
1675 | XChangeProperty (THIS->display->display, window, property, |
1716 | XChangeProperty (THIS->display->display, window, property, |
1676 | type, format, PropModeReplace, |
1717 | type, format, PropModeReplace, |
1677 | (unsigned char *)data, len * 8 / format); |
1718 | (unsigned char *)data_, len / elemsize); |
|
|
1719 | XSync (THIS->display->display, 0); |
1678 | } |
1720 | } |
|
|
1721 | |
|
|
1722 | Atom |
|
|
1723 | XInternAtom (rxvt_term *term, char *atom_name, int only_if_exists = FALSE) |
|
|
1724 | C_ARGS: term->display->display, atom_name, only_if_exists |
|
|
1725 | |
|
|
1726 | char * |
|
|
1727 | XGetAtomName (rxvt_term *term, Atom atom) |
|
|
1728 | C_ARGS: term->display->display, atom |
|
|
1729 | CLEANUP: |
|
|
1730 | XFree (RETVAL); |
1679 | |
1731 | |
1680 | void |
1732 | void |
1681 | XDeleteProperty (rxvt_term *term, Window window, Atom property) |
1733 | XDeleteProperty (rxvt_term *term, Window window, Atom property) |
1682 | C_ARGS: term->display->display, window, property |
1734 | C_ARGS: term->display->display, window, property |
1683 | |
1735 | |
… | |
… | |
1685 | rxvt_term::DefaultRootWindow () |
1737 | rxvt_term::DefaultRootWindow () |
1686 | CODE: |
1738 | CODE: |
1687 | RETVAL = THIS->display->root; |
1739 | RETVAL = THIS->display->root; |
1688 | OUTPUT: |
1740 | OUTPUT: |
1689 | RETVAL |
1741 | RETVAL |
|
|
1742 | |
|
|
1743 | #if 0 |
1690 | |
1744 | |
1691 | Window |
1745 | Window |
1692 | XCreateSimpleWindow (rxvt_term *term, Window parent, int x, int y, unsigned int width, unsigned int height) |
1746 | XCreateSimpleWindow (rxvt_term *term, Window parent, int x, int y, unsigned int width, unsigned int height) |
1693 | C_ARGS: term->display->display, (Window)parent, |
1747 | C_ARGS: term->display->display, (Window)parent, |
1694 | x, y, width, height, 0, |
1748 | x, y, width, height, 0, |
1695 | term->pix_colors_focused[Color_border], |
1749 | term->pix_colors_focused[Color_border], |
1696 | term->pix_colors_focused[Color_border] |
1750 | term->pix_colors_focused[Color_border] |
1697 | |
1751 | |
|
|
1752 | #endif |
|
|
1753 | |
1698 | void |
1754 | void |
1699 | XReparentWindow (rxvt_term *term, Window window, Window parent, int x = 0, int y = 0) |
1755 | XReparentWindow (rxvt_term *term, Window window, Window parent, int x = 0, int y = 0) |
1700 | C_ARGS: term->display->display, window, parent, x, y |
1756 | C_ARGS: term->display->display, window, parent, x, y |
1701 | |
1757 | |
1702 | void |
1758 | void |
… | |
… | |
1707 | XUnmapWindow (rxvt_term *term, Window window) |
1763 | XUnmapWindow (rxvt_term *term, Window window) |
1708 | C_ARGS: term->display->display, window |
1764 | C_ARGS: term->display->display, window |
1709 | |
1765 | |
1710 | void |
1766 | void |
1711 | XMoveResizeWindow (rxvt_term *term, Window window, int x, int y, unsigned int width, unsigned int height) |
1767 | XMoveResizeWindow (rxvt_term *term, Window window, int x, int y, unsigned int width, unsigned int height) |
1712 | C_ARGS: term->display->display, (Window)window, x, y, width, height |
1768 | C_ARGS: term->display->display, window, x, y, width, height |
|
|
1769 | |
|
|
1770 | void |
|
|
1771 | rxvt_term::XChangeInput (Window window, U32 add_events, U32 del_events = 0) |
|
|
1772 | CODE: |
|
|
1773 | { |
|
|
1774 | XWindowAttributes attr; |
|
|
1775 | XGetWindowAttributes (THIS->display->display, window, &attr); |
|
|
1776 | XSelectInput (THIS->display->display, window, attr.your_event_mask | add_events & ~del_events); |
|
|
1777 | } |
|
|
1778 | |
|
|
1779 | void |
|
|
1780 | rxvt_term::XTranslateCoordinates (Window src, Window dst, int x, int y) |
|
|
1781 | PPCODE: |
|
|
1782 | { |
|
|
1783 | int dx, dy; |
|
|
1784 | Window child; |
|
|
1785 | |
|
|
1786 | if (XTranslateCoordinates (THIS->display->display, src, dst, x, y, &dx, &dy, &child)) |
|
|
1787 | { |
|
|
1788 | EXTEND (SP, 3); |
|
|
1789 | PUSHs (newSViv (dx)); |
|
|
1790 | PUSHs (newSViv (dy)); |
|
|
1791 | PUSHs (newSVuv (child)); |
|
|
1792 | } |
|
|
1793 | } |
1713 | |
1794 | |
1714 | ############################################################################# |
1795 | ############################################################################# |
1715 | # urxvt::overlay |
1796 | # urxvt::overlay |
1716 | ############################################################################# |
1797 | ############################################################################# |
1717 | |
1798 | |