--- rxvt-unicode/src/rxvt.h 2012/01/01 17:43:47 1.458 +++ rxvt-unicode/src/rxvt.h 2012/05/20 16:23:42 1.481 @@ -1,17 +1,17 @@ #ifndef RXVT_H_ /* include once only */ #define RXVT_H_ -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #ifdef HAVE_STDINT_H #include #endif #include #include -#include +#include #include #ifdef HAVE_SYS_IOCTL_H #include @@ -20,16 +20,12 @@ #include #endif -#if HAVE_CWCHAR -# include -#elif HAVE_WCHAR_H +#if HAVE_WCHAR_H # include #else // stdlib.h might provide it #endif -using namespace std; - // we assume that Xlib.h defines XPointer, and it does since at least 1994... extern "C" { @@ -76,12 +72,6 @@ #include #include -#ifdef HAVE_AFTERIMAGE -# include -# undef min -# undef max -#endif - #ifdef HAVE_PIXBUF # include #endif @@ -90,6 +80,7 @@ # define HAVE_BG_PIXMAP 1 #endif +#include #include "encoding.h" #include "rxvtutil.h" #include "rxvtfont.h" @@ -220,6 +211,57 @@ } }; +#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 +{ + 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 + GdkPixbuf *pixbuf; + + ~rxvt_image () + { + if (pixbuf) + g_object_unref (pixbuf); + } + + int width () + { + return gdk_pixbuf_get_width (pixbuf); + } + int height () + { + return gdk_pixbuf_get_height (pixbuf); + } +# endif + + bool set_file (const char *file); + bool set_geometry (const char *geom, bool update = false); +}; +# endif +#endif + /* ***************************************************************************** * STRUCTURES AND TYPEDEFS @@ -781,6 +823,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) { } @@ -872,6 +917,8 @@ struct TermWin_t { + int vt_width; /* actual window width [pixels] */ + int vt_height; /* actual window height [pixels] */ int width; /* window width [pixels] */ int height; /* window height [pixels] */ int fwidth; /* font width [pixels] */ @@ -893,7 +940,6 @@ Window parent; /* parent identifier */ Window vt; /* vt100 window */ GC gc; /* GC for drawing */ - Pixmap pixmap; rxvt_drawable *drawable; rxvt_fontset *fontset[4]; }; @@ -1030,6 +1076,7 @@ enc_utf8:1, /* whether locale uses utf-8 */ seen_input:1, /* whether we have seen some program output yet */ seen_resize:1, /* whether we had a resize event */ + init_done:1, parsed_geometry:1; unsigned char refresh_type, @@ -1073,8 +1120,6 @@ unsigned int ModLevel3Mask, ModMetaMask, ModNumLockMask; - int old_width, /* last used width in screen resize */ - old_height; /* last used height in screen resize */ unsigned long priv_modes, SavedModes; /* ---------- */ @@ -1094,58 +1139,25 @@ 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 */ - - 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; - } + uint8_t bg_flags; - bool bg_set_file (const char *file); +# ifdef BG_IMAGE_FROM_FILE + rxvt_image bg_image; + void get_image_geometry (rxvt_image &image, int &w, int &h, int &x, int &y); + bool render_image (rxvt_image &image); # endif # ifdef ENABLE_TRANSPARENCY @@ -1154,17 +1166,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); - 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; @@ -1184,19 +1198,7 @@ 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); @@ -1217,11 +1219,6 @@ vector allocated; // free these memory blocks with free() - char env_windowid[21]; /* environmental variable WINDOWID */ - char env_colorfgbg[sizeof ("COLORFGBG=default;default;bg") + 1]; - char *env_display; /* environmental variable DISPLAY */ - char *env_term; /* environmental variable TERM */ - char *locale; char charsets[4]; char *v_buffer; /* pointer to physical buffer */ @@ -1290,6 +1287,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 @@ -1417,7 +1415,7 @@ void set_title (const char *str); void set_icon_name (const char *str); void set_window_color (int idx, const char *color); - void set_colorfgbg (); + char *get_colorfgbg (); bool set_color (rxvt_color &color, const char *name); void alias_color (int dst, int src); void set_widthheight (unsigned int newwidth, unsigned int newheight);