ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/rxvt.h
(Generate patch)

Comparing rxvt-unicode/src/rxvt.h (file contents):
Revision 1.262 by root, Sat Aug 26 06:37:10 2006 UTC vs.
Revision 1.280 by ayin, Sun Jul 29 08:56:36 2007 UTC

70 70
71#ifndef HAVE_XPOINTER 71#ifndef HAVE_XPOINTER
72typedef char *XPointer; 72typedef char *XPointer;
73#endif 73#endif
74 74
75#ifdef HAVE_TERMIOS_H
76# include <termios.h> 75#include <termios.h>
77typedef struct termios ttymode_t; 76typedef struct termios ttymode_t;
78#else
79# include <sgtty.h>
80typedef struct {
81 struct sgttyb sg;
82 struct tchars tc;
83 struct ltchars lc;
84 int line;
85 int local;
86} ttymode_t;
87#endif
88 77
78#ifdef HAVE_AFTERIMAGE
79# include <afterimage.h>
80#undef min
81#undef max
89#ifdef XPM_BACKGROUND 82#elif defined(XPM_BACKGROUND)
90# ifdef XPM_INC_X11 83# ifdef XPM_INC_X11
91# include <X11/xpm.h> 84# include <X11/xpm.h>
92# else 85# else
93# include <xpm.h> 86# include <xpm.h>
94# endif 87# endif
124// misc.C 117// misc.C
125char * rxvt_wcstombs (const wchar_t *str, int len = -1); 118char * rxvt_wcstombs (const wchar_t *str, int len = -1);
126wchar_t * rxvt_mbstowcs (const char *str, int len = -1); 119wchar_t * rxvt_mbstowcs (const char *str, int len = -1);
127char * rxvt_wcstoutf8 (const wchar_t *str, int len = -1); 120char * rxvt_wcstoutf8 (const wchar_t *str, int len = -1);
128wchar_t * rxvt_utf8towcs (const char *str, int len = -1); 121wchar_t * rxvt_utf8towcs (const char *str, int len = -1);
129char * rxvt_strdup_cpp (const char *str);
130 122
131#define rxvt_strdup(s) ((s) ? strdup(s) : 0) 123#define rxvt_strdup(s) ((s) ? strdup(s) : 0)
132 124
133char * rxvt_r_basename (const char *str) NOTHROW; 125char * rxvt_r_basename (const char *str) NOTHROW;
134void rxvt_vlog (const char *fmt, va_list arg_ptr) NOTHROW; 126void rxvt_vlog (const char *fmt, va_list arg_ptr) NOTHROW;
141const char * rxvt_Str_skip_space (const char *str) NOTHROW; 133const char * rxvt_Str_skip_space (const char *str) NOTHROW;
142char * rxvt_Str_trim (char *str) NOTHROW; 134char * rxvt_Str_trim (char *str) NOTHROW;
143int rxvt_Str_escaped (char *str) NOTHROW; 135int rxvt_Str_escaped (char *str) NOTHROW;
144char ** rxvt_splitcommastring (const char *cs) NOTHROW; 136char ** rxvt_splitcommastring (const char *cs) NOTHROW;
145void rxvt_freecommastring (char **cs) NOTHROW; 137void rxvt_freecommastring (char **cs) NOTHROW;
146char * rxvt_File_find (const char *file, const char *ext, const char *path) NOTHROW;
147 138
148///////////////////////////////////////////////////////////////////////////// 139/////////////////////////////////////////////////////////////////////////////
149 140
150// temporarily replace the process environment 141// temporarily replace the process environment
151extern char **environ; 142extern char **environ;
188#endif 179#endif
189 180
190#ifdef XPM_BACKGROUND 181#ifdef XPM_BACKGROUND
191typedef struct { 182typedef struct {
192 short w, h, x, y; 183 short w, h, x, y;
184 bool auto_resize ;
193 Pixmap pixmap; 185 Pixmap pixmap;
194} bgPixmap_t; 186} bgPixmap_t;
195#endif 187#endif
196 188
197/* 189/*
520 * on the unnecessary items, e.g. Color_pointer, but won't bother 512 * on the unnecessary items, e.g. Color_pointer, but won't bother
521 * until we need to. Also, be aware of usage in pixcolor_set 513 * until we need to. Also, be aware of usage in pixcolor_set
522 */ 514 */
523 515
524enum colour_list { 516enum colour_list {
517 Color_none = -2,
518 Color_transparent = -1,
525 Color_fg = 0, 519 Color_fg = 0,
526 Color_bg, 520 Color_bg,
527 minCOLOR, /* 2 */ 521 minCOLOR, /* 2 */
528 Color_Black = minCOLOR, 522 Color_Black = minCOLOR,
529 Color_Red3, 523 Color_Red3,
682 * MACRO DEFINES 676 * MACRO DEFINES
683 ***************************************************************************** 677 *****************************************************************************
684 */ 678 */
685#define dLocal(type,name) type const name = this->name 679#define dLocal(type,name) type const name = this->name
686 680
687// for speed reasons, we assume that all latin1 characters 681// for speed reasons, we assume that all codepoints 32 to 126 are
688// are single-width (the first unicode combining character 682// single-width.
689// is actually 0x300, but ascii is what matters most). 683#define WCWIDTH(c) (IN_RANGE_INC (c, 0x20, 0x7e) ? 1 : wcwidth (c))
690#define WCWIDTH(c) ((c) & ~0xff ? wcwidth (c) : 1)
691 684
692/* convert pixel dimensions to row/column values. Everything as int32_t */ 685/* convert pixel dimensions to row/column values. Everything as int32_t */
693#define Pixel2Col(x) Pixel2Width((int32_t)(x)) 686#define Pixel2Col(x) Pixel2Width((int32_t)(x))
694#define Pixel2Row(y) Pixel2Height((int32_t)(y)) 687#define Pixel2Row(y) Pixel2Height((int32_t)(y))
695#define Pixel2Width(x) ((int32_t)(x) / (int32_t)fwidth) 688#define Pixel2Width(x) ((int32_t)(x) / (int32_t)fwidth)
696#define Pixel2Height(y) ((int32_t)(y) / (int32_t)fheight) 689#define Pixel2Height(y) ((int32_t)(y) / (int32_t)fheight)
697#define Col2Pixel(col) ((int32_t)Width2Pixel(col)) 690#define Col2Pixel(col) ((int32_t)Width2Pixel(col))
698#define Row2Pixel(row) ((int32_t)Height2Pixel(row)) 691#define Row2Pixel(row) ((int32_t)Height2Pixel(row))
699#define Width2Pixel(n) ((int32_t)(n) * (int32_t)fwidth) 692#define Width2Pixel(n) ((int32_t)(n) * (int32_t)fwidth)
700#define Height2Pixel(n) ((int32_t)(n) * (int32_t)fheight) 693#define Height2Pixel(n) ((int32_t)(n) * (int32_t)fheight)
701
702#define OPTION(opt) (options & (opt))
703#define DEFAULT_OPTIONS (Opt_scrollBar | Opt_scrollTtyOutput \
704 | Opt_jumpScroll | Opt_secondaryScreen \
705 | Opt_pastableTabs | Opt_intensityStyles)
706 694
707// for m >= -n, ensure remainder lies between 0..n-1 695// for m >= -n, ensure remainder lies between 0..n-1
708#define MOD(m,n) (((m) + (n)) % (n)) 696#define MOD(m,n) (((m) + (n)) % (n))
709 697
710#define LINENO(n) MOD (term_start + int(n), total_rows) 698#define LINENO(n) MOD (term_start + int(n), total_rows)
909 rxvt_perl_term perl; 897 rxvt_perl_term perl;
910#endif 898#endif
911 struct mbstate mbstate; // current input multibyte state 899 struct mbstate mbstate; // current input multibyte state
912 900
913 unsigned char want_refresh:1, 901 unsigned char want_refresh:1,
914#ifdef TRANSPARENT 902#ifdef ENABLE_TRANSPARENCY
915 want_full_refresh:1, /* awaiting full screen refresh */ 903 want_full_refresh:1, /* awaiting full screen refresh */
916#endif
917#if defined(XPM_BACKGROUND) || defined(TRANSPARENT)
918 am_transparent:1, /* is a transparent term */ 904 am_transparent:1, /* is a transparent term */
919 am_pixmap_trans:1, /* transparency w/known root pixmap */ 905 am_pixmap_trans:1, /* transparency w/known root pixmap */
920#endif 906#endif
921 current_screen:1, /* primary or secondary */ 907 current_screen:1, /* primary or secondary */
922 num_scr_allow:1, 908 num_scr_allow:1,
965 /* give proper Scroll behaviour */ 951 /* give proper Scroll behaviour */
966#if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) 952#if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING)
967 mouse_slip_wheel_speed, 953 mouse_slip_wheel_speed,
968#endif 954#endif
969 refresh_count, 955 refresh_count,
970 refresh_limit,
971 last_bot, /* scrollbar last bottom position */ 956 last_bot, /* scrollbar last bottom position */
972 last_top, /* scrollbar last top position */ 957 last_top, /* scrollbar last top position */
973 last_state, /* scrollbar last state */ 958 last_state, /* scrollbar last state */
974 scrollbar_len, 959 scrollbar_len,
975 window_vt_x, 960 window_vt_x,
1033 XComposeStatus compose; 1018 XComposeStatus compose;
1034 ttymode_t tio; 1019 ttymode_t tio;
1035 row_col_t oldcursor; 1020 row_col_t oldcursor;
1036#ifdef XPM_BACKGROUND 1021#ifdef XPM_BACKGROUND
1037 bgPixmap_t bgPixmap; 1022 bgPixmap_t bgPixmap;
1023#ifdef HAVE_AFTERIMAGE
1024 struct ASVisual *asv;
1025 ASImageManager *asimman;
1026 ASImage *original_asim;
1027 struct { unsigned int width, height; } xpmAttr; /* all we need is width/height */
1028#else
1038 XpmAttributes xpmAttr; /* originally loaded pixmap and its scaling */ 1029 XpmAttributes xpmAttr; /* originally loaded pixmap and its scaling */
1030#endif
1039#endif 1031#endif
1040 1032
1041#if ENABLE_OVERLAY 1033#if ENABLE_OVERLAY
1042 int ov_x, ov_y, ov_w, ov_h; // overlay dimensions 1034 int ov_x, ov_y, ov_w, ov_h; // overlay dimensions
1043 text_t **ov_text; 1035 text_t **ov_text;
1101 void vt_select_input () const NOTHROW 1093 void vt_select_input () const NOTHROW
1102 { 1094 {
1103 XSelectInput (dpy, vt, vt_emask | vt_emask_perl | vt_emask_xim); 1095 XSelectInput (dpy, vt, vt_emask | vt_emask_perl | vt_emask_xim);
1104 } 1096 }
1105 1097
1106#if TRANSPARENT || ENABLE_PERL 1098#if ENABLE_TRANSPARENCY || ENABLE_PERL
1107 void rootwin_cb (XEvent &xev); 1099 void rootwin_cb (XEvent &xev);
1108 xevent_watcher rootwin_ev; 1100 xevent_watcher rootwin_ev;
1101#endif
1102#if ENABLE_TRANSPARENCY
1103 int check_our_parents ();
1104 void check_our_parents_cb (time_watcher &w);
1105 time_watcher check_our_parents_ev;
1109#endif 1106#endif
1110 1107
1111 void x_cb (XEvent &xev); 1108 void x_cb (XEvent &xev);
1112 void flush (); 1109 void flush ();
1113 xevent_watcher termwin_ev; 1110 xevent_watcher termwin_ev;
1231 void button_press (XButtonEvent &ev); 1228 void button_press (XButtonEvent &ev);
1232 void button_release (XButtonEvent &ev); 1229 void button_release (XButtonEvent &ev);
1233 void focus_in (); 1230 void focus_in ();
1234 void focus_out (); 1231 void focus_out ();
1235 void update_fade_color (unsigned int idx); 1232 void update_fade_color (unsigned int idx);
1236 int check_our_parents ();
1237#ifdef PRINTPIPE 1233#ifdef PRINTPIPE
1238 FILE *popen_printer (); 1234 FILE *popen_printer ();
1239 int pclose_printer (FILE *stream); 1235 int pclose_printer (FILE *stream);
1240#endif 1236#endif
1241 void process_print_pipe (); 1237 void process_print_pipe ();
1302 { 1298 {
1303 int base = GET_BASEFG (r); 1299 int base = GET_BASEFG (r);
1304#ifndef NO_BRIGHTCOLOR 1300#ifndef NO_BRIGHTCOLOR
1305 if (r & RS_Bold 1301 if (r & RS_Bold
1306# if ENABLE_STYLES 1302# if ENABLE_STYLES
1307 && OPTION (Opt_intensityStyles) 1303 && option (Opt_intensityStyles)
1308# endif 1304# endif
1309 && IN_RANGE_INC (base, minCOLOR, minBrightCOLOR)) 1305 && IN_RANGE_INC (base, minCOLOR, minBrightCOLOR))
1310 base += minBrightCOLOR - minCOLOR; 1306 base += minBrightCOLOR - minCOLOR;
1311#endif 1307#endif
1312 return base; 1308 return base;
1316 { 1312 {
1317 int base = GET_BASEBG (r); 1313 int base = GET_BASEBG (r);
1318#ifndef NO_BRIGHTCOLOR 1314#ifndef NO_BRIGHTCOLOR
1319 if (r & RS_Blink 1315 if (r & RS_Blink
1320# if ENABLE_STYLES 1316# if ENABLE_STYLES
1321 && OPTION (Opt_intensityStyles) 1317 && option (Opt_intensityStyles)
1322# endif 1318# endif
1323 && IN_RANGE_INC (base, minCOLOR, minBrightCOLOR)) 1319 && IN_RANGE_INC (base, minCOLOR, minBrightCOLOR))
1324 base += minBrightCOLOR - minCOLOR; 1320 base += minBrightCOLOR - minCOLOR;
1325#endif 1321#endif
1326 return base; 1322 return base;
1327 } 1323 }
1328 1324
1329 bool option (uint32_t opt) const NOTHROW 1325 bool option (uint8_t opt) const NOTHROW
1330 { 1326 {
1331 return OPTION (opt); 1327 return options[opt >> 3] & (1 << (opt & 7));
1332 } 1328 }
1333 1329
1334 void set_option (uint32_t opt, bool set) NOTHROW 1330 void set_option (uint8_t opt, bool set = true) NOTHROW
1335 { 1331 {
1336 if (set) 1332 if (set)
1337 options |= opt; 1333 options[opt >> 3] |= (1 << (opt & 7));
1338 else 1334 else
1339 options &= ~opt; 1335 options[opt >> 3] &= ~(1 << (opt & 7));
1340 } 1336 }
1341 1337
1342 void scr_blank_line (line_t &l, unsigned int col, unsigned int width, rend_t efs) const NOTHROW; 1338 void scr_blank_line (line_t &l, unsigned int col, unsigned int width, rend_t efs) const NOTHROW;
1343 void scr_blank_screen_mem (line_t &l, rend_t efs) const NOTHROW; 1339 void scr_blank_screen_mem (line_t &l, rend_t efs) const NOTHROW;
1344 int scr_scroll_text (int row1, int row2, int count) NOTHROW; 1340 int scr_scroll_text (int row1, int row2, int count) NOTHROW;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines