--- rxvt-unicode/src/rxvt.h 2004/09/05 09:54:28 1.124 +++ rxvt-unicode/src/rxvt.h 2005/08/11 02:05:07 1.160 @@ -12,7 +12,7 @@ #include #include #if ENABLE_FRILLS -#include +# include #endif #include "encoding.h" @@ -21,6 +21,12 @@ #include "iom.h" #include "salloc.h" +#if ENABLE_FRILLS +# define ENABLE_XEMBED 1 +# define ENABLE_EWMH 1 +# define CURSOR_BLINK 1 +#endif + /* ***************************************************************************** * SYSTEM HACKS @@ -82,14 +88,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,...); @@ -101,11 +116,11 @@ char * rxvt_Str_trim (char *str); int rxvt_Str_escaped (char *str); char ** rxvt_splitcommastring (const char *cs); +void rxvt_freecommastring (char **cs); char * rxvt_File_find (const char *file, const char *ext, const char *path); 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); +void rxvt_usleep (int usecs); /* ***************************************************************************** @@ -125,7 +140,7 @@ /* If we're using either the rxvt scrollbar or menu bars, keep the * scrollColor resource. */ -#if defined(RXVT_SCROLLBAR) || defined(MENUBAR) || defined(PLAIN_SCROLLBAR) +#if defined(RXVT_SCROLLBAR) || defined(NEXT_SCROLLBAR) || defined(MENUBAR) || defined(PLAIN_SCROLLBAR) # define KEEP_SCROLLCOLOR 1 #else # undef KEEP_SCROLLCOLOR @@ -133,8 +148,8 @@ #ifdef XPM_BACKGROUND typedef struct { - short w, h, x, y; - Pixmap pixmap; + short w, h, x, y; + Pixmap pixmap; } bgPixmap_t; #endif @@ -143,10 +158,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) @@ -171,6 +186,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 @@ -230,10 +270,10 @@ #define R_SB_ALIGN_TOP 1 #define R_SB_ALIGN_BOTTOM 2 -#define R_SB_RXVT 0 #define R_SB_NEXT 1 #define R_SB_XTERM 2 #define R_SB_PLAIN 4 +#define R_SB_RXVT 8 #define SB_WIDTH_NEXT 19 #define SB_WIDTH_XTERM 15 @@ -436,22 +476,24 @@ XTerm_restoreFG = 39, // change default fg color XTerm_restoreBG = 49, // change default bg color XTerm_dumpscreen = 55, // dump scrollback and all of screen - XTerm_locale = 701, // change locale - XTerm_Menu = 703, // set menu item - XTerm_Color_IT = 704, // change actual 'Italic' colour - XTerm_Color_tint = 705, // change actual tint colour + + URxvt_locale = 701, // change locale + URxvt_Menu = 703, // set menu item + URxvt_Color_IT = 704, // change actual 'Italic' colour + URxvt_Color_tint = 705, // change actual tint colour URxvt_font = 710, URxvt_boldFont = 711, URxvt_italicFont = 712, URxvt_boldItalicFont = 713, + + URxvt_view_up = 720, + URxvt_view_down = 721, }; /* Words starting with `Color_' are colours. Others are counts */ /* - * The following comment is mostly obsolete since pixcolor_set was expanded: - * We're currently upto 29 colours. Only 3 more available. The - * PixColor and rendition colour usage should probably be decoupled + * The PixColor and rendition colour usage should probably be decoupled * on the unnecessary items, e.g. Color_pointer, but won't bother * until we need to. Also, be aware of usage in pixcolor_set */ @@ -498,6 +540,9 @@ Color_UL, Color_RV, #endif +#if ENABLE_FRILLS + Color_underline, +#endif #ifdef OPTION_HC Color_HC, #endif @@ -508,6 +553,9 @@ #if TINTING Color_tint, #endif +#if OFF_FOCUS_FADING + Color_fade, +#endif NRS_COLORS, /* */ #ifdef KEEP_SCROLLCOLOR Color_topShadow = NRS_COLORS, @@ -558,8 +606,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, @@ -597,20 +646,26 @@ Rs_ext_bwidth, Rs_int_bwidth, Rs_borderLess, -#endif - Rs_scrollBar_thickness, -#ifndef NO_LINESPACE Rs_lineSpace, + Rs_pty_fd, + Rs_cursorUnderline, +#endif +#if CURSOR_BLINK + Rs_cursorBlink, +#endif +#if ENABLE_XEMBED + Rs_embed, #endif Rs_cutchars, Rs_modifier, Rs_answerbackstring, Rs_tripleclickwords, Rs_insecure, - Rs_cursorBlink, Rs_pointerBlank, Rs_pointerBlankDelay, Rs_imLocale, + Rs_imFont, + Rs_pastableTabs, #ifndef NO_SECONDARY_SCREEN Rs_secondaryScreen, Rs_secondaryScroll, @@ -634,16 +689,33 @@ 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_MOTIF_WM_HINTS, #endif -#ifdef OFFIX_DND /* OffiX Dnd (drag 'n' drop) support */ +#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 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 }; @@ -680,9 +752,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 @@ -743,6 +815,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)) @@ -850,13 +924,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 @@ -939,6 +1006,8 @@ mbstate () { reset (); } }; +#define UNICODE_MASK 0x1fffffUL + #if UNICODE3 # define COMPOSE_LO 0x40000000UL # define COMPOSE_HI 0x400fffffUL @@ -977,6 +1046,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 @@ -1003,7 +1076,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; @@ -1059,7 +1132,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 */ @@ -1099,11 +1173,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; @@ -1158,6 +1231,7 @@ text_t text, rend_t rend = OVERLAY_RSTYLE); void scr_overlay_set (int x, int y, const char *s); + void scr_overlay_set (int x, int y, const wchar_t *s); #endif vector allocated; // free these memory blocks with free() @@ -1167,16 +1241,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; @@ -1198,7 +1271,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 (); @@ -1208,7 +1282,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); @@ -1254,12 +1328,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 (); @@ -1323,6 +1399,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 (); @@ -1352,6 +1430,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); @@ -1403,6 +1483,11 @@ void scr_refresh (unsigned char refresh_type); bool scr_refresh_rend (rend_t mask, rend_t value); void scr_erase_screen (int mode); +#if ENABLE_FRILLS + void scr_erase_savelines (); + void scr_backindex (); + void scr_forwardindex (); +#endif void scr_touch (bool refresh); void scr_expose (int x, int y, int width, int height, bool refresh); rxvt_fontset *scr_find_fontset (rend_t r = DEFAULT_RSTYLE); @@ -1419,8 +1504,6 @@ void scr_add_lines (const unicode_t *str, int nlines, int len); void scr_backspace (); void scr_tab (int count, bool ht = false); - void scr_backindex (); - void scr_forwardindex (); void scr_gotorc (int row, int col, int relative); void scr_index (enum page_dirn direction); void scr_erase_line (int mode); @@ -1446,7 +1529,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); @@ -1491,7 +1574,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 ();