--- rxvt-unicode/src/rxvt.h 2006/02/06 05:40:15 1.255 +++ rxvt-unicode/src/rxvt.h 2007/10/11 16:01:26 1.307 @@ -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,28 +72,17 @@ 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 +#include "background.h" + #ifndef STDIN_FILENO # define STDIN_FILENO 0 # define STDOUT_FILENO 1 @@ -113,9 +103,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,24 +112,19 @@ 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) -char * rxvt_r_basename (const char *str) NOTHROW; +char * rxvt_basename (const char *str) NOTHROW; 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)) NORETURN; void rxvt_exit_failure () THROW ((class rxvt_failure_exception)) NORETURN; -int rxvt_Str_match (const char *s1, const char *s2) NOTHROW; -const char * rxvt_Str_skip_space (const char *str) NOTHROW; -char * rxvt_Str_trim (char *str) NOTHROW; -int rxvt_Str_escaped (char *str) NOTHROW; +char * rxvt_strtrim (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; ///////////////////////////////////////////////////////////////////////////// @@ -150,7 +132,7 @@ extern char **environ; extern char **rxvt_environ; // the original environ pointer -inline void set_environ (stringvec *envv) +static inline void set_environ (stringvec *envv) { #if ENABLE_PERL assert (envv); @@ -160,7 +142,7 @@ environ = (char **)envv->begin (); } -inline void set_environ (char **envv) +static inline void set_environ (char **envv) { #if ENABLE_PERL assert (envv); @@ -186,13 +168,6 @@ # undef KEEP_SCROLLCOLOR #endif -#ifdef XPM_BACKGROUND -typedef struct { - short w, h, x, y; - Pixmap pixmap; -} bgPixmap_t; -#endif - /* * the 'essential' information for reporting Mouse Events * pared down from XButtonEvent @@ -247,7 +222,7 @@ /* COLORTERM, TERM environment variables */ #define COLORTERMENV "rxvt" -#ifdef XPM_BACKGROUND +#ifdef BG_IMAGE_FROM_FILE # define COLORTERMENVFULL COLORTERMENV "-xpm" #else # define COLORTERMENVFULL COLORTERMENV @@ -521,6 +496,8 @@ */ enum colour_list { + Color_none = -2, + Color_transparent = -1, Color_fg = 0, Color_bg, minCOLOR, /* 2 */ @@ -572,7 +549,7 @@ Color_scroll, Color_trough, #endif -#if TINTING +#if ENABLE_TRANSPARENCY Color_tint, #endif #if OFF_FOCUS_FADING @@ -627,11 +604,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 +655,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 +669,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 +735,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 +748,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 +870,6 @@ struct mbstate mbstate; // current input multibyte state unsigned char want_refresh:1, -#ifdef TRANSPARENT - 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 +919,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 */ @@ -1020,19 +974,16 @@ /* ---------- */ Cursor leftptr_cursor; /* ---------- */ -#ifndef NO_BACKSPACE_KEY - const char *key_backspace; -#endif -#ifndef NO_DELETE_KEY - const char *key_delete; -#endif struct mouse_event MEvent; 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 +1051,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,13 +1128,12 @@ 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 (); const char **init_resources (int argc, const char *const *argv); - const char *x_resource (const char *name); void init_env (); void set_locale (const char *locale); void init_xlocale (); @@ -1208,7 +1163,7 @@ bool IMisRunning (); void IMSendSpot (); bool IM_get_IC (const char *modifiers); - void IMSetStatusPosition (); + void IMSetPosition (); #endif void resize_scrollbar (); @@ -1229,7 +1184,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); @@ -1263,6 +1218,8 @@ 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); + void get_window_origin (int &x, int &y); + Pixmap get_pixmap_property (int prop_id); // screen.C @@ -1300,7 +1257,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; @@ -1314,7 +1271,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; @@ -1322,17 +1279,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,22 +1412,7 @@ int parse_keysym (const char *str, const char *arg); 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); }; -/* - ***************************************************************************** - * PROTOTYPES - ***************************************************************************** - */ -#ifdef PROTOTYPES -# define __PROTO(p) p -#else -# define __PROTO(p) () -#endif - #endif /* _RXVT_H_ */