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.158 by root, Sun Jun 3 18:04:44 2012 UTC vs.
Revision 1.170 by root, Tue Jun 5 19:32:29 2012 UTC

52///////////////////////////////////////////////////////////////////////////// 52/////////////////////////////////////////////////////////////////////////////
53 53
54typedef char * octet_string; 54typedef char * octet_string;
55typedef char * utf8_string; 55typedef char * utf8_string;
56 56
57typedef int render_repeat_mode;
58
57typedef GdkPixbuf * urxvt__pixbuf; 59typedef GdkPixbuf * urxvt__pixbuf;
58typedef rxvt_img * urxvt__img; 60typedef rxvt_img * urxvt__img;
59 61
60///////////////////////////////////////////////////////////////////////////// 62/////////////////////////////////////////////////////////////////////////////
61 63
389 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);
390 hv_store ((HV *)SvRV ((SV *)term->perl.self), "_selection", 10, newRV_noinc ((SV *)newAV ()), 0); 392 hv_store ((HV *)SvRV ((SV *)term->perl.self), "_selection", 10, newRV_noinc ((SV *)newAV ()), 0);
391 } 393 }
392} 394}
393 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;
438}
439
394static void 440static void
395ungrab (rxvt_term *THIS) 441ungrab (rxvt_term *THIS)
396{ 442{
397 if (THIS->perl.grabtime) 443 if (THIS->perl.grabtime)
398 { 444 {
429 } 475 }
430 } 476 }
431 477
432 bool event_consumed; 478 bool event_consumed;
433 479
434 if (htype == HOOK_INIT || htype == HOOK_DESTROY // must be called always
435 || term->perl.should_invoke [htype]) 480 if (term->perl.should_invoke [htype])
436 { 481 {
437 dSP; 482 dSP;
438 va_list ap; 483 va_list ap;
439 484
440 va_start (ap, htype); 485 va_start (ap, htype);
650 ENTER; 695 ENTER;
651 SAVETMPS; 696 SAVETMPS;
652 697
653 dSP; 698 dSP;
654 XPUSHs (sv_2mortal (newSVpvn (data, len))); 699 XPUSHs (sv_2mortal (newSVpvn (data, len)));
700 PUTBACK;
655 call_sv ((SV *)sel->cb_sv, G_VOID | G_DISCARD | G_EVAL); 701 call_sv ((SV *)sel->cb_sv, G_VOID | G_DISCARD | G_EVAL);
656 702
657 if (SvTRUE (ERRSV)) 703 if (SvTRUE (ERRSV))
658 rxvt_warn ("perl selection callback evaluation error: %s", SvPVbyte_nolen (ERRSV)); 704 rxvt_warn ("perl selection callback evaluation error: %s", SvPVbyte_nolen (ERRSV));
659 705
800 const_iv (XIMSecondary), 846 const_iv (XIMSecondary),
801 const_iv (XIMTertiary), 847 const_iv (XIMTertiary),
802 const_iv (XIMVisibleToForward), 848 const_iv (XIMVisibleToForward),
803 const_iv (XIMVisibleToBackword), 849 const_iv (XIMVisibleToBackword),
804 const_iv (XIMVisibleToCenter), 850 const_iv (XIMVisibleToCenter),
805#if HAVE_XRENDER 851#if XRENDER
806 const_iv (PictStandardARGB32), 852 const_iv (PictStandardARGB32),
807 const_iv (PictStandardRGB24), 853 const_iv (PictStandardRGB24),
808 const_iv (PictStandardA8), 854 const_iv (PictStandardA8),
809 const_iv (PictStandardA4), 855 const_iv (PictStandardA4),
810 const_iv (PictStandardA1), 856 const_iv (PictStandardA1),
857 const_iv (RepeatNone),
858 const_iv (RepeatNormal),
859 const_iv (RepeatPad),
860 const_iv (RepeatReflect),
811#endif 861#endif
812# if 0 862# if 0
813 const_iv (XIMForwardChar), 863 const_iv (XIMForwardChar),
814 const_iv (XIMBackwardChar), 864 const_iv (XIMBackwardChar),
815 const_iv (XIMForwardWord), 865 const_iv (XIMForwardWord),
841 rxvt_fatal ("%s", msg); 891 rxvt_fatal ("%s", msg);
842 892
843void 893void
844_exit (int status) 894_exit (int status)
845 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 }
911
846NV 912NV
847NOW () 913NOW ()
848 CODE: 914 CODE:
849 RETVAL = ev::now (); 915 RETVAL = ev::now ();
850 OUTPUT: 916 OUTPUT:
974rxvt_term::destroy () 1040rxvt_term::destroy ()
975 1041
976void 1042void
977rxvt_term::set_should_invoke (int htype, int inc) 1043rxvt_term::set_should_invoke (int htype, int inc)
978 CODE: 1044 CODE:
979 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 }
980 1058
981int 1059int
982rxvt_term::grab_button (int button, U32 modifiers, Window window = THIS->vt) 1060rxvt_term::grab_button (int button, U32 modifiers, Window window = THIS->vt)
983 CODE: 1061 CODE:
984 RETVAL = XGrabButton (THIS->dpy, button, modifiers, window, 1, 1062 RETVAL = XGrabButton (THIS->dpy, button, modifiers, window, 1,
1241 CODE: 1319 CODE:
1242 RETVAL = THIS->parent; 1320 RETVAL = THIS->parent;
1243 OUTPUT: 1321 OUTPUT:
1244 RETVAL 1322 RETVAL
1245 1323
1246Window 1324int
1247rxvt_term::vt () 1325rxvt_term::parent_x ()
1248 CODE: 1326 CODE:
1249 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;
1250 OUTPUT: 1335 OUTPUT:
1251 RETVAL 1336 RETVAL
1252 1337
1253void 1338void
1254rxvt_term::vt_emask_add (U32 emask) 1339rxvt_term::vt_emask_add (U32 emask)
1730 1815
1731void 1816void
1732rxvt_term::scr_bell () 1817rxvt_term::scr_bell ()
1733 1818
1734void 1819void
1820rxvt_term::scr_recolour (bool refresh = true);
1821
1822void
1735rxvt_term::scr_change_screen (int screen) 1823rxvt_term::scr_change_screen (int screen)
1736 1824
1737void 1825void
1738rxvt_term::scr_add_lines (SV *string) 1826rxvt_term::scr_add_lines (SV *string)
1739 CODE: 1827 CODE:
1852 type, format, PropModeReplace, 1940 type, format, PropModeReplace,
1853 (unsigned char *)data_, len / elemsize); 1941 (unsigned char *)data_, len / elemsize);
1854} 1942}
1855 1943
1856Atom 1944Atom
1857XInternAtom (rxvt_term *term, char *atom_name, int only_if_exists = FALSE) 1945XInternAtom (rxvt_term *term, octet_string atom_name, int only_if_exists = FALSE)
1858 C_ARGS: term->dpy, atom_name, only_if_exists 1946 C_ARGS: term->dpy, atom_name, only_if_exists
1859 1947
1860char * 1948char *
1861XGetAtomName (rxvt_term *term, Atom atom) 1949XGetAtomName (rxvt_term *term, Atom atom)
1862 C_ARGS: term->dpy, atom 1950 C_ARGS: term->dpy, atom
1863 CLEANUP: 1951 CLEANUP:
1864 XFree (RETVAL); 1952 XFree (RETVAL);
1865 1953
1866void 1954void
1867XDeleteProperty (rxvt_term *term, Window window, Atom property) 1955XDeleteProperty (rxvt_term *term, Window window, Atom property)
1868 C_ARGS: term->dpy, window, property 1956 C_ARGS: term->dpy, window, property
1869 1957
1870Window 1958Window
1871rxvt_term::DefaultRootWindow () 1959rxvt_term::DefaultRootWindow ()
1872 CODE: 1960 CODE:
1873 RETVAL = THIS->display->root; 1961 RETVAL = THIS->display->root;
1927} 2015}
1928 2016
1929############################################################################# 2017#############################################################################
1930# fancy bg bloatstuff (TODO: should be moved up somewhere) 2018# fancy bg bloatstuff (TODO: should be moved up somewhere)
1931 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
1932#ifdef ENABLE_TRANSPARENCY 2042#if ENABLE_TRANSPARENCY
1933 2043
2044#if 0
2045
1934# rxvt_img * 2046rxvt_img *
1935# rxvt_term::new_root_img () 2047rxvt_term::new_img_from_root ()
1936# CODE: 2048 CODE:
1937# RETVAL = rxvt_img::new_from_root (THIS); 2049 RETVAL = rxvt_img::new_from_root (THIS);
1938# OUTPUT: 2050 OUTPUT:
1939# RETVAL 2051 RETVAL
1940 2052
1941#endif 2053#endif
1942 2054
2055#endif
2056
1943#if HAVE_PIXBUF 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
1944 2093
1945#endif 2094#endif
1946 2095
1947############################################################################# 2096#############################################################################
1948# urxvt::overlay 2097# urxvt::overlay
1982 2131
1983#if HAVE_IMG 2132#if HAVE_IMG
1984 2133
1985# rxvt_img *new (rxvt_screen *screen, XRenderPictFormat *format, int width, int height) 2134# rxvt_img *new (rxvt_screen *screen, XRenderPictFormat *format, int width, int height)
1986# rxvt_img *rxvt_img (rxvt_screen *screen, XRenderPictFormat *format, int width, int height, Pixmap pixmap); 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
1987 2164
1988void 2165void
1989rxvt_img::fill (SV *c) 2166rxvt_img::fill (SV *c)
1990 INIT: 2167 INIT:
1991 rxvt_color rc; 2168 rxvt_color rc;
1992 parse_color (THIS->s, rc, c); 2169 parse_color (THIS->s, rc, c);
1993 C_ARGS: rc 2170 C_ARGS: rc
1994 2171
1995void 2172void
2173rxvt_img::DESTROY ()
2174 CODE:
2175 delete THIS;
2176
2177rxvt_img *
1996rxvt_img::blur (int rh, int rv) 2178rxvt_img::blur (int rh, int rv)
1997 2179
1998void 2180void
1999rxvt_img::brightness (double r, double g, double b, double a = 1.) 2181rxvt_img::brightness (NV r, NV g, NV b, NV a = 1.)
2000 2182
2001void 2183void
2002rxvt_img::contrast (double r, double g, double b, double a = 1.) 2184rxvt_img::contrast (NV r, NV g, NV b, NV a = 1.)
2185
2186void
2187rxvt_img::unshare ()
2003 2188
2004rxvt_img * 2189rxvt_img *
2005rxvt_img::copy () 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
2006 2204
2007rxvt_img * 2205rxvt_img *
2008rxvt_img::scale (int new_width, int new_height) 2206rxvt_img::scale (int new_width, int new_height)
2009 2207
2010# rxvt_img * 2208rxvt_img *
2011# rxvt_img::transform (int new_width, int new_height, double matrix[16]); 2209rxvt_img::rotate (int new_width, int new_height, int x, int y, NV phi, render_repeat_mode repeat = RepeatNormal)
2012 2210
2013#endif 2211#endif
2014 2212

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines