--- rxvt-unicode/src/rxvt.h 2006/01/21 23:50:33 1.232 +++ rxvt-unicode/src/rxvt.h 2006/01/25 02:53:13 1.243 @@ -17,6 +17,7 @@ #if ENABLE_FRILLS # define ENABLE_XEMBED 1 # define ENABLE_EWMH 1 +# define ENABLE_XIM_ONTHESPOT 1 # define CURSOR_BLINK 1 #else # define ENABLE_MINIMAL 1 @@ -37,6 +38,7 @@ #include "rxvttoolkit.h" #include "iom.h" #include "salloc.h" +#include "libptytty.h" #include "rxvtperl.h" @@ -143,6 +145,7 @@ 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) @@ -169,13 +172,21 @@ inline void set_environ (stringvec *envv) { +#if ENABLE_PERL + assert (envv); +#else if (envv) +#endif environ = (char **)envv->begin (); } inline void set_environ (char **envv) { +#if ENABLE_PERL + assert (envv); +#else if (envv) +#endif environ = envv; } @@ -202,32 +213,6 @@ } bgPixmap_t; #endif -struct rxvt_ptytty { - int pty; // pty file descriptor; connected to rxvt - int tty; // tty file descriptor; connected to child - - rxvt_ptytty () - : pty(-1), tty(-1) - { - } - - virtual ~rxvt_ptytty () - { - } - - virtual bool get () = 0; -#if UTMP_SUPPORT - virtual void login (int cmd_pid, bool login_shell, const char *hostname) = 0; -#endif - - void close_tty (); - bool make_controlling_tty (); - void set_utf8_mode (bool on); -}; - -rxvt_ptytty *rxvt_new_ptytty (); // create a new pty object -void rxvt_ptytty_server (); // start the ptytty server process - /* * the 'essential' information for reporting Mouse Events * pared down from XButtonEvent @@ -636,42 +621,6 @@ NUM_RESOURCES }; -// see init.C:xa_names, which must be kept in sync -enum { - XA_TEXT = 0, - XA_COMPOUND_TEXT, - XA_UTF8_STRING, - XA_MULTIPLE, - XA_TARGETS, - XA_TIMESTAMP, - XA_VT_SELECTION, - XA_INCR, - XA_WM_PROTOCOLS, - XA_WM_DELETE_WINDOW, - XA_CLIPBOARD, -#if ENABLE_FRILLS - XA_MOTIF_WM_HINTS, -#endif -#if ENABLE_EWMH - XA_NET_WM_PID, - XA_NET_WM_NAME, - XA_NET_WM_ICON_NAME, - XA_NET_WM_PING, -#endif -#if USE_XIM - XA_WM_LOCALE_NAME, -#endif -#if TRANSPARENT - XA_XROOTPMAP_ID, - XA_ESETROOT_PMAP_ID, -#endif -#if ENABLE_XEMBED - XA_XEMBED, - XA_XEMBED_INFO, -#endif - NUM_XA -}; - /* DEC private modes */ #define PrivMode_132 (1UL<<0) #define PrivMode_132OK (1UL<<1) @@ -754,6 +703,11 @@ #define dLocal(type,name) type const name = this->name #define dDisp Display *disp = this->display->display +// for speed reasons, we assume that all latin1 characters +// are single-width (the first unicdoe combining character +// is actually 0x300, but ascii is what matters most). +#define WCWIDTH(c) ((c) < 0x100 ? 1 : wcwidth (c)) + /* convert pixel dimensions to row/column values. Everything as int32_t */ #define Pixel2Col(x) Pixel2Width((int32_t)(x)) #define Pixel2Row(y) Pixel2Height((int32_t)(y)) @@ -841,27 +795,6 @@ # define XPMClearArea(a, b, c, d, e, f, g) #endif -#ifdef DEBUG_CMD -# define D_CMD(x) fprintf x ; fputc('\n', stderr) -#else -# define D_CMD(x) -#endif -#ifdef DEBUG_INIT -# define D_INIT(x) fprintf x ; fputc('\n', stderr) -#else -# define D_INIT(x) -#endif -#ifdef DEBUG_MAIN -# define D_MAIN(x) fprintf x ; fputc('\n', stderr) -#else -# define D_MAIN(x) -#endif -#ifdef DEBUG_SIZE -# define D_SIZE(x) fprintf x ; fputc('\n', stderr) -#else -# define D_SIZE(x) -#endif - typedef callback1 log_callback; typedef callback1 getfd_callback; @@ -1068,7 +1001,7 @@ unsigned long priv_modes, SavedModes; /* ---------- */ - Atom xa[NUM_XA]; + Atom *xa; /* ---------- */ #ifdef RXVT_SCROLLBAR GC scrollbarGC, @@ -1135,15 +1068,16 @@ vector allocated; // free these memory blocks with free() - char *env_windowid; /* environmental variable WINDOWID */ + char env_windowid[21]; /* environmental variable WINDOWID */ + char env_colorfgbg[sizeof ("COLORFGBG=default;default;bg") + 1]; char *env_display; /* environmental variable DISPLAY */ char *env_term; /* environmental variable TERM */ - char *env_colorfgbg; + char *locale; char charsets[4]; char *v_buffer; /* pointer to physical buffer */ unsigned int v_buflen; /* size of area to write */ - stringvec *argv, *envv; /* if != 0, will be freed on destroy time */ + stringvec *argv, *envv; /* if != 0, will be freed at destroy time */ #ifdef KEYSYM_RESOURCE keyboard_manager *keyboard; @@ -1154,7 +1088,7 @@ char *cmdbuf_ptr, *cmdbuf_endp; char cmdbuf_base[CBUFSIZ]; - rxvt_ptytty *pty; + ptytty *pty; rxvt_salloc *talloc; // text line allocator rxvt_salloc *ralloc; // rend line allocator @@ -1175,11 +1109,11 @@ // modifies first argument(!) void paste (char *data, unsigned int len) NOTHROW; - long vt_emask, vt_emask_perl; + long vt_emask, vt_emask_perl, vt_emask_xim; void vt_select_input () const NOTHROW { - XSelectInput (display->display, vt, vt_emask | vt_emask_perl); + XSelectInput (display->display, vt, vt_emask | vt_emask_perl | vt_emask_xim); } #if TRANSPARENT @@ -1239,7 +1173,14 @@ void destroy (); void emergency_cleanup (); - bool init (int argc, const char *const *argv); + 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 (); @@ -1268,10 +1209,10 @@ void window_calc (unsigned int newwidth, unsigned int newheight); #if USE_XIM - rxvt_xim *input_method; - XIC Input_Context; - XIMStyle input_style; - XPoint spot; // most recently sent spot position + rxvt_xim *input_method; + XIC Input_Context; + XIMStyle input_style; + XPoint spot; // most recently sent spot position void im_destroy (); void im_cb (); im_watcher im_ev; @@ -1339,7 +1280,7 @@ // screen.C - void lalloc (line_t &l) const NOTHROW + void lalloc (line_t &l) const { l.t = (text_t *)talloc->alloc (); l.r = (rend_t *)ralloc->alloc (); @@ -1353,7 +1294,7 @@ } #endif - void lresize (line_t &l) const NOTHROW + void lresize (line_t &l) const { if (!l.t) return; @@ -1431,10 +1372,11 @@ enum cursor_mode { SAVE, RESTORE }; - void scr_poweron () NOTHROW; + void scr_poweron (); void scr_cursor (cursor_mode mode) NOTHROW; void scr_do_wrap () NOTHROW; - int scr_change_screen (int scrn) NOTHROW; + void scr_swap_screen () NOTHROW; + void scr_change_screen (int scrn); void scr_color (unsigned int color, int fgbg) NOTHROW; void scr_rendition (int set, int style) NOTHROW; void scr_add_lines (const wchar_t *str, int len, int minlines = 0) NOTHROW; @@ -1536,9 +1478,5 @@ # define __PROTO(p) () #endif -#ifdef DEBUG_malloc -# include "dmalloc.h" /* This comes last */ -#endif - #endif /* _RXVT_H_ */