--- rxvt-unicode/src/rxvt.h 2007/08/08 22:39:49 1.289 +++ rxvt-unicode/src/rxvt.h 2007/11/30 10:57:04 1.328 @@ -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" @@ -75,11 +73,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 +91,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 +105,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 +122,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 +132,7 @@ environ = (char **)envv->begin (); } -inline void set_environ (char **envv) +static inline void set_environ (char **envv) { #if ENABLE_PERL assert (envv); @@ -172,61 +158,6 @@ # undef KEEP_SCROLLCOLOR #endif -#if defined(XPM_BACKGROUND) || defined(ENABLE_TRANSPARENCY) -# define HAVE_BG_PIXMAP 1/* to simplify further usage */ -struct bgPixmap_t { -# define bgPmap_geometrySet (1UL<<0) -# define bgPmap_propScale (1UL<<1) -# define bgPmap_geometryFlags (bgPmap_geometrySet|bgPmap_propScale) - -# define bgPmap_Transparent (1UL<<16) - unsigned long flags; - -# ifdef XPM_BACKGROUND -# ifdef HAVE_AFTERIMAGE - ASImage *original_asim; - bool render_asim (ASImage *background, ARGB32 background_tint); -# endif - -#define bgPmap_defaultScale 100 -#define bgPmap_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 */ - bool handle_geometry (const char *geom); - void set_defaultGeometry () - { - h_scale = v_scale = bgPmap_defaultScale; - h_align = v_align = bgPmap_defaultAlign; - flags |= bgPmap_geometrySet; - }; - -# endif /* XPM_BACKGROUND */ - - rxvt_term *target; - bool set_target (rxvt_term *new_target) - { - if (new_target) - if (target != new_target) - { - target = new_target; - return true; - } - return false; - }; - - Pixmap pixmap; - unsigned int pmap_width, pmap_height; - unsigned int pmap_depth; - - bool window_size_sensitive(); - void apply_background(); - -}; -#else -# undef HAVE_BG_PIXMAP -#endif - /* * the 'essential' information for reporting Mouse Events * pared down from XButtonEvent @@ -238,36 +169,26 @@ 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 -# 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) @@ -281,7 +202,7 @@ /* COLORTERM, TERM environment variables */ #define COLORTERMENV "rxvt" -#ifdef XPM_BACKGROUND +#ifdef BG_IMAGE_FROM_FILE # define COLORTERMENVFULL COLORTERMENV "-xpm" #else # define COLORTERMENVFULL COLORTERMENV @@ -490,7 +411,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 */ /* @@ -659,15 +580,10 @@ #define PrivMode_smoothScroll (1UL<<17) #define PrivMode_vt52 (1UL<<18) #define PrivMode_LFNL (1UL<<19) -/* too annoying to implement X11 highlight tracking */ -/* #define PrivMode_MouseX11Track (1LU<<20) */ +#define PrivMode_MouseBtnEvent (1UL<<20) +#define PrivMode_MouseAnyEvent (1UL<<21) -#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) @@ -685,6 +601,17 @@ # define PATH_MAX 16384 #endif +#if ENABLE_FRILLS +# include +typedef struct _mwmhints { + CARD32 flags; + CARD32 functions; + CARD32 decorations; + INT32 input_mode; + CARD32 status; +} MWMHints; +#endif + /* Motif window hints */ #define MWM_HINTS_FUNCTIONS (1L << 0) #define MWM_HINTS_DECORATIONS (1L << 1) @@ -858,7 +785,7 @@ /****************************************************************************/ -// primivite wrapper around mbstate_t to ensure initialisation +// primitive wrapper around mbstate_t to ensure initialisation struct mbstate { mbstate_t mbs; @@ -925,7 +852,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 @@ -934,11 +861,6 @@ struct mbstate mbstate; // current input multibyte state unsigned char want_refresh:1, -#ifdef ENABLE_TRANSPARENCY - want_full_refresh:1, /* awaiting full screen refresh */ - 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, @@ -995,6 +917,8 @@ window_vt_x, window_vt_y, window_sb_x, + mouse_row, + mouse_col, # ifdef POINTER_BLANK pointerBlankDelay, # endif @@ -1043,12 +967,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; @@ -1092,6 +1010,9 @@ #ifdef KEYSYM_RESOURCE keyboard_manager *keyboard; #endif +#ifndef NO_RESOURCES + XrmDatabase option_db; +#endif const char *rs[NUM_RESOURCES]; /* command input buffering */ @@ -1116,63 +1037,65 @@ # 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 void rootwin_cb (XEvent &xev); xevent_watcher rootwin_ev; #endif -#if ENABLE_TRANSPARENCY - int check_our_parents (); - void check_our_parents_cb (time_watcher &w); - time_watcher check_our_parents_ev; +#ifdef HAVE_BG_PIXMAP + int update_background (); +#if TRACE_PIXMAPS + int 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); - 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::idle &w, int revents); ev::idle 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 (); @@ -1181,24 +1104,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 { @@ -1207,22 +1117,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; @@ -1242,8 +1136,6 @@ void IMSetPosition (); #endif - void resize_scrollbar (); - // command.C void key_press (XKeyEvent &ev); void key_release (XKeyEvent &ev); @@ -1281,9 +1173,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); @@ -1294,6 +1206,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 @@ -1355,17 +1269,35 @@ 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 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; @@ -1382,7 +1314,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; @@ -1443,8 +1374,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); @@ -1469,6 +1398,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); @@ -1476,24 +1406,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 -//int scale_pixmap (const char *geom); - void resize_pixmap (); - void set_bgPixmap (const char *file); }; -/* - ***************************************************************************** - * PROTOTYPES - ***************************************************************************** - */ -#ifdef PROTOTYPES -# define __PROTO(p) p -#else -# define __PROTO(p) () -#endif - -#endif /* _RXVT_H_ */ +#endif /* _RXVT_H_ */