--- rxvt-unicode/src/rxvt.h 2006/02/02 18:04:46 1.254 +++ rxvt-unicode/src/rxvt.h 2007/08/26 16:55:58 1.297 @@ -10,15 +10,16 @@ #endif #if ENABLE_PERL -# define ENABLE_FRILLS 1 +# define ENABLE_FRILLS 1 # define ENABLE_COMBINING 1 #endif #if ENABLE_FRILLS -# define ENABLE_XEMBED 1 -# define ENABLE_EWMH 1 +# define ENABLE_XEMBED 1 +# define ENABLE_EWMH 1 # define ENABLE_XIM_ONTHESPOT 1 -# define CURSOR_BLINK 1 +# define CURSOR_BLINK 1 +# define OPTION_HC 1 #else # define ENABLE_MINIMAL 1 #endif @@ -71,26 +72,13 @@ typedef char *XPointer; #endif -#ifdef HAVE_TERMIOS_H -# include +#include typedef struct termios ttymode_t; -#else -# include -typedef struct { - struct sgttyb sg; - struct tchars tc; - struct ltchars lc; - int line; - int local; -} ttymode_t; -#endif -#ifdef XPM_BACKGROUND -# ifdef XPM_INC_X11 -# include -# else -# include -# endif +#ifdef HAVE_AFTERIMAGE +# include +#undef min +#undef max #endif #ifndef STDIN_FILENO @@ -113,9 +101,6 @@ ***************************************************************************** */ // main.C -RETSIGTYPE rxvt_Child_signal (int sig) NOTHROW; -RETSIGTYPE rxvt_Exit_signal (int sig) NOTHROW; -void rxvt_clean_exit () NOTHROW; void * rxvt_malloc (size_t size); void * rxvt_calloc (size_t number, size_t size); void * rxvt_realloc (void *ptr, size_t size); @@ -125,7 +110,6 @@ wchar_t * rxvt_mbstowcs (const char *str, int len = -1); char * rxvt_wcstoutf8 (const wchar_t *str, int len = -1); wchar_t * rxvt_utf8towcs (const char *str, int len = -1); -char * rxvt_strdup_cpp (const char *str); #define rxvt_strdup(s) ((s) ? strdup(s) : 0) @@ -142,7 +126,6 @@ int rxvt_Str_escaped (char *str) NOTHROW; char ** rxvt_splitcommastring (const char *cs) NOTHROW; void rxvt_freecommastring (char **cs) NOTHROW; -char * rxvt_File_find (const char *file, const char *ext, const char *path) NOTHROW; ///////////////////////////////////////////////////////////////////////////// @@ -186,11 +169,97 @@ # undef KEEP_SCROLLCOLOR #endif -#ifdef XPM_BACKGROUND -typedef struct { - short w, h, x, y; +#if defined(XPM_BACKGROUND) || defined(ENABLE_TRANSPARENCY) +# define HAVE_BG_PIXMAP 1/* to simplify further usage */ +struct bgPixmap_t { + + enum { + geometrySet = (1UL<<0), + propScale = (1UL<<1), + geometryFlags = (geometrySet|propScale), + + tintSet = (1UL<<8), + tintNeeded = (1UL<<9), + tintWholesome = (1UL<<10), + tintServerSide = (1UL<<11), + tintFlags = (tintSet|tintServerSide|tintNeeded|tintWholesome), + blurNeeded = (1UL<<12), + + isTransparent = (1UL<<16), + isInvalid = (1UL<<17) + }; + + unsigned long flags; + + enum { + transpPmapTiled = (1UL<<0), + transpPmapTinted = tintNeeded, + transpPmapBlured = blurNeeded, + transpTransformations = (tintNeeded|blurNeeded) + }; /* this flags are returned by make_transparency_pixmap if called */ + +# ifdef XPM_BACKGROUND +# ifdef HAVE_AFTERIMAGE + ASImage *original_asim; + bool render_asim (ASImage *background, ARGB32 background_tint); +# endif + + enum { defaultScale = 100, defaultAlign = 50 }; + + 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 */ + void unset_geometry () { flags = flags & ~geometryFlags; }; + bool set_geometry (const char *geom); + void set_defaultGeometry () + { + h_scale = v_scale = defaultScale; + h_align = v_align = defaultAlign; + flags |= geometrySet; + }; + + bool set_file (const char *file); +# endif /* XPM_BACKGROUND */ + + rxvt_term *target; + bool set_target (rxvt_term *new_target); + +# ifdef ENABLE_TRANSPARENCY + int root_depth; /* obtained when target is set */ + Pixmap root_pixmap; /* current root pixmap set */ + rxvt_color tint; + int shade; + int h_blurRadius, v_blurRadius; + + bool set_transparent (); + bool set_blur_radius (const char *geom); + bool set_tint (rxvt_color &new_tint); + bool unset_tint (); + bool set_shade (const char *shade_str); + bool set_root_pixmap (); + + unsigned long make_transparency_pixmap ();/* returns combination of the transpTransformations flags */ +# endif + double invalid_since; + Pixmap pixmap; -} bgPixmap_t; + unsigned int pmap_width, pmap_height; + unsigned int pmap_depth; + + bool window_size_sensitive (); + bool need_client_side_rendering (); + void apply (); + bool render (); + void invalidate () { + if (!(flags & isInvalid)) + { + flags |= isInvalid; + invalid_since = NOW; + } + }; +}; +#else +# undef HAVE_BG_PIXMAP #endif /* @@ -521,6 +590,8 @@ */ enum colour_list { + Color_none = -2, + Color_transparent = -1, Color_fg = 0, Color_bg, minCOLOR, /* 2 */ @@ -572,7 +643,7 @@ Color_scroll, Color_trough, #endif -#if TINTING +#if ENABLE_TRANSPARENCY Color_tint, #endif #if OFF_FOCUS_FADING @@ -627,11 +698,6 @@ /* #define PrivMode_MouseX11Track (1LU<<20) */ #define PrivMode_mouse_report (PrivMode_MouseX10|PrivMode_MouseX11) -#define PrivMode(test,bit) \ - if (test) \ - priv_modes |= (bit); \ - else \ - priv_modes &= ~(bit) #ifdef ALLOW_132_MODE # define PrivMode_Default (PrivMode_Autowrap|PrivMode_ShiftKeys|PrivMode_VisibleCursor|PrivMode_132OK) @@ -683,10 +749,9 @@ */ #define dLocal(type,name) type const name = this->name -// for speed reasons, we assume that all latin1 characters -// are single-width (the first unicode combining character -// is actually 0x300, but ascii is what matters most). -#define WCWIDTH(c) ((c) & ~0xff ? wcwidth (c) : 1) +// for speed reasons, we assume that all codepoints 32 to 126 are +// single-width. +#define WCWIDTH(c) (IN_RANGE_INC (c, 0x20, 0x7e) ? 1 : wcwidth (c)) /* convert pixel dimensions to row/column values. Everything as int32_t */ #define Pixel2Col(x) Pixel2Width((int32_t)(x)) @@ -698,11 +763,6 @@ #define Width2Pixel(n) ((int32_t)(n) * (int32_t)fwidth) #define Height2Pixel(n) ((int32_t)(n) * (int32_t)fheight) -#define OPTION(opt) (options & (opt)) -#define DEFAULT_OPTIONS (Opt_scrollBar | Opt_scrollTtyOutput \ - | Opt_jumpScroll | Opt_secondaryScreen \ - | Opt_pastableTabs | Opt_intensityStyles) - // for m >= -n, ensure remainder lies between 0..n-1 #define MOD(m,n) (((m) + (n)) % (n)) @@ -769,14 +829,8 @@ #define scrollbar_size() (scrollBar.end - scrollBar.beg \ - scrollbar_minheight ()) -#ifdef XPM_BACKGROUND -# define XPMClearArea(a, b, c, d, e, f, g) XClearArea((a), (b), (c), (d), (e), (f), (g)) -#else -# define XPMClearArea(a, b, c, d, e, f, g) -#endif - -typedef callback1 log_callback; -typedef callback1 getfd_callback; +typedef callback log_callback; +typedef callback getfd_callback; #define SET_LOCALE(locale) rxvt_set_locale (locale) extern bool rxvt_set_locale (const char *locale) NOTHROW; @@ -788,6 +842,8 @@ #define LINE_LONGER 0x0001 // line is continued on the next row #define LINE_FILTERED 0x0002 // line has been filtered #define LINE_COMPRESSED 0x0004 // line has been compressed (NYI) +#define LINE_FILTER 0x0008 // line needs to be filtered before display (NYI) +#define LINE_BIDI 0x0010 // line needs bidi (NYI) struct line_t { text_t *t; // terminal the text @@ -908,13 +964,9 @@ struct mbstate mbstate; // current input multibyte state unsigned char want_refresh:1, -#ifdef TRANSPARENT +#ifdef ENABLE_TRANSPARENCY want_full_refresh:1, /* awaiting full screen refresh */ #endif -#if defined(XPM_BACKGROUND) || defined(TRANSPARENT) - am_transparent:1, /* is a transparent term */ - am_pixmap_trans:1, /* transparency w/known root pixmap */ -#endif current_screen:1, /* primary or secondary */ num_scr_allow:1, bypass_keystate:1, @@ -964,7 +1016,6 @@ mouse_slip_wheel_speed, #endif refresh_count, - refresh_limit, last_bot, /* scrollbar last bottom position */ last_top, /* scrollbar last top position */ last_state, /* scrollbar last state */ @@ -1030,9 +1081,12 @@ XComposeStatus compose; ttymode_t tio; row_col_t oldcursor; -#ifdef XPM_BACKGROUND +#ifdef HAVE_BG_PIXMAP bgPixmap_t bgPixmap; - XpmAttributes xpmAttr; /* originally loaded pixmap and its scaling */ +#endif +#ifdef HAVE_AFTERIMAGE + ASVisual *asv; + ASImageManager *asimman; #endif #if ENABLE_OVERLAY @@ -1100,10 +1154,15 @@ XSelectInput (dpy, vt, vt_emask | vt_emask_perl | vt_emask_xim); } -#if TRANSPARENT +#if ENABLE_TRANSPARENCY || ENABLE_PERL void rootwin_cb (XEvent &xev); xevent_watcher rootwin_ev; #endif +#ifdef HAVE_BG_PIXMAP + int update_background (); + void update_background_cb (time_watcher &w); + time_watcher update_background_ev; +#endif void x_cb (XEvent &xev); void flush (); @@ -1172,8 +1231,8 @@ void make_current () const // make this the "currently active" urxvt instance { SET_R (this); - rxvt_set_locale (locale); set_environ (envv); + rxvt_set_locale (locale); } void init_secondary (); @@ -1208,13 +1267,14 @@ bool IMisRunning (); void IMSendSpot (); bool IM_get_IC (const char *modifiers); - void IMSetStatusPosition (); + void IMSetPosition (); #endif void resize_scrollbar (); // command.C - void lookup_key (XKeyEvent &ev); + void key_press (XKeyEvent &ev); + void key_release (XKeyEvent &ev); unsigned int cmd_write (const char *str, unsigned int count); wchar_t next_char () NOTHROW; @@ -1228,7 +1288,7 @@ void button_release (XButtonEvent &ev); void focus_in (); void focus_out (); - int check_our_parents (); + void update_fade_color (unsigned int idx); #ifdef PRINTPIPE FILE *popen_printer (); int pclose_printer (FILE *stream); @@ -1299,7 +1359,7 @@ #ifndef NO_BRIGHTCOLOR if (r & RS_Bold # if ENABLE_STYLES - && OPTION (Opt_intensityStyles) + && option (Opt_intensityStyles) # endif && IN_RANGE_INC (base, minCOLOR, minBrightCOLOR)) base += minBrightCOLOR - minCOLOR; @@ -1313,7 +1373,7 @@ #ifndef NO_BRIGHTCOLOR if (r & RS_Blink # if ENABLE_STYLES - && OPTION (Opt_intensityStyles) + && option (Opt_intensityStyles) # endif && IN_RANGE_INC (base, minCOLOR, minBrightCOLOR)) base += minBrightCOLOR - minCOLOR; @@ -1321,17 +1381,25 @@ return base; } - bool option (uint32_t opt) const NOTHROW + bool option (uint8_t opt) const NOTHROW + { + return options[opt >> 3] & (1 << (opt & 7)); + } + + void set_option (uint8_t opt, bool set = true) NOTHROW { - return OPTION (opt); + if (set) + options[opt >> 3] |= (1 << (opt & 7)); + else + options[opt >> 3] &= ~(1 << (opt & 7)); } - void set_option (uint32_t opt, bool set) NOTHROW + void PrivMode (int set, unsigned bit) NOTHROW { if (set) - options |= opt; + priv_modes |= bit; else - options &= ~opt; + priv_modes &= ~bit; } void scr_blank_line (line_t &l, unsigned int col, unsigned int width, rend_t efs) const NOTHROW; @@ -1447,21 +1515,9 @@ void get_xdefaults (FILE *stream, const char *name); void extract_resources (); // xpm.C - int scale_pixmap (const char *geom); - void resize_pixmap (); - Pixmap set_bgPixmap (const char *file); + void get_window_origin (int &x, int &y); + Pixmap get_pixmap_property (int prop_id); }; -/* - ***************************************************************************** - * PROTOTYPES - ***************************************************************************** - */ -#ifdef PROTOTYPES -# define __PROTO(p) p -#else -# define __PROTO(p) () -#endif - #endif /* _RXVT_H_ */