--- rxvt-unicode/src/rxvt.h 2004/01/31 00:20:21 1.27 +++ rxvt-unicode/src/rxvt.h 2004/02/24 16:25:45 1.42 @@ -51,9 +51,6 @@ } ttymode_t; #endif -#ifdef GREEK_SUPPORT -# include "grkelot.h" -#endif #ifdef XPM_BACKGROUND # ifdef XPM_INC_X11 # include @@ -132,9 +129,9 @@ (swapittmp) = (one); (one) = (two); (two) = (swapittmp); \ } while (/* CONSTCOND */ 0) #define BOUND_POSITIVE_INT16(val) \ - (int16_t)((val) <= 0 \ + (int16_t) ((val) <= 0 \ ? 0 \ - : min((val), (((uint16_t)-1)>>1))) + : min ((val), (((uint16_t)-1)>>1))) /* ***************************************************************************** @@ -184,7 +181,7 @@ #define scrollBar_esc 30 #define menuBar_margin 2 /* margin below text */ -#if defined(RXVT_SCROLLBAR) || defined(NEXT_SCROLLBAR) || defined(XTERM_SCROLLBAR) +#if defined(RXVT_SCROLLBAR) || defined(NEXT_SCROLLBAR) || defined(XTERM_SCROLLBAR) || defined(PLAIN_SCROLLBAR) # define HAVE_SCROLLBARS #endif @@ -202,9 +199,11 @@ #define R_SB_RXVT 0 #define R_SB_NEXT 1 #define R_SB_XTERM 2 +#define R_SB_PLAIN 4 #define SB_WIDTH_NEXT 19 -#define SB_WIDTH_XTERM 7 +#define SB_WIDTH_XTERM 15 +#define SB_WIDTH_PLAIN 7 #ifndef SB_WIDTH_RXVT # define SB_WIDTH_RXVT 10 #endif @@ -241,7 +240,7 @@ * | +---------+ | * | | ......%%| | * | | ......%%| | - * | | ..()..%%| | + * | | .. ()..%%| | * | | ......%%| | * | | %%%%%%%%| | * | +---------+ | <......................... @@ -272,11 +271,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,27 +294,31 @@ #define FONT_DN "#-" #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) - -/* modes for rxvt_scr_insdel_chars(), rxvt_scr_insdel_lines() */ -#define INSERT -1 /* don't change these values */ -#define DELETE +1 -#define ERASE +2 +/* flags for rxvt_scr_gotorc () */ +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 () */ +enum { + INSERT = -1, /* don't change these values */ + DELETE = +1, + ERASE = +2, +}; -/* modes for rxvt_scr_page() - scroll page. used by scrollbar window */ +/* 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() */ +/* arguments for rxvt_scr_change_screen () */ enum { PRIMARY = 0, - SECONDARY + SECONDARY, }; #define RS_None 0 /* Normal */ @@ -347,7 +352,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 */ @@ -355,26 +360,38 @@ * 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_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_locale = 9, /* change locale */ + 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 */ +}; /* Words starting with `Color_' are colours. Others are counts */ /* @@ -473,10 +490,6 @@ #if (MENUBAR_MAX) Rs_menu, #endif -#ifdef GREEK_SUPPORT - Rs_greek_keyboard, - Rs_greektoggle_key, -#endif Rs_loginShell, Rs_jumpScroll, #ifdef HAVE_SCROLLBARS @@ -545,7 +558,7 @@ NUM_RESOURCES }; -// see init.C:xa_named, which must be kept in sync +// see init.C:xa_names, which must be kept in sync enum { XA_TEXT = 0, XA_COMPOUND_TEXT, @@ -596,7 +609,7 @@ if (test) \ PrivateModes |= (bit); \ else \ - PrivateModes &= ~(bit) + PrivateModes &= ~ (bit) #ifdef ALLOW_132_MODE # define PrivMode_Default \ @@ -606,9 +619,9 @@ (PrivMode_Autowrap|PrivMode_aplKP|PrivMode_ShiftKeys|PrivMode_VisibleCursor) #endif -#define XDEPTH Xdepth -#define XCMAP Xcmap -#define XVISUAL Xvisual +#define XDEPTH display->depth +#define XCMAP display->cmap +#define XVISUAL display->visual #define IMBUFSIZ 128 /* input modifier buffer sizes */ #ifndef BUFSIZ @@ -650,24 +663,22 @@ #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 Xroot DefaultRootWindow(Xdisplay) - /* how to build & extract colors and attributes */ #define GET_BASEFG(x) (((x) & RS_fgMask)) #define GET_BASEBG(x) (((x) & RS_bgMask)>>Color_Bits) #ifndef NO_BRIGHTCOLOR # define GET_FGCOLOR(x) \ ((((x) & RS_Bold) == 0 \ - || GET_BASEFG(x) < minCOLOR \ - || GET_BASEFG(x) >= minBrightCOLOR) \ - ? GET_BASEFG(x) \ - : (GET_BASEFG(x) + (minBrightCOLOR - minCOLOR))) + || GET_BASEFG (x) < minCOLOR \ + || GET_BASEFG (x) >= minBrightCOLOR) \ + ? GET_BASEFG (x) \ + : (GET_BASEFG (x) + (minBrightCOLOR - minCOLOR))) # define GET_BGCOLOR(x) \ ((((x) & RS_Blink) == 0 \ - || GET_BASEBG(x) < minCOLOR \ - || GET_BASEBG(x) >= minBrightCOLOR) \ - ? GET_BASEBG(x) \ - : (GET_BASEBG(x) + (minBrightCOLOR - minCOLOR))) + || GET_BASEBG (x) < minCOLOR \ + || GET_BASEBG (x) >= minBrightCOLOR) \ + ? GET_BASEBG (x) \ + : (GET_BASEBG (x) + (minBrightCOLOR - minCOLOR))) #else # define GET_FGCOLOR(x) GET_BASEFG(x) # define GET_BGCOLOR(x) GET_BASEBG(x) @@ -701,7 +712,7 @@ #define scrollbarnext_dnval() (scrollBar.end + (scrollBar.width + 1)) #define scrollbarnext_upButton(y) ((y) > scrollBar.end \ - && (y) <= scrollbarnext_dnval()) + && (y) <= scrollbarnext_dnval ()) #define scrollbarnext_dnButton(y) ((y) > scrollbarnext_dnval()) #define SCROLLNEXT_MINHEIGHT SB_THUMB_MIN_HEIGHT #define scrollbarrxvt_upButton(y) ((y) < scrollBar.beg) @@ -716,7 +727,7 @@ #define scrollbar_below_slider(y) ((y) > scrollBar.bot) #define scrollbar_position(y) ((y) - scrollBar.beg) #define scrollbar_size() (scrollBar.end - scrollBar.beg \ - - scrollbar_minheight()) + - scrollbar_minheight ()) #if (MENUBAR_MAX > 1) /* rendition style flags */ @@ -821,10 +832,9 @@ struct mbstate { mbstate_t mbs; - mbstate () - { - MEMSET (&mbs, 0, sizeof (mbs)); - } + operator mbstate_t *() { return &mbs; } + void reset () { MEMSET (&mbs, 0, sizeof (mbs)); } + mbstate () { reset (); } }; struct rxvt_term : rxvt_vars { @@ -869,16 +879,10 @@ selection_wait, selection_type; /* ---------- */ -#ifdef GREEK_SUPPORT - short greek_mode; /* greek keyboard mode */ -#endif 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 */ -#ifdef RXVT_GRAPHICS - uint16_t gr_prev_start; -#endif /* ---------- */ rend_t rstyle; /* ---------- */ @@ -950,6 +954,9 @@ GC xscrollbarGC, ShadowGC; #endif +#ifdef PLAIN_SCROLLBAR + GC pscrollbarGC; +#endif #ifdef NEXT_SCROLLBAR GC blackGC, whiteGC, @@ -987,20 +994,14 @@ #if defined (HOTKEY_CTRL) || defined (HOTKEY_META) KeySym ks_bigfont, ks_smallfont; #endif -#ifdef GREEK_SUPPORT - KeySym ks_greekmodeswith; -#endif #ifdef USE_XIM + rxvt_xim *input_method; XIC Input_Context; XIMStyle input_style; int event_type; #endif struct mouse_event MEvent; XComposeStatus compose; -#ifdef RXVT_GRAPHICS - int graphics_up; - struct grwin_t *gr_root; -#endif ttymode_t tio; #ifdef UTMP_SUPPORT # ifdef HAVE_STRUCT_UTMP @@ -1019,10 +1020,6 @@ bgPixmap_t bgPixmap; XpmAttributes xpmAttr; /* originally loaded pixmap and its scaling */ #endif -#ifdef MULTICHAR_SET - int oldcursormulti; - void (*multichar_decode)(unsigned char *str, int len); -#endif #ifndef RESET_TTY_TO_COMMON_DEFAULTS struct stat ttyfd_stat; /* original status of our tty */ #endif @@ -1030,13 +1027,10 @@ menu_t *ActiveMenu, /* currently active menu */ *BuildMenu; /* the menu currently being built */ bar_t *CurrentBar; -# if !(MENUBAR_MAX > 1) +# if ! (MENUBAR_MAX > 1) bar_t BarList; # endif /* (MENUBAR_MAX > 1) */ #endif -#ifdef RXVT_GRAPHICS - Window gr_last_id; -#endif #ifdef CURSOR_BLINK struct timeval lastcursorchange; #endif @@ -1055,6 +1049,7 @@ 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]; #endif @@ -1070,11 +1065,23 @@ void flush (); + void rootwin_cb (XEvent &xev); + xevent_watcher rootwin_ev; + + void x_cb (XEvent &xev); + xevent_watcher termwin_ev; + xevent_watcher vt_ev; +#ifdef HAVE_SCROLLBARS + xevent_watcher scrollbar_ev; +#endif +#ifdef MENUBAR + xevent_watcher menubar_ev; +#endif + void check_cb (check_watcher &w); check_watcher check_ev; void destroy_cb (time_watcher &w); time_watcher destroy_ev; void pty_cb (io_watcher &w, short revents); io_watcher pty_ev; - void x_cb (io_watcher &w, short revents); io_watcher x_ev; void incr_cb (time_watcher &w); time_watcher incr_ev; @@ -1106,7 +1113,6 @@ uint32_t next_char (); bool pty_fill (); - void process_x_events (); void *operator new (size_t s); void operator delete (void *p, size_t s); @@ -1120,17 +1126,24 @@ int run_command (const char *const *argv); int run_child (const char *const *argv); - void color_aliases(int idx); + 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); + 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); + + bool IMisRunning (); + void IMSendSpot (); + bool IM_get_IC (const char *modifiers); + void IMSetStatusPosition (); #endif void resize_scrollbar (); @@ -1141,7 +1154,7 @@ void selection_extend (int x, int y, int flag); void selection_rotate (int x, int y); - /* screen(!) */ + /* 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); @@ -1154,20 +1167,22 @@ 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 - void lookup_key (XKeyEvent *ev); + 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 process_x_event (XEvent *ev); - void button_press (XButtonEvent *ev); - void button_release (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 (); @@ -1179,7 +1194,7 @@ unsigned char * get_to_st (unsigned char *ends_how); void process_dcs_seq (); void process_osc_seq (); - void xterm_seq (int op, const char *str, unsigned char resp __attribute__((unused))); + void xterm_seq (int op, const char *str, unsigned char resp __attribute__ ((unused))); 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); @@ -1194,18 +1209,14 @@ void privileges (int mode); void privileged_utmp (char action); void privileged_ttydev (char action); - void change_font (int init, const char *fontname); - void font_up_down (int n, int direction); + bool change_font (const char *fontname); + bool font_up_down (int n, int direction); void set_title (const char *str); void set_iconName (const char *str); void set_window_color (int idx, const char *color); void set_colorfgbg (); int rXParseAllocColor (rxvt_color * screen_in_out, const char *colour); void set_widthheight (unsigned int width, unsigned int height); - bool IMisRunning (); - void IMSendSpot (); - bool IM_get_IC (); - void IMSetStatusPosition (); #ifdef MENUBAR // menubar.C @@ -1213,19 +1224,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); @@ -1234,9 +1245,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 @@ -1286,7 +1297,7 @@ void selection_delimit_word (enum page_dirn dirn, const row_col_t *mark, row_col_t *ret); void selection_extend_colrow (int32_t col, int32_t row, int button3, int buttonpress, int clickchange); void selection_remove_trailing_spaces (); - void selection_send (const XSelectionRequestEvent *rq); + void selection_send (const XSelectionRequestEvent &rq); #if defined(NEXT_SCROLLBAR) // scrollbar-next.C @@ -1294,20 +1305,22 @@ void init_scrollbar_stuff (); void drawBevel (Drawable d, int x1, int y1, int w, int h); int scrollbar_show_next (int update, int last_top, int last_bot, int scrollbar_len); -# define scrollbar_update scrollbar_show_next // HACK #endif #if defined(RXVT_SCROLLBAR) // scrollbar-rxvt.C void Draw_button (int x, int y, int state, int dirn); int scrollbar_show_rxvt (int update, int last_top, int last_bot, int scrollbar_len); -# define scrollbar_update scrollbar_show_rxvt // HACK #endif #if defined(XTERM_SCROLLBAR) // scrollbar-xterm.C int scrollbar_show_xterm (int update, int last_top, int last_bot, int scrollbar_len); -# define scrollbar_update scrollbar_show_xterm // HACK +#endif + +#if defined(PLAIN_SCROLLBAR) + // scrollbar-plain.C + int scrollbar_show_plain (int update, int last_top, int last_bot, int scrollbar_len); #endif // scrollbar.C