--- rxvt-unicode/src/rxvt.h 2012/01/19 17:10:51 1.467 +++ rxvt-unicode/src/rxvt.h 2012/05/25 08:27:47 1.484 @@ -72,12 +72,6 @@ #include #include -#ifdef HAVE_AFTERIMAGE -# include -# undef min -# undef max -#endif - #ifdef HAVE_PIXBUF # include #endif @@ -86,6 +80,7 @@ # define HAVE_BG_PIXMAP 1 #endif +#include #include "encoding.h" #include "rxvtutil.h" #include "rxvtfont.h" @@ -216,6 +211,55 @@ } }; +#ifdef HAVE_BG_PIXMAP +# ifdef BG_IMAGE_FROM_FILE +enum { + IM_IS_SET = 1 << 0, + IM_IS_SIZE_SENSITIVE = 1 << 1, + IM_KEEP_ASPECT = 1 << 2, + IM_ROOT_ALIGN = 1 << 3, + IM_TILE = 1 << 4, + IM_GEOMETRY_FLAGS = IM_KEEP_ASPECT | IM_ROOT_ALIGN | IM_TILE, +}; + +enum { + noScale = 0, + windowScale = 100, + defaultScale = windowScale, + centerAlign = 50, + defaultAlign = centerAlign, +}; + +struct rxvt_image +{ + 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 */ + +# ifdef HAVE_PIXBUF + auto_ptr pixbuf; + + int width () + { + return gdk_pixbuf_get_width (pixbuf); + } + int height () + { + return gdk_pixbuf_get_height (pixbuf); + } +# endif + + rxvt_image (); + bool set_file_geometry (const char *file); + bool set_file (const char *file); + bool set_geometry (const char *geom, bool update = false); +}; +# endif +#endif + /* ***************************************************************************** * STRUCTURES AND TYPEDEFS @@ -777,6 +821,9 @@ struct compose_char { unicode_t c1, c2; // any chars != NOCHAR are valid + #if __cplusplus >= 201103L || ECB_GCC_VERSION(4,4) + compose_char () = default; + #endif compose_char (unicode_t c1, unicode_t c2) : c1(c1), c2(c2) { } @@ -1090,58 +1137,31 @@ void bg_destroy (); enum { - //subset returned by make_transparency_pixmap - BG_IS_VALID = 1 << 0, - BG_NEEDS_TINT = 1 << 1, - BG_NEEDS_BLUR = 1 << 2, - - BG_EFFECTS_FLAGS = BG_NEEDS_TINT | BG_NEEDS_BLUR, - - BG_KEEP_ASPECT = 1 << 3, - BG_ROOT_ALIGN = 1 << 4, - BG_TILE = 1 << 14, - BG_GEOMETRY_FLAGS = BG_KEEP_ASPECT | BG_ROOT_ALIGN | BG_TILE, - - BG_TINT_SET = 1 << 5, - BG_TINT_BITAND = 1 << 6, - BG_TINT_FLAGS = BG_NEEDS_TINT | BG_TINT_BITAND, - - BG_HAS_RENDER = 1 << 7, - BG_HAS_RENDER_CONV = 1 << 8, - BG_CLIENT_RENDER = 1 << 9, - - BG_IS_TRANSPARENT = 1 << 10, - BG_NEEDS_REFRESH = 1 << 11, - BG_IS_SIZE_SENSITIVE = 1 << 12, - BG_IS_FROM_FILE = 1 << 13, - }; + BG_IS_VALID = 1 << 0, - unsigned int bg_flags; + BG_IS_TRANSPARENT = 1 << 1, + BG_NEEDS_REFRESH = 1 << 2, -# ifdef BG_IMAGE_FROM_FILE - void get_image_geometry (int image_width, int image_height, int &w, int &h, int &x, int &y); - bool render_image (unsigned long tr_flags); + BG_HAS_RENDER = 1 << 3, + BG_HAS_RENDER_CONV = 1 << 4, + BG_CLIENT_RENDER = 1 << 5, - enum { - noScale = 0, - windowScale = 100, - defaultScale = windowScale, - centerAlign = 50, - defaultAlign = centerAlign, + BG_TINT_SET = 1 << 6, + BG_TINT_BITAND = 1 << 7, }; - 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 */ + uint8_t bg_flags; - bool bg_set_geometry (const char *geom, bool update = false); - void bg_set_default_geometry () +# ifdef BG_IMAGE_FROM_FILE + vector image_vec; + rxvt_image *new_image () { - h_scale = v_scale = defaultScale; - h_align = v_align = defaultAlign; + image_vec.resize (image_vec.size () + 1); + return &image_vec.back (); } - - bool bg_set_file (const char *file); + void get_image_geometry (rxvt_image &image, int &w, int &h, int &x, int &y); + bool render_image (rxvt_image &image); + void parse_image (int id, const char *type, const char *arg); # endif # ifdef ENABLE_TRANSPARENCY @@ -1150,17 +1170,19 @@ int shade; int h_blurRadius, v_blurRadius; - bool bg_set_transparent (); + void bg_set_transparent () + { + bg_flags |= BG_IS_TRANSPARENT; + } void bg_set_root_pixmap (); - void set_tint_shade_flags (); 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, Visual *visual, int width, int height, int depth); - bool tint_pixmap (Pixmap pixmap, Visual *visual, int width, int height); - void tint_ximage (Visual *visual, XImage *ximage); - unsigned long make_transparency_pixmap (); + 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 (); # endif ev_tstamp bg_valid_since; @@ -1180,22 +1202,10 @@ bg_flags &= ~BG_IS_VALID; } #endif -#ifdef HAVE_AFTERIMAGE - ASImage *original_asim; - ASVisual *asv; - ASImageManager *asimman; - - void init_asv () - { - if (!asv) - asv = create_asvisual_for_id (dpy, display->screen, depth, XVisualIDFromVisual (visual), cmap, NULL); - } -#endif #ifdef HAVE_PIXBUF - GdkPixbuf *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); + unsigned int width, unsigned int height, bool argb); #endif #if ENABLE_OVERLAY @@ -1281,6 +1291,7 @@ void pty_cb (ev::io &w, int revents); ev::io pty_ev; #ifdef CURSOR_BLINK + void cursor_blink_reset (); void cursor_blink_cb (ev::timer &w, int revents); ev::timer cursor_blink_ev; #endif #ifdef TEXT_BLINK @@ -1564,6 +1575,15 @@ const char *x_resource (const char *name); void extract_resources (); void extract_keysym_resources (); + void find_resources (const char *n_prefix, const char *c_prefix, int mode, + Bool (*proc)(XrmDatabase *, XrmBindingList, XrmQuarkList, XrmRepresentation *, XrmValue *, XPointer)); + bool parse_bool_resource (const char *str) + { + return (!strcasecmp (str, "TRUE") + || !strcasecmp (str, "YES") + || !strcasecmp (str, "ON") + || !strcasecmp (str, "1")); + } }; #endif /* _RXVT_H_ */