--- rxvt-unicode/src/rxvt.h 2004/03/22 15:15:04 1.60 +++ rxvt-unicode/src/rxvt.h 2004/08/08 14:44:21 1.88 @@ -5,10 +5,15 @@ #include "feature.h" +#include + #include #include #include #include +#ifndef NO_FRILLS +#include +#endif #include "encoding.h" #include "defaultfont.h" @@ -131,6 +136,16 @@ ? 0 \ : min ((val), (((uint16_t)-1)>>1))) +#ifndef NO_FRILLS +typedef struct _mwmhints { + CARD32 flags; + CARD32 functions; + CARD32 decorations; + INT32 input_mode; + CARD32 status; +} MWMHints; +#endif + /* ***************************************************************************** * NORMAL DEFINES @@ -266,7 +281,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 */ - REFRESH_BOUNDS = 1<<3 }; #ifdef NO_SECONDARY_SCREEN @@ -354,13 +368,13 @@ XTerm_name = 0, XTerm_iconName = 1, XTerm_title = 2, - XTerm_property = 3, // change X property, not yet implemented + XTerm_property = 3, // change X property 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_Color_pointer_fg = 13, // change actual 'Pointer' color + XTerm_Color_pointer_bg = 14, // not implemented XTerm_Color05 = 15, // not implemented XTerm_Color06 = 16, // not implemented XTerm_Color_RV = 17, // change actual 'Highlight' color @@ -373,7 +387,6 @@ /* * 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 @@ -382,6 +395,7 @@ 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 }; /* Words starting with `Color_' are colours. Others are counts */ @@ -428,7 +442,8 @@ Color_cursor, Color_cursor2, #endif - Color_pointer, + Color_pointer_fg, + Color_pointer_bg, Color_border, #ifndef NO_BOLD_UNDERLINE_REVERSE Color_BD, @@ -442,6 +457,9 @@ Color_scroll, Color_trough, #endif +#if TINTING + Color_tint, +#endif NRS_COLORS, /* */ #ifdef KEEP_SCROLLCOLOR Color_topShadow = NRS_COLORS, @@ -526,6 +544,7 @@ #ifndef NO_FRILLS Rs_ext_bwidth, Rs_int_bwidth, + Rs_borderLess, #endif Rs_scrollBar_thickness, #ifndef NO_LINESPACE @@ -535,10 +554,24 @@ Rs_modifier, Rs_answerbackstring, Rs_tripleclickwords, + Rs_insecure, Rs_cursorBlink, Rs_pointerBlank, Rs_pointerBlankDelay, Rs_imLocale, +#ifndef NO_SECONDARY_SCREEN + Rs_secondaryScreen, + Rs_secondaryScroll, +#endif +#ifndef NO_BOLD_UNDERLINE_REVERSE + Rs_realBold, +#endif +#ifdef OFF_FOCUS_FADING + Rs_fade, +#endif +#ifdef TINTING + Rs_shade, +#endif NUM_RESOURCES }; @@ -555,6 +588,7 @@ XA_WMDELETEWINDOW, #ifdef TRANSPARENT XA_XROOTPMAPID, + XA_XSETROOTID, #endif #ifdef OFFIX_DND /* OffiX Dnd (drag 'n' drop) support */ XA_DNDPROTOCOL, @@ -601,15 +635,43 @@ # define PrivMode_Default (PrivMode_Autowrap|PrivMode_aplKP|PrivMode_ShiftKeys|PrivMode_VisibleCursor) #endif -#define XDEPTH display->depth -#define XCMAP display->cmap -#define XVISUAL display->visual - +// do not change these constants lightly, there are many interdependencies #define IMBUFSIZ 128 // input modifier buffer sizes #define KBUFSZ 512 // size of keyboard mapping buffer #define CBUFSIZ 4096 // size of command buffer #define UBUFSIZ 4096 // character buffer +#ifndef PATH_MAX +# define PATH_MAX 16384 +#endif + +/* Motif window hints */ +#define MWM_HINTS_FUNCTIONS (1L << 0) +#define MWM_HINTS_DECORATIONS (1L << 1) +#define MWM_HINTS_INPUT_MODE (1L << 2) +#define MWM_HINTS_STATUS (1L << 3) +/* bit definitions for MwmHints.functions */ +#define MWM_FUNC_ALL (1L << 0) +#define MWM_FUNC_RESIZE (1L << 1) +#define MWM_FUNC_MOVE (1L << 2) +#define MWM_FUNC_MINIMIZE (1L << 3) +#define MWM_FUNC_MAXIMIZE (1L << 4) +#define MWM_FUNC_CLOSE (1L << 5) +/* bit definitions for MwmHints.decorations */ +#define MWM_DECOR_ALL (1L << 0) +#define MWM_DECOR_BORDER (1L << 1) +#define MWM_DECOR_RESIZEH (1L << 2) +#define MWM_DECOR_TITLE (1L << 3) +#define MWM_DECOR_MENU (1L << 4) +#define MWM_DECOR_MINIMIZE (1L << 5) +#define MWM_DECOR_MAXIMIZE (1L << 6) +/* bit definitions for MwmHints.inputMode */ +#define MWM_INPUT_MODELESS 0 +#define MWM_INPUT_PRIMARY_APPLICATION_MODAL 1 +#define MWM_INPUT_SYSTEM_MODAL 2 +#define MWM_INPUT_FULL_APPLICATION_MODAL 3 +#define PROP_MWM_HINTS_ELEMENTS 5 + /* ***************************************************************************** * MACRO DEFINES @@ -632,17 +694,17 @@ #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)TermWin.int_bwidth) -#define Pixel2Row(y) Pixel2Height((int32_t)(y) - (int32_t)TermWin.int_bwidth) +#define Pixel2Col(x) Pixel2Width((int32_t)(x)) +#define Pixel2Row(y) Pixel2Height((int32_t)(y)) #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 Col2Pixel(col) ((int32_t)Width2Pixel(col)) +#define Row2Pixel(row) ((int32_t)Height2Pixel(row)) #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)TermWin.width + 2 * (int32_t)TermWin.int_bwidth) -#define TermWin_TotalHeight() ((int32_t)TermWin.height + 2 * (int32_t)TermWin.int_bwidth) +#define TermWin_TotalWidth() ((int32_t)TermWin.width) +#define TermWin_TotalHeight() ((int32_t)TermWin.height) /* how to build & extract colors and attributes */ #define GET_BASEFG(x) (((x) & RS_fgMask)) @@ -799,7 +861,7 @@ extern void rxvt_exit_failure () __attribute__ ((noreturn)); #define SET_LOCALE(locale) rxvt_set_locale (locale) -extern void rxvt_set_locale (const char *locale); +extern bool rxvt_set_locale (const char *locale); /* ***************************************************************************** @@ -870,9 +932,9 @@ struct rxvt_term : rxvt_vars { - log_callback *log_hook; + log_callback *log_hook; // log error messages through this hook, if != 0 - struct mbstate mbstate; + struct mbstate mbstate; // current input multibyte state unsigned char want_refresh:1, #ifdef TRANSPARENT @@ -895,9 +957,8 @@ #ifdef POINTER_BLANK hidden_pointer:1, #endif - parsed_geometry:1, // enc_utf8:1, /* wether terminal reads/writes utf-8 */ - seen_input:1; /* wether any input has been seen so far */ + parsed_geometry:1; unsigned char refresh_type, #ifdef UTMP_SUPPORT @@ -907,43 +968,36 @@ next_tty_action, #endif #ifdef META8_OPTION - meta_char, /* Alt-key prefix */ + meta_char, /* Alt-key prefix */ #endif scrollbar_align, selection_wait, selection_type; /* ---------- */ short rvideo; - int16_t num_scr; /* screen: number lines scrolled */ - unsigned int prev_ncol, /* screen: previous number of columns */ - prev_nrow; /* screen: previous number of rows */ + int16_t num_scr; /* screen: number lines scrolled */ + unsigned int prev_ncol, /* screen: previous number of columns */ + prev_nrow; /* screen: previous number of rows */ /* ---------- */ rend_t rstyle; /* ---------- */ uint32_t pixcolor_set[NPIXCLR_SETS]; /* ---------- */ #ifdef SELECTION_SCROLLING - int scroll_selection_delay, - scroll_selection_lines; + int scroll_selection_lines; enum page_dirn scroll_selection_dir; int selection_save_x, selection_save_y, - selection_save_state, - pending_scroll_selection; + selection_save_state; #endif /* ---------- */ int csrO, /* Hops - csr offset in thumb/slider to */ /* give proper Scroll behaviour */ -#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING - scroll_arrow_delay, -#endif #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) - mouse_slip_wheel_delay, mouse_slip_wheel_speed, #endif refresh_count, refresh_limit, - fnum, /* logical font number */ last_bot, /* scrollbar last bottom position */ last_top, /* scrollbar last top position */ last_state, /* scrollbar last state */ @@ -1069,7 +1123,7 @@ struct timeval lastmotion; #endif - vector allocated; // free these memory blocks + vector allocated; // free these memory blocks with free() char *env_windowid; /* environmental variable WINDOWID */ char *env_display; /* environmental variable DISPLAY */ @@ -1080,9 +1134,9 @@ 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 */ + 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]; #endif @@ -1091,8 +1145,10 @@ unsigned char *cmdbuf_ptr, *cmdbuf_endp; unsigned char cmdbuf_base[CBUFSIZ]; - rxvt_salloc *ralloc; - rxvt_salloc *talloc; + rxvt_salloc *talloc; // text line allocator + rxvt_salloc *ralloc; // rend line allocator + + static vector termlist; // a vector of all running rxvt_term's void paste (const unsigned char *data, unsigned int len); @@ -1111,8 +1167,9 @@ xevent_watcher menubar_ev; #endif - void check_cb (check_watcher &w); check_watcher check_ev; + void check_cb (check_watcher &w); check_watcher check_ev; void destroy_cb (time_watcher &w); time_watcher destroy_ev; + void flush_cb (time_watcher &w); time_watcher flush_ev; void pty_cb (io_watcher &w, short revents); io_watcher pty_ev; @@ -1125,11 +1182,21 @@ void text_blink_cb (time_watcher &w); time_watcher text_blink_ev; #endif +#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING + void cont_scroll_cb (time_watcher &w); time_watcher cont_scroll_ev; +#endif +#ifdef SELECTION_SCROLLING + void sel_scroll_cb (time_watcher &w); time_watcher sel_scroll_ev; +#endif +#if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) + void slip_wheel_cb (time_watcher &w); time_watcher slip_wheel_ev; +#endif + #ifdef POINTER_BLANK void pointer_cb (time_watcher &w); time_watcher pointer_ev; void pointer_blank (); - void pointer_unblank (); #endif + void pointer_unblank (); void tt_printf (const char *fmt,...); void tt_write (const unsigned char *data, unsigned int len); @@ -1143,8 +1210,6 @@ bool init (int argc, const char *const *argv); bool init_vars (); - unicode_t next_char (); - bool pty_fill (); void *operator new (size_t s); @@ -1158,6 +1223,7 @@ void init_command (const char *const *argv); int 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 (); @@ -1194,7 +1260,7 @@ void scr_reset (); void scr_reset_realloc (); void scr_release (); - void scr_clear (bool really = true); + 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); @@ -1208,7 +1274,12 @@ // command.C void lookup_key (XKeyEvent &ev); unsigned int cmd_write (const unsigned char *str, unsigned int count); + + unicode_t next_char (); unicode_t cmd_getc (); + unicode_t next_octet (); + unicode_t cmd_get8 (); + bool cmd_parse (); void mouse_report (XButtonEvent &ev); void button_press (XButtonEvent &ev); @@ -1227,7 +1298,8 @@ unsigned char *get_to_st (unicode_t &ends_how); void process_dcs_seq (); void process_osc_seq (); - void xterm_seq (int op, const char *str, unsigned char resp __attribute__ ((unused))); + void process_color_seq (int report, int color, const char *str, unsigned char resp); + void process_xterm_seq (int op, const char *str, unsigned char resp); int privcases (int mode, unsigned long bit); void process_terminal_mode (int mode, int priv, unsigned int nargs, const int *arg); void process_sgr_mode (unsigned int nargs, const int *arg);