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.135 by sf-exg, Sat Dec 18 18:17:38 2010 UTC vs.
Revision 1.170 by root, Tue Jun 5 19:32:29 2012 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 Marc Lehmann <pcg@goof.com> 6 * Copyright (c) 2005-2008,2011 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 2 of the License, or
11 * (at your option) any later version. 11 * (at your option) any later version.
23#define line_t perl_line_t 23#define line_t perl_line_t
24#include <EXTERN.h> 24#include <EXTERN.h>
25#include <perl.h> 25#include <perl.h>
26#include <XSUB.h> 26#include <XSUB.h>
27#undef line_t 27#undef line_t
28#undef bool // perl defines it's own bool type, except with g++... what a trap
28 29
29#include "../config.h" 30#include "../config.h"
30 31
31#include <cstddef> 32#include <stddef.h>
32#include <cstdarg> 33#include <stdarg.h>
33 34
34#include "unistd.h" 35#include "unistd.h"
35 36
36#include "ev_cpp.h" 37#include "ev_cpp.h"
37#include "rxvt.h" 38#include "rxvt.h"
45 46
46#undef LINENO 47#undef LINENO
47#define LINENO(n) MOD (THIS->term_start + int(n), THIS->total_rows) 48#define LINENO(n) MOD (THIS->term_start + int(n), THIS->total_rows)
48#undef ROW 49#undef ROW
49#define ROW(n) THIS->row_buf [LINENO (n)] 50#define ROW(n) THIS->row_buf [LINENO (n)]
51
52/////////////////////////////////////////////////////////////////////////////
53
54typedef char * octet_string;
55typedef char * utf8_string;
56
57typedef int render_repeat_mode;
58
59typedef GdkPixbuf * urxvt__pixbuf;
60typedef rxvt_img * urxvt__img;
61
62/////////////////////////////////////////////////////////////////////////////
63
64static void
65parse_color (rxvt_screen *s, rxvt_color &c, SV *sv)
66{
67 //TODO: support component stuff
68 c.set (s, SvPVbyte_nolen (sv));
69}
50 70
51///////////////////////////////////////////////////////////////////////////// 71/////////////////////////////////////////////////////////////////////////////
52 72
53static wchar_t * 73static wchar_t *
54sv2wcs (SV *sv) 74sv2wcs (SV *sv)
302 THIS->refresh_check (); 322 THIS->refresh_check ();
303} 323}
304 324
305///////////////////////////////////////////////////////////////////////////// 325/////////////////////////////////////////////////////////////////////////////
306 326
307#define IOM_CLASS "urxvt"
308#define IOM_WARN rxvt_warn
309#include "iom_perl.h" 327#include "iom_perl.h"
310 328
311///////////////////////////////////////////////////////////////////////////// 329/////////////////////////////////////////////////////////////////////////////
312 330
313struct rxvt_perl_interp rxvt_perl; 331struct rxvt_perl_interp rxvt_perl;
343 " unshift @INC, '" LIBDIR "';" 361 " unshift @INC, '" LIBDIR "';"
344 "}" 362 "}"
345 "" 363 ""
346 "use urxvt;" 364 "use urxvt;"
347 }; 365 };
348 int argc = ARRAY_LENGTH(args); 366 int argc = ecb_array_length (args);
349 char **argv = args; 367 char **argv = args;
350 368
351 PERL_SYS_INIT3 (&argc, &argv, &environ); 369 PERL_SYS_INIT3 (&argc, &argv, &environ);
352 perl = perl_alloc (); 370 perl = perl_alloc ();
353 perl_construct (perl); 371 perl_construct (perl);
369 if (perl) 387 if (perl)
370 { 388 {
371 // runs outside of perls ENV 389 // runs outside of perls ENV
372 term->perl.self = (void *)newSVptr ((void *)term, "urxvt::term"); 390 term->perl.self = (void *)newSVptr ((void *)term, "urxvt::term");
373 hv_store ((HV *)SvRV ((SV *)term->perl.self), "_overlay", 8, newRV_noinc ((SV *)newAV ()), 0); 391 hv_store ((HV *)SvRV ((SV *)term->perl.self), "_overlay", 8, newRV_noinc ((SV *)newAV ()), 0);
392 hv_store ((HV *)SvRV ((SV *)term->perl.self), "_selection", 10, newRV_noinc ((SV *)newAV ()), 0);
374 } 393 }
394}
395
396void
397rxvt_perl_interp::usage (int type)
398{
399 localise_env set_environ (perl_environ);
400
401 ENTER;
402 SAVETMPS;
403
404 dSP;
405 XPUSHs (sv_2mortal (newSViv (type)));
406 PUTBACK;
407 call_pv ("urxvt::usage", G_VOID | G_DISCARD | G_EVAL);
408
409 FREETMPS;
410 LEAVE;
411}
412
413uint8_t
414rxvt_perl_interp::resource (rxvt_term *term, const char *name, bool arg, bool longopt, bool flag, const char *value)
415{
416 localise_env set_environ (perl_environ);
417
418 ENTER;
419 SAVETMPS;
420
421 dSP;
422 EXTEND (SP, 6);
423 PUSHs (sv_2mortal (newSVterm (term)));
424 PUSHs (sv_2mortal (newSVpv (name, 0)));
425 PUSHs (arg ? &PL_sv_yes : &PL_sv_no);
426 PUSHs (longopt ? &PL_sv_yes : &PL_sv_no);
427 PUSHs (flag ? &PL_sv_yes : &PL_sv_no);
428 PUSHs (value ? sv_2mortal (newSVpv (value, 0)) : &PL_sv_undef);
429 PUTBACK;
430 call_pv ("urxvt::resource", G_SCALAR | G_EVAL);
431
432 uint8_t ret = POPi;
433
434 FREETMPS;
435 LEAVE;
436
437 return ret;
375} 438}
376 439
377static void 440static void
378ungrab (rxvt_term *THIS) 441ungrab (rxvt_term *THIS)
379{ 442{
399 AV *av = (AV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)term->perl.self), "_overlay", 8, 0)); 462 AV *av = (AV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)term->perl.self), "_overlay", 8, 0));
400 463
401 for (int i = 0; i <= AvFILL (av); i++) 464 for (int i = 0; i <= AvFILL (av); i++)
402 ((overlay *)SvIV (*av_fetch (av, i, 0)))->swap (); 465 ((overlay *)SvIV (*av_fetch (av, i, 0)))->swap ();
403 } 466 }
467 else if (htype == HOOK_DESTROY)
468 {
469 AV *av = (AV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)term->perl.self), "_selection", 10, 0));
470
471 for (int i = AvFILL (av); i >= 0; i--)
472 {
473 rxvt_selection *req = (rxvt_selection *)SvIV (*av_fetch (av, i, 0));
474 delete req;
475 }
476 }
404 477
405 bool event_consumed; 478 bool event_consumed;
406 479
407 if (htype == HOOK_INIT || htype == HOOK_DESTROY // must be called always
408 || term->perl.should_invoke [htype]) 480 if (term->perl.should_invoke [htype])
409 { 481 {
410 dSP; 482 dSP;
411 va_list ap; 483 va_list ap;
412 484
413 va_start (ap, htype); 485 va_start (ap, htype);
415 ENTER; 487 ENTER;
416 SAVETMPS; 488 SAVETMPS;
417 489
418 PUSHMARK (SP); 490 PUSHMARK (SP);
419 491
492 EXTEND (SP, 2);
420 XPUSHs (sv_2mortal (newSVterm (term))); 493 PUSHs (sv_2mortal (newSVterm (term)));
421 XPUSHs (sv_2mortal (newSViv (htype))); 494 PUSHs (sv_2mortal (newSViv (htype)));
422 495
423 for (;;) { 496 for (;;) {
424 data_type dt = (data_type)va_arg (ap, int); 497 data_type dt = (data_type)va_arg (ap, int);
425 498
426 switch (dt) 499 switch (dt)
583 FREETMPS; 656 FREETMPS;
584 LEAVE; 657 LEAVE;
585 658
586 if (SvTRUE (ERRSV)) 659 if (SvTRUE (ERRSV))
587 { 660 {
588 rxvt_warn ("perl hook %d evaluation error: %s", htype, SvPV_nolen (ERRSV)); 661 rxvt_warn ("perl hook %d evaluation error: %s", htype, SvPVbyte_nolen (ERRSV));
589 ungrab (term); // better lose the grab than the session 662 ungrab (term); // better lose the grab than the session
590 } 663 }
591 664
592 event_consumed = !!count; 665 event_consumed = !!count;
593 } 666 }
610 // don't allow further calls 683 // don't allow further calls
611 term->perl.self = 0; 684 term->perl.self = 0;
612 } 685 }
613 686
614 return event_consumed; 687 return event_consumed;
688}
689
690void
691rxvt_perl_interp::selection_finish (rxvt_selection *sel, char *data, unsigned int len)
692{
693 localise_env set_environ (perl_environ);
694
695 ENTER;
696 SAVETMPS;
697
698 dSP;
699 XPUSHs (sv_2mortal (newSVpvn (data, len)));
700 PUTBACK;
701 call_sv ((SV *)sel->cb_sv, G_VOID | G_DISCARD | G_EVAL);
702
703 if (SvTRUE (ERRSV))
704 rxvt_warn ("perl selection callback evaluation error: %s", SvPVbyte_nolen (ERRSV));
705
706 FREETMPS;
707 LEAVE;
615} 708}
616 709
617///////////////////////////////////////////////////////////////////////////// 710/////////////////////////////////////////////////////////////////////////////
618 711
619MODULE = urxvt PACKAGE = urxvt 712MODULE = urxvt PACKAGE = urxvt
753 const_iv (XIMSecondary), 846 const_iv (XIMSecondary),
754 const_iv (XIMTertiary), 847 const_iv (XIMTertiary),
755 const_iv (XIMVisibleToForward), 848 const_iv (XIMVisibleToForward),
756 const_iv (XIMVisibleToBackword), 849 const_iv (XIMVisibleToBackword),
757 const_iv (XIMVisibleToCenter), 850 const_iv (XIMVisibleToCenter),
851#if XRENDER
852 const_iv (PictStandardARGB32),
853 const_iv (PictStandardRGB24),
854 const_iv (PictStandardA8),
855 const_iv (PictStandardA4),
856 const_iv (PictStandardA1),
857 const_iv (RepeatNone),
858 const_iv (RepeatNormal),
859 const_iv (RepeatPad),
860 const_iv (RepeatReflect),
861#endif
758# if 0 862# if 0
759 const_iv (XIMForwardChar), 863 const_iv (XIMForwardChar),
760 const_iv (XIMBackwardChar), 864 const_iv (XIMBackwardChar),
761 const_iv (XIMForwardWord), 865 const_iv (XIMForwardWord),
762 const_iv (XIMBackwardWord), 866 const_iv (XIMBackwardWord),
770 const_iv (XIMDontChange), 874 const_iv (XIMDontChange),
771# endif 875# endif
772# endif 876# endif
773 }; 877 };
774 878
775 for (civ = const_iv + ARRAY_LENGTH(const_iv); civ-- > const_iv; ) 879 for (civ = const_iv + ecb_array_length (const_iv); civ > const_iv; civ--)
776 newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); 880 newCONSTSUB (stash, (char *)civ[-1].name, newSViv (civ[-1].iv));
777} 881}
778 882
779void 883void
780warn (const char *msg) 884warn (const char *msg)
781 CODE: 885 CODE:
786 CODE: 890 CODE:
787 rxvt_fatal ("%s", msg); 891 rxvt_fatal ("%s", msg);
788 892
789void 893void
790_exit (int status) 894_exit (int status)
895
896void
897catch_fatal (SV *block)
898 PROTOTYPE: &
899 CODE:
900 try
901 {
902 PUSHMARK (SP);
903 PUTBACK;
904 call_sv (block, G_VOID | G_DISCARD);
905 SPAGAIN;
906 }
907 catch (const rxvt_failure_exception &e)
908 {
909 croak ("rxvt_fatal exception caught, trying to continue.");
910 }
791 911
792NV 912NV
793NOW () 913NOW ()
794 CODE: 914 CODE:
795 RETVAL = ev::now (); 915 RETVAL = ev::now ();
853 for (rxvt_term **t = rxvt_term::termlist.begin (); t < rxvt_term::termlist.end (); t++) 973 for (rxvt_term **t = rxvt_term::termlist.begin (); t < rxvt_term::termlist.end (); t++)
854 if ((*t)->perl.self) 974 if ((*t)->perl.self)
855 PUSHs (sv_2mortal (newSVterm (*t))); 975 PUSHs (sv_2mortal (newSVterm (*t)));
856} 976}
857 977
978IV
979_new_selection_request (rxvt_term *term, int selnum, Time tm, Window win, Atom prop, SV *cb)
980 CODE:
981 rxvt_selection *req = new rxvt_selection (term->display, selnum, tm, win, prop, term);
982 req->cb_sv = newSVsv (cb);
983 AV *av = (AV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)term->perl.self), "_selection", 10, 0));
984 av_push (av, newSViv ((IV)req));
985 RETVAL = (IV)req;
986 OUTPUT:
987 RETVAL
988
989void
990_delete_selection_request (IV req_)
991 CODE:
992 rxvt_selection *req = (rxvt_selection *)req_;
993 AV *av = (AV *)SvRV (*hv_fetch ((HV *)SvRV ((SV *)req->term->perl.self), "_selection", 10, 0));
994 int i;
995
996 for (i = AvFILL (av); i >= 0; i--)
997 if (SvIV (*av_fetch (av, i, 1)) == req_)
998 break;
999
1000 for (; i < AvFILL (av); i++)
1001 av_store (av, i, SvREFCNT_inc (*av_fetch (av, i + 1, 0)));
1002
1003 av_pop (av);
1004
1005 delete req;
1006
858MODULE = urxvt PACKAGE = urxvt::term 1007MODULE = urxvt PACKAGE = urxvt::term
859 1008
860SV * 1009SV *
861_new (AV *env, AV *arg) 1010_new (AV *env, AV *arg)
862 CODE: 1011 CODE:
863{ 1012{
864 rxvt_term *term = new rxvt_term; 1013 rxvt_term *term = new rxvt_term;
865 1014
866 stringvec *argv = new stringvec; 1015 stringvec *argv = new stringvec;
867 stringvec *envv = new stringvec;
868
869 for (int i = 0; i <= AvFILL (arg); i++) 1016 for (int i = 0; i <= AvFILL (arg); i++)
870 argv->push_back (strdup (SvPVbyte_nolen (*av_fetch (arg, i, 1)))); 1017 argv->push_back (strdup (SvPVbyte_nolen (*av_fetch (arg, i, 1))));
871 1018
1019 stringvec *envv = new stringvec;
872 for (int i = AvFILL (env) + 1; i--; ) 1020 for (int i = AvFILL (env) + 1; i--; )
873 envv->push_back (strdup (SvPVbyte_nolen (*av_fetch (env, i, 1)))); 1021 envv->push_back (strdup (SvPVbyte_nolen (*av_fetch (env, i, 1))));
874 1022
875 envv->push_back (0);
876
877 try 1023 try
878 { 1024 {
879 term->init (argv, envv); 1025 term->init (argv, envv);
880 } 1026 }
881 catch (const class rxvt_failure_exception &e) 1027 catch (const class rxvt_failure_exception &e)
894rxvt_term::destroy () 1040rxvt_term::destroy ()
895 1041
896void 1042void
897rxvt_term::set_should_invoke (int htype, int inc) 1043rxvt_term::set_should_invoke (int htype, int inc)
898 CODE: 1044 CODE:
899 THIS->perl.should_invoke [htype] += inc; 1045 uint8_t &count = THIS->perl.should_invoke [htype];
1046 uint8_t prev = count;
1047 count += inc;
1048 if (!prev != !count)
1049 {
1050 // hook status changed, react
1051 switch (htype)
1052 {
1053 case HOOK_POSITION_CHANGE:
1054 if (count)
1055 THIS->get_window_origin (THIS->parent_x, THIS->parent_y);
1056 }
1057 }
900 1058
901int 1059int
902rxvt_term::grab_button (int button, U32 modifiers, Window window = THIS->vt) 1060rxvt_term::grab_button (int button, U32 modifiers, Window window = THIS->vt)
903 CODE: 1061 CODE:
904 RETVAL = XGrabButton (THIS->dpy, button, modifiers, window, 1, 1062 RETVAL = XGrabButton (THIS->dpy, button, modifiers, window, 1,
920 1078
921void 1079void
922rxvt_term::XUngrabKey (int keycode, U32 modifiers, Window window = THIS->vt) 1080rxvt_term::XUngrabKey (int keycode, U32 modifiers, Window window = THIS->vt)
923 CODE: 1081 CODE:
924 XUngrabKey (THIS->dpy, keycode, modifiers, window); 1082 XUngrabKey (THIS->dpy, keycode, modifiers, window);
925
926void
927rxvt_term::XUngrabKeyboard (Time eventtime)
928 CODE:
929 XUngrabKeyboard (THIS->dpy, eventtime);
930 1083
931bool 1084bool
932rxvt_term::grab (Time eventtime, int sync = 0) 1085rxvt_term::grab (Time eventtime, int sync = 0)
933 CODE: 1086 CODE:
934{ 1087{
1046 rxvt_pop_locale (); 1199 rxvt_pop_locale ();
1047 1200
1048 RETVAL = wcs2sv (wstr); 1201 RETVAL = wcs2sv (wstr);
1049 free (wstr); 1202 free (wstr);
1050} 1203}
1051 OUTPUT:
1052 RETVAL
1053
1054char *
1055rxvt_term::locale ()
1056 CODE:
1057 RETVAL = THIS->locale;
1058 OUTPUT: 1204 OUTPUT:
1059 RETVAL 1205 RETVAL
1060 1206
1061#define TERM_OFFSET(sym) offsetof (TermWin_t, sym) 1207#define TERM_OFFSET(sym) offsetof (TermWin_t, sym)
1062 1208
1169 RETVAL 1315 RETVAL
1170 1316
1171Window 1317Window
1172rxvt_term::parent () 1318rxvt_term::parent ()
1173 CODE: 1319 CODE:
1174 RETVAL = THIS->parent [0]; 1320 RETVAL = THIS->parent;
1175 OUTPUT: 1321 OUTPUT:
1176 RETVAL 1322 RETVAL
1177 1323
1178Window 1324int
1179rxvt_term::vt () 1325rxvt_term::parent_x ()
1180 CODE: 1326 CODE:
1181 RETVAL = THIS->vt; 1327 RETVAL = THIS->parent_x;
1328 OUTPUT:
1329 RETVAL
1330
1331int
1332rxvt_term::parent_y ()
1333 CODE:
1334 RETVAL = THIS->parent_y;
1182 OUTPUT: 1335 OUTPUT:
1183 RETVAL 1336 RETVAL
1184 1337
1185void 1338void
1186rxvt_term::vt_emask_add (U32 emask) 1339rxvt_term::vt_emask_add (U32 emask)
1206 if (newval <= 0) 1359 if (newval <= 0)
1207 THIS->scr_changeview (max (newval, THIS->top_row)); 1360 THIS->scr_changeview (max (newval, THIS->top_row));
1208} 1361}
1209 OUTPUT: 1362 OUTPUT:
1210 RETVAL 1363 RETVAL
1364
1365void
1366rxvt_term::set_urgency (bool enable)
1211 1367
1212void 1368void
1213rxvt_term::focus_in () 1369rxvt_term::focus_in ()
1214 1370
1215void 1371void
1448# include "rsinc.h" 1604# include "rsinc.h"
1449# undef def 1605# undef def
1450# undef reserve 1606# undef reserve
1451 }; 1607 };
1452 1608
1453 rs = rslist + ARRAY_LENGTH(rslist); 1609 rs = rslist + ecb_array_length (rslist);
1454 1610
1455 if (*name) 1611 if (*name)
1456 { 1612 {
1457 do { 1613 do {
1458 if (rs-- == rslist) 1614 if (rs-- == rslist)
1497 1653
1498 if (set >= 0) 1654 if (set >= 0)
1499 { 1655 {
1500 THIS->set_option (optval, set); 1656 THIS->set_option (optval, set);
1501 1657
1502 if (THIS->env_colorfgbg [0]) // avoid doing this before START 1658 if (THIS->init_done) // avoid doing this before START
1503 switch (optval) 1659 switch (optval)
1504 { 1660 {
1505 case Opt_skipBuiltinGlyphs: 1661 case Opt_skipBuiltinGlyphs:
1506 THIS->set_fonts (); 1662 THIS->set_fonts ();
1507 THIS->scr_remap_chars (); 1663 THIS->scr_remap_chars ();
1508 THIS->scr_touch (true); 1664 THIS->scr_touch (true);
1509 THIS->want_refresh = 1; 1665 THIS->want_refresh = 1;
1510 THIS->refresh_check (); 1666 THIS->refresh_check ();
1511 break; 1667 break;
1668#ifdef CURSOR_BLINK
1669 case Opt_cursorBlink:
1670 THIS->cursor_blink_reset ();
1671 break;
1672#endif
1512 1673
1513 case Opt_cursorUnderline: 1674 case Opt_cursorUnderline:
1514 THIS->want_refresh = 1; 1675 THIS->want_refresh = 1;
1515 THIS->refresh_check (); 1676 THIS->refresh_check ();
1516 break; 1677 break;
1530 CODE: 1691 CODE:
1531 RETVAL = 0 < THIS->parse_keysym (keysym, str); 1692 RETVAL = 0 < THIS->parse_keysym (keysym, str);
1532 THIS->keyboard->register_done (); 1693 THIS->keyboard->register_done ();
1533 OUTPUT: 1694 OUTPUT:
1534 RETVAL 1695 RETVAL
1696
1697void
1698rxvt_term::register_command (int keysym, unsigned int state, SV *str)
1699 CODE:
1700 wchar_t *wstr = sv2wcs (str);
1701 THIS->keyboard->register_user_translation (keysym, state, wstr);
1702 free (wstr);
1535 1703
1536void 1704void
1537rxvt_term::screen_cur (...) 1705rxvt_term::screen_cur (...)
1538 PROTOTYPE: $;$$ 1706 PROTOTYPE: $;$$
1539 ALIAS: 1707 ALIAS:
1647 1815
1648void 1816void
1649rxvt_term::scr_bell () 1817rxvt_term::scr_bell ()
1650 1818
1651void 1819void
1820rxvt_term::scr_recolour (bool refresh = true);
1821
1822void
1652rxvt_term::scr_change_screen (int screen) 1823rxvt_term::scr_change_screen (int screen)
1653 1824
1654void 1825void
1655rxvt_term::scr_add_lines (SV *string) 1826rxvt_term::scr_add_lines (SV *string)
1656 CODE: 1827 CODE:
1769 type, format, PropModeReplace, 1940 type, format, PropModeReplace,
1770 (unsigned char *)data_, len / elemsize); 1941 (unsigned char *)data_, len / elemsize);
1771} 1942}
1772 1943
1773Atom 1944Atom
1774XInternAtom (rxvt_term *term, char *atom_name, int only_if_exists = FALSE) 1945XInternAtom (rxvt_term *term, octet_string atom_name, int only_if_exists = FALSE)
1775 C_ARGS: term->dpy, atom_name, only_if_exists 1946 C_ARGS: term->dpy, atom_name, only_if_exists
1776 1947
1777char * 1948char *
1778XGetAtomName (rxvt_term *term, Atom atom) 1949XGetAtomName (rxvt_term *term, Atom atom)
1779 C_ARGS: term->dpy, atom 1950 C_ARGS: term->dpy, atom
1780 CLEANUP: 1951 CLEANUP:
1781 XFree (RETVAL); 1952 XFree (RETVAL);
1782 1953
1783void 1954void
1784XDeleteProperty (rxvt_term *term, Window window, Atom property) 1955XDeleteProperty (rxvt_term *term, Window window, Atom property)
1785 C_ARGS: term->dpy, window, property 1956 C_ARGS: term->dpy, window, property
1786 1957
1787Window 1958Window
1788rxvt_term::DefaultRootWindow () 1959rxvt_term::DefaultRootWindow ()
1789 CODE: 1960 CODE:
1790 RETVAL = THIS->display->root; 1961 RETVAL = THIS->display->root;
1842 PUSHs (newSVuv (child)); 2013 PUSHs (newSVuv (child));
1843 } 2014 }
1844} 2015}
1845 2016
1846############################################################################# 2017#############################################################################
2018# fancy bg bloatstuff (TODO: should be moved up somewhere)
2019
2020# TODO: ugly
2021void
2022rxvt_term::get_geometry ()
2023 PPCODE:
2024 EXTEND (SP, 4);
2025 PUSHs (sv_2mortal (newSViv (THIS->parent_x)));
2026 PUSHs (sv_2mortal (newSViv (THIS->parent_y)));
2027 PUSHs (sv_2mortal (newSViv (THIS->szHint.width)));
2028 PUSHs (sv_2mortal (newSViv (THIS->szHint.height)));
2029
2030#if HAVE_IMG
2031
2032rxvt_img *
2033rxvt_term::new_img (SV *format, int width, int height)
2034 CODE:
2035 XRenderPictFormat *f = SvOK (format)
2036 ? XRenderFindStandardFormat (THIS->dpy, SvIV (format))
2037 : XRenderFindVisualFormat (THIS->dpy, THIS->visual);
2038 RETVAL = new rxvt_img (THIS, f, width, height);
2039 OUTPUT:
2040 RETVAL
2041
2042#if ENABLE_TRANSPARENCY
2043
2044#if 0
2045
2046rxvt_img *
2047rxvt_term::new_img_from_root ()
2048 CODE:
2049 RETVAL = rxvt_img::new_from_root (THIS);
2050 OUTPUT:
2051 RETVAL
2052
2053#endif
2054
2055#endif
2056
2057#if HAVE_PIXBUF
2058
2059rxvt_img *
2060rxvt_term::new_img_from_file (octet_string filename)
2061 CODE:
2062 try
2063 {
2064 RETVAL = rxvt_img::new_from_file (THIS, filename);
2065 }
2066 catch (const class rxvt_failure_exception &e)
2067 {
2068 croak ("new_img_from_file failed");
2069 }
2070 OUTPUT:
2071 RETVAL
2072
2073#endif
2074
2075#if HAVE_BG_PIXMAP
2076
2077void
2078rxvt_term::set_background (rxvt_img *img)
2079 CODE:
2080 THIS->bg_destroy ();
2081 THIS->bg_pixmap = None;
2082 THIS->bg_flags &= ~rxvt_term::BG_NEEDS_REFRESH;
2083
2084 if (img) // TODO: cannot be false
2085 {
2086 img->unshare ();
2087 THIS->bg_pixmap = img->steal ();
2088 THIS->bg_flags |= rxvt_term::BG_NEEDS_REFRESH;
2089 THIS->bg_valid_since = ev::now (); // TODO: extra bloat
2090 }
2091
2092#endif
2093
2094#endif
2095
2096#############################################################################
1847# urxvt::overlay 2097# urxvt::overlay
1848############################################################################# 2098#############################################################################
1849 2099
1850MODULE = urxvt PACKAGE = urxvt::overlay 2100MODULE = urxvt PACKAGE = urxvt::overlay
1851 2101
1861void 2111void
1862overlay::DESTROY () 2112overlay::DESTROY ()
1863 2113
1864INCLUDE: $PERL <iom_perl.xs -pe s/IOM_MODULE/urxvt/g,s/IOM_CLASS/urxvt/g | 2114INCLUDE: $PERL <iom_perl.xs -pe s/IOM_MODULE/urxvt/g,s/IOM_CLASS/urxvt/g |
1865 2115
2116MODULE = urxvt PACKAGE = urxvt::pixbuf PREFIX = gdk_pixbuf_
2117
2118#if HAVE_PIXBUF
2119
2120urxvt::pixbuf gdk_pixbuf_new_from_file (SV *klass, octet_string filename)
2121 C_ARGS: filename, 0
2122
2123void
2124DESTROY (urxvt::pixbuf self)
2125 CODE:
2126 gdk_pixbuf_unref (self);
2127
2128#endif
2129
2130MODULE = urxvt PACKAGE = urxvt::img
2131
2132#if HAVE_IMG
2133
2134# rxvt_img *new (rxvt_screen *screen, XRenderPictFormat *format, int width, int height)
2135# rxvt_img *rxvt_img (rxvt_screen *screen, XRenderPictFormat *format, int width, int height, Pixmap pixmap);
2136
2137int
2138rxvt_img::w ()
2139 CODE:
2140 RETVAL = THIS->w;
2141 OUTPUT:
2142 RETVAL
2143
2144int
2145rxvt_img::h ()
2146 CODE:
2147 RETVAL = THIS->h;
2148 OUTPUT:
2149 RETVAL
2150
2151bool
2152rxvt_img::shared ()
2153 CODE:
2154 RETVAL = THIS->shared;
2155 OUTPUT:
2156 RETVAL
2157
2158Pixmap
2159rxvt_img::pm ()
2160 CODE:
2161 RETVAL = THIS->pm;
2162 OUTPUT:
2163 RETVAL
2164
2165void
2166rxvt_img::fill (SV *c)
2167 INIT:
2168 rxvt_color rc;
2169 parse_color (THIS->s, rc, c);
2170 C_ARGS: rc
2171
2172void
2173rxvt_img::DESTROY ()
2174 CODE:
2175 delete THIS;
2176
2177rxvt_img *
2178rxvt_img::blur (int rh, int rv)
2179
2180void
2181rxvt_img::brightness (NV r, NV g, NV b, NV a = 1.)
2182
2183void
2184rxvt_img::contrast (NV r, NV g, NV b, NV a = 1.)
2185
2186void
2187rxvt_img::unshare ()
2188
2189rxvt_img *
2190rxvt_img::clone ()
2191
2192rxvt_img *
2193rxvt_img::sub_rect (int x, int y, int width, int height, render_repeat_mode repeat = RepeatNormal)
2194
2195rxvt_img *
2196rxvt_img::transform (int new_width, int new_height, NV p11, NV p12, NV p13, NV p21, NV p22, NV p23, NV p31, NV p32, NV p33, render_repeat_mode repeat = RepeatNormal)
2197 INIT:
2198 double matrix[9] = {
2199 p11, p12, p13,
2200 p21, p22, p23,
2201 p31, p32, p33
2202 };
2203 C_ARGS: new_width, new_height, matrix, repeat
2204
2205rxvt_img *
2206rxvt_img::scale (int new_width, int new_height)
2207
2208rxvt_img *
2209rxvt_img::rotate (int new_width, int new_height, int x, int y, NV phi, render_repeat_mode repeat = RepeatNormal)
2210
2211#endif
2212

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines