--- rxvt-unicode/src/rxvt.h 2003/12/18 02:07:12 1.15 +++ rxvt-unicode/src/rxvt.h 2004/01/29 23:26:01 1.25 @@ -1,9 +1,5 @@ -/* - * $Id: rxvt.h,v 1.15 2003/12/18 02:07:12 pcg Exp $ - */ - -#ifndef _RXVT_H_ /* include once only */ -#define _RXVT_H_ +#ifndef RXVT_H_ /* include once only */ +#define RXVT_H_ #include "rxvtlib.h" @@ -19,6 +15,8 @@ #include "iom.h" #include "salloc.h" +#include + /* ***************************************************************************** * SYSTEM HACKS @@ -318,13 +316,7 @@ SECONDARY }; -enum { - SBYTE = 0, - WBYTE -}; - - -#define RS_None 0 /* Normal */ +#define RS_None 0 /* Normal */ #define RS_fgMask 0x000001FFu /* 512 colors */ #define RS_bgMask 0x0003FE00u /* 512 colors */ @@ -333,14 +325,11 @@ #define RS_RVid 0x00100000u /* reverse video */ #define RS_Uline 0x00200000u /* underline */ -#define RS_wide 0x00400000u /* only multibyte characters */ -#define IS_WIDE(r) ((r) & RS_wide) - -#define RS_fontMask 0xff000000u /* plenty(?) of fonts */ -#define RS_fontShift 24 +#define RS_fontMask 0xffc00000u /* plenty(?) of fonts */ +#define RS_fontShift 22 #define RS_baseattrMask (RS_Bold|RS_Blink|RS_RVid|RS_Uline) -#define RS_attrMask (RS_baseattrMask|RS_fontMask|RS_wide) +#define RS_attrMask (RS_baseattrMask|RS_fontMask) #define Sel_none 0 /* Not waiting */ #define Sel_normal 0x01 /* normal selection */ @@ -350,7 +339,8 @@ #define Sel_Secondary 0x02 #define Sel_Clipboard 0x03 #define Sel_whereMask 0x0f -#define Sel_CompoundText 0x10 /* last request was Compound */ +#define Sel_CompoundText 0x10 /* last request was COMPOUND_TEXT */ +#define Sel_UTF8String 0x20 /* last request was UTF8_STRING */ enum { C0_NUL = 0x00, @@ -455,10 +445,10 @@ }; #define Color_Bits 9 -#define NPIXCLR_SETS 9 /* (256 + 14) bits / 32 bits */ +#define NPIXCLR_SETS ((TOTAL_COLORS + 31) / 32) #define NPIXCLR_BITS 32 -#define DEFAULT_RSTYLE (RS_None | (Color_fg) | (Color_bg<Xdepth -# define XCMAP R->Xcmap -# define XVISUAL R->Xvisual -#else -# ifdef DEBUG_DEPTH -# define XDEPTH DEBUG_DEPTH -# else -# define XDEPTH DefaultDepth(R->Xdisplay,Xscreen) -# define XCMAP DefaultColormap(R->Xdisplay,Xscreen) -# define XVISUAL DefaultVisual(R->Xdisplay,Xscreen) -# endif -#endif -#define IMBUFSIZ 128 /* input modifier buffer sizes */ +#define XDEPTH R->Xdepth +#define XCMAP R->Xcmap +#define XVISUAL R->Xvisual + +#define IMBUFSIZ 128 /* input modifier buffer sizes */ #ifndef BUFSIZ -# define BUFSIZ 4096 +# define BUFSIZ 4096 #endif -#define KBUFSZ 512 /* size of keyboard mapping buffer */ +#define KBUFSZ 512 /* size of keyboard mapping buffer */ /* ***************************************************************************** @@ -662,19 +638,18 @@ #define STRRCHR(x, y) strrchr((const char *)(x), (int)(y)) /* convert pixel dimensions to row/column values. Everything as int32_t */ -#define Pixel2Col(x) Pixel2Width((int32_t)(x) - (int32_t)R->TermWin.int_bwidth) -#define Pixel2Row(y) Pixel2Height((int32_t)(y) - (int32_t)R->TermWin.int_bwidth) -#define Pixel2Width(x) ((int32_t)(x) / (int32_t)R->TermWin.fwidth) -#define Pixel2Height(y) ((int32_t)(y) / (int32_t)R->TermWin.fheight) -#define Col2Pixel(col) ((int32_t)Width2Pixel(col) + (int32_t)R->TermWin.int_bwidth) -#define Row2Pixel(row) ((int32_t)Height2Pixel(row) + (int32_t)R->TermWin.int_bwidth) -#define Width2Pixel(n) ((int32_t)(n) * (int32_t)R->TermWin.fwidth) -#define Height2Pixel(n) ((int32_t)(n) * (int32_t)R->TermWin.fheight) +#define Pixel2Col(x) Pixel2Width((int32_t)(x) - (int32_t)TermWin.int_bwidth) +#define Pixel2Row(y) Pixel2Height((int32_t)(y) - (int32_t)TermWin.int_bwidth) +#define Pixel2Width(x) ((int32_t)(x) / (int32_t)TermWin.fwidth) +#define Pixel2Height(y) ((int32_t)(y) / (int32_t)TermWin.fheight) +#define Col2Pixel(col) ((int32_t)Width2Pixel(col) + (int32_t)TermWin.int_bwidth) +#define Row2Pixel(row) ((int32_t)Height2Pixel(row) + (int32_t)TermWin.int_bwidth) +#define Width2Pixel(n) ((int32_t)(n) * (int32_t)TermWin.fwidth) +#define Height2Pixel(n) ((int32_t)(n) * (int32_t)TermWin.fheight) -#define TermWin_TotalWidth() ((int32_t)R->TermWin.width + 2 * (int32_t)R->TermWin.int_bwidth) -#define TermWin_TotalHeight() ((int32_t)R->TermWin.height + 2 * (int32_t)R->TermWin.int_bwidth) +#define TermWin_TotalWidth() ((int32_t)TermWin.width + 2 * (int32_t)TermWin.int_bwidth) +#define TermWin_TotalHeight() ((int32_t)TermWin.height + 2 * (int32_t)TermWin.int_bwidth) -#define Xscreen DefaultScreen(R->Xdisplay) #define Xroot DefaultRootWindow(R->Xdisplay) /* how to build & extract colors and attributes */ @@ -711,10 +686,10 @@ #define SET_ATTR(x,a) (((x) & ~RS_attrMask)| (a)) #define SET_PIXCOLOR(h, x) ((h)->pixcolor_set[(x) / NPIXCLR_BITS] |= (1 << ((x) % NPIXCLR_BITS))) -#define ISSET_PIXCOLOR(h, x) ((h)->pixcolor_set[(x) / NPIXCLR_BITS] & (1 << ((x) % NPIXCLR_BITS))) +#define ISSET_PIXCOLOR(h, x) ((h)->pixcolor_set[(x) / NPIXCLR_BITS] & (1 << ((x) % NPIXCLR_BITS))) #ifdef HAVE_SCROLLBARS -# define scrollbar_TotalWidth() (R->scrollBar.width + R->sb_shadow * 2) +# define scrollbar_TotalWidth() (scrollBar.width + sb_shadow * 2) #else # define scrollbar_TotalWidth() (0) #endif @@ -724,11 +699,6 @@ #define scrollbar_isUpDn() isupper (R->scrollBar.state) #define isScrollbarWindow(w) (R->scrollBar.state && (w) == R->scrollBar.win) -#define scrollbar_setIdle() R->scrollBar.state = 1 -#define scrollbar_setMotion() R->scrollBar.state = 'm' -#define scrollbar_setUp() R->scrollBar.state = 'U' -#define scrollbar_setDn() R->scrollBar.state = 'D' - #define scrollbarnext_dnval() (R->scrollBar.end + (R->scrollBar.width + 1)) #define scrollbarnext_upButton(y) ((y) > R->scrollBar.end \ && (y) <= scrollbarnext_dnval()) @@ -750,7 +720,7 @@ #if (MENUBAR_MAX > 1) /* rendition style flags */ -# define menuBar_height() (R->TermWin.fheight + SHADOW) +# define menuBar_height() (TermWin.fheight + SHADOW) # define menuBar_TotalHeight() (menuBar_height() + SHADOW + menuBar_margin) # define isMenuBarWindow(w) ((w) == R->menuBar.win) #else @@ -836,15 +806,14 @@ #endif #define BLINK_INTERVAL 0.5 +#define TEXT_BLINK_INTERVAL 0.5 struct mbstate { - unsigned char orig; - uint32_t reg; - int cnt; + mbstate_t mbs; mbstate () { - cnt = 0; + MEMSET (&mbs, 0, sizeof (mbs)); } }; @@ -866,11 +835,15 @@ #ifdef CURSOR_BLINK hidden_cursor:1, #endif +#ifdef TEXT_BLINK + hidden_text:1, +#endif #ifdef POINTER_BLANK hidden_pointer:1, #endif parsed_geometry:1, - seen_input:1; /* wether any input has been seen so far */ + seen_input:1, /* wether any input has been seen so far */ + enc_utf8:1; /* wether terminal reads/writes utf-8 */ unsigned char refresh_type, #ifdef UTMP_SUPPORT @@ -891,15 +864,15 @@ #endif short rvideo; int16_t num_scr; /* screen: number lines scrolled */ - uint16_t prev_ncol, /* screen: previous number of columns */ + unsigned int prev_ncol, /* screen: previous number of columns */ prev_nrow; /* screen: previous number of rows */ #ifdef RXVT_GRAPHICS - uint16_t gr_prev_start; + uint16_t gr_prev_start; #endif /* ---------- */ rend_t rstyle; /* ---------- */ - uint32_t pixcolor_set[NPIXCLR_SETS]; + uint32_t pixcolor_set[NPIXCLR_SETS]; /* ---------- */ #ifdef SELECTION_SCROLLING int scroll_selection_delay, @@ -954,10 +927,6 @@ unsigned long PrivateModes, SavedModes; /* ---------- */ -#ifdef PREFER_24BIT - Visual *Xvisual; -#endif -/* ---------- */ Atom xa[NUM_XA]; /* ---------- */ #ifdef MENUBAR @@ -1073,6 +1042,7 @@ char *env_colorfgbg; char *buffer; char *locale; + char *codeset; char charsets[4]; unsigned char *v_buffer; /* pointer to physical buffer */ unsigned int v_buflen; /* size of area to write */ @@ -1084,7 +1054,6 @@ /* command input buffering */ unsigned char *cmdbuf_ptr, *cmdbuf_endp; unsigned char cmdbuf_base[BUFSIZ]; - unsigned char kbuf[KBUFSZ]; rxvt_salloc *ralloc; rxvt_salloc *talloc; @@ -1102,7 +1071,10 @@ void incr_cb (time_watcher &w); time_watcher incr_ev; #ifdef CURSOR_BLINK - void blink_cb (time_watcher &w); time_watcher blink_ev; + void cursor_blink_cb (time_watcher &w); time_watcher cursor_blink_ev; +#endif +#ifdef TEXT_BLINK + void text_blink_cb (time_watcher &w); time_watcher text_blink_ev; #endif #ifdef POINTER_BLANK @@ -1131,6 +1103,36 @@ 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); + int run_child (const char *const *argv); + + void color_aliases(int idx); + void recolour_cursor (); + void create_windows (int argc, const char *const *argv); + void resize_all_windows (unsigned int width, unsigned int height, int ignoreparent); + void window_calc (unsigned int width, unsigned int height); + void set_preedit_area (XRectangle * preedit_rect, XRectangle * status_rect, XRectangle * needed_rect); + +#if USE_XIM + void set_size (XRectangle *size); + void set_position (XPoint *pos); + void set_color (unsigned long *fg, unsigned long *bg); +#endif + + void resize_scrollbar (); + + void pixel_position (int *x, int *y); + + void selection_click (int clicks, int x, int y); + 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); @@ -1138,8 +1140,17 @@ void scr_reset (); void scr_reset_realloc (); void scr_release (); + void scr_clear (); + 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); }; +#define SET_LOCALE(locale) rxvt_set_locale (locale) +extern void rxvt_set_locale (const char *locale); + #ifndef __attribute__ # ifdef __GNUC__ # if (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || (__GNUC__ < 2)