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.167 by root, Tue Jun 5 13:39:26 2012 UTC vs.
Revision 1.182 by root, Thu Jun 7 16:30:58 2012 UTC

382 } 382 }
383 383
384 rxvt_pop_locale (); 384 rxvt_pop_locale ();
385 } 385 }
386 386
387 if (perl) 387 if (perl && !term->perl.self)
388 { 388 {
389 // runs outside of perls ENV 389 // runs outside of perls ENV
390 term->perl.self = (void *)newSVptr ((void *)term, "urxvt::term"); 390 term->perl.self = (void *)newSVptr ((void *)term, "urxvt::term");
391 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); 392 hv_store ((HV *)SvRV ((SV *)term->perl.self), "_selection", 10, newRV_noinc ((SV *)newAV ()), 0);
393 } 393 }
394} 394}
395 395
396void
397rxvt_perl_interp::usage (rxvt_term *term, int type)
398{
399 localise_env set_environ (perl_environ);
400
401 ENTER;
402 SAVETMPS;
403
404 dSP;
405 PUSHMARK (SP);
406 EXTEND (SP, 2);
407 PUSHs (sv_2mortal (newSVterm (term)));
408 PUSHs (sv_2mortal (newSViv (type)));
409 PUTBACK;
410 call_pv ("urxvt::usage", G_VOID | G_DISCARD);
411
412 FREETMPS;
413 LEAVE;
414}
415
416uint8_t
417rxvt_perl_interp::parse_resource (rxvt_term *term, const char *name, bool arg, bool longopt, bool flag, const char *value)
418{
419 localise_env set_environ (perl_environ);
420
421 ENTER;
422 SAVETMPS;
423
424 dSP;
425 PUSHMARK (SP);
426 EXTEND (SP, 6);
427 PUSHs (sv_2mortal (newSVterm (term)));
428 PUSHs (sv_2mortal (newSVpv (name, 0)));
429 PUSHs (arg ? &PL_sv_yes : &PL_sv_no);
430 PUSHs (longopt ? &PL_sv_yes : &PL_sv_no);
431 PUSHs (flag ? &PL_sv_yes : &PL_sv_no);
432 PUSHs (value ? sv_2mortal (newSVpv (value, 0)) : &PL_sv_undef);
433 PUTBACK;
434 call_pv ("urxvt::parse_resource", G_SCALAR);
435 SPAGAIN;
436
437 uint8_t ret = POPi;
438
439 FREETMPS;
440 LEAVE;
441
442 return ret;
443}
444
396static void 445static void
397ungrab (rxvt_term *THIS) 446ungrab (rxvt_term *THIS)
398{ 447{
399 if (THIS->perl.grabtime) 448 if (THIS->perl.grabtime)
400 { 449 {
431 } 480 }
432 } 481 }
433 482
434 bool event_consumed; 483 bool event_consumed;
435 484
436 if (htype == HOOK_INIT || htype == HOOK_DESTROY // must be called always
437 || term->perl.should_invoke [htype]) 485 if (term->perl.should_invoke [htype])
438 { 486 {
439 dSP; 487 dSP;
440 va_list ap; 488 va_list ap;
441 489
442 va_start (ap, htype); 490 va_start (ap, htype);
652 ENTER; 700 ENTER;
653 SAVETMPS; 701 SAVETMPS;
654 702
655 dSP; 703 dSP;
656 XPUSHs (sv_2mortal (newSVpvn (data, len))); 704 XPUSHs (sv_2mortal (newSVpvn (data, len)));
705 PUTBACK;
657 call_sv ((SV *)sel->cb_sv, G_VOID | G_DISCARD | G_EVAL); 706 call_sv ((SV *)sel->cb_sv, G_VOID | G_DISCARD | G_EVAL);
658 707
659 if (SvTRUE (ERRSV)) 708 if (SvTRUE (ERRSV))
660 rxvt_warn ("perl selection callback evaluation error: %s", SvPVbyte_nolen (ERRSV)); 709 rxvt_warn ("perl selection callback evaluation error: %s", SvPVbyte_nolen (ERRSV));
661 710
835 for (civ = const_iv + ecb_array_length (const_iv); civ > const_iv; civ--) 884 for (civ = const_iv + ecb_array_length (const_iv); civ > const_iv; civ--)
836 newCONSTSUB (stash, (char *)civ[-1].name, newSViv (civ[-1].iv)); 885 newCONSTSUB (stash, (char *)civ[-1].name, newSViv (civ[-1].iv));
837} 886}
838 887
839void 888void
889log (const char *msg)
890 CODE:
891 rxvt_log ("%s", msg);
892
893void
840warn (const char *msg) 894warn (const char *msg)
841 CODE: 895 CODE:
842 rxvt_warn ("%s", msg); 896 rxvt_warn ("%s", msg);
843 897
844void 898void
1009 case HOOK_POSITION_CHANGE: 1063 case HOOK_POSITION_CHANGE:
1010 if (count) 1064 if (count)
1011 THIS->get_window_origin (THIS->parent_x, THIS->parent_y); 1065 THIS->get_window_origin (THIS->parent_x, THIS->parent_y);
1012 } 1066 }
1013 } 1067 }
1068
1069void
1070rxvt_term::put_option_db (octet_string specifier, octet_string value)
1071 CODE:
1072 XrmPutStringResource (&THIS->option_db, specifier, value);
1014 1073
1015int 1074int
1016rxvt_term::grab_button (int button, U32 modifiers, Window window = THIS->vt) 1075rxvt_term::grab_button (int button, U32 modifiers, Window window = THIS->vt)
1017 CODE: 1076 CODE:
1018 RETVAL = XGrabButton (THIS->dpy, button, modifiers, window, 1, 1077 RETVAL = XGrabButton (THIS->dpy, button, modifiers, window, 1,
1973############################################################################# 2032#############################################################################
1974# fancy bg bloatstuff (TODO: should be moved up somewhere) 2033# fancy bg bloatstuff (TODO: should be moved up somewhere)
1975 2034
1976# TODO: ugly 2035# TODO: ugly
1977void 2036void
1978rxvt_term::get_geometry () 2037rxvt_term::background_geometry (bool border = false)
1979 PPCODE: 2038 PPCODE:
1980 EXTEND (SP, 4); 2039 EXTEND (SP, 4);
1981 PUSHs (sv_2mortal (newSViv (THIS->parent_x))); 2040 PUSHs (sv_2mortal (newSViv (THIS->parent_x + (border ? THIS->window_vt_x : 0))));
1982 PUSHs (sv_2mortal (newSViv (THIS->parent_y))); 2041 PUSHs (sv_2mortal (newSViv (THIS->parent_y + (border ? THIS->window_vt_y : 0))));
1983 PUSHs (sv_2mortal (newSViv (THIS->szHint.width))); 2042 PUSHs (sv_2mortal (newSViv (border ? THIS->vt_width : THIS->szHint.width )));
1984 PUSHs (sv_2mortal (newSViv (THIS->szHint.height))); 2043 PUSHs (sv_2mortal (newSViv (border ? THIS->vt_height : THIS->szHint.height)));
1985 2044
1986#if HAVE_IMG 2045#if HAVE_IMG
2046
2047#if 0
1987 2048
1988rxvt_img * 2049rxvt_img *
1989rxvt_term::new_img (SV *format, int width, int height) 2050rxvt_term::new_img (SV *format, int width, int height)
1990 CODE: 2051 CODE:
1991 XRenderPictFormat *f = SvOK (format) 2052 XRenderPictFormat *f = SvOK (format)
1992 ? XRenderFindVisualFormat (THIS->dpy, THIS->visual)
1993 : XRenderFindStandardFormat (THIS->dpy, SvIV (format)); 2053 ? XRenderFindStandardFormat (THIS->dpy, SvIV (format))
2054 : XRenderFindVisualFormat (THIS->dpy, THIS->visual);
1994 RETVAL = new rxvt_img (THIS, f, width, height); 2055 RETVAL = new rxvt_img (THIS, f, width, height);
1995 OUTPUT: 2056 OUTPUT:
1996 RETVAL 2057 RETVAL
1997 2058
2059#endif
2060
1998#if ENABLE_TRANSPARENCY 2061#if ENABLE_TRANSPARENCY
1999
2000#if 0
2001 2062
2002rxvt_img * 2063rxvt_img *
2003rxvt_term::new_img_from_root () 2064rxvt_term::new_img_from_root ()
2004 CODE: 2065 CODE:
2005 RETVAL = rxvt_img::new_from_root (THIS); 2066 RETVAL = rxvt_img::new_from_root (THIS);
2006 OUTPUT: 2067 OUTPUT:
2007 RETVAL 2068 RETVAL
2008 2069
2009#endif 2070#endif
2010 2071
2011#endif
2012
2013#if HAVE_PIXBUF 2072#if HAVE_PIXBUF
2014 2073
2015rxvt_img * 2074rxvt_img *
2016rxvt_term::new_img_from_file (octet_string filename) 2075rxvt_term::new_img_from_file (octet_string filename)
2017 CODE: 2076 CODE:
2029#endif 2088#endif
2030 2089
2031#if HAVE_BG_PIXMAP 2090#if HAVE_BG_PIXMAP
2032 2091
2033void 2092void
2034rxvt_term::set_background (rxvt_img *img) 2093rxvt_term::set_background (rxvt_img *img, bool border = false)
2035 CODE: 2094 CODE:
2036 THIS->bg_destroy (); 2095 THIS->bg_destroy ();
2037 THIS->bg_pixmap = None; 2096 THIS->bg_pixmap = None;
2038 THIS->bg_flags &= ~rxvt_term::BG_NEEDS_REFRESH; 2097 THIS->bg_flags &= ~(rxvt_term::BG_NEEDS_REFRESH | rxvt_term::BG_INHIBIT_RENDER | rxvt_term::BG_IS_TRANSPARENT);
2039 2098
2040 if (img) // TODO: cannot be false 2099 if (img) // TODO: cannot be false
2041 { 2100 {
2042 img->unshare (); 2101 img = img->reify ();
2102 rxvt_img *img2 = img->convert_to (XRenderFindVisualFormat (THIS->dpy, THIS->visual), THIS->pix_colors [Color_bg]);
2103 delete img;
2043 THIS->bg_pixmap = img->steal (); 2104 THIS->bg_pixmap = img2->steal ();
2105 THIS->bg_flags |= rxvt_term::BG_NEEDS_REFRESH | rxvt_term::BG_INHIBIT_RENDER;
2106
2107 if (!border)
2044 THIS->bg_flags |= rxvt_term::BG_NEEDS_REFRESH; 2108 THIS->bg_flags |= rxvt_term::BG_IS_TRANSPARENT;
2109
2045 THIS->bg_valid_since = ev::now (); // TODO: extra bloat 2110 THIS->bg_valid_since = ev::now (); // TODO: extra bloat
2046 } 2111 }
2047 2112
2048#endif 2113#endif
2049 2114
2099 2164
2100int 2165int
2101rxvt_img::h () 2166rxvt_img::h ()
2102 CODE: 2167 CODE:
2103 RETVAL = THIS->h; 2168 RETVAL = THIS->h;
2104 OUTPUT:
2105 RETVAL
2106
2107bool
2108rxvt_img::shared ()
2109 CODE:
2110 RETVAL = THIS->shared;
2111 OUTPUT: 2169 OUTPUT:
2112 RETVAL 2170 RETVAL
2113 2171
2114Pixmap 2172Pixmap
2115rxvt_img::pm () 2173rxvt_img::pm ()
2129rxvt_img::DESTROY () 2187rxvt_img::DESTROY ()
2130 CODE: 2188 CODE:
2131 delete THIS; 2189 delete THIS;
2132 2190
2133void 2191void
2134rxvt_img::blur (int rh, int rv) 2192rxvt_img::unshare ()
2193
2194void
2195rxvt_img::repeat_mode (render_repeat_mode repeat = RepeatNormal)
2196
2197void
2198rxvt_img::move (int dx, int dy)
2135 2199
2136void 2200void
2137rxvt_img::brightness (NV r, NV g, NV b, NV a = 1.) 2201rxvt_img::brightness (NV r, NV g, NV b, NV a = 1.)
2138 2202
2139void 2203void
2140rxvt_img::contrast (NV r, NV g, NV b, NV a = 1.) 2204rxvt_img::contrast (NV r, NV g, NV b, NV a = 1.)
2141
2142void
2143rxvt_img::unshare ()
2144 2205
2145rxvt_img * 2206rxvt_img *
2146rxvt_img::clone () 2207rxvt_img::clone ()
2147 2208
2148rxvt_img * 2209rxvt_img *
2149rxvt_img::sub_rect (int x, int y, int width, int height, render_repeat_mode repeat = RepeatNormal) 2210rxvt_img::reify ()
2150 2211
2151rxvt_img * 2212rxvt_img *
2213rxvt_img::sub_rect (int x, int y, int width, int height)
2214
2215rxvt_img *
2216rxvt_img::blur (int rh, int rv)
2217
2218rxvt_img *
2152rxvt_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) 2219rxvt_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)
2153 INIT: 2220 INIT:
2154 double matrix[9] = { 2221 double matrix[9] = {
2155 p11, p12, p13, 2222 p11, p12, p13,
2156 p21, p22, p23, 2223 p21, p22, p23,
2157 p31, p32, p33 2224 p31, p32, p33
2158 }; 2225 };
2159 C_ARGS: new_width, new_height, matrix, repeat 2226 C_ARGS: new_width, new_height, matrix
2160 2227
2161rxvt_img * 2228rxvt_img *
2162rxvt_img::scale (int new_width, int new_height) 2229rxvt_img::scale (int new_width, int new_height)
2163 2230
2164rxvt_img * 2231rxvt_img *
2165rxvt_img::rotate (int new_width, int new_height, int x, int y, NV phi, render_repeat_mode repeat = RepeatNormal) 2232rxvt_img::rotate (int new_width, int new_height, int x, int y, NV phi)
2166 2233
2167#endif 2234#endif
2168 2235

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines