… | |
… | |
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) |
… | |
… | |
580 | #define PrivMode_smoothScroll (1UL<<17) |
581 | #define PrivMode_smoothScroll (1UL<<17) |
581 | #define PrivMode_vt52 (1UL<<18) |
582 | #define PrivMode_vt52 (1UL<<18) |
582 | #define PrivMode_LFNL (1UL<<19) |
583 | #define PrivMode_LFNL (1UL<<19) |
583 | #define PrivMode_MouseBtnEvent (1UL<<20) |
584 | #define PrivMode_MouseBtnEvent (1UL<<20) |
584 | #define PrivMode_MouseAnyEvent (1UL<<21) |
585 | #define PrivMode_MouseAnyEvent (1UL<<21) |
585 | /* too annoying to implement X11 highlight tracking */ |
|
|
586 | /* #define PrivMode_MouseX11Track (1LU<<20) */ |
|
|
587 | |
586 | |
588 | #define PrivMode_mouse_report (PrivMode_MouseX10|PrivMode_MouseX11|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent) |
587 | #define PrivMode_mouse_report (PrivMode_MouseX10|PrivMode_MouseX11|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent) |
589 | |
588 | |
590 | #ifdef ALLOW_132_MODE |
589 | #ifdef ALLOW_132_MODE |
591 | # define PrivMode_Default (PrivMode_Autowrap|PrivMode_ShiftKeys|PrivMode_VisibleCursor|PrivMode_132OK) |
590 | # define PrivMode_Default (PrivMode_Autowrap|PrivMode_ShiftKeys|PrivMode_VisibleCursor|PrivMode_132OK) |
… | |
… | |
596 | // do not change these constants lightly, there are many interdependencies |
595 | // do not change these constants lightly, there are many interdependencies |
597 | #define IMBUFSIZ 128 // input modifier buffer sizes |
596 | #define IMBUFSIZ 128 // input modifier buffer sizes |
598 | #define KBUFSZ 512 // size of keyboard mapping buffer |
597 | #define KBUFSZ 512 // size of keyboard mapping buffer |
599 | #define CBUFSIZ 2048 // size of command buffer |
598 | #define CBUFSIZ 2048 // size of command buffer |
600 | #define UBUFSIZ 2048 // character buffer |
599 | #define UBUFSIZ 2048 // character buffer |
601 | |
|
|
602 | #ifndef PATH_MAX |
|
|
603 | # define PATH_MAX 16384 |
|
|
604 | #endif |
|
|
605 | |
600 | |
606 | #if ENABLE_FRILLS |
601 | #if ENABLE_FRILLS |
607 | # include <X11/Xmd.h> |
602 | # include <X11/Xmd.h> |
608 | typedef struct _mwmhints { |
603 | typedef struct _mwmhints { |
609 | CARD32 flags; |
604 | CARD32 flags; |
… | |
… | |
659 | #define Pixel2Height(y) ((int32_t)(y) / (int32_t)fheight) |
654 | #define Pixel2Height(y) ((int32_t)(y) / (int32_t)fheight) |
660 | #define Col2Pixel(col) ((int32_t)Width2Pixel(col)) |
655 | #define Col2Pixel(col) ((int32_t)Width2Pixel(col)) |
661 | #define Row2Pixel(row) ((int32_t)Height2Pixel(row)) |
656 | #define Row2Pixel(row) ((int32_t)Height2Pixel(row)) |
662 | #define Width2Pixel(n) ((int32_t)(n) * (int32_t)fwidth) |
657 | #define Width2Pixel(n) ((int32_t)(n) * (int32_t)fwidth) |
663 | #define Height2Pixel(n) ((int32_t)(n) * (int32_t)fheight) |
658 | #define Height2Pixel(n) ((int32_t)(n) * (int32_t)fheight) |
664 | |
|
|
665 | // for m >= -n, ensure remainder lies between 0..n-1 |
|
|
666 | #define MOD(m,n) (((m) + (n)) % (n)) |
|
|
667 | |
659 | |
668 | #define LINENO(n) MOD (term_start + int(n), total_rows) |
660 | #define LINENO(n) MOD (term_start + int(n), total_rows) |
669 | #define ROW(n) row_buf [LINENO (n)] |
661 | #define ROW(n) row_buf [LINENO (n)] |
670 | |
662 | |
671 | /* how to build & extract colors and attributes */ |
663 | /* how to build & extract colors and attributes */ |
… | |
… | |
1049 | #if ENABLE_TRANSPARENCY || ENABLE_PERL |
1041 | #if ENABLE_TRANSPARENCY || ENABLE_PERL |
1050 | void rootwin_cb (XEvent &xev); |
1042 | void rootwin_cb (XEvent &xev); |
1051 | xevent_watcher rootwin_ev; |
1043 | xevent_watcher rootwin_ev; |
1052 | #endif |
1044 | #endif |
1053 | #ifdef HAVE_BG_PIXMAP |
1045 | #ifdef HAVE_BG_PIXMAP |
1054 | int update_background (); |
1046 | void update_background (); |
1055 | #if TRACE_PIXMAPS |
1047 | #if TRACE_PIXMAPS |
1056 | int trace_update_background (const char *file, int line); |
1048 | void trace_update_background (const char *file, int line); |
1057 | # define update_background() trace_update_background (__FILE__, __LINE__) |
1049 | # define update_background() trace_update_background (__FILE__, __LINE__) |
1058 | #endif |
1050 | #endif |
1059 | void update_background_cb (ev::timer &w, int revents); |
1051 | void update_background_cb (ev::timer &w, int revents); |
1060 | ev::timer update_background_ev; |
1052 | ev::timer update_background_ev; |
1061 | #endif |
1053 | #endif |
… | |
… | |
1066 | #ifdef HAVE_SCROLLBARS |
1058 | #ifdef HAVE_SCROLLBARS |
1067 | xevent_watcher scrollbar_ev; |
1059 | xevent_watcher scrollbar_ev; |
1068 | #endif |
1060 | #endif |
1069 | |
1061 | |
1070 | 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; |
1071 | void prepare_cb (ev::prepare &w, int revents); ev::prepare prepare_ev; |
|
|
1072 | 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 (); |
1073 | void flush (); |
1065 | void flush (); |
1074 | 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; |
1075 | bool pty_fill (); |
1067 | bool pty_fill (); |
1076 | 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; |
1077 | 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; |
… | |
… | |
1104 | |
1096 | |
1105 | void tt_printf (const char *fmt,...); |
1097 | void tt_printf (const char *fmt,...); |
1106 | void tt_write (const char *data, unsigned int len); |
1098 | void tt_write (const char *data, unsigned int len); |
1107 | void pty_write (); |
1099 | void pty_write (); |
1108 | |
1100 | |
1109 | bool init (stringvec *argv, stringvec *envv) |
1101 | void init (stringvec *argv, stringvec *envv) |
1110 | { |
1102 | { |
1111 | this->argv = argv; |
1103 | this->argv = argv; |
1112 | return init (argv->size (), argv->begin (), envv); |
1104 | init (argv->size (), argv->begin (), envv); |
1113 | } |
1105 | } |
1114 | |
1106 | |
1115 | void make_current () const // make this the "currently active" urxvt instance |
1107 | void make_current () const // make this the "currently active" urxvt instance |
1116 | { |
1108 | { |
1117 | SET_R (this); |
1109 | SET_R (this); |
… | |
… | |
1173 | int privcases (int mode, unsigned long bit); |
1165 | int privcases (int mode, unsigned long bit); |
1174 | void process_terminal_mode (int mode, int priv, unsigned int nargs, const int *arg); |
1166 | void process_terminal_mode (int mode, int priv, unsigned int nargs, const int *arg); |
1175 | void process_sgr_mode (unsigned int nargs, const int *arg); |
1167 | void process_sgr_mode (unsigned int nargs, const int *arg); |
1176 | void process_graphics (); |
1168 | void process_graphics (); |
1177 | // init.C |
1169 | // init.C |
1178 | bool init_vars (); |
1170 | void init_vars (); |
1179 | void init_secondary (); |
1171 | void init_secondary (); |
1180 | const char **init_resources (int argc, const char *const *argv); |
1172 | const char **init_resources (int argc, const char *const *argv); |
1181 | void init_env (); |
1173 | void init_env (); |
1182 | void set_locale (const char *locale); |
1174 | void set_locale (const char *locale); |
1183 | void init_xlocale (); |
1175 | void init_xlocale (); |
… | |
… | |
1192 | void tt_winch (); |
1184 | void tt_winch (); |
1193 | rxvt_term (); |
1185 | rxvt_term (); |
1194 | ~rxvt_term (); |
1186 | ~rxvt_term (); |
1195 | void destroy (); |
1187 | void destroy (); |
1196 | void emergency_cleanup (); |
1188 | void emergency_cleanup (); |
1197 | bool init (int argc, const char *const *argv, stringvec *envv); |
1189 | void init (int argc, const char *const *argv, stringvec *envv); |
1198 | void recolour_cursor (); |
1190 | void recolour_cursor (); |
1199 | 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); |
1200 | void window_calc (unsigned int newwidth, unsigned int newheight); |
1192 | void window_calc (unsigned int newwidth, unsigned int newheight); |
1201 | bool set_fonts (); |
1193 | bool set_fonts (); |
1202 | 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); |