… | |
… | |
554 | break; |
554 | break; |
555 | |
555 | |
556 | case DT_STR_LEN: |
556 | case DT_STR_LEN: |
557 | { |
557 | { |
558 | char *str = va_arg (ap, char *); |
558 | char *str = va_arg (ap, char *); |
559 | int len = va_arg (ap, int); |
559 | int len = va_arg (ap, int); |
560 | |
560 | |
|
|
561 | printf ("pushing str %p:%d\n", str,len);//D |
561 | XPUSHs (sv_2mortal (newSVpvn (str, len))); |
562 | XPUSHs (sv_2mortal (newSVpvn (str, len))); |
562 | } |
563 | } |
563 | break; |
564 | break; |
564 | |
565 | |
565 | case DT_WCS_LEN: |
566 | case DT_WCS_LEN: |
566 | { |
567 | { |
567 | wchar_t *wstr = va_arg (ap, wchar_t *); |
568 | wchar_t *wstr = va_arg (ap, wchar_t *); |
568 | int wlen = va_arg (ap, int); |
569 | int wlen = va_arg (ap, int); |
569 | |
570 | |
570 | XPUSHs (sv_2mortal (wcs2sv (wstr, wlen))); |
571 | XPUSHs (sv_2mortal (wcs2sv (wstr, wlen))); |
|
|
572 | } |
|
|
573 | break; |
|
|
574 | |
|
|
575 | case DT_LCS_LEN: |
|
|
576 | { |
|
|
577 | long *lstr = va_arg (ap, long *); |
|
|
578 | int llen = va_arg (ap, int); |
|
|
579 | |
|
|
580 | XPUSHs (sv_2mortal (newSVpvn ((char *)lstr, llen * sizeof (long)))); |
571 | } |
581 | } |
572 | break; |
582 | break; |
573 | |
583 | |
574 | case DT_XEVENT: |
584 | case DT_XEVENT: |
575 | { |
585 | { |
576 | XEvent *xe = va_arg (ap, XEvent *); |
586 | XEvent *xe = va_arg (ap, XEvent *); |
577 | HV *hv = newHV (); |
587 | HV *hv = newHV (); |
578 | |
588 | |
579 | # define set(name, sv) hv_store (hv, # name, sizeof (# name) - 1, sv, 0) |
589 | # define set(name, sv) hv_store (hv, # name, sizeof (# name) - 1, sv, 0) |
580 | # define setiv(name, val) hv_store (hv, # name, sizeof (# name) - 1, newSViv (val), 0) |
590 | # define setiv(name, val) hv_store (hv, # name, sizeof (# name) - 1, newSViv (val), 0) |
581 | # define setuv(name, val) hv_store (hv, # name, sizeof (# name) - 1, newSVuv (val), 0) |
591 | # define setuv(name, val) hv_store (hv, # name, sizeof (# name) - 1, newSVuv (val), 0) |
582 | # undef set |
592 | # undef set |
583 | |
593 | |
584 | setiv (type, xe->type); |
594 | setiv (type, xe->type); |
585 | setiv (send_event, xe->xany.send_event); |
595 | setiv (send_event, xe->xany.send_event); |
586 | setiv (serial, xe->xany.serial); |
596 | setiv (serial, xe->xany.serial); |
587 | |
597 | |
… | |
… | |
596 | setuv (root, xe->xmotion.root); |
606 | setuv (root, xe->xmotion.root); |
597 | setuv (subwindow, xe->xmotion.subwindow); |
607 | setuv (subwindow, xe->xmotion.subwindow); |
598 | setuv (time, xe->xmotion.time); |
608 | setuv (time, xe->xmotion.time); |
599 | setiv (x, xe->xmotion.x); |
609 | setiv (x, xe->xmotion.x); |
600 | setiv (y, xe->xmotion.y); |
610 | setiv (y, xe->xmotion.y); |
601 | setiv (row, xe->xmotion.y / term->fheight); |
611 | setiv (row, xe->xmotion.y / term->fheight + term->view_start); |
602 | setiv (col, xe->xmotion.x / term->fwidth); |
612 | setiv (col, xe->xmotion.x / term->fwidth); |
603 | setiv (x_root, xe->xmotion.x_root); |
613 | setiv (x_root, xe->xmotion.x_root); |
604 | setiv (y_root, xe->xmotion.y_root); |
614 | setiv (y_root, xe->xmotion.y_root); |
605 | setuv (state, xe->xmotion.state); |
615 | setuv (state, xe->xmotion.state); |
606 | |
616 | |
… | |
… | |
640 | break; |
650 | break; |
641 | } |
651 | } |
642 | |
652 | |
643 | break; |
653 | break; |
644 | |
654 | |
|
|
655 | case PropertyNotify: |
|
|
656 | setuv (window, xe->xproperty.window); |
|
|
657 | setuv (atom, xe->xproperty.atom); |
|
|
658 | setuv (time, xe->xproperty.time); |
|
|
659 | setiv (state, xe->xproperty.state); |
|
|
660 | break; |
|
|
661 | |
645 | case ClientMessage: |
662 | case ClientMessage: |
646 | setuv (window, xe->xclient.window); |
663 | setuv (window, xe->xclient.window); |
647 | setuv (message_type, xe->xclient.message_type); |
664 | setuv (message_type, xe->xclient.message_type); |
648 | setuv (format, xe->xclient.format); |
665 | setuv (format, xe->xclient.format); |
649 | setuv (l0, xe->xclient.data.l[0]); |
666 | setuv (l0, xe->xclient.data.l[0]); |
650 | setuv (l1, xe->xclient.data.l[1]); |
667 | setuv (l1, xe->xclient.data.l[1]); |
651 | setuv (l2, xe->xclient.data.l[2]); |
668 | setuv (l2, xe->xclient.data.l[2]); |
652 | setuv (l3, xe->xclient.data.l[3]); |
669 | setuv (l3, xe->xclient.data.l[3]); |
653 | setuv (l4, xe->xclient.data.l[4]); |
670 | setuv (l4, xe->xclient.data.l[4]); |
|
|
671 | break; |
654 | } |
672 | } |
655 | |
673 | |
656 | XPUSHs (sv_2mortal (newRV_noinc ((SV *)hv))); |
674 | XPUSHs (sv_2mortal (newRV_noinc ((SV *)hv))); |
657 | } |
675 | } |
658 | break; |
676 | break; |
… | |
… | |
708 | } |
726 | } |
709 | else if (htype == HOOK_DESTROY) |
727 | else if (htype == HOOK_DESTROY) |
710 | { |
728 | { |
711 | clearSVptr ((SV *)term->perl.self); |
729 | clearSVptr ((SV *)term->perl.self); |
712 | SvREFCNT_dec ((SV *)term->perl.self); |
730 | SvREFCNT_dec ((SV *)term->perl.self); |
|
|
731 | |
|
|
732 | // don't allow further calls |
|
|
733 | term->perl.self = 0; |
713 | } |
734 | } |
714 | |
735 | |
715 | swap (perl_environ, environ); |
736 | swap (perl_environ, environ); |
716 | |
737 | |
717 | return event_consumed; |
738 | return event_consumed; |
… | |
… | |
834 | const_iv (SelectionRequest), |
855 | const_iv (SelectionRequest), |
835 | const_iv (SelectionNotify), |
856 | const_iv (SelectionNotify), |
836 | const_iv (ColormapNotify), |
857 | const_iv (ColormapNotify), |
837 | const_iv (ClientMessage), |
858 | const_iv (ClientMessage), |
838 | const_iv (MappingNotify), |
859 | const_iv (MappingNotify), |
|
|
860 | # if ENABLE_XIM_ONTHESPOT |
|
|
861 | const_iv (XIMReverse), |
|
|
862 | const_iv (XIMUnderline), |
|
|
863 | const_iv (XIMHighlight), |
|
|
864 | const_iv (XIMPrimary), |
|
|
865 | const_iv (XIMSecondary), |
|
|
866 | const_iv (XIMTertiary), |
|
|
867 | const_iv (XIMVisibleToForward), |
|
|
868 | const_iv (XIMVisibleToBackword), |
|
|
869 | const_iv (XIMVisibleToCenter), |
|
|
870 | |
|
|
871 | const_iv (XIMForwardChar), |
|
|
872 | const_iv (XIMBackwardChar), |
|
|
873 | const_iv (XIMForwardWord), |
|
|
874 | const_iv (XIMBackwardWord), |
|
|
875 | const_iv (XIMCaretUp), |
|
|
876 | const_iv (XIMCaretDown), |
|
|
877 | const_iv (XIMNextLine), |
|
|
878 | const_iv (XIMPreviousLine), |
|
|
879 | const_iv (XIMLineStart), |
|
|
880 | const_iv (XIMLineEnd), |
|
|
881 | const_iv (XIMAbsolutePosition), |
|
|
882 | const_iv (XIMDontChange), |
|
|
883 | # endif |
839 | }; |
884 | }; |
840 | |
885 | |
841 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); |
886 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); |
842 | civ-- > const_iv; ) |
887 | civ-- > const_iv; ) |
843 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
888 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
… | |
… | |
920 | if (items < 1 || !SvROK (ST (0)) || SvTYPE (SvRV (ST (0))) != SVt_PVAV) |
965 | if (items < 1 || !SvROK (ST (0)) || SvTYPE (SvRV (ST (0))) != SVt_PVAV) |
921 | croak ("first argument to urxvt::term->_new must be arrayref"); |
966 | croak ("first argument to urxvt::term->_new must be arrayref"); |
922 | |
967 | |
923 | rxvt_term *term = new rxvt_term; |
968 | rxvt_term *term = new rxvt_term; |
924 | |
969 | |
925 | term->argv = new stringvec; |
970 | stringvec *argv = new stringvec; |
926 | term->envv = new stringvec; |
971 | stringvec *envv = new stringvec; |
927 | |
972 | |
928 | for (int i = 1; i < items; i++) |
973 | for (int i = 1; i < items; i++) |
929 | term->argv->push_back (strdup (SvPVbyte_nolen (ST (i)))); |
974 | argv->push_back (strdup (SvPVbyte_nolen (ST (i)))); |
930 | |
975 | |
931 | AV *envv = (AV *)SvRV (ST (0)); |
976 | AV *env = (AV *)SvRV (ST (0)); |
932 | for (int i = AvFILL (envv) + 1; i--; ) |
977 | for (int i = AvFILL (env) + 1; i--; ) |
933 | term->envv->push_back (strdup (SvPVbyte_nolen (*av_fetch (envv, i, 1)))); |
978 | envv->push_back (strdup (SvPVbyte_nolen (*av_fetch (env, i, 1)))); |
934 | |
979 | |
935 | term->envv->push_back (0); |
980 | envv->push_back (0); |
936 | |
981 | |
937 | bool success; |
982 | bool success; |
938 | |
983 | |
939 | try |
984 | try |
940 | { |
985 | { |
941 | success = term->init (term->argv->size (), term->argv->begin ()); |
986 | success = term->init (argv, envv); |
942 | } |
987 | } |
943 | catch (const class rxvt_failure_exception &e) |
988 | catch (const class rxvt_failure_exception &e) |
944 | { |
989 | { |
945 | success = false; |
990 | success = false; |
946 | } |
991 | } |
… | |
… | |
1109 | rxvt_term::ModLevel3Mask () |
1154 | rxvt_term::ModLevel3Mask () |
1110 | ALIAS: |
1155 | ALIAS: |
1111 | ModLevel3Mask = 0 |
1156 | ModLevel3Mask = 0 |
1112 | ModMetaMask = 1 |
1157 | ModMetaMask = 1 |
1113 | ModNumLockMask = 2 |
1158 | ModNumLockMask = 2 |
|
|
1159 | current_screen = 3 |
|
|
1160 | hidden_cursor = 4 |
1114 | CODE: |
1161 | CODE: |
1115 | switch (ix) |
1162 | switch (ix) |
1116 | { |
1163 | { |
1117 | case 0: RETVAL = THIS->ModLevel3Mask; break; |
1164 | case 0: RETVAL = THIS->ModLevel3Mask; break; |
1118 | case 1: RETVAL = THIS->ModMetaMask; break; |
1165 | case 1: RETVAL = THIS->ModMetaMask; break; |
1119 | case 2: RETVAL = THIS->ModNumLockMask; break; |
1166 | case 2: RETVAL = THIS->ModNumLockMask; break; |
|
|
1167 | case 3: RETVAL = THIS->current_screen; break; |
|
|
1168 | case 4: RETVAL = THIS->hidden_cursor; break; |
1120 | } |
1169 | } |
1121 | OUTPUT: |
1170 | OUTPUT: |
1122 | RETVAL |
1171 | RETVAL |
1123 | |
1172 | |
1124 | char * |
1173 | char * |
… | |
… | |
1162 | if (events != EVENT_UNDEF) |
1211 | if (events != EVENT_UNDEF) |
1163 | THIS->pty_ev.set (events); |
1212 | THIS->pty_ev.set (events); |
1164 | OUTPUT: |
1213 | OUTPUT: |
1165 | RETVAL |
1214 | RETVAL |
1166 | |
1215 | |
|
|
1216 | int |
|
|
1217 | rxvt_term::pty_fd () |
|
|
1218 | CODE: |
|
|
1219 | RETVAL = THIS->pty->pty; |
|
|
1220 | OUTPUT: |
|
|
1221 | RETVAL |
|
|
1222 | |
1167 | Window |
1223 | Window |
1168 | rxvt_term::parent () |
1224 | rxvt_term::parent () |
1169 | CODE: |
1225 | CODE: |
1170 | RETVAL = THIS->parent [0]; |
1226 | RETVAL = THIS->parent [0]; |
1171 | OUTPUT: |
1227 | OUTPUT: |
… | |
… | |
1204 | } |
1260 | } |
1205 | OUTPUT: |
1261 | OUTPUT: |
1206 | RETVAL |
1262 | RETVAL |
1207 | |
1263 | |
1208 | void |
1264 | void |
|
|
1265 | rxvt_term::focus_in () |
|
|
1266 | |
|
|
1267 | void |
|
|
1268 | rxvt_term::focus_out () |
|
|
1269 | |
|
|
1270 | void |
1209 | rxvt_term::want_refresh () |
1271 | rxvt_term::want_refresh () |
1210 | CODE: |
1272 | CODE: |
1211 | THIS->want_refresh = 1; |
1273 | THIS->want_refresh = 1; |
1212 | |
1274 | |
1213 | void |
1275 | void |
… | |
… | |
1219 | |
1281 | |
1220 | line_t &l = ROW(row_number); |
1282 | line_t &l = ROW(row_number); |
1221 | |
1283 | |
1222 | if (GIMME_V != G_VOID) |
1284 | if (GIMME_V != G_VOID) |
1223 | { |
1285 | { |
1224 | wchar_t *wstr = new wchar_t [THIS->ncol]; |
1286 | wchar_t *wstr = rxvt_temp_buf<wchar_t> (THIS->ncol); |
1225 | |
1287 | |
1226 | for (int col = 0; col < THIS->ncol; col++) |
1288 | for (int col = 0; col < THIS->ncol; col++) |
1227 | wstr [col] = l.t [col]; |
1289 | wstr [col] = l.t [col]; |
1228 | |
1290 | |
1229 | XPUSHs (sv_2mortal (wcs2sv (wstr, THIS->ncol))); |
1291 | XPUSHs (sv_2mortal (wcs2sv (wstr, THIS->ncol))); |
1230 | |
|
|
1231 | delete [] wstr; |
|
|
1232 | } |
1292 | } |
1233 | |
1293 | |
1234 | if (new_text) |
1294 | if (new_text) |
1235 | { |
1295 | { |
1236 | wchar_t *wstr = sv2wcs (new_text); |
1296 | wchar_t *wstr = sv2wcs (new_text); |
1237 | |
1297 | |
1238 | int len = min (wcslen (wstr) - start_ofs, max_len); |
1298 | int len = min (wcslen (wstr) - start_ofs, max_len); |
1239 | |
1299 | |
1240 | if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len)) |
1300 | if (start_col < 0 || start_col + len > THIS->ncol) |
1241 | { |
1301 | { |
1242 | free (wstr); |
1302 | free (wstr); |
1243 | croak ("new_text extends beyond horizontal margins"); |
1303 | croak ("new_text extends beyond horizontal margins"); |
1244 | } |
1304 | } |
1245 | |
1305 | |
… | |
… | |
1279 | croak ("new_rend must be arrayref"); |
1339 | croak ("new_rend must be arrayref"); |
1280 | |
1340 | |
1281 | AV *av = (AV *)SvRV (new_rend); |
1341 | AV *av = (AV *)SvRV (new_rend); |
1282 | int len = min (AvFILL (av) + 1 - start_ofs, max_len); |
1342 | int len = min (AvFILL (av) + 1 - start_ofs, max_len); |
1283 | |
1343 | |
1284 | if (!IN_RANGE_INC (start_col, 0, THIS->ncol - len)) |
1344 | if (start_col < 0 || start_col + len > THIS->ncol) |
1285 | croak ("new_rend array extends beyond horizontal margins"); |
1345 | croak ("new_rend array extends beyond horizontal margins"); |
1286 | |
1346 | |
1287 | for (int col = start_col; col < start_col + len; col++) |
1347 | for (int col = start_col; col < start_col + len; col++) |
1288 | { |
1348 | { |
1289 | rend_t r = SvIV (*av_fetch (av, start_ofs + col - start_col, 1)) & ~RS_fontMask; |
1349 | rend_t r = SvIV (*av_fetch (av, start_ofs + col - start_col, 1)) & ~RS_fontMask; |
… | |
… | |
1329 | rxvt_term::special_encode (SV *string) |
1389 | rxvt_term::special_encode (SV *string) |
1330 | CODE: |
1390 | CODE: |
1331 | { |
1391 | { |
1332 | wchar_t *wstr = sv2wcs (string); |
1392 | wchar_t *wstr = sv2wcs (string); |
1333 | int wlen = wcslen (wstr); |
1393 | int wlen = wcslen (wstr); |
1334 | wchar_t *rstr = new wchar_t [wlen]; // cannot become longer |
1394 | wchar_t *rstr = rxvt_temp_buf<wchar_t> (wlen * 2); // cannot become longer |
1335 | |
1395 | |
1336 | rxvt_push_locale (THIS->locale); |
1396 | rxvt_push_locale (THIS->locale); |
1337 | |
1397 | |
1338 | wchar_t *r = rstr; |
1398 | wchar_t *r = rstr; |
1339 | for (wchar_t *s = wstr; *s; s++) |
1399 | for (wchar_t *s = wstr; *s; s++) |
|
|
1400 | { |
|
|
1401 | int w = WCWIDTH (*s); |
|
|
1402 | |
1340 | if (wcwidth (*s) == 0) |
1403 | if (w == 0) |
1341 | { |
1404 | { |
1342 | if (r == rstr) |
1405 | if (r == rstr) |
1343 | croak ("leading combining character unencodable"); |
1406 | croak ("leading combining character unencodable"); |
1344 | |
1407 | |
1345 | unicode_t n = rxvt_compose (r[-1], *s); |
1408 | unicode_t n = rxvt_compose (r[-1], *s); |
1346 | if (n == NOCHAR) |
1409 | if (n == NOCHAR) |
1347 | n = rxvt_composite.compose (r[-1], *s); |
1410 | n = rxvt_composite.compose (r[-1], *s); |
1348 | |
1411 | |
1349 | r[-1] = n; |
1412 | r[-1] = n; |
1350 | } |
1413 | } |
1351 | #if !UNICODE_3 |
1414 | #if !UNICODE_3 |
1352 | else if (*s >= 0x10000) |
1415 | else if (*s >= 0x10000) |
1353 | *r++ = rxvt_composite.compose (*s); |
1416 | *r++ = rxvt_composite.compose (*s); |
1354 | #endif |
1417 | #endif |
1355 | else |
1418 | else |
1356 | *r++ = *s; |
1419 | *r++ = *s; |
|
|
1420 | |
|
|
1421 | // the *2 above only allows wcwidth <= 2 |
|
|
1422 | if (w > 1) |
|
|
1423 | *r++ = NOCHAR; |
|
|
1424 | } |
1357 | |
1425 | |
1358 | rxvt_pop_locale (); |
1426 | rxvt_pop_locale (); |
1359 | |
1427 | |
1360 | RETVAL = wcs2sv (rstr, r - rstr); |
1428 | RETVAL = wcs2sv (rstr, r - rstr); |
1361 | |
|
|
1362 | delete [] rstr; |
|
|
1363 | } |
1429 | } |
1364 | OUTPUT: |
1430 | OUTPUT: |
1365 | RETVAL |
1431 | RETVAL |
1366 | |
1432 | |
1367 | SV * |
1433 | SV * |
… | |
… | |
1379 | else if (IS_COMPOSE (*s)) |
1445 | else if (IS_COMPOSE (*s)) |
1380 | dlen += rxvt_composite.expand (*s, 0); |
1446 | dlen += rxvt_composite.expand (*s, 0); |
1381 | else |
1447 | else |
1382 | dlen++; |
1448 | dlen++; |
1383 | |
1449 | |
1384 | wchar_t *rstr = new wchar_t [dlen]; |
1450 | wchar_t *rstr = rxvt_temp_buf<wchar_t> (dlen); |
1385 | |
1451 | |
1386 | // decode |
1452 | // decode |
1387 | wchar_t *r = rstr; |
1453 | wchar_t *r = rstr; |
1388 | for (wchar_t *s = wstr; *s; s++) |
1454 | for (wchar_t *s = wstr; *s; s++) |
1389 | if (*s == NOCHAR) |
1455 | if (*s == NOCHAR) |
… | |
… | |
1392 | r += rxvt_composite.expand (*s, r); |
1458 | r += rxvt_composite.expand (*s, r); |
1393 | else |
1459 | else |
1394 | *r++ = *s; |
1460 | *r++ = *s; |
1395 | |
1461 | |
1396 | RETVAL = wcs2sv (rstr, r - rstr); |
1462 | RETVAL = wcs2sv (rstr, r - rstr); |
1397 | |
|
|
1398 | delete [] rstr; |
|
|
1399 | } |
1463 | } |
1400 | OUTPUT: |
1464 | OUTPUT: |
1401 | RETVAL |
1465 | RETVAL |
1402 | |
1466 | |
1403 | void |
1467 | void |
… | |
… | |
1513 | if (items == 3) |
1577 | if (items == 3) |
1514 | { |
1578 | { |
1515 | rc.row = SvIV (ST (1)); |
1579 | rc.row = SvIV (ST (1)); |
1516 | rc.col = SvIV (ST (2)); |
1580 | rc.col = SvIV (ST (2)); |
1517 | |
1581 | |
1518 | if (ix == 2 && rc.col == 0) |
1582 | if (ix == 2) |
1519 | { |
1583 | { |
|
|
1584 | if (rc.col == 0) |
|
|
1585 | { |
|
|
1586 | // col == 0 means end of previous line |
1520 | rc.row--; |
1587 | rc.row--; |
1521 | rc.col = THIS->ncol; |
1588 | rc.col = THIS->ncol; |
|
|
1589 | } |
|
|
1590 | else if (IN_RANGE_EXC (rc.row, THIS->top_row, THIS->nrow) |
|
|
1591 | && rc.col > ROW(rc.row).l) |
|
|
1592 | { |
|
|
1593 | // col >= length means while line and add newline |
|
|
1594 | rc.col = THIS->ncol; |
|
|
1595 | } |
1522 | } |
1596 | } |
1523 | |
1597 | |
1524 | clamp_it (rc.col, 0, THIS->ncol); |
1598 | clamp_it (rc.col, 0, THIS->ncol); |
1525 | clamp_it (rc.row, THIS->top_row, THIS->nrow - 1); |
1599 | clamp_it (rc.row, THIS->top_row, THIS->nrow - 1); |
1526 | |
1600 | |
… | |
… | |
1573 | void |
1647 | void |
1574 | rxvt_term::scr_xor_span (int beg_row, int beg_col, int end_row, int end_col, U32 rstyle = RS_RVid) |
1648 | rxvt_term::scr_xor_span (int beg_row, int beg_col, int end_row, int end_col, U32 rstyle = RS_RVid) |
1575 | |
1649 | |
1576 | void |
1650 | void |
1577 | rxvt_term::scr_bell () |
1651 | rxvt_term::scr_bell () |
|
|
1652 | |
|
|
1653 | void |
|
|
1654 | rxvt_term::scr_change_screen (int screen) |
1578 | |
1655 | |
1579 | void |
1656 | void |
1580 | rxvt_term::scr_add_lines (SV *string) |
1657 | rxvt_term::scr_add_lines (SV *string) |
1581 | CODE: |
1658 | CODE: |
1582 | { |
1659 | { |
… | |
… | |
1650 | Atom type; |
1727 | Atom type; |
1651 | int format; |
1728 | int format; |
1652 | unsigned long nitems; |
1729 | unsigned long nitems; |
1653 | unsigned long bytes_after; |
1730 | unsigned long bytes_after; |
1654 | unsigned char *prop; |
1731 | unsigned char *prop; |
|
|
1732 | |
1655 | XGetWindowProperty (THIS->display->display, window, property, |
1733 | XGetWindowProperty (THIS->display->display, window, property, |
1656 | 0, 1<<30, 0, AnyPropertyType, |
1734 | 0, 1<<24, 0, AnyPropertyType, |
1657 | &type, &format, &nitems, &bytes_after, &prop); |
1735 | &type, &format, &nitems, &bytes_after, &prop); |
|
|
1736 | |
1658 | if (type != None) |
1737 | if (type != None) |
1659 | { |
1738 | { |
|
|
1739 | int elemsize = format == 16 ? sizeof (short) |
|
|
1740 | : format == 32 ? sizeof (long) |
|
|
1741 | : 1; |
|
|
1742 | |
1660 | EXTEND (SP, 3); |
1743 | EXTEND (SP, 3); |
1661 | PUSHs (newSVuv ((U32)type)); |
1744 | PUSHs (newSVuv ((U32)type)); |
1662 | PUSHs (newSViv (format)); |
1745 | PUSHs (newSViv (format)); |
1663 | PUSHs (newSVpvn ((char *)prop, nitems * format / 8)); |
1746 | PUSHs (newSVpvn ((char *)prop, nitems * elemsize)); |
1664 | XFree (prop); |
1747 | XFree (prop); |
1665 | } |
1748 | } |
1666 | } |
1749 | } |
1667 | |
1750 | |
1668 | void |
1751 | void |
… | |
… | |
1670 | CODE: |
1753 | CODE: |
1671 | { |
1754 | { |
1672 | STRLEN len; |
1755 | STRLEN len; |
1673 | char *data_ = SvPVbyte (data, len); |
1756 | char *data_ = SvPVbyte (data, len); |
1674 | |
1757 | |
|
|
1758 | int elemsize = format == 16 ? sizeof (short) |
|
|
1759 | : format == 32 ? sizeof (long) |
|
|
1760 | : 1; |
|
|
1761 | |
1675 | XChangeProperty (THIS->display->display, window, property, |
1762 | XChangeProperty (THIS->display->display, window, property, |
1676 | type, format, PropModeReplace, |
1763 | type, format, PropModeReplace, |
1677 | (unsigned char *)data, len * 8 / format); |
1764 | (unsigned char *)data_, len / elemsize); |
|
|
1765 | XSync (THIS->display->display, 0); |
1678 | } |
1766 | } |
|
|
1767 | |
|
|
1768 | Atom |
|
|
1769 | XInternAtom (rxvt_term *term, char *atom_name, int only_if_exists = FALSE) |
|
|
1770 | C_ARGS: term->display->display, atom_name, only_if_exists |
|
|
1771 | |
|
|
1772 | char * |
|
|
1773 | XGetAtomName (rxvt_term *term, Atom atom) |
|
|
1774 | C_ARGS: term->display->display, atom |
|
|
1775 | CLEANUP: |
|
|
1776 | XFree (RETVAL); |
1679 | |
1777 | |
1680 | void |
1778 | void |
1681 | XDeleteProperty (rxvt_term *term, Window window, Atom property) |
1779 | XDeleteProperty (rxvt_term *term, Window window, Atom property) |
1682 | C_ARGS: term->display->display, window, property |
1780 | C_ARGS: term->display->display, window, property |
1683 | |
1781 | |
… | |
… | |
1685 | rxvt_term::DefaultRootWindow () |
1783 | rxvt_term::DefaultRootWindow () |
1686 | CODE: |
1784 | CODE: |
1687 | RETVAL = THIS->display->root; |
1785 | RETVAL = THIS->display->root; |
1688 | OUTPUT: |
1786 | OUTPUT: |
1689 | RETVAL |
1787 | RETVAL |
|
|
1788 | |
|
|
1789 | #if 0 |
1690 | |
1790 | |
1691 | Window |
1791 | Window |
1692 | XCreateSimpleWindow (rxvt_term *term, Window parent, int x, int y, unsigned int width, unsigned int height) |
1792 | XCreateSimpleWindow (rxvt_term *term, Window parent, int x, int y, unsigned int width, unsigned int height) |
1693 | C_ARGS: term->display->display, (Window)parent, |
1793 | C_ARGS: term->display->display, (Window)parent, |
1694 | x, y, width, height, 0, |
1794 | x, y, width, height, 0, |
1695 | term->pix_colors_focused[Color_border], |
1795 | term->pix_colors_focused[Color_border], |
1696 | term->pix_colors_focused[Color_border] |
1796 | term->pix_colors_focused[Color_border] |
1697 | |
1797 | |
|
|
1798 | #endif |
|
|
1799 | |
1698 | void |
1800 | void |
1699 | XReparentWindow (rxvt_term *term, Window window, Window parent, int x = 0, int y = 0) |
1801 | XReparentWindow (rxvt_term *term, Window window, Window parent, int x = 0, int y = 0) |
1700 | C_ARGS: term->display->display, window, parent, x, y |
1802 | C_ARGS: term->display->display, window, parent, x, y |
1701 | |
1803 | |
1702 | void |
1804 | void |
… | |
… | |
1707 | XUnmapWindow (rxvt_term *term, Window window) |
1809 | XUnmapWindow (rxvt_term *term, Window window) |
1708 | C_ARGS: term->display->display, window |
1810 | C_ARGS: term->display->display, window |
1709 | |
1811 | |
1710 | void |
1812 | void |
1711 | XMoveResizeWindow (rxvt_term *term, Window window, int x, int y, unsigned int width, unsigned int height) |
1813 | 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 |
1814 | C_ARGS: term->display->display, window, x, y, width, height |
|
|
1815 | |
|
|
1816 | void |
|
|
1817 | rxvt_term::XChangeInput (Window window, U32 add_events, U32 del_events = 0) |
|
|
1818 | CODE: |
|
|
1819 | { |
|
|
1820 | XWindowAttributes attr; |
|
|
1821 | XGetWindowAttributes (THIS->display->display, window, &attr); |
|
|
1822 | XSelectInput (THIS->display->display, window, attr.your_event_mask | add_events & ~del_events); |
|
|
1823 | } |
|
|
1824 | |
|
|
1825 | void |
|
|
1826 | rxvt_term::XTranslateCoordinates (Window src, Window dst, int x, int y) |
|
|
1827 | PPCODE: |
|
|
1828 | { |
|
|
1829 | int dx, dy; |
|
|
1830 | Window child; |
|
|
1831 | |
|
|
1832 | if (XTranslateCoordinates (THIS->display->display, src, dst, x, y, &dx, &dy, &child)) |
|
|
1833 | { |
|
|
1834 | EXTEND (SP, 3); |
|
|
1835 | PUSHs (newSViv (dx)); |
|
|
1836 | PUSHs (newSViv (dy)); |
|
|
1837 | PUSHs (newSVuv (child)); |
|
|
1838 | } |
|
|
1839 | } |
1713 | |
1840 | |
1714 | ############################################################################# |
1841 | ############################################################################# |
1715 | # urxvt::overlay |
1842 | # urxvt::overlay |
1716 | ############################################################################# |
1843 | ############################################################################# |
1717 | |
1844 | |