--- rxvt-unicode/src/rxvt.h 2007/08/17 22:01:33 1.294 +++ rxvt-unicode/src/rxvt.h 2007/11/11 04:08:00 1.318 @@ -38,7 +38,7 @@ #include "rxvtutil.h" #include "rxvtfont.h" #include "rxvttoolkit.h" -#include "iom.h" +#include "ev_cpp.h" #include "salloc.h" #include "libptytty.h" @@ -75,11 +75,7 @@ #include typedef struct termios ttymode_t; -#ifdef HAVE_AFTERIMAGE -# include -#undef min -#undef max -#endif +#include "background.h" #ifndef STDIN_FILENO # define STDIN_FILENO 0 @@ -97,13 +93,10 @@ /* ***************************************************************************** - * PROTOTYPES + * PROTOTYPES ***************************************************************************** */ // 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); @@ -114,19 +107,14 @@ char * rxvt_wcstoutf8 (const wchar_t *str, int len = -1); wchar_t * rxvt_utf8towcs (const char *str, int len = -1); -#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; @@ -136,7 +124,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); @@ -146,7 +134,7 @@ environ = (char **)envv->begin (); } -inline void set_environ (char **envv) +static inline void set_environ (char **envv) { #if ENABLE_PERL assert (envv); @@ -172,98 +160,6 @@ # undef KEEP_SCROLLCOLOR #endif -#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), - tintServerSide = (1UL<<10), - tintFlags = (tintSet|tintServerSide|tintNeeded), - blurNeeded = (1UL<<11), - - 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; - 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 - /* * the 'essential' information for reporting Mouse Events * pared down from XButtonEvent @@ -287,24 +183,24 @@ #if ENABLE_XEMBED // XEMBED messages -# define XEMBED_EMBEDDED_NOTIFY 0 -# define XEMBED_WINDOW_ACTIVATE 1 -# define XEMBED_WINDOW_DEACTIVATE 2 -# define XEMBED_REQUEST_FOCUS 3 -# define XEMBED_FOCUS_IN 4 -# define XEMBED_FOCUS_OUT 5 -# define XEMBED_FOCUS_NEXT 6 +# define XEMBED_EMBEDDED_NOTIFY 0 +# define XEMBED_WINDOW_ACTIVATE 1 +# define XEMBED_WINDOW_DEACTIVATE 2 +# define XEMBED_REQUEST_FOCUS 3 +# define XEMBED_FOCUS_IN 4 +# define XEMBED_FOCUS_OUT 5 +# define XEMBED_FOCUS_NEXT 6 # define XEMBED_FOCUS_PREV 7 -# define XEMBED_MODALITY_ON 10 -# define XEMBED_MODALITY_OFF 11 -# define XEMBED_REGISTER_ACCELERATOR 12 -# define XEMBED_UNREGISTER_ACCELERATOR 13 +# define XEMBED_MODALITY_ON 10 +# define XEMBED_MODALITY_OFF 11 +# define XEMBED_REGISTER_ACCELERATOR 12 +# define XEMBED_UNREGISTER_ACCELERATOR 13 # define XEMBED_ACTIVATE_ACCELERATOR 14 // XEMBED detail code -# define XEMBED_FOCUS_CURRENT 0 -# define XEMBED_FOCUS_FIRST 1 +# define XEMBED_FOCUS_CURRENT 0 +# define XEMBED_FOCUS_FIRST 1 # define XEMBED_FOCUS_LAST 2 # define XEMBED_MAPPED (1 << 0) @@ -318,7 +214,7 @@ /* COLORTERM, TERM environment variables */ #define COLORTERMENV "rxvt" -#ifdef XPM_BACKGROUND +#ifdef BG_IMAGE_FROM_FILE # define COLORTERMENVFULL COLORTERMENV "-xpm" #else # define COLORTERMENVFULL COLORTERMENV @@ -527,7 +423,7 @@ C0_BS , C0_HT , C0_LF , C0_VT , C0_FF , C0_CR , C0_SO , C0_SI , C0_DLE, C0_DC1, C0_DC2, D0_DC3, C0_DC4, C0_NAK, C0_SYN, C0_ETB, C0_CAN, C0_EM , C0_SUB, C0_ESC, C0_IS4, C0_IS3, C0_IS2, C0_IS1, -}; +}; #define CHAR_ST 0x9c /* 0234 */ /* @@ -696,15 +592,12 @@ #define PrivMode_smoothScroll (1UL<<17) #define PrivMode_vt52 (1UL<<18) #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) -#define PrivMode(test,bit) \ - if (test) \ - priv_modes |= (bit); \ - else \ - priv_modes &= ~(bit) +#define PrivMode_mouse_report (PrivMode_MouseX10|PrivMode_MouseX11|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent) #ifdef ALLOW_132_MODE # define PrivMode_Default (PrivMode_Autowrap|PrivMode_ShiftKeys|PrivMode_VisibleCursor|PrivMode_132OK) @@ -895,7 +788,7 @@ /****************************************************************************/ -// primivite wrapper around mbstate_t to ensure initialisation +// primitive wrapper around mbstate_t to ensure initialisation struct mbstate { mbstate_t mbs; @@ -962,7 +855,7 @@ static const char resval_undef []; // options specifically unset static const char resval_on []; // boolean options switched on static const char resval_off []; // or off - + log_callback *log_hook; // log error messages through this hook, if != 0 getfd_callback *getfd_hook; // convert remote to local fd, if != 0 #if ENABLE_PERL @@ -971,9 +864,6 @@ struct mbstate mbstate; // current input multibyte state unsigned char want_refresh:1, -#ifdef ENABLE_TRANSPARENCY - want_full_refresh:1, /* awaiting full screen refresh */ -#endif current_screen:1, /* primary or secondary */ num_scr_allow:1, bypass_keystate:1, @@ -1030,6 +920,8 @@ window_vt_x, window_vt_y, window_sb_x, + mouse_row, + mouse_col, # ifdef POINTER_BLANK pointerBlankDelay, # endif @@ -1078,12 +970,6 @@ /* ---------- */ 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; @@ -1151,14 +1037,11 @@ # endif #endif - // modifies first argument(!) - void paste (char *data, unsigned int len) NOTHROW; - - long vt_emask, vt_emask_perl, vt_emask_xim; + long vt_emask, vt_emask_perl, vt_emask_xim, vt_emask_mouse; void vt_select_input () const NOTHROW { - XSelectInput (dpy, vt, vt_emask | vt_emask_perl | vt_emask_xim); + XSelectInput (dpy, vt, vt_emask | vt_emask_perl | vt_emask_xim | vt_emask_mouse); } #if ENABLE_TRANSPARENCY || ENABLE_PERL @@ -1167,47 +1050,48 @@ #endif #ifdef HAVE_BG_PIXMAP int update_background (); - void update_background_cb (time_watcher &w); - time_watcher update_background_ev; + void update_background_cb (ev::timer &w, int revents); + ev::timer update_background_ev; #endif void x_cb (XEvent &xev); - void flush (); xevent_watcher termwin_ev; xevent_watcher vt_ev; #ifdef HAVE_SCROLLBARS 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 flush_cb (time_watcher &w); time_watcher flush_ev; - void pty_cb (io_watcher &w, short revents); io_watcher pty_ev; - void incr_cb (time_watcher &w) NOTHROW; time_watcher incr_ev; + void child_cb (ev::child &w, int revents); ev::child child_ev; + void prepare_cb (ev::prepare &w, int revents); ev::prepare prepare_ev; + void destroy_cb (ev::check &w, int revents); ev::check destroy_ev; + void flush (); + void flush_cb (ev::timer &w, int revents); ev::timer flush_ev; + bool pty_fill (); + 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; +#ifndef NO_BELL + 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 (); @@ -1216,24 +1100,11 @@ void tt_write (const char *data, unsigned int len); void pty_write (); - void tt_winch (); - - rxvt_term (); - ~rxvt_term (); - void destroy (); - void emergency_cleanup (); - - bool init (int argc, const char *const *argv, stringvec *envv); - bool init (stringvec *argv, stringvec *envv) { this->argv = argv; return init (argv->size (), argv->begin (), envv); } - - bool init_vars (); - - bool pty_fill (); void make_current () const // make this the "currently active" urxvt instance { @@ -1242,22 +1113,6 @@ 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 (); - void init_command (const char *const *argv); - void run_command (const char *const *argv); - int run_child (const char *const *argv); - - void color_aliases (int idx); - void recolour_cursor (); - void create_windows (int argc, const char *const *argv); - void resize_all_windows (unsigned int newwidth, unsigned int newheight, int ignoreparent); - void window_calc (unsigned int newwidth, unsigned int newheight); - #if USE_XIM rxvt_xim *input_method; XIC Input_Context; @@ -1277,8 +1132,6 @@ void IMSetPosition (); #endif - void resize_scrollbar (); - // command.C void key_press (XKeyEvent &ev); void key_release (XKeyEvent &ev); @@ -1316,9 +1169,29 @@ void process_sgr_mode (unsigned int nargs, const int *arg); void process_graphics (); // init.C + bool init_vars (); + void init_secondary (); + const char **init_resources (int argc, const char *const *argv); + void init_env (); + void set_locale (const char *locale); + void init_xlocale (); + void init_command (const char *const *argv); + void run_command (const char *const *argv); + int run_child (const char *const *argv); + void color_aliases (int idx); + void create_windows (int argc, const char *const *argv); void Get_Colours (); void get_ourmods (); // main.C + void tt_winch (); + rxvt_term (); + ~rxvt_term (); + void destroy (); + void emergency_cleanup (); + bool 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); bool set_fonts (); void set_string_property (Atom prop, const char *str, int len = -1); void set_utf8_property (Atom prop, const char *str, int len = -1); @@ -1329,6 +1202,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 @@ -1401,6 +1276,16 @@ options[opt >> 3] &= ~(1 << (opt & 7)); } + void PrivMode (int set, unsigned bit) NOTHROW + { + if (set) + priv_modes |= bit; + else + priv_modes &= ~bit; + } + + // modifies first argument(!) + void paste (char *data, unsigned int len) NOTHROW; void scr_blank_line (line_t &l, unsigned int col, unsigned int width, rend_t efs) const NOTHROW; void scr_blank_screen_mem (line_t &l, rend_t efs) const NOTHROW; int scr_scroll_text (int row1, int row2, int count) NOTHROW; @@ -1417,7 +1302,6 @@ #endif void scr_touch (bool refresh) NOTHROW; void scr_expose (int x, int y, int width, int height, bool refresh) NOTHROW; - rxvt_fontset *scr_find_fontset (rend_t r = DEFAULT_RSTYLE); void scr_recolour () NOTHROW; void scr_remap_chars () NOTHROW; void scr_remap_chars (line_t &l) NOTHROW; @@ -1478,8 +1362,6 @@ void selection_extend (int x, int y, int flag) NOTHROW; void selection_rotate (int x, int y) NOTHROW; - void pixel_position (int *x, int *y) NOTHROW; - #if defined(NEXT_SCROLLBAR) // scrollbar-next.C Pixmap renderPixmap (const char *const *data, int width, int height); @@ -1504,6 +1386,7 @@ #endif // scrollbar.C + void resize_scrollbar (); int scrollbar_mapping (int map); int scrollbar_show (int update); void setup_scrollbar (const char *scrollalign, const char *scrollstyle, const char *thickness); @@ -1511,23 +1394,9 @@ // xdefaults.C void get_options (int argc, const char *const *argv); int parse_keysym (const char *str, const char *arg); - void get_xdefaults (FILE *stream, const char *name); + const char *x_resource (const char *name); void extract_resources (); - // xpm.C - 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_ */