--- rxvt-unicode/src/rxvt.h 2010/12/16 23:03:50 1.422 +++ rxvt-unicode/src/rxvt.h 2011/02/06 11:42:28 1.434 @@ -30,6 +30,8 @@ using namespace std; +// we assume that Xlib.h defines XPointer, and it does since at least 1994... + extern "C" { #include #include @@ -74,6 +76,20 @@ #include #include +#ifdef HAVE_AFTERIMAGE +# include +# undef min +# undef max +#endif + +#ifdef HAVE_PIXBUF +# include +#endif + +#if defined(BG_IMAGE_FROM_FILE) || defined(ENABLE_TRANSPARENCY) +# define HAVE_BG_PIXMAP 1 +#endif + #include "encoding.h" #include "rxvtutil.h" #include "rxvtfont.h" @@ -100,14 +116,8 @@ ***************************************************************************** */ -#ifndef HAVE_XPOINTER -typedef char *XPointer; -#endif - #include -#include "background.h" - #ifndef STDIN_FILENO # define STDIN_FILENO 0 # define STDOUT_FILENO 1 @@ -157,8 +167,14 @@ void rxvt_exit_failure () THROW ((class rxvt_failure_exception)) NORETURN; char * rxvt_strtrim (char *str) NOTHROW; -char ** rxvt_splitcommastring (const char *cs) NOTHROW; -void rxvt_freecommastring (char **cs) NOTHROW; +char ** rxvt_strsplit (char delim, const char *str) NOTHROW; + +static inline void +rxvt_free_strsplit (char **ptr) NOTHROW +{ + free (ptr[0]); + free (ptr); +} void * rxvt_malloc (size_t size); void * rxvt_calloc (size_t number, size_t size); @@ -376,7 +392,6 @@ #define Sel_none 0 /* Not waiting */ #define Sel_normal 0x01 /* normal selection */ #define Sel_incr 0x02 /* incremental selection */ -#define Sel_direct 0x00 #define Sel_Primary 0x01 #define Sel_Secondary 0x02 #define Sel_Clipboard 0x03 @@ -1098,9 +1113,100 @@ static struct termios def_tio; row_col_t oldcursor; #ifdef HAVE_BG_PIXMAP - bgPixmap_t bgPixmap; + void bg_init (); + 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_PROP_SCALE = 1 << 3, + BG_ROOT_ALIGN = 1 << 4, + BG_GEOMETRY_FLAGS = BG_PROP_SCALE | BG_ROOT_ALIGN, + + 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, + }; + + unsigned int bg_flags; + +# 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); + + enum { + noScale = 0, + windowScale = 100, + defaultScale = windowScale, + centerAlign = 50, + defaultAlign = centerAlign, + }; + + 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 bg_set_geometry (const char *geom, bool update = false); + void bg_set_default_geometry () + { + h_scale = v_scale = defaultScale; + h_align = v_align = defaultAlign; + } + + bool bg_set_file (const char *file); +# endif + +# ifdef ENABLE_TRANSPARENCY + Pixmap root_pixmap; /* current root pixmap set */ + rxvt_color tint; + int shade; + int h_blurRadius, v_blurRadius; + + bool bg_set_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); + bool tint_pixmap (Pixmap pixmap, Visual *visual, int width, int height); + unsigned long make_transparency_pixmap (); +# endif + + ev_tstamp bg_valid_since; + + Pixmap bg_pixmap; + unsigned int bg_pmap_width, bg_pmap_height; + + int target_x; + int target_y; + bool bg_set_position (int x, int y); + bool bg_window_size_sensitive (); + bool bg_window_position_sensitive (); + + bool bg_render (); + void bg_invalidate () + { + bg_flags &= ~BG_IS_VALID; + } #endif #ifdef HAVE_AFTERIMAGE + ASImage *original_asim; ASVisual *asv; ASImageManager *asimman; @@ -1110,6 +1216,12 @@ 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); +#endif #if ENABLE_OVERLAY overlay_base ov; @@ -1336,7 +1448,7 @@ 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 (int prop_id); + Pixmap get_pixmap_property (Atom property); // screen.C @@ -1431,7 +1543,7 @@ #endif void scr_touch (bool refresh) NOTHROW; void scr_expose (int x, int y, int width, int height, bool refresh) NOTHROW; - void scr_recolour () NOTHROW; + void scr_recolour (bool refresh = true) NOTHROW; void scr_remap_chars () NOTHROW; void scr_remap_chars (line_t &l) NOTHROW;