--- rxvt-unicode/src/rxvt.h 2012/05/25 08:27:47 1.484 +++ rxvt-unicode/src/rxvt.h 2012/06/03 15:50:22 1.496 @@ -85,9 +85,9 @@ #include "rxvtutil.h" #include "rxvtfont.h" #include "rxvttoolkit.h" +#include "rxvtimg.h" #include "scrollbar.h" #include "ev_cpp.h" -#include "salloc.h" #include "libptytty.h" #include "rxvtperl.h" @@ -150,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; @@ -212,6 +212,36 @@ }; #ifdef HAVE_BG_PIXMAP +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); +}; + # ifdef BG_IMAGE_FROM_FILE enum { IM_IS_SET = 1 << 0, @@ -230,17 +260,29 @@ defaultAlign = centerAlign, }; -struct rxvt_image +struct rxvt_image : image_effects { - int id; unsigned short alpha; uint8_t flags; unsigned int h_scale, v_scale; /* percents of the window size */ int h_align, v_align; /* percents of the window size: 0 - left align, 50 - center, 100 - right */ + bool is_size_sensitive () + { + return (!(flags & IM_TILE) + || h_scale || v_scale + || (!(flags & IM_ROOT_ALIGN) && (h_align || v_align))); + } + # ifdef HAVE_PIXBUF - auto_ptr pixbuf; + GdkPixbuf *pixbuf; + + void destroy () + { + if (pixbuf) + g_object_unref (pixbuf); + } int width () { @@ -748,6 +790,16 @@ tlen_t_ l; // length of each text line uint32_t f; // flags + bool valid () + { + return l >= 0; + } + + void alloc () + { + l = 0; + } + bool is_longer () { return f & LINE_LONGER; @@ -1027,6 +1079,7 @@ XSizeHints szHint; rxvt_color *pix_colors; Cursor TermWin_cursor; /* cursor for vt window */ + line_t *row_buf; // all lines, scrollback + terminal, circular line_t *drawn_buf; // text on screen line_t *swap_buf; // lines for swap buffer @@ -1141,13 +1194,6 @@ 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; @@ -1165,26 +1211,21 @@ # endif # ifdef ENABLE_TRANSPARENCY - Pixmap root_pixmap; /* current root pixmap set */ - rxvt_color tint; - int shade; - int h_blurRadius, v_blurRadius; + 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; @@ -1243,8 +1284,10 @@ ptytty *pty; - rxvt_salloc *talloc; // text line allocator - rxvt_salloc *ralloc; // rend line allocator + // chunk contains all line_t's as well as rend_t and text_t buffers + // for drawn_buf, swap_buf and row_buf, in this order + void *chunk; + size_t chunk_size; static vector termlist; // a vector of all running rxvt_term's @@ -1428,34 +1471,6 @@ // screen.C - void lalloc (line_t &l) const - { - l.t = (text_t *)talloc->alloc (); - l.r = (rend_t *)ralloc->alloc (); - } - -#if 0 - void lfree (line_t &l) - { - talloc->free (l.t); - ralloc->free (l.r); - } -#endif - - void lresize (line_t &l) const - { - if (!l.t) - return; - - l.t = (text_t *)talloc->alloc (l.t, prev_ncol * sizeof (text_t)); - l.r = (rend_t *)ralloc->alloc (l.r, prev_ncol * sizeof (rend_t)); - - l.l = min (l.l, ncol); - - if (ncol > prev_ncol) - scr_blank_line (l, prev_ncol, ncol - prev_ncol, DEFAULT_RSTYLE); - } - int fgcolor_of (rend_t r) const NOTHROW { int base = GET_BASEFG (r); @@ -1494,6 +1509,7 @@ // modifies first argument(!) void tt_paste (char *data, unsigned int len) NOTHROW; void paste (char *data, unsigned int len) NOTHROW; + void scr_alloc () NOTHROW; void scr_blank_line (line_t &l, unsigned int col, unsigned int width, rend_t efs) const NOTHROW; void scr_blank_screen_mem (line_t &l, rend_t efs) const NOTHROW; void scr_kill_char (line_t &l, int col) const NOTHROW;