--- rxvt-unicode/src/rxvtperl.xs 2012/06/07 17:30:33 1.185 +++ rxvt-unicode/src/rxvtperl.xs 2012/06/12 10:45:53 1.192 @@ -56,7 +56,9 @@ typedef int render_repeat_mode; +#if HAVE_PIXBUF typedef GdkPixbuf * urxvt__pixbuf; +#endif typedef rxvt_img * urxvt__img; ///////////////////////////////////////////////////////////////////////////// @@ -64,7 +66,7 @@ static void parse_color (rxvt_screen *s, rxvt_color &c, SV *sv) { - //TODO: support component stuff + //TODO: support component stuff, 0..1 c.set (s, SvPVbyte_nolen (sv)); } @@ -343,7 +345,7 @@ } void -rxvt_perl_interp::init (rxvt_term *term) +rxvt_perl_interp::init () { if (!perl) { @@ -383,6 +385,12 @@ rxvt_pop_locale (); } +} + +void +rxvt_perl_interp::init (rxvt_term *term) +{ + init (); if (perl && !term->perl.self) { @@ -394,6 +402,12 @@ } void +rxvt_perl_interp::eval (const char *str) +{ + eval_pv (str, 1); +} + +void rxvt_perl_interp::usage (rxvt_term *term, int type) { localise_env set_environ (perl_environ); @@ -2032,7 +2046,13 @@ ############################################################################# # fancy bg bloatstuff (TODO: should be moved up somewhere) -# TODO: ugly +bool +rxvt_term::has_render () + CODE: + RETVAL = THIS->display->flags & DISPLAY_HAS_RENDER; + OUTPUT: + RETVAL + void rxvt_term::background_geometry (bool border = false) PPCODE: @@ -2044,20 +2064,17 @@ #if HAVE_IMG -#if 0 - rxvt_img * -rxvt_term::new_img (SV *format, int width, int height) +rxvt_term::new_img (SV *format, int width = 1, int height = 1) CODE: XRenderPictFormat *f = SvOK (format) ? XRenderFindStandardFormat (THIS->dpy, SvIV (format)) : XRenderFindVisualFormat (THIS->dpy, THIS->visual); - RETVAL = new rxvt_img (THIS, f, width, height); + RETVAL = new rxvt_img (THIS, f, 0, 0, width, height); + RETVAL->alloc (); OUTPUT: RETVAL -#endif - #if ENABLE_TRANSPARENCY rxvt_img * @@ -2093,42 +2110,30 @@ rxvt_term::set_background (rxvt_img *img, bool border = false) CODE: THIS->bg_destroy (); - THIS->bg_pixmap = None; THIS->bg_flags &= ~(rxvt_term::BG_NEEDS_REFRESH | rxvt_term::BG_INHIBIT_RENDER | rxvt_term::BG_IS_TRANSPARENT); if (img) // TODO: cannot be false { img = img->clone (); // own the img - { - rxvt_img *img2 = img->convert_format (XRenderFindVisualFormat (THIS->dpy, THIS->visual), THIS->pix_colors [Color_bg]); - delete img; - img = img2; - } - if (img->repeat != RepeatNormal) // X11 only supports RepeatNormal as bg pixmap - { - rxvt_img *img2 = img->sub_rect (0, 0, - border ? THIS->vt_width : THIS->szHint.width, - border ? THIS->vt_height : THIS->szHint.height); - delete img; - img = img2; - } + img->sub_rect (0, 0, + border ? THIS->vt_width : THIS->szHint.width, + border ? THIS->vt_height : THIS->szHint.height) + ->replace (img); + + // just in case, should usually be a nop + img->reify () + ->replace (img); - { - // just in case, should usually be a nop - rxvt_img *img2 = img->reify (); - delete img; - img = img2; - } + img->convert_format (XRenderFindVisualFormat (THIS->dpy, THIS->visual), THIS->pix_colors [Color_bg]) + ->replace (img); - THIS->bg_pixmap = img->steal (); + THIS->bg_img = img; THIS->bg_flags |= rxvt_term::BG_NEEDS_REFRESH | rxvt_term::BG_INHIBIT_RENDER; if (!border) THIS->bg_flags |= rxvt_term::BG_IS_TRANSPARENT; - - delete img; } #endif @@ -2242,20 +2247,20 @@ rxvt_img::blur (int rh, int rv) rxvt_img * -rxvt_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) +rxvt_img::transform (NV p11, NV p12, NV p13, NV p21, NV p22, NV p23, NV p31, NV p32, NV p33, int new_width = 0, int new_height = 0) INIT: double matrix[9] = { p11, p12, p13, p21, p22, p23, p31, p32, p33 }; - C_ARGS: new_width, new_height, matrix + C_ARGS: matrix, new_width, new_height rxvt_img * rxvt_img::scale (int new_width, int new_height) rxvt_img * -rxvt_img::rotate (int new_width, int new_height, int x, int y, NV phi) +rxvt_img::rotate (int x, int y, NV phi, int new_width = 0, int new_height = 0) #endif