--- rxvt-unicode/src/rxvt.h 2012/05/28 14:26:11 1.488 +++ rxvt-unicode/src/rxvt.h 2012/06/05 11:00:40 1.499 @@ -72,7 +72,7 @@ #include #include -#ifdef HAVE_PIXBUF +#if HAVE_PIXBUF # include #endif @@ -85,6 +85,7 @@ #include "rxvtutil.h" #include "rxvtfont.h" #include "rxvttoolkit.h" +#include "rxvtimg.h" #include "scrollbar.h" #include "ev_cpp.h" #include "libptytty.h" @@ -149,8 +150,8 @@ void rxvt_vlog (const char *fmt, va_list arg_ptr) NOTHROW; void rxvt_log (const char *fmt,...) NOTHROW; void rxvt_warn (const char *fmt,...) NOTHROW; -void rxvt_fatal (const char *fmt, ...) THROW ((class rxvt_failure_exception)) ecb_noreturn; -void rxvt_exit_failure () THROW ((class rxvt_failure_exception)) ecb_noreturn; +void rxvt_fatal (const char *fmt, ...) THROW ((class rxvt_failure_exception)) ecb_noreturn ecb_cold; +void rxvt_exit_failure () THROW ((class rxvt_failure_exception)) ecb_noreturn ecb_cold; char * rxvt_strtrim (char *str) NOTHROW; char ** rxvt_strsplit (char delim, const char *str) NOTHROW; @@ -211,7 +212,37 @@ }; #ifdef HAVE_BG_PIXMAP -# ifdef BG_IMAGE_FROM_FILE +struct image_effects +{ + bool tint_set; + rxvt_color tint; + int shade; + int h_blurRadius, v_blurRadius; + + image_effects () + { + tint_set = + h_blurRadius = + v_blurRadius = 0; + shade = 100; + } + + bool need_tint () + { + return shade != 100 || tint_set; + } + + bool need_blur () + { + return h_blurRadius && v_blurRadius; + } + + bool set_tint (const rxvt_color &new_tint); + bool set_shade (const char *shade_str); + bool set_blur (const char *geom); +}; + +# if BG_IMAGE_FROM_FILE enum { IM_IS_SET = 1 << 0, IM_IS_SIZE_SENSITIVE = 1 << 1, @@ -229,7 +260,7 @@ defaultAlign = centerAlign, }; -struct rxvt_image +struct rxvt_image : image_effects { unsigned short alpha; uint8_t flags; @@ -237,7 +268,14 @@ int h_align, v_align; /* percents of the window size: 0 - left align, 50 - center, 100 - right */ -# ifdef HAVE_PIXBUF + bool is_size_sensitive () + { + return (!(flags & IM_TILE) + || h_scale || v_scale + || (!(flags & IM_ROOT_ALIGN) && (h_align || v_align))); + } + +# if HAVE_PIXBUF GdkPixbuf *pixbuf; void destroy () @@ -315,7 +353,7 @@ /* COLORTERM, TERM environment variables */ #define COLORTERMENV "rxvt" -#ifdef BG_IMAGE_FROM_FILE +#if BG_IMAGE_FROM_FILE # define COLORTERMENVFULL COLORTERMENV "-xpm" #else # define COLORTERMENVFULL COLORTERMENV @@ -1156,18 +1194,11 @@ BG_IS_TRANSPARENT = 1 << 1, BG_NEEDS_REFRESH = 1 << 2, - - BG_HAS_RENDER = 1 << 3, - BG_HAS_RENDER_CONV = 1 << 4, - BG_CLIENT_RENDER = 1 << 5, - - BG_TINT_SET = 1 << 6, - BG_TINT_BITAND = 1 << 7, }; uint8_t bg_flags; -# ifdef BG_IMAGE_FROM_FILE +# if BG_IMAGE_FROM_FILE vector image_vec; rxvt_image *new_image () { @@ -1179,27 +1210,22 @@ void parse_image (int id, const char *type, const char *arg); # endif -# ifdef ENABLE_TRANSPARENCY - Pixmap root_pixmap; /* current root pixmap set */ - rxvt_color tint; - int shade; - int h_blurRadius, v_blurRadius; +# if ENABLE_TRANSPARENCY + Pixmap root_pixmap; /* current root pixmap set */ + image_effects root_effects; void bg_set_transparent () { bg_flags |= BG_IS_TRANSPARENT; } void bg_set_root_pixmap (); - bool bg_set_tint (rxvt_color &new_tint); - bool bg_set_shade (const char *shade_str); - bool bg_set_blur (const char *geom); - - bool blur_pixmap (Pixmap pixmap, int width, int height); - bool tint_pixmap (Pixmap pixmap, int width, int height); - void tint_ximage (XImage *ximage); - bool make_transparency_pixmap (); + bool render_root_image (); # endif + bool blur_pixmap (Pixmap pixmap, int width, int height, bool argb, int h_blurRadius, int v_blurRadius); + bool tint_pixmap (Pixmap pixmap, int width, int height, bool argb, rxvt_color &tint, bool tint_set, int shade); + void tint_ximage (XImage *ximage, rxvt_color &tint, bool tint_set, int shade); + ev_tstamp bg_valid_since; Pixmap bg_pixmap; @@ -1217,7 +1243,7 @@ bg_flags &= ~BG_IS_VALID; } #endif -#ifdef HAVE_PIXBUF +#if HAVE_PIXBUF bool pixbuf_to_pixmap (GdkPixbuf *pixbuf, Pixmap pixmap, GC gc, int src_x, int src_y, int dst_x, int dst_y, unsigned int width, unsigned int height, bool argb); @@ -1238,6 +1264,8 @@ vector allocated; // free these memory blocks with free() + int parent_x, parent_y; // parent window position relative to root, only updated on demand + char *locale; char charsets[4]; char *v_buffer; /* pointer to physical buffer */ @@ -1441,7 +1469,6 @@ void alias_color (int dst, int src); void set_widthheight (unsigned int newwidth, unsigned int newheight); void get_window_origin (int &x, int &y); - Pixmap get_pixmap_property (Atom property); // screen.C