--- rxvt-unicode/src/rxvt.h 2004/02/22 08:28:36 1.38 +++ rxvt-unicode/src/rxvt.h 2004/03/14 17:33:08 1.52 @@ -15,8 +15,6 @@ #include "iom.h" #include "salloc.h" -#include - /* ***************************************************************************** * SYSTEM HACKS @@ -143,10 +141,6 @@ # error if you disable both selection styles, how can you select, silly? #endif -#define APL_CLASS "XTerm" /* class name */ -#define APL_SUBCLASS "Rxvt" /* also check resources under this name */ -#define APL_NAME "rxvt" /* normal name */ - /* COLORTERM, TERM environment variables */ #define COLORTERMENV "rxvt" #ifdef XPM_BACKGROUND @@ -155,7 +149,7 @@ # define COLORTERMENVFULL COLORTERMENV #endif #ifndef TERMENV -# define TERMENV "xterm" +# define TERMENV "rxvt" #endif #if defined (NO_MOUSE_REPORT) && !defined (NO_MOUSE_REPORT_SCROLLBAR) @@ -271,11 +265,13 @@ * +---< SB_WIDTH_NEXT */ -#define NO_REFRESH 0 /* Window not visible at all! */ -#define FAST_REFRESH (1<<0) /* Fully exposed window */ -#define SLOW_REFRESH (1<<1) /* Partially exposed window */ -#define SMOOTH_REFRESH (1<<2) /* Do sync'ing to make it smooth */ -#define REFRESH_BOUNDS (1<<3) +enum { + NO_REFRESH = 0 , /* Window not visible at all! */ + FAST_REFRESH = 1<<0, /* Fully exposed window */ + SLOW_REFRESH = 1<<1, /* Partially exposed window */ + SMOOTH_REFRESH = 1<<2, /* Do sync'ing to make it smooth */ + REFRESH_BOUNDS = 1<<3 +}; #ifdef NO_SECONDARY_SCREEN # define NSCREENS 0 @@ -293,26 +289,30 @@ #define FONT_UP "#+" /* flags for rxvt_scr_gotorc () */ -#define C_RELATIVE 1 /* col movement is relative */ -#define R_RELATIVE 2 /* row movement is relative */ -#define RELATIVE (R_RELATIVE|C_RELATIVE) +enum { + C_RELATIVE = 1 , /* col movement is relative */ + R_RELATIVE = 2, /* row movement is relative */ + RELATIVE = 1 | 2, +}; /* modes for rxvt_scr_insdel_chars (), rxvt_scr_insdel_lines () */ -#define INSERT -1 /* don't change these values */ -#define DELETE +1 -#define ERASE +2 +enum { + INSERT = -1, /* don't change these values */ + DELETE = +1, + ERASE = +2, +}; /* modes for rxvt_scr_page () - scroll page. used by scrollbar window */ enum page_dirn { UP, DN, - NO_DIR + NO_DIR, }; /* arguments for rxvt_scr_change_screen () */ enum { PRIMARY = 0, - SECONDARY + SECONDARY, }; #define RS_None 0 /* Normal */ @@ -346,7 +346,7 @@ C0_SOH, C0_STX, C0_ETX, C0_EOT, C0_ENQ, C0_ACK, C0_BEL, 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 + C0_CAN, C0_EM , C0_SUB, C0_ESC, C0_IS4, C0_IS3, C0_IS2, C0_IS1, }; #define CHAR_ST 0x9c /* 0234 */ @@ -354,27 +354,39 @@ * XTerm Operating System Commands: ESC ] Ps;Pt (ST|BEL) * colour extensions by Christian W. Zuckschwerdt */ -#define XTerm_name 0 -#define XTerm_iconName 1 -#define XTerm_title 2 -#define XTerm_Color 4 /* change colors */ -#define XTerm_Color_cursor 12 /* change actual 'Cursor' color */ -#define XTerm_Color_pointer 13 /* change actual 'Pointer' color */ -#define XTerm_Color_RV 17 /* change actual 'Highlight' color */ -#define XTerm_Color_BD 18 /* change actual 'Bold' color */ -#define XTerm_Color_UL 19 /* change actual 'Underline' color */ -#define XTerm_logfile 46 /* not implemented */ -#define XTerm_font 50 - -/* - * rxvt extensions of XTerm OSCs: ESC ] Ps;Pt (ST|BEL) - */ -#define XTerm_locale 9 /* change locale */ -#define XTerm_Menu 10 /* set menu item */ -#define XTerm_Pixmap 20 /* new bg pixmap */ -#define XTerm_restoreFG 39 /* change default fg color */ -#define XTerm_restoreBG 49 /* change default bg color */ -#define XTerm_dumpscreen 55 /* dump scrollback and all of screen */ +enum { + XTerm_name = 0, + XTerm_iconName = 1, + XTerm_title = 2, + XTerm_property = 3, // change X property, not yet implemented + XTerm_Color = 4, // change colors + XTerm_Color00 = 10, // not implemented, CLASH! + XTerm_Color01 = 11, // not implemented + XTerm_Color_cursor = 12, // change actual 'Cursor' color + XTerm_Color_pointer = 13, // change actual 'Pointer' color + XTerm_Color04 = 14, // not implemented + XTerm_Color05 = 15, // not implemented + XTerm_Color06 = 16, // not implemented + XTerm_Color_RV = 17, // change actual 'Highlight' color + XTerm_logfile = 46, // not implemented + XTerm_font = 50, + + XTerm_konsole30 = 30, // reserved for konsole + XTerm_konsole31 = 31, // reserved for konsole + XTerm_emacs51 = 51, // reserved for emacs shell + /* + * rxvt extensions of XTerm OSCs: ESC ] Ps;Pt (ST|BEL) + */ + XTerm_Menu = 10, // set menu item + XTerm_Color_BD = 18, // change actual 'Bold' color + XTerm_Color_UL = 19, // change actual 'Underline' color + XTerm_Pixmap = 20, // new bg pixmap + 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_findfont = 702, // find font of given character (in decimal) +}; /* Words starting with `Color_' are colours. Others are counts */ /* @@ -511,10 +523,6 @@ Rs_preeditType, Rs_inputMethod, #endif -#if defined (HOTKEY_CTRL) || defined (HOTKEY_META) - Rs_bigfont_key, - Rs_smallfont_key, -#endif #ifdef TRANSPARENT Rs_transparent, Rs_transparent_all, @@ -528,9 +536,6 @@ Rs_lineSpace, #endif Rs_cutchars, -#ifdef ACS_ASCII - Rs_acs_chars, -#endif Rs_modifier, Rs_answerbackstring, Rs_tripleclickwords, @@ -592,14 +597,12 @@ if (test) \ PrivateModes |= (bit); \ else \ - PrivateModes &= ~ (bit) + PrivateModes &= ~(bit) #ifdef ALLOW_132_MODE -# define PrivMode_Default \ -(PrivMode_Autowrap|PrivMode_aplKP|PrivMode_ShiftKeys|PrivMode_VisibleCursor|PrivMode_132OK) +# define PrivMode_Default (PrivMode_Autowrap|PrivMode_aplKP|PrivMode_ShiftKeys|PrivMode_VisibleCursor|PrivMode_132OK) #else -# define PrivMode_Default \ -(PrivMode_Autowrap|PrivMode_aplKP|PrivMode_ShiftKeys|PrivMode_VisibleCursor) +# define PrivMode_Default (PrivMode_Autowrap|PrivMode_aplKP|PrivMode_ShiftKeys|PrivMode_VisibleCursor) #endif #define XDEPTH display->depth @@ -820,8 +823,46 @@ mbstate () { reset (); } }; +#if UNICODE3 +# define COMPOSE_LO 0x40000000UL +# define COMPOSE_HI 0x400fffffUL +# define IS_COMPOSE(n) ((int32_t)(n) >= COMPOSE_LO) +#else +# define COMPOSE_LO 0xd800UL +# define COMPOSE_HI 0xf8ffUL // dfff should be safer, but... +# define IS_COMPOSE(n) (COMPOSE_LO <= (n) && (n) <= COMPOSE_HI) +#endif + +#if ENABLE_COMBINING +// compose chars are used to represent composite characters +// that are not representable in unicode, as well as characters +// not fitting in the BMP. +struct compose_char { + uint32_t c1, c2; // any chars != NOCHAR are valid + compose_char (uint32_t c1, uint32_t c2) + : c1(c1), c2(c2) + { } +}; + +class rxvt_composite_vec { + vector v; +public: + text_t compose (uint32_t c1, uint32_t c2 = NOCHAR); + int expand (uint32_t c, wchar_t *r); + compose_char *operator [](text_t c) + { + return c >= COMPOSE_LO && c < COMPOSE_LO + v.size () + ? &v[c - COMPOSE_LO] + : 0; + } +}; + +extern class rxvt_composite_vec rxvt_composite; +#endif + + struct rxvt_term : rxvt_vars { - struct mbstate mbstate; + struct mbstate mbstate; unsigned char want_refresh:1, #ifdef TRANSPARENT @@ -974,9 +1015,6 @@ #ifndef NO_DELETE_KEY const char *key_delete; #endif -#if defined (HOTKEY_CTRL) || defined (HOTKEY_META) - KeySym ks_bigfont, ks_smallfont; -#endif #ifdef USE_XIM rxvt_xim *input_method; XIC Input_Context; @@ -1031,7 +1069,6 @@ char charsets[4]; unsigned char *v_buffer; /* pointer to physical buffer */ unsigned int v_buflen; /* size of area to write */ - char *newfont[MAX_NFONTS]; stringvec *argv, *envv; /* if != 0, will be freed on destroy time */ #ifdef KEYSYM_RESOURCE const unsigned char *Keysym_map[256]; @@ -1144,12 +1181,14 @@ void scr_reset (); void scr_reset_realloc (); void scr_release (); - void scr_clear (); + void scr_clear (bool really = true); void scr_refresh (unsigned char refresh_type); bool scr_refresh_rend (rend_t mask, rend_t value); void scr_erase_screen (int mode); void scr_touch (bool refresh); void scr_expose (int x, int y, int width, int height, bool refresh); + void scr_remap_chars (); + void scr_remap_chars (text_t *tp, rend_t *rp); /* autoconvert */ @@ -1157,12 +1196,13 @@ void lookup_key (XKeyEvent &ev); unsigned int cmd_write (const unsigned char *str, unsigned int count); uint32_t cmd_getc (); - void mouse_report (const XButtonEvent &ev); - void button_press (const XButtonEvent &ev); - void button_release (const XButtonEvent &ev); + bool cmd_parse (); + void mouse_report (XButtonEvent &ev); + void button_press (XButtonEvent &ev); + void button_release (XButtonEvent &ev); int check_our_parents (); #ifdef PRINTPIPE - FILE * popen_printer (); + FILE *popen_printer (); int pclose_printer (FILE *stream); #endif void process_print_pipe (); @@ -1204,19 +1244,19 @@ int action_dispatch (action_t *action); void menuarrow_free (char name); void menuarrow_add (char *string); - char * menu_find_base (menu_t **menu, char *path); - menu_t * menu_delete (menu_t *menu); - menu_t * menu_add (menu_t *parent, char *path); + char *menu_find_base (menu_t **menu, char *path); + menu_t *menu_delete (menu_t *menu); + menu_t *menu_add (menu_t *parent, char *path); void drawbox_menubar (int x, int len, int state); void drawtriangle (int x, int y, int state); void drawbox_menuitem (int y, int state); void menu_show (); - void menu_display (void (*update) (rxvt_t *)); + void menu_display (void (rxvt_term::*update) ()); void menu_hide_all (); void menu_hide (); void menu_clear (menu_t *menu); void menubar_clear (); - bar_t * menubar_find (const char *name); + bar_t *menubar_find (const char *name); int menubar_push (const char *name); void menubar_remove (const char *name); void menubar_dump (FILE *fp); @@ -1225,9 +1265,9 @@ void draw_Arrows (int name, int state); void menubar_expose (); int menubar_mapping (int map); - int menu_select (XButtonEvent *ev); - void menubar_select (XButtonEvent *ev); - void menubar_control (XButtonEvent *ev); + int menu_select (XButtonEvent &ev); + void menubar_select (XButtonEvent &ev); + void menubar_control (XButtonEvent &ev); void map_menuBar (int map); #endif