… | |
… | |
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 |
87 | class rxvt_failure_exception { }; |
100 | class rxvt_failure_exception { }; |
88 | |
101 | |
… | |
… | |
145 | /* |
158 | /* |
146 | ***************************************************************************** |
159 | ***************************************************************************** |
147 | * STRUCTURES AND TYPEDEFS |
160 | * STRUCTURES AND TYPEDEFS |
148 | ***************************************************************************** |
161 | ***************************************************************************** |
149 | */ |
162 | */ |
150 | struct grwin_t; |
|
|
151 | |
163 | |
152 | /* If we're using either the rxvt scrollbar, keep the |
164 | /* If we're using either the rxvt scrollbar, keep the |
153 | * scrollColor resource. |
165 | * scrollColor resource. |
154 | */ |
166 | */ |
155 | #if defined(RXVT_SCROLLBAR) || defined(NEXT_SCROLLBAR) || defined(PLAIN_SCROLLBAR) |
167 | #if defined(RXVT_SCROLLBAR) || defined(NEXT_SCROLLBAR) || defined(PLAIN_SCROLLBAR) |
… | |
… | |
211 | # define TERMENV "rxvt-unicode" |
223 | # define TERMENV "rxvt-unicode" |
212 | #endif |
224 | #endif |
213 | |
225 | |
214 | #if defined (NO_MOUSE_REPORT) && !defined (NO_MOUSE_REPORT_SCROLLBAR) |
226 | #if defined (NO_MOUSE_REPORT) && !defined (NO_MOUSE_REPORT_SCROLLBAR) |
215 | # define NO_MOUSE_REPORT_SCROLLBAR 1 |
227 | # 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 |
228 | #endif |
228 | |
229 | |
229 | #define scrollBar_esc 30 |
230 | #define scrollBar_esc 30 |
230 | |
231 | |
231 | #if defined(RXVT_SCROLLBAR) || defined(NEXT_SCROLLBAR) || defined(XTERM_SCROLLBAR) || defined(PLAIN_SCROLLBAR) |
232 | #if defined(RXVT_SCROLLBAR) || defined(NEXT_SCROLLBAR) || defined(XTERM_SCROLLBAR) || defined(PLAIN_SCROLLBAR) |
… | |
… | |
595 | #define IMBUFSIZ 128 // input modifier buffer sizes |
596 | #define IMBUFSIZ 128 // input modifier buffer sizes |
596 | #define KBUFSZ 512 // size of keyboard mapping buffer |
597 | #define KBUFSZ 512 // size of keyboard mapping buffer |
597 | #define CBUFSIZ 2048 // size of command buffer |
598 | #define CBUFSIZ 2048 // size of command buffer |
598 | #define UBUFSIZ 2048 // character buffer |
599 | #define UBUFSIZ 2048 // character buffer |
599 | |
600 | |
600 | #ifndef PATH_MAX |
|
|
601 | # define PATH_MAX 16384 |
|
|
602 | #endif |
|
|
603 | |
|
|
604 | #if ENABLE_FRILLS |
601 | #if ENABLE_FRILLS |
605 | # include <X11/Xmd.h> |
602 | # include <X11/Xmd.h> |
606 | typedef struct _mwmhints { |
603 | typedef struct _mwmhints { |
607 | CARD32 flags; |
604 | CARD32 flags; |
608 | CARD32 functions; |
605 | CARD32 functions; |
… | |
… | |
657 | #define Pixel2Height(y) ((int32_t)(y) / (int32_t)fheight) |
654 | #define Pixel2Height(y) ((int32_t)(y) / (int32_t)fheight) |
658 | #define Col2Pixel(col) ((int32_t)Width2Pixel(col)) |
655 | #define Col2Pixel(col) ((int32_t)Width2Pixel(col)) |
659 | #define Row2Pixel(row) ((int32_t)Height2Pixel(row)) |
656 | #define Row2Pixel(row) ((int32_t)Height2Pixel(row)) |
660 | #define Width2Pixel(n) ((int32_t)(n) * (int32_t)fwidth) |
657 | #define Width2Pixel(n) ((int32_t)(n) * (int32_t)fwidth) |
661 | #define Height2Pixel(n) ((int32_t)(n) * (int32_t)fheight) |
658 | #define Height2Pixel(n) ((int32_t)(n) * (int32_t)fheight) |
662 | |
|
|
663 | // for m >= -n, ensure remainder lies between 0..n-1 |
|
|
664 | #define MOD(m,n) (((m) + (n)) % (n)) |
|
|
665 | |
659 | |
666 | #define LINENO(n) MOD (term_start + int(n), total_rows) |
660 | #define LINENO(n) MOD (term_start + int(n), total_rows) |
667 | #define ROW(n) row_buf [LINENO (n)] |
661 | #define ROW(n) row_buf [LINENO (n)] |
668 | |
662 | |
669 | /* how to build & extract colors and attributes */ |
663 | /* how to build & extract colors and attributes */ |
… | |
… | |
1047 | #if ENABLE_TRANSPARENCY || ENABLE_PERL |
1041 | #if ENABLE_TRANSPARENCY || ENABLE_PERL |
1048 | void rootwin_cb (XEvent &xev); |
1042 | void rootwin_cb (XEvent &xev); |
1049 | xevent_watcher rootwin_ev; |
1043 | xevent_watcher rootwin_ev; |
1050 | #endif |
1044 | #endif |
1051 | #ifdef HAVE_BG_PIXMAP |
1045 | #ifdef HAVE_BG_PIXMAP |
1052 | int update_background (); |
1046 | void update_background (); |
1053 | #if TRACE_PIXMAPS |
1047 | #if TRACE_PIXMAPS |
1054 | int trace_update_background (const char *file, int line); |
1048 | void trace_update_background (const char *file, int line); |
1055 | # define update_background() trace_update_background (__FILE__, __LINE__) |
1049 | # define update_background() trace_update_background (__FILE__, __LINE__) |
1056 | #endif |
1050 | #endif |
1057 | void update_background_cb (ev::timer &w, int revents); |
1051 | void update_background_cb (ev::timer &w, int revents); |
1058 | ev::timer update_background_ev; |
1052 | ev::timer update_background_ev; |
1059 | #endif |
1053 | #endif |
… | |
… | |
1064 | #ifdef HAVE_SCROLLBARS |
1058 | #ifdef HAVE_SCROLLBARS |
1065 | xevent_watcher scrollbar_ev; |
1059 | xevent_watcher scrollbar_ev; |
1066 | #endif |
1060 | #endif |
1067 | |
1061 | |
1068 | void child_cb (ev::child &w, int revents); ev::child child_ev; |
1062 | 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; |
1063 | void destroy_cb (ev::idle &w, int revents); ev::idle destroy_ev; |
|
|
1064 | void refresh_check (); |
1071 | void flush (); |
1065 | void flush (); |
1072 | void flush_cb (ev::timer &w, int revents); ev::timer flush_ev; |
1066 | void flush_cb (ev::timer &w, int revents); ev::timer flush_ev; |
1073 | bool pty_fill (); |
1067 | bool pty_fill (); |
1074 | void pty_cb (ev::io &w, int revents); ev::io pty_ev; |
1068 | 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; |
1069 | void incr_cb (ev::timer &w, int revents) NOTHROW; ev::timer incr_ev; |
… | |
… | |
1102 | |
1096 | |
1103 | void tt_printf (const char *fmt,...); |
1097 | void tt_printf (const char *fmt,...); |
1104 | void tt_write (const char *data, unsigned int len); |
1098 | void tt_write (const char *data, unsigned int len); |
1105 | void pty_write (); |
1099 | void pty_write (); |
1106 | |
1100 | |
1107 | bool init (stringvec *argv, stringvec *envv) |
1101 | void init (stringvec *argv, stringvec *envv) |
1108 | { |
1102 | { |
1109 | this->argv = argv; |
1103 | this->argv = argv; |
1110 | return init (argv->size (), argv->begin (), envv); |
1104 | init (argv->size (), argv->begin (), envv); |
1111 | } |
1105 | } |
1112 | |
1106 | |
1113 | void make_current () const // make this the "currently active" urxvt instance |
1107 | void make_current () const // make this the "currently active" urxvt instance |
1114 | { |
1108 | { |
1115 | SET_R (this); |
1109 | SET_R (this); |
… | |
… | |
1190 | void tt_winch (); |
1184 | void tt_winch (); |
1191 | rxvt_term (); |
1185 | rxvt_term (); |
1192 | ~rxvt_term (); |
1186 | ~rxvt_term (); |
1193 | void destroy (); |
1187 | void destroy (); |
1194 | void emergency_cleanup (); |
1188 | void emergency_cleanup (); |
1195 | bool init (int argc, const char *const *argv, stringvec *envv); |
1189 | void init (int argc, const char *const *argv, stringvec *envv); |
1196 | void recolour_cursor (); |
1190 | void recolour_cursor (); |
1197 | void resize_all_windows (unsigned int newwidth, unsigned int newheight, int ignoreparent); |
1191 | void resize_all_windows (unsigned int newwidth, unsigned int newheight, int ignoreparent); |
1198 | void window_calc (unsigned int newwidth, unsigned int newheight); |
1192 | void window_calc (unsigned int newwidth, unsigned int newheight); |
1199 | bool set_fonts (); |
1193 | bool set_fonts (); |
1200 | void set_string_property (Atom prop, const char *str, int len = -1); |
1194 | void set_string_property (Atom prop, const char *str, int len = -1); |