--- rxvt-unicode/src/rxvt.h 2004/08/04 03:29:28 1.87 +++ rxvt-unicode/src/rxvt.h 2004/12/01 02:12:18 1.126 @@ -11,13 +11,13 @@ #include #include #include -#ifndef NO_FRILLS +#if ENABLE_FRILLS #include #endif #include "encoding.h" -#include "defaultfont.h" -#include "rxvtcolor.h" +#include "rxvtfont.h" +#include "rxvttoolkit.h" #include "iom.h" #include "salloc.h" @@ -30,10 +30,10 @@ * @ Unixware: defines (__svr4__) */ #if defined (SVR4) && !defined (__svr4__) -# define __svr4__ +# define __svr4__ 1 #endif #if defined (sun) && !defined (__sun__) -# define __sun__ +# define __sun__ 1 #endif #ifndef HAVE_XPOINTER @@ -70,15 +70,46 @@ #if defined(HAVE_GRANTPT) && defined(HAVE_UNLOCKPT) # if defined(PTYS_ARE_GETPT) || defined(PTYS_ARE_PTMX) -# define NO_SETOWNER_TTYDEV +# define NO_SETOWNER_TTYDEV 1 # endif #endif #if defined(__CYGWIN32__) || defined(PTYS_ARE_OPENPTY) -# define NO_SETOWNER_TTYDEV +# define NO_SETOWNER_TTYDEV 1 #endif /* ***************************************************************************** + * PROTOTYPES + ***************************************************************************** + */ +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); +char * rxvt_strdup (const char *str); +char * rxvt_r_basename (const char *str); +void rxvt_vlog (const char *fmt, va_list arg_ptr); +void rxvt_log (const char *fmt,...); +void rxvt_warn (const char *fmt,...); +void rxvt_fatal (const char *fmt,...); +void rxvt_exit_failure (); +int rxvt_Str_match (const char *s1, const char *s2); +const char * rxvt_Str_skip_space (const char *str); +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); + +/* + ***************************************************************************** * STRUCTURES AND TYPEDEFS ***************************************************************************** */ @@ -95,7 +126,7 @@ /* If we're using either the rxvt scrollbar or menu bars, keep the * scrollColor resource. */ -#if defined(RXVT_SCROLLBAR) || defined(MENUBAR) +#if defined(RXVT_SCROLLBAR) || defined(MENUBAR) || defined(PLAIN_SCROLLBAR) # define KEEP_SCROLLCOLOR 1 #else # undef KEEP_SCROLLCOLOR @@ -119,11 +150,6 @@ unsigned int button; /* detail */ }; -#ifndef min -# define min(a,b) (((a) < (b)) ? (a) : (b)) -# define max(a,b) (((a) > (b)) ? (a) : (b)) -#endif - #define MAX_IT(current, other) if ((other) > (current)) (current) = (other) #define MIN_IT(current, other) if ((other) < (current)) (current) = (other) #define SWAP_IT(one, two, typeof) \ @@ -136,7 +162,7 @@ ? 0 \ : min ((val), (((uint16_t)-1)>>1))) -#ifndef NO_FRILLS +#if ENABLE_FRILLS typedef struct _mwmhints { CARD32 flags; CARD32 functions; @@ -160,17 +186,21 @@ # define COLORTERMENVFULL COLORTERMENV #endif #ifndef TERMENV -# define TERMENV "rxvt" +# define TERMENV "rxvt-unicode" #endif #if defined (NO_MOUSE_REPORT) && !defined (NO_MOUSE_REPORT_SCROLLBAR) -# define NO_MOUSE_REPORT_SCROLLBAR +# define NO_MOUSE_REPORT_SCROLLBAR 1 #endif #ifdef NO_RESOURCES # undef USE_XGETDEFAULT #endif +#if ISO_14755 +# define ENABLE_OVERLAY 1 +#endif + /* now look for other badly set stuff */ #if !defined (EACCESS) && defined(EAGAIN) @@ -187,7 +217,7 @@ #define menuBar_margin 2 /* margin below text */ #if defined(RXVT_SCROLLBAR) || defined(NEXT_SCROLLBAR) || defined(XTERM_SCROLLBAR) || defined(PLAIN_SCROLLBAR) -# define HAVE_SCROLLBARS +# define HAVE_SCROLLBARS 1 #endif /* width of scrollBar, menuBar shadow, must be 1 or 2 */ @@ -281,10 +311,6 @@ 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 */ -#if 0 - REFRESH_BOUNDS = 1<<3 -#endif - REFRESH_BOUNDS = 0 /* only required for old int_bwidth code. */ //TODO: remove this and all depending code }; #ifdef NO_SECONDARY_SCREEN @@ -293,10 +319,6 @@ # define NSCREENS 1 #endif -#define IGNORE 0 -#define SAVE 's' -#define RESTORE 'r' - /* special (internal) prefix for font commands */ #define FONT_CMD '#' #define FONT_DN "#-" @@ -331,18 +353,36 @@ #define RS_None 0 /* Normal */ -#define RS_fgMask 0x000001FFu /* 512 colors */ -#define RS_bgMask 0x0003FE00u /* 512 colors */ -#define RS_Bold 0x00040000u /* bold */ -#define RS_Blink 0x00080000u /* blink */ -#define RS_RVid 0x00100000u /* reverse video */ -#define RS_Uline 0x00200000u /* underline */ +#define RS_fgMask 0x0000007fUL /* 128 colors */ +#define RS_bgMask 0x00003f80UL /* 128 colors */ + +// font styles +#define RS_Bold 0x00004000UL // value 1 +#define RS_Italic 0x00008000UL // value 2 + +// fake styles +#define RS_Blink 0x00010000UL /* blink */ +#define RS_RVid 0x00020000UL /* reverse video */ +#define RS_Uline 0x00040000UL /* underline */ + +// 5 bits still to go + +// other flags +#define RS_Careful 0x80000000UL /* be careful when drawing these */ + +#define RS_styleCount 4 +#define RS_styleMask (RS_Bold | RS_Italic) +#define RS_styleShift 14 -#define RS_fontMask 0xffc00000u /* plenty(?) of fonts */ -#define RS_fontShift 22 +#define RS_baseattrMask (RS_Italic | RS_Bold | RS_Blink | RS_RVid | RS_Uline) +#define RS_attrMask (RS_baseattrMask | RS_fontMask) -#define RS_baseattrMask (RS_Bold|RS_Blink|RS_RVid|RS_Uline) -#define RS_attrMask (RS_baseattrMask|RS_fontMask) +#define RS_fontCount 127 // not 127 or 256, see rxvtfont.h +#define RS_fontMask 0xff000000UL // plenty(?) of fonts, includes RS_Careful +#define RS_fontShift 24 + +#define DEFAULT_RSTYLE (RS_None | Color_fg | (Color_bg << Color_Bits)) +#define OVERLAY_RSTYLE (RS_None | Color_Black | (Color_Yellow << Color_Bits)) #define Sel_none 0 /* Not waiting */ #define Sel_normal 0x01 /* normal selection */ @@ -398,8 +438,14 @@ 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) XTerm_Menu = 703, // set menu item + XTerm_Color_IT = 704, // change actual 'Italic' colour + XTerm_Color_tint = 705, // change actual tint colour + + URxvt_font = 710, + URxvt_boldFont = 711, + URxvt_italicFont = 712, + URxvt_boldItalicFont = 713, }; /* Words starting with `Color_' are colours. Others are counts */ @@ -438,10 +484,8 @@ #else Color_White = maxCOLOR, #endif -#ifdef TTY_256COLOR - min256COLOR = Color_White + 1, - max256COLOR = minCOLOR + 255, -#endif + minTermCOLOR = Color_White + 1, + maxTermCOLOR = Color_White + 72, #ifndef NO_CURSORCOLOR Color_cursor, Color_cursor2, @@ -451,6 +495,7 @@ Color_border, #ifndef NO_BOLD_UNDERLINE_REVERSE Color_BD, + Color_IT, Color_UL, Color_RV, #endif @@ -468,18 +513,17 @@ #ifdef KEEP_SCROLLCOLOR Color_topShadow = NRS_COLORS, Color_bottomShadow, - TOTAL_COLORS /* upto 30 */ + TOTAL_COLORS #else - TOTAL_COLORS = NRS_COLORS /* */ + TOTAL_COLORS = NRS_COLORS #endif }; -#define Color_Bits 9 +#define Color_Bits 7 // 0 .. maxTermCOLOR + #define NPIXCLR_SETS ((TOTAL_COLORS + 31) / 32) #define NPIXCLR_BITS 32 -#define DEFAULT_RSTYLE (RS_None | (Color_fg) | (Color_bg<> RS_fontShift) -#define SET_FONT(x,fid) ((x) & ~RS_fontMask) | ((fid) << RS_fontShift) +#define SET_FONT(x,fid) (((x) & ~RS_fontMask) | ((fid) << RS_fontShift)) + +#define GET_STYLE(x) (((x) & RS_styleMask) >> RS_styleShift) +#define SET_STYLE(x,style) (((x) & ~RS_styleMask) | ((style) << RS_styleShift)) #define GET_ATTR(x) (((x) & RS_attrMask)) #define GET_BGATTR(x) \ (((x) & RS_RVid) ? (((x) & (RS_attrMask & ~RS_RVid)) \ | (((x) & RS_fgMask)< allocated; // free these memory blocks with free() char *env_windowid; /* environmental variable WINDOWID */ @@ -1154,12 +1189,29 @@ static vector termlist; // a vector of all running rxvt_term's +#if ENABLE_FRILLS || ISO_14755 + // ISO 14755 entry support + unicode_t iso14755buf; + void commit_iso14755 (); + int hex_keyval (XKeyEvent &ev); +# if ISO_14755 + void iso14755_51 (unicode_t ch, rend_t r = DEFAULT_RSTYLE); + void iso14755_54 (int x, int y); +# endif +#endif + void paste (const unsigned char *data, unsigned int len); void flush (); +#if TRANSPARENT void rootwin_cb (XEvent &xev); xevent_watcher rootwin_ev; +#endif + + + void sig_term (sig_watcher &w); sig_watcher sw_term; + void sig_chld (sig_watcher &w); sig_watcher sw_chld; void x_cb (XEvent &xev); xevent_watcher termwin_ev; @@ -1216,18 +1268,14 @@ bool pty_fill (); - void *operator new (size_t s); - void operator delete (void *p, size_t s); - 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); - int run_command (const char *const *argv); + void run_command (const char *const *argv); int run_child (const char *const *argv); - static void child_exited (int pid); void color_aliases (int idx); void recolour_cursor (); @@ -1236,12 +1284,17 @@ void window_calc (unsigned int width, unsigned int height); #if USE_XIM + 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; - void im_set_size (XRectangle *size); - void im_set_position (XPoint *pos); - void im_set_color (unsigned long *fg, unsigned long *bg); - void im_set_preedit_area (XRectangle * preedit_rect, XRectangle * status_rect, XRectangle * needed_rect); + void im_set_size (XRectangle &size); + void im_set_position (XPoint &pos); + void im_set_color (unsigned long &fg, unsigned long &bg); + void im_set_preedit_area (XRectangle &preedit_rect, XRectangle &status_rect, const XRectangle &needed_rect); bool IMisRunning (); void IMSendSpot (); @@ -1257,22 +1310,6 @@ void selection_extend (int x, int y, int flag); void selection_rotate (int x, int y); - /* screen (!) */ - void scr_blank_line (text_t *et, rend_t *er, unsigned int width, rend_t efs); - void scr_blank_screen_mem (text_t **tp, rend_t **rp, unsigned int row, rend_t efs); - int scr_scroll_text (int row1, int row2, int count, int spec); - void scr_reset (); - void scr_reset_realloc (); - void scr_release (); - void scr_clear (bool really = false); - 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 */ // command.C @@ -1314,12 +1351,9 @@ // logging.C void makeutent (const char *pty, const char *hostname); void cleanutent (); - // main.C; - void privileges (int mode); - void privileged_utmp (char action); - void privileged_ttydev (char action); - bool change_font (const char *fontname); - bool font_up_down (int n, int direction); + // main.C + void privileged_utmp (rxvt_privaction action); + bool set_fonts (); void set_title (const char *str); void set_icon_name (const char *str); void set_window_color (int idx, const char *color); @@ -1361,14 +1395,32 @@ #endif // screen.C + void scr_blank_line (text_t *et, rend_t *er, unsigned int width, rend_t efs); + void scr_blank_screen_mem (text_t **tp, rend_t **rp, unsigned int row, rend_t efs); + int scr_scroll_text (int row1, int row2, int count, int spec); + void scr_reset (); + void scr_reset_realloc (); + void scr_release (); + void scr_clear (bool really = false); + 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); + rxvt_fontset *scr_find_fontset (rend_t r = DEFAULT_RSTYLE); + void scr_recolour (); + void scr_remap_chars (); + void scr_remap_chars (text_t *tp, rend_t *rp); + void scr_poweron (); void scr_cursor (int mode); + void scr_do_wrap (); int scr_change_screen (int scrn); void scr_color (unsigned int color, int fgbg); void scr_rendition (int set, int style); void scr_add_lines (const unicode_t *str, int nlines, int len); void scr_backspace (); - void scr_tab (int count); + void scr_tab (int count, bool ht = false); void scr_backindex (); void scr_forwardindex (); void scr_gotorc (int row, int col, int relative); @@ -1390,7 +1442,7 @@ void scr_charset_set (int set, unsigned int ch); int scr_move_to (int y, int len); int scr_page (enum page_dirn direction, int nlines); - int scr_changeview (uint16_t oldviewstart); + int scr_changeview (unsigned int oldviewstart); void scr_bell (); void scr_printscreen (int fullhist); void scr_reverse_selection (); @@ -1458,7 +1510,6 @@ #else # define __PROTO(p) () #endif -#include "protos.h" #ifdef DEBUG_malloc # include "dmalloc.h" /* This comes last */