--- rxvt-unicode/src/rxvtlib.h.in 2005/12/21 19:50:17 1.52 +++ rxvt-unicode/src/rxvtlib.h.in 2007/12/11 08:54:08 1.79 @@ -11,7 +11,6 @@ @include_unistd_h@ @include_string_h@ @include_fcntl_h@ -@include_util_h@ @include_assert_h@ @include_sys_ioctl_h@ @include_sys_time_h@ @@ -30,10 +29,12 @@ // stdlib.h might provide it #endif -#include "ptytty.h" +using namespace std; extern "C" { -#include /* Xlib, Xutil, Xresource, Xfuncproto */ +#include +#include +#include } /* @@ -54,7 +55,6 @@ struct rxvt_color; struct rxvt_vars; /* defined later on */ struct rxvt_term; -struct rxvt_display; struct rxvt_im; struct rxvt_drawable; @@ -62,12 +62,9 @@ extern rxvt_t rxvt_current_term; -#define SET_R(r) rxvt_current_term = (r) +#define SET_R(r) rxvt_current_term = const_cast(r) #define GET_R rxvt_current_term -#define scrollbar_visible() scrollBar.state -#define menubar_visible() menuBar.state - typedef struct { int row; int col; @@ -79,45 +76,24 @@ typedef uint16_t text_t; // saves lots of memory #endif typedef uint32_t rend_t; -typedef int32_t tlen_t; // was int16_t, but this result sin smaller code and memory use - -#define LINE_CONT -1 +typedef int32_t tlen_t; // was int16_t, but this results in smaller code and memory use +typedef int32_t tlen_t_; // specifically for use in the line_t structure -struct line_t { - text_t *t; // terminal the text - rend_t *r; // rendition, uses RS_ flags - tlen_t l; // length of each text line, LINE_CONT == continued on next line - - bool is_longer () - { - return l < 0; - } - - void set_is_longer () - { - l = LINE_CONT; - } - - void clear () - { - t = 0; - r = 0; - l = 0; - } -}; +struct line_t; /* * terminal limits: * * width : 1 <= width * height : 1 <= height - * ncol : 1 <= ncol <= MAX(int16_t) - * nrow : 1 <= nrow <= MAX(int16_t) - * saveLines : 0 <= saveLines <= MAX(int16_t) - * total_rows : nrow + saveLines - * nsaved : 0 <= nsaved <= saveLines + * ncol : 1 <= ncol <= MAX(tlen_t) + * nrow : 1 <= nrow <= MAX(int) + * saveLines : 0 <= saveLines <= MAX(int) * term_start : 0 <= term_start < saveLines - * view_start : 0 <= view_start < saveLines + * total_rows : nrow + saveLines + * + * top_row : -saveLines <= top_row <= 0 + * view_start : top_row <= view_start <= 0 * * | most coordinates are stored relative to term_start, * ROW_BUF | which is the first line of the terminal screen @@ -125,9 +101,9 @@ * |························= row_buf[1] * |························= row_buf[2] etc. * | - * +------------+···········= term_start - nsaved - * | scrollback | - * | scrollback +---------+·= term_start - view_start + * +------------+···········= term_start + top_row + * | scrollback | + * | scrollback +---------+·= term_start + view_start * | scrollback | display | * | scrollback | display | * +------------+·display·+·= term_start @@ -156,9 +132,9 @@ int lineSpace; /* number of extra pixels between rows */ int saveLines; /* number of lines that fit in scrollback */ int total_rows; /* total number of rows in this terminal */ - int nsaved; /* number of rows saved to scrollback */ int term_start; /* term lines start here */ int view_start; /* scrollback view starts here */ + int top_row; /* topmost row index of scrollback */ Window parent[6]; /* parent identifiers - we're parent[0] */ Window vt; /* vt100 window */ GC gc; /* GC for drawing */ @@ -211,7 +187,7 @@ unsigned int screen; /* screen being used */ unsigned int clicks; /* number of clicks */ selection_op_t op; /* current operation */ - bool rect; /* rectangluar selection? */ + bool rect; /* rectangular selection? */ row_col_t beg; /* beginning of selection <= mark */ row_col_t mark; /* point of initial click <= end */ row_col_t end; /* one character past end point */ @@ -228,54 +204,18 @@ #define Screen_DefaultFlags (Screen_VisibleCursor | Screen_Autowrap) /* rxvt_vars.options */ -#define Opt_console (1UL<<0) -#define Opt_loginShell (1UL<<1) -#define Opt_iconic (1UL<<2) -#define Opt_visualBell (1UL<<3) -#define Opt_mapAlert (1UL<<4) -#define Opt_reverseVideo (1UL<<5) -#define Opt_utmpInhibit (1UL<<6) -#define Opt_scrollBar (1UL<<7) -#define Opt_scrollBar_right (1UL<<8) -#define Opt_scrollBar_floating (1UL<<9) -#define Opt_meta8 (1UL<<10) -#define Opt_scrollTtyOutput (1UL<<11) -#define Opt_scrollTtyKeypress (1UL<<12) -#define Opt_transparent (1UL<<13) -#define Opt_tripleclickwords (1UL<<14) -#define Opt_scrollWithBuffer (1UL<<15) -#define Opt_jumpScroll (1UL<<16) -#define Opt_mouseWheelScrollPage (1UL<<17) -#define Opt_pointerBlank (1UL<<18) -#define Opt_cursorBlink (1UL<<19) -#define Opt_secondaryScreen (1UL<<20) -#define Opt_secondaryScroll (1UL<<21) -#define Opt_pastableTabs (1UL<<22) -#define Opt_cursorUnderline (1UL<<23) -#if ENABLE_FRILLS -# define Opt_insecure (1UL<<24) // insecure esc sequences -# define Opt_borderLess (1UL<<25) // mem borderless hints -#else -# define Opt_insecure 0 -# define Opt_borderLess 0 -#endif -/* place holder used for parsing command-line options */ -#define Opt_Reverse (1UL<<30) -#define Opt_Boolean (1UL<<31) - -#define DEFAULT_OPTIONS (Opt_scrollBar | Opt_scrollTtyOutput \ - | Opt_jumpScroll | Opt_secondaryScreen \ - | Opt_pastableTabs) +enum { +# define def(name,idx) Opt_ ## name = idx, +# define nodef(name) Opt_ ## name = 0, +# include "optinc.h" +# undef nodef +# undef def +Opt_count +}; /* ------------------------------------------------------------------------- */ typedef struct { - short state; - Window win; - struct rxvt_drawable *drawable; -} menuBar_t; - -typedef struct { char state; /* scrollbar state */ char init; /* scrollbar has been initialised */ unsigned int beg; /* slider sub-window begin height */ @@ -295,10 +235,8 @@ struct rxvt_vars : TermWin_t { scrollBar_t scrollBar; - menuBar_t menuBar; - unsigned long options; + uint8_t options[(Opt_count + 7) >> 3]; XSizeHints szHint; - rxvt_display *display; rxvt_color *pix_colors; rxvt_color *pix_colors_focused; #ifdef OFF_FOCUS_FADING @@ -307,11 +245,9 @@ short numpix_colors; Cursor TermWin_cursor; /* cursor for vt window */ int sb_shadow; /* scrollbar shadow width */ - rxvt_ptytty pty; int numlock_state; - line_t *row_buf; // all lines, scrollback + terminal, circular + line_t *row_buf; // all lines, scrollback + terminal, circular, followed by temp_buf line_t *drawn_buf; // text on screen - line_t *temp_buf; // temporary buffer line_t *swap_buf; // lines for swap buffer char *tabs; /* per location: 1 == tab-stop */ screen_t screen;