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.328 by ayin, Fri Nov 30 10:57:04 2007 UTC vs.
Revision 1.337 by ayin, Wed Dec 26 14:16:23 2007 UTC

79# define STDIN_FILENO 0 79# define STDIN_FILENO 0
80# define STDOUT_FILENO 1 80# define STDOUT_FILENO 1
81# define STDERR_FILENO 2 81# define STDERR_FILENO 2
82#endif 82#endif
83 83
84#if !defined (EACCESS) && defined(EAGAIN)
85# define EACCESS EAGAIN
86#endif
87
88#ifndef EXIT_SUCCESS /* missing from <stdlib.h> */
89# define EXIT_SUCCESS 0 /* exit function success */
90# define EXIT_FAILURE 1 /* exit function failure */
91#endif
92
93#ifndef PATH_MAX
94# define PATH_MAX 16384
95#endif
96
84/****************************************************************************/ 97/****************************************************************************/
85 98
86// exception thrown on fatal (per-instance) errors 99// exception thrown on fatal (per-instance) errors
87class rxvt_failure_exception { }; 100class rxvt_failure_exception { };
88 101
93 ***************************************************************************** 106 *****************************************************************************
94 * PROTOTYPES 107 * PROTOTYPES
95 ***************************************************************************** 108 *****************************************************************************
96 */ 109 */
97// main.C 110// main.C
98void * rxvt_malloc (size_t size); 111#define SET_LOCALE(locale) rxvt_set_locale (locale)
99void * rxvt_calloc (size_t number, size_t size); 112extern bool rxvt_set_locale (const char *locale) NOTHROW;
100void * rxvt_realloc (void *ptr, size_t size); 113extern void rxvt_push_locale (const char *locale) NOTHROW;
114extern void rxvt_pop_locale () NOTHROW;
101 115
102// misc.C 116// misc.C
103char * rxvt_wcstombs (const wchar_t *str, int len = -1); 117char * rxvt_wcstombs (const wchar_t *str, int len = -1);
104wchar_t * rxvt_mbstowcs (const char *str, int len = -1); 118wchar_t * rxvt_mbstowcs (const char *str, int len = -1);
105char * rxvt_wcstoutf8 (const wchar_t *str, int len = -1); 119char * rxvt_wcstoutf8 (const wchar_t *str, int len = -1);
114 128
115char * rxvt_strtrim (char *str) NOTHROW; 129char * rxvt_strtrim (char *str) NOTHROW;
116char ** rxvt_splitcommastring (const char *cs) NOTHROW; 130char ** rxvt_splitcommastring (const char *cs) NOTHROW;
117void rxvt_freecommastring (char **cs) NOTHROW; 131void rxvt_freecommastring (char **cs) NOTHROW;
118 132
133void * rxvt_malloc (size_t size);
134void * rxvt_calloc (size_t number, size_t size);
135void * rxvt_realloc (void *ptr, size_t size);
136
119///////////////////////////////////////////////////////////////////////////// 137/////////////////////////////////////////////////////////////////////////////
120 138
121// temporarily replace the process environment 139// temporarily replace the process environment
122extern char **environ; 140extern char **environ;
123extern char **rxvt_environ; // the original environ pointer 141extern char **rxvt_environ; // the original environ pointer
124 142
143static inline void
125static inline void set_environ (stringvec *envv) 144set_environ (stringvec *envv)
126{ 145{
127#if ENABLE_PERL 146#if ENABLE_PERL
128 assert (envv); 147 assert (envv);
129#else 148#else
130 if (envv) 149 if (envv)
131#endif 150#endif
132 environ = (char **)envv->begin (); 151 environ = (char **)envv->begin ();
133} 152}
134 153
135static inline void set_environ (char **envv) 154static inline void
155set_environ (char **envv)
136{ 156{
137#if ENABLE_PERL 157#if ENABLE_PERL
138 assert (envv); 158 assert (envv);
139#else 159#else
140 if (envv) 160 if (envv)
145/* 165/*
146 ***************************************************************************** 166 *****************************************************************************
147 * STRUCTURES AND TYPEDEFS 167 * STRUCTURES AND TYPEDEFS
148 ***************************************************************************** 168 *****************************************************************************
149 */ 169 */
150struct grwin_t;
151 170
152/* If we're using either the rxvt scrollbar, keep the 171/* If we're using either the rxvt scrollbar, keep the
153 * scrollColor resource. 172 * scrollColor resource.
154 */ 173 */
155#if defined(RXVT_SCROLLBAR) || defined(NEXT_SCROLLBAR) || defined(PLAIN_SCROLLBAR) 174#if defined(RXVT_SCROLLBAR) || defined(NEXT_SCROLLBAR) || defined(PLAIN_SCROLLBAR)
211# define TERMENV "rxvt-unicode" 230# define TERMENV "rxvt-unicode"
212#endif 231#endif
213 232
214#if defined (NO_MOUSE_REPORT) && !defined (NO_MOUSE_REPORT_SCROLLBAR) 233#if defined (NO_MOUSE_REPORT) && !defined (NO_MOUSE_REPORT_SCROLLBAR)
215# define NO_MOUSE_REPORT_SCROLLBAR 1 234# define NO_MOUSE_REPORT_SCROLLBAR 1
216#endif
217
218/* now look for other badly set stuff */
219
220#if !defined (EACCESS) && defined(EAGAIN)
221# define EACCESS EAGAIN
222#endif
223
224#ifndef EXIT_SUCCESS /* missing from <stdlib.h> */
225# define EXIT_SUCCESS 0 /* exit function success */
226# define EXIT_FAILURE 1 /* exit function failure */
227#endif 235#endif
228 236
229#define scrollBar_esc 30 237#define scrollBar_esc 30
230 238
231#if defined(RXVT_SCROLLBAR) || defined(NEXT_SCROLLBAR) || defined(XTERM_SCROLLBAR) || defined(PLAIN_SCROLLBAR) 239#if defined(RXVT_SCROLLBAR) || defined(NEXT_SCROLLBAR) || defined(XTERM_SCROLLBAR) || defined(PLAIN_SCROLLBAR)
595#define IMBUFSIZ 128 // input modifier buffer sizes 603#define IMBUFSIZ 128 // input modifier buffer sizes
596#define KBUFSZ 512 // size of keyboard mapping buffer 604#define KBUFSZ 512 // size of keyboard mapping buffer
597#define CBUFSIZ 2048 // size of command buffer 605#define CBUFSIZ 2048 // size of command buffer
598#define UBUFSIZ 2048 // character buffer 606#define UBUFSIZ 2048 // character buffer
599 607
600#ifndef PATH_MAX
601# define PATH_MAX 16384
602#endif
603
604#if ENABLE_FRILLS 608#if ENABLE_FRILLS
605# include <X11/Xmd.h> 609# include <X11/Xmd.h>
606typedef struct _mwmhints { 610typedef struct _mwmhints {
607 CARD32 flags; 611 CARD32 flags;
608 CARD32 functions; 612 CARD32 functions;
658#define Col2Pixel(col) ((int32_t)Width2Pixel(col)) 662#define Col2Pixel(col) ((int32_t)Width2Pixel(col))
659#define Row2Pixel(row) ((int32_t)Height2Pixel(row)) 663#define Row2Pixel(row) ((int32_t)Height2Pixel(row))
660#define Width2Pixel(n) ((int32_t)(n) * (int32_t)fwidth) 664#define Width2Pixel(n) ((int32_t)(n) * (int32_t)fwidth)
661#define Height2Pixel(n) ((int32_t)(n) * (int32_t)fheight) 665#define Height2Pixel(n) ((int32_t)(n) * (int32_t)fheight)
662 666
663// for m >= -n, ensure remainder lies between 0..n-1
664#define MOD(m,n) (((m) + (n)) % (n))
665
666#define LINENO(n) MOD (term_start + int(n), total_rows) 667#define LINENO(n) MOD (term_start + int(n), total_rows)
667#define ROW(n) row_buf [LINENO (n)] 668#define ROW(n) row_buf [LINENO (n)]
668 669
669/* how to build & extract colors and attributes */ 670/* how to build & extract colors and attributes */
670#define GET_BASEFG(x) (((x) & RS_fgMask)) 671#define GET_BASEFG(x) (((x) & RS_fgMask))
726#define scrollbar_size() (scrollBar.end - scrollBar.beg \ 727#define scrollbar_size() (scrollBar.end - scrollBar.beg \
727 - scrollbar_minheight ()) 728 - scrollbar_minheight ())
728 729
729typedef callback<void (const char *)> log_callback; 730typedef callback<void (const char *)> log_callback;
730typedef callback<int (int)> getfd_callback; 731typedef callback<int (int)> getfd_callback;
731
732#define SET_LOCALE(locale) rxvt_set_locale (locale)
733extern bool rxvt_set_locale (const char *locale) NOTHROW;
734extern void rxvt_push_locale (const char *locale) NOTHROW;
735extern void rxvt_pop_locale () NOTHROW;
736 732
737/****************************************************************************/ 733/****************************************************************************/
738 734
739#define LINE_LONGER 0x0001 // line is continued on the next row 735#define LINE_LONGER 0x0001 // line is continued on the next row
740#define LINE_FILTERED 0x0002 // line has been filtered 736#define LINE_FILTERED 0x0002 // line has been filtered
1047#if ENABLE_TRANSPARENCY || ENABLE_PERL 1043#if ENABLE_TRANSPARENCY || ENABLE_PERL
1048 void rootwin_cb (XEvent &xev); 1044 void rootwin_cb (XEvent &xev);
1049 xevent_watcher rootwin_ev; 1045 xevent_watcher rootwin_ev;
1050#endif 1046#endif
1051#ifdef HAVE_BG_PIXMAP 1047#ifdef HAVE_BG_PIXMAP
1052 int update_background (); 1048 void update_background ();
1053#if TRACE_PIXMAPS 1049#if TRACE_PIXMAPS
1054 int trace_update_background (const char *file, int line); 1050 void trace_update_background (const char *file, int line);
1055# define update_background() trace_update_background (__FILE__, __LINE__) 1051# define update_background() trace_update_background (__FILE__, __LINE__)
1056#endif 1052#endif
1057 void update_background_cb (ev::timer &w, int revents); 1053 void update_background_cb (ev::timer &w, int revents);
1058 ev::timer update_background_ev; 1054 ev::timer update_background_ev;
1059#endif 1055#endif
1064#ifdef HAVE_SCROLLBARS 1060#ifdef HAVE_SCROLLBARS
1065 xevent_watcher scrollbar_ev; 1061 xevent_watcher scrollbar_ev;
1066#endif 1062#endif
1067 1063
1068 void child_cb (ev::child &w, int revents); ev::child child_ev; 1064 void child_cb (ev::child &w, int revents); ev::child child_ev;
1069 void prepare_cb (ev::prepare &w, int revents); ev::prepare prepare_ev;
1070 void destroy_cb (ev::idle &w, int revents); ev::idle destroy_ev; 1065 void destroy_cb (ev::idle &w, int revents); ev::idle destroy_ev;
1066 void refresh_check ();
1071 void flush (); 1067 void flush ();
1072 void flush_cb (ev::timer &w, int revents); ev::timer flush_ev; 1068 void flush_cb (ev::timer &w, int revents); ev::timer flush_ev;
1073 bool pty_fill (); 1069 bool pty_fill ();
1074 void pty_cb (ev::io &w, int revents); ev::io pty_ev; 1070 void pty_cb (ev::io &w, int revents); ev::io pty_ev;
1075 void incr_cb (ev::timer &w, int revents) NOTHROW; ev::timer incr_ev; 1071 void incr_cb (ev::timer &w, int revents) NOTHROW; ev::timer incr_ev;
1102 1098
1103 void tt_printf (const char *fmt,...); 1099 void tt_printf (const char *fmt,...);
1104 void tt_write (const char *data, unsigned int len); 1100 void tt_write (const char *data, unsigned int len);
1105 void pty_write (); 1101 void pty_write ();
1106 1102
1107 bool init (stringvec *argv, stringvec *envv) 1103 void init (stringvec *argv, stringvec *envv)
1108 { 1104 {
1109 this->argv = argv; 1105 this->argv = argv;
1110 return init (argv->size (), argv->begin (), envv); 1106 init (argv->size (), argv->begin (), envv);
1111 } 1107 }
1112 1108
1113 void make_current () const // make this the "currently active" urxvt instance 1109 void make_current () const // make this the "currently active" urxvt instance
1114 { 1110 {
1115 SET_R (this); 1111 SET_R (this);
1171 int privcases (int mode, unsigned long bit); 1167 int privcases (int mode, unsigned long bit);
1172 void process_terminal_mode (int mode, int priv, unsigned int nargs, const int *arg); 1168 void process_terminal_mode (int mode, int priv, unsigned int nargs, const int *arg);
1173 void process_sgr_mode (unsigned int nargs, const int *arg); 1169 void process_sgr_mode (unsigned int nargs, const int *arg);
1174 void process_graphics (); 1170 void process_graphics ();
1175 // init.C 1171 // init.C
1176 bool init_vars (); 1172 void init_vars ();
1177 void init_secondary (); 1173 void init_secondary ();
1178 const char **init_resources (int argc, const char *const *argv); 1174 const char **init_resources (int argc, const char *const *argv);
1179 void init_env (); 1175 void init_env ();
1180 void set_locale (const char *locale); 1176 void set_locale (const char *locale);
1181 void init_xlocale (); 1177 void init_xlocale ();
1190 void tt_winch (); 1186 void tt_winch ();
1191 rxvt_term (); 1187 rxvt_term ();
1192 ~rxvt_term (); 1188 ~rxvt_term ();
1193 void destroy (); 1189 void destroy ();
1194 void emergency_cleanup (); 1190 void emergency_cleanup ();
1195 bool init (int argc, const char *const *argv, stringvec *envv); 1191 void init (int argc, const char *const *argv, stringvec *envv);
1196 void recolour_cursor (); 1192 void recolour_cursor ();
1197 void resize_all_windows (unsigned int newwidth, unsigned int newheight, int ignoreparent); 1193 void resize_all_windows (unsigned int newwidth, unsigned int newheight, int ignoreparent);
1198 void window_calc (unsigned int newwidth, unsigned int newheight); 1194 void window_calc (unsigned int newwidth, unsigned int newheight);
1199 bool set_fonts (); 1195 bool set_fonts ();
1200 void set_string_property (Atom prop, const char *str, int len = -1); 1196 void set_string_property (Atom prop, const char *str, int len = -1);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines