… | |
… | |
35 | #include "encoding.h" |
35 | #include "encoding.h" |
36 | #include "rxvtfont.h" |
36 | #include "rxvtfont.h" |
37 | #include "rxvttoolkit.h" |
37 | #include "rxvttoolkit.h" |
38 | #include "iom.h" |
38 | #include "iom.h" |
39 | #include "salloc.h" |
39 | #include "salloc.h" |
|
|
40 | #include "libptytty.h" |
40 | |
41 | |
41 | #include "rxvtperl.h" |
42 | #include "rxvtperl.h" |
42 | |
43 | |
43 | // try to avoid some macros to decrease code size, on some systems |
44 | // try to avoid some macros to decrease code size, on some systems |
44 | #if ENABLE_MINIMAL |
45 | #if ENABLE_MINIMAL |
… | |
… | |
141 | // misc.C |
142 | // misc.C |
142 | char * rxvt_wcstombs (const wchar_t *str, int len = -1); |
143 | char * rxvt_wcstombs (const wchar_t *str, int len = -1); |
143 | wchar_t * rxvt_mbstowcs (const char *str, int len = -1); |
144 | wchar_t * rxvt_mbstowcs (const char *str, int len = -1); |
144 | char * rxvt_wcstoutf8 (const wchar_t *str, int len = -1); |
145 | char * rxvt_wcstoutf8 (const wchar_t *str, int len = -1); |
145 | wchar_t * rxvt_utf8towcs (const char *str, int len = -1); |
146 | wchar_t * rxvt_utf8towcs (const char *str, int len = -1); |
|
|
147 | char * rxvt_strdup_cpp (const char *str); |
146 | |
148 | |
147 | #define rxvt_strdup(s) ((s) ? strdup(s) : 0) |
149 | #define rxvt_strdup(s) ((s) ? strdup(s) : 0) |
148 | |
150 | |
149 | char * rxvt_r_basename (const char *str) NOTHROW; |
151 | char * rxvt_r_basename (const char *str) NOTHROW; |
150 | void rxvt_vlog (const char *fmt, va_list arg_ptr) NOTHROW; |
152 | void rxvt_vlog (const char *fmt, va_list arg_ptr) NOTHROW; |
… | |
… | |
158 | char * rxvt_Str_trim (char *str) NOTHROW; |
160 | char * rxvt_Str_trim (char *str) NOTHROW; |
159 | int rxvt_Str_escaped (char *str) NOTHROW; |
161 | int rxvt_Str_escaped (char *str) NOTHROW; |
160 | char ** rxvt_splitcommastring (const char *cs) NOTHROW; |
162 | char ** rxvt_splitcommastring (const char *cs) NOTHROW; |
161 | void rxvt_freecommastring (char **cs) NOTHROW; |
163 | void rxvt_freecommastring (char **cs) NOTHROW; |
162 | char * rxvt_File_find (const char *file, const char *ext, const char *path) NOTHROW; |
164 | char * rxvt_File_find (const char *file, const char *ext, const char *path) NOTHROW; |
163 | void rxvt_usleep (int usecs) NOTHROW; |
|
|
164 | |
165 | |
165 | ///////////////////////////////////////////////////////////////////////////// |
166 | ///////////////////////////////////////////////////////////////////////////// |
166 | |
167 | |
167 | // temporarily replace the process environment |
168 | // temporarily replace the process environment |
168 | extern char **environ; |
169 | extern char **environ; |
… | |
… | |
200 | typedef struct { |
201 | typedef struct { |
201 | short w, h, x, y; |
202 | short w, h, x, y; |
202 | Pixmap pixmap; |
203 | Pixmap pixmap; |
203 | } bgPixmap_t; |
204 | } bgPixmap_t; |
204 | #endif |
205 | #endif |
205 | |
|
|
206 | struct rxvt_ptytty { |
|
|
207 | int pty; // pty file descriptor; connected to rxvt |
|
|
208 | int tty; // tty file descriptor; connected to child |
|
|
209 | |
|
|
210 | rxvt_ptytty () |
|
|
211 | : pty(-1), tty(-1) |
|
|
212 | { |
|
|
213 | } |
|
|
214 | |
|
|
215 | virtual ~rxvt_ptytty () |
|
|
216 | { |
|
|
217 | } |
|
|
218 | |
|
|
219 | virtual bool get () = 0; |
|
|
220 | #if UTMP_SUPPORT |
|
|
221 | virtual void login (int cmd_pid, bool login_shell, const char *hostname) = 0; |
|
|
222 | #endif |
|
|
223 | |
|
|
224 | void close_tty (); |
|
|
225 | bool make_controlling_tty (); |
|
|
226 | void set_utf8_mode (bool on); |
|
|
227 | }; |
|
|
228 | |
|
|
229 | rxvt_ptytty *rxvt_new_ptytty (); // create a new pty object |
|
|
230 | void rxvt_ptytty_server (); // start the ptytty server process |
|
|
231 | |
206 | |
232 | /* |
207 | /* |
233 | * the 'essential' information for reporting Mouse Events |
208 | * the 'essential' information for reporting Mouse Events |
234 | * pared down from XButtonEvent |
209 | * pared down from XButtonEvent |
235 | */ |
210 | */ |
… | |
… | |
996 | #if defined(XPM_BACKGROUND) || defined(TRANSPARENT) |
971 | #if defined(XPM_BACKGROUND) || defined(TRANSPARENT) |
997 | am_transparent:1, /* is a transparent term */ |
972 | am_transparent:1, /* is a transparent term */ |
998 | am_pixmap_trans:1, /* transparency w/known root pixmap */ |
973 | am_pixmap_trans:1, /* transparency w/known root pixmap */ |
999 | #endif |
974 | #endif |
1000 | current_screen:1, /* primary or secondary */ |
975 | current_screen:1, /* primary or secondary */ |
1001 | hate_those_clicks:1, /* a.k.a. keep mark position */ |
|
|
1002 | num_scr_allow:1, |
976 | num_scr_allow:1, |
1003 | bypass_keystate:1, |
977 | bypass_keystate:1, |
1004 | #ifdef CURSOR_BLINK |
978 | #ifdef CURSOR_BLINK |
1005 | hidden_cursor:1, |
979 | hidden_cursor:1, |
1006 | #endif |
980 | #endif |
… | |
… | |
1021 | #endif |
995 | #endif |
1022 | scrollbar_align, |
996 | scrollbar_align, |
1023 | selection_wait, |
997 | selection_wait, |
1024 | selection_type; |
998 | selection_type; |
1025 | /* ---------- */ |
999 | /* ---------- */ |
|
|
1000 | bool rvideo_state, rvideo_mode; |
|
|
1001 | #ifndef NO_BELL |
1026 | short rvideo; |
1002 | bool rvideo_bell; |
|
|
1003 | #endif |
1027 | int num_scr; /* screen: number lines scrolled */ |
1004 | int num_scr; /* screen: number lines scrolled */ |
1028 | int prev_ncol, /* screen: previous number of columns */ |
1005 | int prev_ncol, /* screen: previous number of columns */ |
1029 | prev_nrow; /* screen: previous number of rows */ |
1006 | prev_nrow; /* screen: previous number of rows */ |
1030 | /* ---------- */ |
1007 | /* ---------- */ |
1031 | rend_t rstyle; |
1008 | rend_t rstyle; |
… | |
… | |
1151 | const char *rs[NUM_RESOURCES]; |
1128 | const char *rs[NUM_RESOURCES]; |
1152 | /* command input buffering */ |
1129 | /* command input buffering */ |
1153 | char *cmdbuf_ptr, *cmdbuf_endp; |
1130 | char *cmdbuf_ptr, *cmdbuf_endp; |
1154 | char cmdbuf_base[CBUFSIZ]; |
1131 | char cmdbuf_base[CBUFSIZ]; |
1155 | |
1132 | |
1156 | rxvt_ptytty *pty; |
1133 | ptytty *pty; |
1157 | |
1134 | |
1158 | rxvt_salloc *talloc; // text line allocator |
1135 | rxvt_salloc *talloc; // text line allocator |
1159 | rxvt_salloc *ralloc; // rend line allocator |
1136 | rxvt_salloc *ralloc; // rend line allocator |
1160 | |
1137 | |
1161 | static vector<rxvt_term *> termlist; // a vector of all running rxvt_term's |
1138 | static vector<rxvt_term *> termlist; // a vector of all running rxvt_term's |
… | |
… | |
1196 | |
1173 | |
1197 | void child_cb (child_watcher &w, int status); child_watcher child_ev; |
1174 | void child_cb (child_watcher &w, int status); child_watcher child_ev; |
1198 | void check_cb (check_watcher &w); check_watcher check_ev; |
1175 | void check_cb (check_watcher &w); check_watcher check_ev; |
1199 | void destroy_cb (time_watcher &w); time_watcher destroy_ev; |
1176 | void destroy_cb (time_watcher &w); time_watcher destroy_ev; |
1200 | void flush_cb (time_watcher &w); time_watcher flush_ev; |
1177 | void flush_cb (time_watcher &w); time_watcher flush_ev; |
1201 | |
|
|
1202 | void pty_cb (io_watcher &w, short revents); io_watcher pty_ev; |
1178 | void pty_cb (io_watcher &w, short revents); io_watcher pty_ev; |
1203 | |
|
|
1204 | void incr_cb (time_watcher &w) NOTHROW; time_watcher incr_ev; |
1179 | void incr_cb (time_watcher &w) NOTHROW; time_watcher incr_ev; |
1205 | |
1180 | |
1206 | #ifdef CURSOR_BLINK |
1181 | #ifdef CURSOR_BLINK |
1207 | void cursor_blink_cb (time_watcher &w); time_watcher cursor_blink_ev; |
1182 | void cursor_blink_cb (time_watcher &w); time_watcher cursor_blink_ev; |
1208 | #endif |
1183 | #endif |
1209 | #ifdef TEXT_BLINK |
1184 | #ifdef TEXT_BLINK |
1210 | void text_blink_cb (time_watcher &w); time_watcher text_blink_ev; |
1185 | void text_blink_cb (time_watcher &w); time_watcher text_blink_ev; |
|
|
1186 | #endif |
|
|
1187 | #ifndef NO_BELL |
|
|
1188 | void bell_cb (time_watcher &w); time_watcher bell_ev; |
1211 | #endif |
1189 | #endif |
1212 | |
1190 | |
1213 | #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING |
1191 | #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING |
1214 | void cont_scroll_cb (time_watcher &w); time_watcher cont_scroll_ev; |
1192 | void cont_scroll_cb (time_watcher &w); time_watcher cont_scroll_ev; |
1215 | #endif |
1193 | #endif |
… | |
… | |
1235 | rxvt_term (); |
1213 | rxvt_term (); |
1236 | ~rxvt_term (); |
1214 | ~rxvt_term (); |
1237 | void destroy (); |
1215 | void destroy (); |
1238 | void emergency_cleanup (); |
1216 | void emergency_cleanup (); |
1239 | |
1217 | |
1240 | bool init (int argc, const char *const *argv); |
1218 | bool init (int argc, const char *const *argv, stringvec *envv); |
|
|
1219 | |
|
|
1220 | bool init (stringvec *argv, stringvec *envv) |
|
|
1221 | { |
|
|
1222 | this->argv = argv; |
|
|
1223 | return init (argv->size (), argv->begin (), envv); |
|
|
1224 | } |
|
|
1225 | |
1241 | bool init_vars (); |
1226 | bool init_vars (); |
1242 | |
1227 | |
1243 | bool pty_fill (); |
1228 | bool pty_fill (); |
1244 | |
1229 | |
1245 | void make_current () const // make this the "currently active" urxvt instance |
1230 | void make_current () const // make this the "currently active" urxvt instance |
… | |
… | |
1448 | void scr_cursor_visible (int mode) NOTHROW; |
1433 | void scr_cursor_visible (int mode) NOTHROW; |
1449 | void scr_autowrap (int mode) NOTHROW; |
1434 | void scr_autowrap (int mode) NOTHROW; |
1450 | void scr_relative_origin (int mode) NOTHROW; |
1435 | void scr_relative_origin (int mode) NOTHROW; |
1451 | void scr_insert_mode (int mode) NOTHROW; |
1436 | void scr_insert_mode (int mode) NOTHROW; |
1452 | void scr_set_tab (int mode) NOTHROW; |
1437 | void scr_set_tab (int mode) NOTHROW; |
1453 | void scr_rvideo_mode (int mode) NOTHROW; |
1438 | void scr_rvideo_mode (bool on) NOTHROW; |
1454 | void scr_report_position () NOTHROW; |
1439 | void scr_report_position () NOTHROW; |
1455 | void set_font_style () NOTHROW; |
1440 | void set_font_style () NOTHROW; |
1456 | void scr_charset_choose (int set) NOTHROW; |
1441 | void scr_charset_choose (int set) NOTHROW; |
1457 | void scr_charset_set (int set, unsigned int ch) NOTHROW; |
1442 | void scr_charset_set (int set, unsigned int ch) NOTHROW; |
1458 | void scr_move_to (int y, int len) NOTHROW; |
1443 | void scr_move_to (int y, int len) NOTHROW; |