--- rxvt-unicode/src/rxvt.h 2004/12/01 02:12:18 1.126 +++ rxvt-unicode/src/rxvt.h 2005/02/20 00:09:25 1.151 @@ -12,7 +12,7 @@ #include #include #if ENABLE_FRILLS -#include +# include #endif #include "encoding.h" @@ -21,6 +21,10 @@ #include "iom.h" #include "salloc.h" +#if ENABLE_FRILLS +# define ENABLE_XEMBED 1 +#endif + /* ***************************************************************************** * SYSTEM HACKS @@ -82,14 +86,23 @@ * PROTOTYPES ***************************************************************************** */ +// main.C RETSIGTYPE rxvt_Child_signal (int sig); RETSIGTYPE rxvt_Exit_signal (int sig); void rxvt_clean_exit (); void * rxvt_malloc (size_t size); void * rxvt_calloc (size_t number, size_t size); void * rxvt_realloc (void *ptr, size_t size); -char * rxvt_wcstombs (const wchar_t *str, int len); +void rxvt_privileges (rxvt_privaction action); + +// util.C +char * rxvt_wcstombs (const wchar_t *str, int len = -1); +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 (const char *str); + +// misc.C char * rxvt_r_basename (const char *str); void rxvt_vlog (const char *fmt, va_list arg_ptr); void rxvt_log (const char *fmt,...); @@ -106,8 +119,6 @@ void rxvt_Draw_Shadow (Display *display, Window win, GC topShadow, GC botShadow, int x, int y, int w, int h); void rxvt_Draw_Triangle (Display *display, Window win, GC topShadow, GC botShadow, int x, int y, int w, int type); -void rxvt_privileges (rxvt_privaction action); - /* ***************************************************************************** * STRUCTURES AND TYPEDEFS @@ -134,8 +145,8 @@ #ifdef XPM_BACKGROUND typedef struct { - short w, h, x, y; - Pixmap pixmap; + short w, h, x, y; + Pixmap pixmap; } bgPixmap_t; #endif @@ -144,10 +155,10 @@ * pared down from XButtonEvent */ struct mouse_event { - int clicks; - Time time; /* milliseconds */ - unsigned int state; /* key or button mask */ - unsigned int button; /* detail */ + int clicks; + Time time; /* milliseconds */ + unsigned int state; /* key or button mask */ + unsigned int button; /* detail */ }; #define MAX_IT(current, other) if ((other) > (current)) (current) = (other) @@ -172,6 +183,31 @@ } 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_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_ACTIVATE_ACCELERATOR 14 + +// XEMBED detail code +# define XEMBED_FOCUS_CURRENT 0 +# define XEMBED_FOCUS_FIRST 1 +# define XEMBED_FOCUS_LAST 2 + +# define XEMBED_MAPPED (1 << 0) +#endif + /* ***************************************************************************** * NORMAL DEFINES @@ -499,6 +535,9 @@ Color_UL, Color_RV, #endif +#if ENABLE_FRILLS + Color_underline, +#endif #ifdef OPTION_HC Color_HC, #endif @@ -559,8 +598,9 @@ Rs_scrollBar_right, Rs_scrollBar_floating, Rs_scrollBar_align, -#endif Rs_scrollstyle, /* Rs_scrollBar_style */ + Rs_scrollBar_thickness, +#endif Rs_scrollTtyOutput, Rs_scrollTtyKeypress, Rs_scrollWithBuffer, @@ -598,10 +638,11 @@ Rs_ext_bwidth, Rs_int_bwidth, Rs_borderLess, -#endif - Rs_scrollBar_thickness, -#ifndef NO_LINESPACE Rs_lineSpace, + Rs_pty_fd, +#endif +#if ENABLE_XEMBED + Rs_embed, #endif Rs_cutchars, Rs_modifier, @@ -612,6 +653,7 @@ Rs_pointerBlank, Rs_pointerBlankDelay, Rs_imLocale, + Rs_imFont, Rs_pastableTabs, #ifndef NO_SECONDARY_SCREEN Rs_secondaryScreen, @@ -636,16 +678,30 @@ XA_TIMESTAMP, XA_VT_SELECTION, XA_INCR, - XA_WMDELETEWINDOW, -#ifdef TRANSPARENT - XA_XROOTPMAPID, - XA_XSETROOTID, + XA_WM_PROTOCOLS, + XA_WM_DELETE_WINDOW, + XA_CLIPBOARD, +#if ENABLE_FRILLS + XA_NET_WM_PID, + XA_MOTIF_WM_HINTS, + XA_NET_WM_NAME, + XA_NET_WM_ICON_NAME, +#endif +#if USE_XIM + XA_WM_LOCALE_NAME, #endif -#ifdef OFFIX_DND /* OffiX Dnd (drag 'n' drop) support */ +#if TRANSPARENT + XA_XROOTPMAP_ID, + XA_ESETROOT_PMAP_ID, +#endif +#if OFFIX_DND /* OffiX Dnd (drag 'n' drop) support */ XA_DNDPROTOCOL, XA_DNDSELECTION, -#endif /* OFFIX_DND */ - XA_CLIPBOARD, +#endif +#if ENABLE_XEMBED + XA_XEMBED, + XA_XEMBED_INFO, +#endif NUM_XA }; @@ -682,9 +738,9 @@ priv_modes &= ~(bit) #ifdef ALLOW_132_MODE -# define PrivMode_Default (PrivMode_Autowrap|PrivMode_aplKP|PrivMode_ShiftKeys|PrivMode_VisibleCursor|PrivMode_132OK) +# define PrivMode_Default (PrivMode_Autowrap|PrivMode_ShiftKeys|PrivMode_VisibleCursor|PrivMode_132OK) #else -# define PrivMode_Default (PrivMode_Autowrap|PrivMode_aplKP|PrivMode_ShiftKeys|PrivMode_VisibleCursor) +# define PrivMode_Default (PrivMode_Autowrap|PrivMode_ShiftKeys|PrivMode_VisibleCursor) #endif // do not change these constants lightly, there are many interdependencies @@ -745,6 +801,8 @@ #define strchr(x, y) strchr((const char *)(x), (int)(y)) #define strrchr(x, y) strrchr((const char *)(x), (int)(y)) +#define dDisp Display *disp = display->display + /* 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)) @@ -852,13 +910,6 @@ # define XPMClearArea(a, b, c, d, e, f, g) #endif -#ifndef STRICT_FONT_CHECKING -# define rxvt_get_fontwidest(font) ((font)->max_bounds.width) -#endif - -#define rxvt_Gr_ButtonPress(x,y) rxvt_Gr_ButtonReport (R, 'P',(x),(y)) -#define rxvt_Gr_ButtonRelease(x,y) rxvt_Gr_ButtonReport (R, 'R',(x),(y)) - #ifdef UTMP_SUPPORT # if !defined(RXVT_UTMPX_FILE) || !defined(HAVE_STRUCT_UTMPX) # undef HAVE_UTMPX_H @@ -941,6 +992,8 @@ mbstate () { reset (); } }; +#define UNICODE_MASK 0x1fffffUL + #if UNICODE3 # define COMPOSE_LO 0x40000000UL # define COMPOSE_HI 0x400fffffUL @@ -979,6 +1032,10 @@ #endif +#ifdef KEYSYM_RESOURCE + class keyboard_manager; +#endif + struct rxvt_term : zero_initialized, rxvt_vars { log_callback *log_hook; // log error messages through this hook, if != 0 @@ -1005,7 +1062,7 @@ #ifdef POINTER_BLANK hidden_pointer:1, #endif -// enc_utf8:1, /* wether terminal reads/writes utf-8 */ + enc_utf8:1, /* wether locale uses utf-8 */ seen_input:1, /* wether we have seen some program output yet */ seen_resize:1, /* wether we had a resize event */ parsed_geometry:1; @@ -1061,7 +1118,8 @@ # endif allowedxerror; /* ---------- */ - unsigned int ModMetaMask, + unsigned int ModLevel3Mask, + ModMetaMask, ModNumLockMask; int old_width, /* last used width in screen resize */ old_height; /* last used height in screen resize */ @@ -1101,11 +1159,10 @@ Time selection_time, selection_request_time; pid_t cmd_pid; /* process id of child */ + char * incr_buf; + size_t incr_buf_size, incr_buf_fill; /* ---------- */ Cursor leftptr_cursor; -#ifdef POINTER_BLANK - Cursor blank_cursor; -#endif /* ---------- */ #ifndef NO_BACKSPACE_KEY const char *key_backspace; @@ -1169,16 +1226,15 @@ char *env_term; /* environmental variable TERM */ char *env_colorfgbg; char *locale; -#if 0 - char *codeset; -#endif char charsets[4]; unsigned 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 */ + #ifdef KEYSYM_RESOURCE - const unsigned char *Keysym_map[256]; + keyboard_manager *keyboard; #endif + const char *rs[NUM_RESOURCES]; /* command input buffering */ unsigned char *cmdbuf_ptr, *cmdbuf_endp; @@ -1200,7 +1256,8 @@ # endif #endif - void paste (const unsigned char *data, unsigned int len); + // modifies first argument(!) + void paste (unsigned char *data, unsigned int len); void flush (); @@ -1210,7 +1267,7 @@ #endif - void sig_term (sig_watcher &w); sig_watcher sw_term; + void sig_term (sig_watcher &w); sig_watcher sw_term, sw_int; void sig_chld (sig_watcher &w); sig_watcher sw_chld; void x_cb (XEvent &xev); @@ -1256,12 +1313,14 @@ void tt_printf (const char *fmt,...); void tt_write (const unsigned 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); bool init_vars (); @@ -1325,6 +1384,8 @@ void mouse_report (XButtonEvent &ev); void button_press (XButtonEvent &ev); void button_release (XButtonEvent &ev); + void focus_in (); + void focus_out (); int check_our_parents (); #ifdef PRINTPIPE FILE *popen_printer (); @@ -1354,6 +1415,8 @@ // main.C void privileged_utmp (rxvt_privaction action); 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); void set_title (const char *str); void set_icon_name (const char *str); void set_window_color (int idx, const char *color); @@ -1448,7 +1511,7 @@ void scr_reverse_selection (); void scr_dump (int fd); void selection_check (int check_more); - int selection_paste (Window win, Atom prop, bool delete_prop); + void selection_paste (Window win, Atom prop, bool delete_prop); void selection_property (Window win, Atom prop); void selection_request (Time tm, int x, int y); int selection_request_other (Atom target, int selnum); @@ -1493,7 +1556,7 @@ 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); - void extract_resources (Display *display, const char *name); + void extract_resources (); // xpm.C int scale_pixmap (const char *geom); void resize_pixmap ();