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.80 by root, Fri Jan 20 12:16:28 2006 UTC vs.
Revision 1.88 by root, Sun Jan 22 00:36:59 2006 UTC

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 }
1109rxvt_term::ModLevel3Mask () 1117rxvt_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
1124char * 1136char *
1204} 1216}
1205 OUTPUT: 1217 OUTPUT:
1206 RETVAL 1218 RETVAL
1207 1219
1208void 1220void
1221rxvt_term::focus_in ()
1222
1223void
1224rxvt_term::focus_out ()
1225
1226void
1209rxvt_term::want_refresh () 1227rxvt_term::want_refresh ()
1210 CODE: 1228 CODE:
1211 THIS->want_refresh = 1; 1229 THIS->want_refresh = 1;
1212 1230
1213void 1231void
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;
1575 1593
1576void 1594void
1577rxvt_term::scr_bell () 1595rxvt_term::scr_bell ()
1578 1596
1579void 1597void
1598rxvt_term::scr_change_screen (int screen)
1599
1600void
1580rxvt_term::scr_add_lines (SV *string) 1601rxvt_term::scr_add_lines (SV *string)
1581 CODE: 1602 CODE:
1582{ 1603{
1583 wchar_t *wstr = sv2wcs (string); 1604 wchar_t *wstr = sv2wcs (string);
1584 THIS->scr_add_lines (wstr, wcslen (wstr)); 1605 THIS->scr_add_lines (wstr, wcslen (wstr));
1650 Atom type; 1671 Atom type;
1651 int format; 1672 int format;
1652 unsigned long nitems; 1673 unsigned long nitems;
1653 unsigned long bytes_after; 1674 unsigned long bytes_after;
1654 unsigned char *prop; 1675 unsigned char *prop;
1676
1655 XGetWindowProperty (THIS->display->display, window, property, 1677 XGetWindowProperty (THIS->display->display, window, property,
1656 0, 1<<30, 0, AnyPropertyType, 1678 0, 1<<24, 0, AnyPropertyType,
1657 &type, &format, &nitems, &bytes_after, &prop); 1679 &type, &format, &nitems, &bytes_after, &prop);
1680
1658 if (type != None) 1681 if (type != None)
1659 { 1682 {
1683 int elemsize = format == 16 ? sizeof (short)
1684 : format == 32 ? sizeof (long)
1685 : 1;
1686
1660 EXTEND (SP, 3); 1687 EXTEND (SP, 3);
1661 PUSHs (newSVuv ((U32)type)); 1688 PUSHs (newSVuv ((U32)type));
1662 PUSHs (newSViv (format)); 1689 PUSHs (newSViv (format));
1663 PUSHs (newSVpvn ((char *)prop, nitems * format / 8)); 1690 PUSHs (newSVpvn ((char *)prop, nitems * elemsize));
1664 XFree (prop); 1691 XFree (prop);
1665 } 1692 }
1666} 1693}
1667 1694
1668void 1695void
1670 CODE: 1697 CODE:
1671{ 1698{
1672 STRLEN len; 1699 STRLEN len;
1673 char *data_ = SvPVbyte (data, len); 1700 char *data_ = SvPVbyte (data, len);
1674 1701
1702 int elemsize = format == 16 ? sizeof (short)
1703 : format == 32 ? sizeof (long)
1704 : 1;
1705
1675 XChangeProperty (THIS->display->display, window, property, 1706 XChangeProperty (THIS->display->display, window, property,
1676 type, format, PropModeReplace, 1707 type, format, PropModeReplace,
1677 (unsigned char *)data, len * 8 / format); 1708 (unsigned char *)data_, len / elemsize);
1709 XSync (THIS->display->display, 0);
1678} 1710}
1711
1712Atom
1713XInternAtom (rxvt_term *term, char *atom_name, int only_if_exists = FALSE)
1714 C_ARGS: term->display->display, atom_name, only_if_exists
1715
1716char *
1717XGetAtomName (rxvt_term *term, Atom atom)
1718 C_ARGS: term->display->display, atom
1719 CLEANUP:
1720 XFree (RETVAL);
1679 1721
1680void 1722void
1681XDeleteProperty (rxvt_term *term, Window window, Atom property) 1723XDeleteProperty (rxvt_term *term, Window window, Atom property)
1682 C_ARGS: term->display->display, window, property 1724 C_ARGS: term->display->display, window, property
1683 1725
1685rxvt_term::DefaultRootWindow () 1727rxvt_term::DefaultRootWindow ()
1686 CODE: 1728 CODE:
1687 RETVAL = THIS->display->root; 1729 RETVAL = THIS->display->root;
1688 OUTPUT: 1730 OUTPUT:
1689 RETVAL 1731 RETVAL
1732
1733#if 0
1690 1734
1691Window 1735Window
1692XCreateSimpleWindow (rxvt_term *term, Window parent, int x, int y, unsigned int width, unsigned int height) 1736XCreateSimpleWindow (rxvt_term *term, Window parent, int x, int y, unsigned int width, unsigned int height)
1693 C_ARGS: term->display->display, (Window)parent, 1737 C_ARGS: term->display->display, (Window)parent,
1694 x, y, width, height, 0, 1738 x, y, width, height, 0,
1695 term->pix_colors_focused[Color_border], 1739 term->pix_colors_focused[Color_border],
1696 term->pix_colors_focused[Color_border] 1740 term->pix_colors_focused[Color_border]
1697 1741
1742#endif
1743
1698void 1744void
1699XReparentWindow (rxvt_term *term, Window window, Window parent, int x = 0, int y = 0) 1745XReparentWindow (rxvt_term *term, Window window, Window parent, int x = 0, int y = 0)
1700 C_ARGS: term->display->display, window, parent, x, y 1746 C_ARGS: term->display->display, window, parent, x, y
1701 1747
1702void 1748void
1707XUnmapWindow (rxvt_term *term, Window window) 1753XUnmapWindow (rxvt_term *term, Window window)
1708 C_ARGS: term->display->display, window 1754 C_ARGS: term->display->display, window
1709 1755
1710void 1756void
1711XMoveResizeWindow (rxvt_term *term, Window window, int x, int y, unsigned int width, unsigned int height) 1757XMoveResizeWindow (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 1758 C_ARGS: term->display->display, window, x, y, width, height
1759
1760void
1761rxvt_term::XChangeInput (Window window, U32 add_events, U32 del_events = 0)
1762 CODE:
1763{
1764 XWindowAttributes attr;
1765 XGetWindowAttributes (THIS->display->display, window, &attr);
1766 XSelectInput (THIS->display->display, window, attr.your_event_mask | add_events & ~del_events);
1767}
1768
1769void
1770rxvt_term::XTranslateCoordinates (Window src, Window dst, int x, int y)
1771 PPCODE:
1772{
1773 int dx, dy;
1774 Window child;
1775
1776 if (XTranslateCoordinates (THIS->display->display, src, dst, x, y, &dx, &dy, &child))
1777 {
1778 EXTEND (SP, 3);
1779 PUSHs (newSViv (dx));
1780 PUSHs (newSViv (dy));
1781 PUSHs (newSVuv (child));
1782 }
1783}
1713 1784
1714############################################################################# 1785#############################################################################
1715# urxvt::overlay 1786# urxvt::overlay
1716############################################################################# 1787#############################################################################
1717 1788

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines