--- rxvt-unicode/src/rxvt.h 2007/11/03 16:43:24 1.317 +++ rxvt-unicode/src/rxvt.h 2007/12/26 13:52:11 1.336 @@ -20,6 +20,7 @@ # define ENABLE_XIM_ONTHESPOT 1 # define CURSOR_BLINK 1 # define OPTION_HC 1 +# define BUILTIN_GLYPHS 1 #else # define ENABLE_MINIMAL 1 #endif @@ -30,15 +31,12 @@ #include #include #include -#if ENABLE_FRILLS -# include -#endif #include "encoding.h" #include "rxvtutil.h" #include "rxvtfont.h" #include "rxvttoolkit.h" -#include "iom.h" +#include "ev_cpp.h" #include "salloc.h" #include "libptytty.h" @@ -83,6 +81,19 @@ # define STDERR_FILENO 2 #endif +#if !defined (EACCESS) && defined(EAGAIN) +# define EACCESS EAGAIN +#endif + +#ifndef EXIT_SUCCESS /* missing from */ +# define EXIT_SUCCESS 0 /* exit function success */ +# define EXIT_FAILURE 1 /* exit function failure */ +#endif + +#ifndef PATH_MAX +# define PATH_MAX 16384 +#endif + /****************************************************************************/ // exception thrown on fatal (per-instance) errors @@ -124,7 +135,8 @@ extern char **environ; extern char **rxvt_environ; // the original environ pointer -static inline void set_environ (stringvec *envv) +static inline void +set_environ (stringvec *envv) { #if ENABLE_PERL assert (envv); @@ -134,7 +146,8 @@ environ = (char **)envv->begin (); } -static inline void set_environ (char **envv) +static inline void +set_environ (char **envv) { #if ENABLE_PERL assert (envv); @@ -149,7 +162,6 @@ * STRUCTURES AND TYPEDEFS ***************************************************************************** */ -struct grwin_t; /* If we're using either the rxvt scrollbar, keep the * scrollColor resource. @@ -171,16 +183,6 @@ unsigned int button; /* detail */ }; -#if ENABLE_FRILLS -typedef struct _mwmhints { - CARD32 flags; - CARD32 functions; - CARD32 decorations; - INT32 input_mode; - CARD32 status; -} MWMHints; -#endif - #if ENABLE_XEMBED // XEMBED messages # define XEMBED_EMBEDDED_NOTIFY 0 @@ -227,17 +229,6 @@ # define NO_MOUSE_REPORT_SCROLLBAR 1 #endif -/* now look for other badly set stuff */ - -#if !defined (EACCESS) && defined(EAGAIN) -# define EACCESS EAGAIN -#endif - -#ifndef EXIT_SUCCESS /* missing from */ -# define EXIT_SUCCESS 0 /* exit function success */ -# define EXIT_FAILURE 1 /* exit function failure */ -#endif - #define scrollBar_esc 30 #if defined(RXVT_SCROLLBAR) || defined(NEXT_SCROLLBAR) || defined(XTERM_SCROLLBAR) || defined(PLAIN_SCROLLBAR) @@ -594,8 +585,6 @@ #define PrivMode_LFNL (1UL<<19) #define PrivMode_MouseBtnEvent (1UL<<20) #define PrivMode_MouseAnyEvent (1UL<<21) -/* too annoying to implement X11 highlight tracking */ -/* #define PrivMode_MouseX11Track (1LU<<20) */ #define PrivMode_mouse_report (PrivMode_MouseX10|PrivMode_MouseX11|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent) @@ -611,8 +600,15 @@ #define CBUFSIZ 2048 // size of command buffer #define UBUFSIZ 2048 // character buffer -#ifndef PATH_MAX -# define PATH_MAX 16384 +#if ENABLE_FRILLS +# include +typedef struct _mwmhints { + CARD32 flags; + CARD32 functions; + CARD32 decorations; + INT32 input_mode; + CARD32 status; +} MWMHints; #endif /* Motif window hints */ @@ -663,9 +659,6 @@ #define Width2Pixel(n) ((int32_t)(n) * (int32_t)fwidth) #define Height2Pixel(n) ((int32_t)(n) * (int32_t)fheight) -// for m >= -n, ensure remainder lies between 0..n-1 -#define MOD(m,n) (((m) + (n)) % (n)) - #define LINENO(n) MOD (term_start + int(n), total_rows) #define ROW(n) row_buf [LINENO (n)] @@ -1013,6 +1006,9 @@ #ifdef KEYSYM_RESOURCE keyboard_manager *keyboard; #endif +#ifndef NO_RESOURCES + XrmDatabase option_db; +#endif const char *rs[NUM_RESOURCES]; /* command input buffering */ @@ -1049,9 +1045,13 @@ xevent_watcher rootwin_ev; #endif #ifdef HAVE_BG_PIXMAP - int update_background (); - void update_background_cb (time_watcher &w); - time_watcher update_background_ev; + void update_background (); +#if TRACE_PIXMAPS + void trace_update_background (const char *file, int line); +# define update_background() trace_update_background (__FILE__, __LINE__) +#endif + void update_background_cb (ev::timer &w, int revents); + ev::timer update_background_ev; #endif void x_cb (XEvent &xev); @@ -1061,37 +1061,37 @@ xevent_watcher scrollbar_ev; #endif - void child_cb (child_watcher &w, int status); child_watcher child_ev; - void check_cb (check_watcher &w); check_watcher check_ev; - void destroy_cb (time_watcher &w); time_watcher destroy_ev; + void child_cb (ev::child &w, int revents); ev::child child_ev; + void destroy_cb (ev::idle &w, int revents); ev::idle destroy_ev; + void refresh_check (); void flush (); - void flush_cb (time_watcher &w); time_watcher flush_ev; + void flush_cb (ev::timer &w, int revents); ev::timer flush_ev; bool pty_fill (); - void pty_cb (io_watcher &w, short revents); io_watcher pty_ev; - void incr_cb (time_watcher &w) NOTHROW; time_watcher incr_ev; + void pty_cb (ev::io &w, int revents); ev::io pty_ev; + void incr_cb (ev::timer &w, int revents) NOTHROW; ev::timer incr_ev; #ifdef CURSOR_BLINK - void cursor_blink_cb (time_watcher &w); time_watcher cursor_blink_ev; + void cursor_blink_cb (ev::timer &w, int revents); ev::timer cursor_blink_ev; #endif #ifdef TEXT_BLINK - void text_blink_cb (time_watcher &w); time_watcher text_blink_ev; + void text_blink_cb (ev::timer &w, int revents); ev::timer text_blink_ev; #endif #ifndef NO_BELL - void bell_cb (time_watcher &w); time_watcher bell_ev; + void bell_cb (ev::timer &w, int revents); ev::timer bell_ev; #endif #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING - void cont_scroll_cb (time_watcher &w); time_watcher cont_scroll_ev; + void cont_scroll_cb (ev::timer &w, int revents); ev::timer cont_scroll_ev; #endif #ifdef SELECTION_SCROLLING - void sel_scroll_cb (time_watcher &w); time_watcher sel_scroll_ev; + void sel_scroll_cb (ev::timer &w, int revents); ev::timer sel_scroll_ev; #endif #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) - void slip_wheel_cb (time_watcher &w); time_watcher slip_wheel_ev; + void slip_wheel_cb (ev::timer &w, int revents); ev::timer slip_wheel_ev; #endif #ifdef POINTER_BLANK - void pointer_cb (time_watcher &w); time_watcher pointer_ev; + void pointer_cb (ev::timer &w, int revents); ev::timer pointer_ev; void pointer_blank (); #endif void pointer_unblank (); @@ -1100,10 +1100,10 @@ void tt_write (const char *data, unsigned int len); void pty_write (); - bool init (stringvec *argv, stringvec *envv) + void init (stringvec *argv, stringvec *envv) { this->argv = argv; - return init (argv->size (), argv->begin (), envv); + init (argv->size (), argv->begin (), envv); } void make_current () const // make this the "currently active" urxvt instance @@ -1169,7 +1169,7 @@ void process_sgr_mode (unsigned int nargs, const int *arg); void process_graphics (); // init.C - bool init_vars (); + void init_vars (); void init_secondary (); const char **init_resources (int argc, const char *const *argv); void init_env (); @@ -1188,7 +1188,7 @@ ~rxvt_term (); void destroy (); void emergency_cleanup (); - bool init (int argc, const char *const *argv, stringvec *envv); + void init (int argc, const char *const *argv, stringvec *envv); void recolour_cursor (); void resize_all_windows (unsigned int newwidth, unsigned int newheight, int ignoreparent); void window_calc (unsigned int newwidth, unsigned int newheight); @@ -1265,11 +1265,19 @@ bool option (uint8_t opt) const NOTHROW { + if (!opt) + return 0; + + --opt; return options[opt >> 3] & (1 << (opt & 7)); } void set_option (uint8_t opt, bool set = true) NOTHROW { + if (!opt) + return; + + --opt; if (set) options[opt >> 3] |= (1 << (opt & 7)); else @@ -1398,5 +1406,5 @@ void extract_resources (); }; -#endif /* _RXVT_H_ */ +#endif /* _RXVT_H_ */