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.296 by ayin, Sun Aug 26 16:25:59 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
89#ifdef XPM_BACKGROUND 78#ifdef HAVE_AFTERIMAGE
90# ifdef XPM_INC_X11 79# include <afterimage.h>
91# include <X11/xpm.h> 80#undef min
92# else 81#undef max
93# include <xpm.h>
94# endif
95#endif 82#endif
96 83
97#ifndef STDIN_FILENO 84#ifndef STDIN_FILENO
98# define STDIN_FILENO 0 85# define STDIN_FILENO 0
99# define STDOUT_FILENO 1 86# define STDOUT_FILENO 1
112 ***************************************************************************** 99 *****************************************************************************
113 * PROTOTYPES 100 * PROTOTYPES
114 ***************************************************************************** 101 *****************************************************************************
115 */ 102 */
116// main.C 103// main.C
117RETSIGTYPE rxvt_Child_signal (int sig) NOTHROW;
118RETSIGTYPE rxvt_Exit_signal (int sig) NOTHROW;
119void rxvt_clean_exit () NOTHROW;
120void * rxvt_malloc (size_t size); 104void * rxvt_malloc (size_t size);
121void * rxvt_calloc (size_t number, size_t size); 105void * rxvt_calloc (size_t number, size_t size);
122void * rxvt_realloc (void *ptr, size_t size); 106void * rxvt_realloc (void *ptr, size_t size);
123 107
124// misc.C 108// misc.C
125char * rxvt_wcstombs (const wchar_t *str, int len = -1); 109char * rxvt_wcstombs (const wchar_t *str, int len = -1);
126wchar_t * rxvt_mbstowcs (const char *str, int len = -1); 110wchar_t * rxvt_mbstowcs (const char *str, int len = -1);
127char * rxvt_wcstoutf8 (const wchar_t *str, int len = -1); 111char * rxvt_wcstoutf8 (const wchar_t *str, int len = -1);
128wchar_t * rxvt_utf8towcs (const char *str, int len = -1); 112wchar_t * rxvt_utf8towcs (const char *str, int len = -1);
129char * rxvt_strdup_cpp (const char *str);
130 113
131#define rxvt_strdup(s) ((s) ? strdup(s) : 0) 114#define rxvt_strdup(s) ((s) ? strdup(s) : 0)
132 115
133char * rxvt_r_basename (const char *str) NOTHROW; 116char * rxvt_r_basename (const char *str) NOTHROW;
134void rxvt_vlog (const char *fmt, va_list arg_ptr) NOTHROW; 117void rxvt_vlog (const char *fmt, va_list arg_ptr) NOTHROW;
141const char * rxvt_Str_skip_space (const char *str) NOTHROW; 124const char * rxvt_Str_skip_space (const char *str) NOTHROW;
142char * rxvt_Str_trim (char *str) NOTHROW; 125char * rxvt_Str_trim (char *str) NOTHROW;
143int rxvt_Str_escaped (char *str) NOTHROW; 126int rxvt_Str_escaped (char *str) NOTHROW;
144char ** rxvt_splitcommastring (const char *cs) NOTHROW; 127char ** rxvt_splitcommastring (const char *cs) NOTHROW;
145void rxvt_freecommastring (char **cs) NOTHROW; 128void rxvt_freecommastring (char **cs) NOTHROW;
146char * rxvt_File_find (const char *file, const char *ext, const char *path) NOTHROW;
147 129
148///////////////////////////////////////////////////////////////////////////// 130/////////////////////////////////////////////////////////////////////////////
149 131
150// temporarily replace the process environment 132// temporarily replace the process environment
151extern char **environ; 133extern char **environ;
185# define KEEP_SCROLLCOLOR 1 167# define KEEP_SCROLLCOLOR 1
186#else 168#else
187# undef KEEP_SCROLLCOLOR 169# undef KEEP_SCROLLCOLOR
188#endif 170#endif
189 171
172#if defined(XPM_BACKGROUND) || defined(ENABLE_TRANSPARENCY)
173# define HAVE_BG_PIXMAP 1/* to simplify further usage */
174struct bgPixmap_t {
175
176 enum {
177 geometrySet = (1UL<<0),
178 propScale = (1UL<<1),
179 geometryFlags = (geometrySet|propScale),
180
181 tintSet = (1UL<<8),
182 tintNeeded = (1UL<<9),
183 tintWholesome = (1UL<<10),
184 tintServerSide = (1UL<<11),
185 tintFlags = (tintSet|tintServerSide|tintNeeded|tintWholesome),
186 blurNeeded = (1UL<<12),
187
188 isTransparent = (1UL<<16),
189 isInvalid = (1UL<<17)
190 };
191
192 unsigned long flags;
193
194 enum {
195 transpPmapTiled = (1UL<<0),
196 transpPmapTinted = tintNeeded,
197 transpPmapBlured = blurNeeded,
198 transpTransformations = (tintNeeded|blurNeeded)
199 }; /* this flags are returned by make_transparency_pixmap if called */
200
190#ifdef XPM_BACKGROUND 201# ifdef XPM_BACKGROUND
191typedef struct { 202# ifdef HAVE_AFTERIMAGE
192 short w, h, x, y; 203 ASImage *original_asim;
204 bool render_asim (ASImage *background, ARGB32 background_tint);
205# endif
206
207 enum { defaultScale = 100, defaultAlign = 50 };
208
209 unsigned int h_scale, v_scale;/* percents of the window size */
210 int h_align, v_align; /* percents of the window size:
211 0 - left align, 50 - center, 100 - right */
212 void unset_geometry () { flags = flags & ~geometryFlags; };
213 bool set_geometry (const char *geom);
214 void set_defaultGeometry ()
215 {
216 h_scale = v_scale = defaultScale;
217 h_align = v_align = defaultAlign;
218 flags |= geometrySet;
219 };
220
221 bool set_file (const char *file);
222# endif /* XPM_BACKGROUND */
223
224 rxvt_term *target;
225 bool set_target (rxvt_term *new_target);
226
227# ifdef ENABLE_TRANSPARENCY
228 int root_depth; /* obtained when target is set */
229 Pixmap root_pixmap; /* current root pixmap set */
230 rxvt_color tint;
231 int shade;
232 int h_blurRadius, v_blurRadius;
233
234 bool set_transparent ();
235 bool set_blur_radius (const char *geom);
236 bool set_tint (rxvt_color &new_tint);
237 bool unset_tint ();
238 bool set_shade (const char *shade_str);
239 bool set_root_pixmap ();
240
241 unsigned long make_transparency_pixmap ();/* returns combination of the transpTransformations flags */
242# endif
243 double invalid_since;
244
193 Pixmap pixmap; 245 Pixmap pixmap;
194} bgPixmap_t; 246 unsigned int pmap_width, pmap_height;
247 unsigned int pmap_depth;
248
249 bool window_size_sensitive ();
250 bool need_client_side_rendering ();
251 void apply ();
252 bool render ();
253 void invalidate () {
254 if (!(flags & isInvalid))
255 {
256 flags |= isInvalid;
257 invalid_since = NOW;
258 }
259 };
260};
261#else
262# undef HAVE_BG_PIXMAP
195#endif 263#endif
196 264
197/* 265/*
198 * the 'essential' information for reporting Mouse Events 266 * the 'essential' information for reporting Mouse Events
199 * pared down from XButtonEvent 267 * pared down from XButtonEvent
520 * on the unnecessary items, e.g. Color_pointer, but won't bother 588 * 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 589 * until we need to. Also, be aware of usage in pixcolor_set
522 */ 590 */
523 591
524enum colour_list { 592enum colour_list {
593 Color_none = -2,
594 Color_transparent = -1,
525 Color_fg = 0, 595 Color_fg = 0,
526 Color_bg, 596 Color_bg,
527 minCOLOR, /* 2 */ 597 minCOLOR, /* 2 */
528 Color_Black = minCOLOR, 598 Color_Black = minCOLOR,
529 Color_Red3, 599 Color_Red3,
571#endif 641#endif
572#ifdef KEEP_SCROLLCOLOR 642#ifdef KEEP_SCROLLCOLOR
573 Color_scroll, 643 Color_scroll,
574 Color_trough, 644 Color_trough,
575#endif 645#endif
576#if TINTING 646#if ENABLE_TRANSPARENCY
577 Color_tint, 647 Color_tint,
578#endif 648#endif
579#if OFF_FOCUS_FADING 649#if OFF_FOCUS_FADING
580 Color_fade, 650 Color_fade,
581#endif 651#endif
682 * MACRO DEFINES 752 * MACRO DEFINES
683 ***************************************************************************** 753 *****************************************************************************
684 */ 754 */
685#define dLocal(type,name) type const name = this->name 755#define dLocal(type,name) type const name = this->name
686 756
687// for speed reasons, we assume that all latin1 characters 757// for speed reasons, we assume that all codepoints 32 to 126 are
688// are single-width (the first unicode combining character 758// single-width.
689// is actually 0x300, but ascii is what matters most). 759#define WCWIDTH(c) (IN_RANGE_INC (c, 0x20, 0x7e) ? 1 : wcwidth (c))
690#define WCWIDTH(c) ((c) & ~0xff ? wcwidth (c) : 1)
691 760
692/* convert pixel dimensions to row/column values. Everything as int32_t */ 761/* convert pixel dimensions to row/column values. Everything as int32_t */
693#define Pixel2Col(x) Pixel2Width((int32_t)(x)) 762#define Pixel2Col(x) Pixel2Width((int32_t)(x))
694#define Pixel2Row(y) Pixel2Height((int32_t)(y)) 763#define Pixel2Row(y) Pixel2Height((int32_t)(y))
695#define Pixel2Width(x) ((int32_t)(x) / (int32_t)fwidth) 764#define Pixel2Width(x) ((int32_t)(x) / (int32_t)fwidth)
697#define Col2Pixel(col) ((int32_t)Width2Pixel(col)) 766#define Col2Pixel(col) ((int32_t)Width2Pixel(col))
698#define Row2Pixel(row) ((int32_t)Height2Pixel(row)) 767#define Row2Pixel(row) ((int32_t)Height2Pixel(row))
699#define Width2Pixel(n) ((int32_t)(n) * (int32_t)fwidth) 768#define Width2Pixel(n) ((int32_t)(n) * (int32_t)fwidth)
700#define Height2Pixel(n) ((int32_t)(n) * (int32_t)fheight) 769#define Height2Pixel(n) ((int32_t)(n) * (int32_t)fheight)
701 770
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
707// for m >= -n, ensure remainder lies between 0..n-1 771// for m >= -n, ensure remainder lies between 0..n-1
708#define MOD(m,n) (((m) + (n)) % (n)) 772#define MOD(m,n) (((m) + (n)) % (n))
709 773
710#define LINENO(n) MOD (term_start + int(n), total_rows) 774#define LINENO(n) MOD (term_start + int(n), total_rows)
711#define ROW(n) row_buf [LINENO (n)] 775#define ROW(n) row_buf [LINENO (n)]
767#define scrollbar_above_slider(y) ((y) < scrollBar.top) 831#define scrollbar_above_slider(y) ((y) < scrollBar.top)
768#define scrollbar_below_slider(y) ((y) > scrollBar.bot) 832#define scrollbar_below_slider(y) ((y) > scrollBar.bot)
769#define scrollbar_position(y) ((y) - scrollBar.beg) 833#define scrollbar_position(y) ((y) - scrollBar.beg)
770#define scrollbar_size() (scrollBar.end - scrollBar.beg \ 834#define scrollbar_size() (scrollBar.end - scrollBar.beg \
771 - scrollbar_minheight ()) 835 - scrollbar_minheight ())
772
773#ifdef XPM_BACKGROUND
774# define XPMClearArea(a, b, c, d, e, f, g) XClearArea((a), (b), (c), (d), (e), (f), (g))
775#else
776# define XPMClearArea(a, b, c, d, e, f, g)
777#endif
778 836
779typedef callback<void (const char *)> log_callback; 837typedef callback<void (const char *)> log_callback;
780typedef callback<int (int)> getfd_callback; 838typedef callback<int (int)> getfd_callback;
781 839
782#define SET_LOCALE(locale) rxvt_set_locale (locale) 840#define SET_LOCALE(locale) rxvt_set_locale (locale)
909 rxvt_perl_term perl; 967 rxvt_perl_term perl;
910#endif 968#endif
911 struct mbstate mbstate; // current input multibyte state 969 struct mbstate mbstate; // current input multibyte state
912 970
913 unsigned char want_refresh:1, 971 unsigned char want_refresh:1,
914#ifdef TRANSPARENT 972#ifdef ENABLE_TRANSPARENCY
915 want_full_refresh:1, /* awaiting full screen refresh */ 973 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 */
919 am_pixmap_trans:1, /* transparency w/known root pixmap */
920#endif 974#endif
921 current_screen:1, /* primary or secondary */ 975 current_screen:1, /* primary or secondary */
922 num_scr_allow:1, 976 num_scr_allow:1,
923 bypass_keystate:1, 977 bypass_keystate:1,
924#ifdef CURSOR_BLINK 978#ifdef CURSOR_BLINK
965 /* give proper Scroll behaviour */ 1019 /* give proper Scroll behaviour */
966#if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) 1020#if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING)
967 mouse_slip_wheel_speed, 1021 mouse_slip_wheel_speed,
968#endif 1022#endif
969 refresh_count, 1023 refresh_count,
970 refresh_limit,
971 last_bot, /* scrollbar last bottom position */ 1024 last_bot, /* scrollbar last bottom position */
972 last_top, /* scrollbar last top position */ 1025 last_top, /* scrollbar last top position */
973 last_state, /* scrollbar last state */ 1026 last_state, /* scrollbar last state */
974 scrollbar_len, 1027 scrollbar_len,
975 window_vt_x, 1028 window_vt_x,
1031#endif 1084#endif
1032 struct mouse_event MEvent; 1085 struct mouse_event MEvent;
1033 XComposeStatus compose; 1086 XComposeStatus compose;
1034 ttymode_t tio; 1087 ttymode_t tio;
1035 row_col_t oldcursor; 1088 row_col_t oldcursor;
1036#ifdef XPM_BACKGROUND 1089#ifdef HAVE_BG_PIXMAP
1037 bgPixmap_t bgPixmap; 1090 bgPixmap_t bgPixmap;
1038 XpmAttributes xpmAttr; /* originally loaded pixmap and its scaling */ 1091#endif
1092#ifdef HAVE_AFTERIMAGE
1093 ASVisual *asv;
1094 ASImageManager *asimman;
1039#endif 1095#endif
1040 1096
1041#if ENABLE_OVERLAY 1097#if ENABLE_OVERLAY
1042 int ov_x, ov_y, ov_w, ov_h; // overlay dimensions 1098 int ov_x, ov_y, ov_w, ov_h; // overlay dimensions
1043 text_t **ov_text; 1099 text_t **ov_text;
1101 void vt_select_input () const NOTHROW 1157 void vt_select_input () const NOTHROW
1102 { 1158 {
1103 XSelectInput (dpy, vt, vt_emask | vt_emask_perl | vt_emask_xim); 1159 XSelectInput (dpy, vt, vt_emask | vt_emask_perl | vt_emask_xim);
1104 } 1160 }
1105 1161
1106#if TRANSPARENT || ENABLE_PERL 1162#if ENABLE_TRANSPARENCY || ENABLE_PERL
1107 void rootwin_cb (XEvent &xev); 1163 void rootwin_cb (XEvent &xev);
1108 xevent_watcher rootwin_ev; 1164 xevent_watcher rootwin_ev;
1165#endif
1166#ifdef HAVE_BG_PIXMAP
1167 int update_background ();
1168 void update_background_cb (time_watcher &w);
1169 time_watcher update_background_ev;
1109#endif 1170#endif
1110 1171
1111 void x_cb (XEvent &xev); 1172 void x_cb (XEvent &xev);
1112 void flush (); 1173 void flush ();
1113 xevent_watcher termwin_ev; 1174 xevent_watcher termwin_ev;
1231 void button_press (XButtonEvent &ev); 1292 void button_press (XButtonEvent &ev);
1232 void button_release (XButtonEvent &ev); 1293 void button_release (XButtonEvent &ev);
1233 void focus_in (); 1294 void focus_in ();
1234 void focus_out (); 1295 void focus_out ();
1235 void update_fade_color (unsigned int idx); 1296 void update_fade_color (unsigned int idx);
1236 int check_our_parents ();
1237#ifdef PRINTPIPE 1297#ifdef PRINTPIPE
1238 FILE *popen_printer (); 1298 FILE *popen_printer ();
1239 int pclose_printer (FILE *stream); 1299 int pclose_printer (FILE *stream);
1240#endif 1300#endif
1241 void process_print_pipe (); 1301 void process_print_pipe ();
1302 { 1362 {
1303 int base = GET_BASEFG (r); 1363 int base = GET_BASEFG (r);
1304#ifndef NO_BRIGHTCOLOR 1364#ifndef NO_BRIGHTCOLOR
1305 if (r & RS_Bold 1365 if (r & RS_Bold
1306# if ENABLE_STYLES 1366# if ENABLE_STYLES
1307 && OPTION (Opt_intensityStyles) 1367 && option (Opt_intensityStyles)
1308# endif 1368# endif
1309 && IN_RANGE_INC (base, minCOLOR, minBrightCOLOR)) 1369 && IN_RANGE_INC (base, minCOLOR, minBrightCOLOR))
1310 base += minBrightCOLOR - minCOLOR; 1370 base += minBrightCOLOR - minCOLOR;
1311#endif 1371#endif
1312 return base; 1372 return base;
1316 { 1376 {
1317 int base = GET_BASEBG (r); 1377 int base = GET_BASEBG (r);
1318#ifndef NO_BRIGHTCOLOR 1378#ifndef NO_BRIGHTCOLOR
1319 if (r & RS_Blink 1379 if (r & RS_Blink
1320# if ENABLE_STYLES 1380# if ENABLE_STYLES
1321 && OPTION (Opt_intensityStyles) 1381 && option (Opt_intensityStyles)
1322# endif 1382# endif
1323 && IN_RANGE_INC (base, minCOLOR, minBrightCOLOR)) 1383 && IN_RANGE_INC (base, minCOLOR, minBrightCOLOR))
1324 base += minBrightCOLOR - minCOLOR; 1384 base += minBrightCOLOR - minCOLOR;
1325#endif 1385#endif
1326 return base; 1386 return base;
1327 } 1387 }
1328 1388
1329 bool option (uint32_t opt) const NOTHROW 1389 bool option (uint8_t opt) const NOTHROW
1330 { 1390 {
1331 return OPTION (opt); 1391 return options[opt >> 3] & (1 << (opt & 7));
1332 } 1392 }
1333 1393
1334 void set_option (uint32_t opt, bool set) NOTHROW 1394 void set_option (uint8_t opt, bool set = true) NOTHROW
1335 { 1395 {
1336 if (set) 1396 if (set)
1337 options |= opt; 1397 options[opt >> 3] |= (1 << (opt & 7));
1338 else 1398 else
1339 options &= ~opt; 1399 options[opt >> 3] &= ~(1 << (opt & 7));
1340 } 1400 }
1341 1401
1342 void scr_blank_line (line_t &l, unsigned int col, unsigned int width, rend_t efs) const NOTHROW; 1402 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; 1403 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; 1404 int scr_scroll_text (int row1, int row2, int count) NOTHROW;
1450 void get_options (int argc, const char *const *argv); 1510 void get_options (int argc, const char *const *argv);
1451 int parse_keysym (const char *str, const char *arg); 1511 int parse_keysym (const char *str, const char *arg);
1452 void get_xdefaults (FILE *stream, const char *name); 1512 void get_xdefaults (FILE *stream, const char *name);
1453 void extract_resources (); 1513 void extract_resources ();
1454 // xpm.C 1514 // xpm.C
1455 int scale_pixmap (const char *geom); 1515 void get_window_origin (int &x, int &y);
1456 void resize_pixmap (); 1516 Pixmap get_pixmap_property (int prop_id);
1457 Pixmap set_bgPixmap (const char *file);
1458}; 1517};
1459 1518
1460/*
1461 *****************************************************************************
1462 * PROTOTYPES
1463 *****************************************************************************
1464 */
1465#ifdef PROTOTYPES
1466# define __PROTO(p) p
1467#else
1468# define __PROTO(p) ()
1469#endif
1470
1471#endif /* _RXVT_H_ */ 1519#endif /* _RXVT_H_ */
1472 1520

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines