… | |
… | |
106 | RETSIGTYPE rxvt_Exit_signal (int sig); |
106 | RETSIGTYPE rxvt_Exit_signal (int sig); |
107 | void rxvt_clean_exit (); |
107 | void rxvt_clean_exit (); |
108 | void * rxvt_malloc (size_t size); |
108 | void * rxvt_malloc (size_t size); |
109 | void * rxvt_calloc (size_t number, size_t size); |
109 | void * rxvt_calloc (size_t number, size_t size); |
110 | void * rxvt_realloc (void *ptr, size_t size); |
110 | void * rxvt_realloc (void *ptr, size_t size); |
111 | void rxvt_privileges (rxvt_privaction action); |
|
|
112 | |
111 | |
113 | // util.C |
112 | // util.C |
114 | char * rxvt_wcstombs (const wchar_t *str, int len = -1); |
113 | char * rxvt_wcstombs (const wchar_t *str, int len = -1); |
115 | wchar_t * rxvt_mbstowcs (const char *str, int len = -1); |
114 | wchar_t * rxvt_mbstowcs (const char *str, int len = -1); |
116 | char * rxvt_wcstoutf8 (const wchar_t *str, int len = -1); |
115 | char * rxvt_wcstoutf8 (const wchar_t *str, int len = -1); |
… | |
… | |
129 | char * rxvt_Str_trim (char *str); |
128 | char * rxvt_Str_trim (char *str); |
130 | int rxvt_Str_escaped (char *str); |
129 | int rxvt_Str_escaped (char *str); |
131 | char ** rxvt_splitcommastring (const char *cs); |
130 | char ** rxvt_splitcommastring (const char *cs); |
132 | void rxvt_freecommastring (char **cs); |
131 | void rxvt_freecommastring (char **cs); |
133 | char * rxvt_File_find (const char *file, const char *ext, const char *path); |
132 | char * rxvt_File_find (const char *file, const char *ext, const char *path); |
134 | void rxvt_Draw_Shadow (Display *display, Window win, GC topShadow, GC botShadow, int x, int y, int w, int h); |
|
|
135 | void rxvt_Draw_Triangle (Display *display, Window win, GC topShadow, GC botShadow, int x, int y, int w, int type); |
|
|
136 | void rxvt_usleep (int usecs); |
133 | void rxvt_usleep (int usecs); |
137 | |
134 | |
138 | ///////////////////////////////////////////////////////////////////////////// |
135 | ///////////////////////////////////////////////////////////////////////////// |
139 | |
136 | |
140 | // temporarily replace the process environment |
137 | // temporarily replace the process environment |
… | |
… | |
158 | * STRUCTURES AND TYPEDEFS |
155 | * STRUCTURES AND TYPEDEFS |
159 | ***************************************************************************** |
156 | ***************************************************************************** |
160 | */ |
157 | */ |
161 | struct grwin_t; |
158 | struct grwin_t; |
162 | |
159 | |
163 | /* If we're using either the rxvt scrollbar or menu bars, keep the |
160 | /* If we're using either the rxvt scrollbar, keep the |
164 | * scrollColor resource. |
161 | * scrollColor resource. |
165 | */ |
162 | */ |
166 | #if defined(RXVT_SCROLLBAR) || defined(NEXT_SCROLLBAR) || defined(PLAIN_SCROLLBAR) |
163 | #if defined(RXVT_SCROLLBAR) || defined(NEXT_SCROLLBAR) || defined(PLAIN_SCROLLBAR) |
167 | # define KEEP_SCROLLCOLOR 1 |
164 | # define KEEP_SCROLLCOLOR 1 |
168 | #else |
165 | #else |
… | |
… | |
173 | typedef struct { |
170 | typedef struct { |
174 | short w, h, x, y; |
171 | short w, h, x, y; |
175 | Pixmap pixmap; |
172 | Pixmap pixmap; |
176 | } bgPixmap_t; |
173 | } bgPixmap_t; |
177 | #endif |
174 | #endif |
|
|
175 | |
|
|
176 | struct rxvt_ptytty { |
|
|
177 | int pty; // pty file descriptor; connected to rxvt |
|
|
178 | int tty; // tty file descriptor; connected to child |
|
|
179 | |
|
|
180 | virtual ~rxvt_ptytty () |
|
|
181 | { |
|
|
182 | // |
|
|
183 | } |
|
|
184 | |
|
|
185 | virtual bool get () = 0; |
|
|
186 | #if UTMP_SUPPORT |
|
|
187 | virtual void login (int cmd_pid, bool login_shell, const char *hostname) = 0; |
|
|
188 | #endif |
|
|
189 | |
|
|
190 | void close_tty (); |
|
|
191 | bool make_controlling_tty (); |
|
|
192 | void set_utf8_mode (bool on); |
|
|
193 | }; |
|
|
194 | |
|
|
195 | rxvt_ptytty *rxvt_new_ptytty (); // create a new pty object |
|
|
196 | void rxvt_ptytty_server (); // start the ptytty server process |
178 | |
197 | |
179 | /* |
198 | /* |
180 | * the 'essential' information for reporting Mouse Events |
199 | * the 'essential' information for reporting Mouse Events |
181 | * pared down from XButtonEvent |
200 | * pared down from XButtonEvent |
182 | */ |
201 | */ |
… | |
… | |
256 | |
275 | |
257 | #define scrollBar_esc 30 |
276 | #define scrollBar_esc 30 |
258 | |
277 | |
259 | #if defined(RXVT_SCROLLBAR) || defined(NEXT_SCROLLBAR) || defined(XTERM_SCROLLBAR) || defined(PLAIN_SCROLLBAR) |
278 | #if defined(RXVT_SCROLLBAR) || defined(NEXT_SCROLLBAR) || defined(XTERM_SCROLLBAR) || defined(PLAIN_SCROLLBAR) |
260 | # define HAVE_SCROLLBARS 1 |
279 | # define HAVE_SCROLLBARS 1 |
261 | #endif |
|
|
262 | |
|
|
263 | /* width of scrollBar shadow, must be 1 or 2 */ |
|
|
264 | #ifdef HALFSHADOW |
|
|
265 | # define MENU_SHADOW 1 |
|
|
266 | #else |
|
|
267 | # define MENU_SHADOW 2 |
|
|
268 | #endif |
280 | #endif |
269 | |
281 | |
270 | #define R_SB_ALIGN_CENTRE 0 |
282 | #define R_SB_ALIGN_CENTRE 0 |
271 | #define R_SB_ALIGN_TOP 1 |
283 | #define R_SB_ALIGN_TOP 1 |
272 | #define R_SB_ALIGN_BOTTOM 2 |
284 | #define R_SB_ALIGN_BOTTOM 2 |
… | |
… | |
345 | * | |
357 | * | |
346 | * +---< SB_WIDTH_NEXT |
358 | * +---< SB_WIDTH_NEXT |
347 | */ |
359 | */ |
348 | |
360 | |
349 | enum { |
361 | enum { |
350 | NO_REFRESH = 0 , /* Window not visible at all! */ |
362 | NO_REFRESH = 0, /* Window not visible at all! */ |
351 | FAST_REFRESH = 1<<0, /* Fully exposed window */ |
363 | FAST_REFRESH = 1, /* Fully exposed window */ |
352 | SLOW_REFRESH = 1<<1, /* Partially exposed window */ |
364 | SLOW_REFRESH = 2, /* Partially exposed window */ |
353 | SMOOTH_REFRESH = 1<<2, /* Do sync'ing to make it smooth */ |
|
|
354 | }; |
365 | }; |
355 | |
366 | |
356 | #ifdef NO_SECONDARY_SCREEN |
367 | #ifdef NO_SECONDARY_SCREEN |
357 | # define NSCREENS 0 |
368 | # define NSCREENS 0 |
358 | #else |
369 | #else |
… | |
… | |
481 | Rxvt_restoreFG = 39, // change default fg color |
492 | Rxvt_restoreFG = 39, // change default fg color |
482 | Rxvt_restoreBG = 49, // change default bg color |
493 | Rxvt_restoreBG = 49, // change default bg color |
483 | Rxvt_dumpscreen = 55, // dump scrollback and all of screen |
494 | Rxvt_dumpscreen = 55, // dump scrollback and all of screen |
484 | |
495 | |
485 | URxvt_locale = 701, // change locale |
496 | URxvt_locale = 701, // change locale |
486 | URxvt_Menu = 703, // set menu item |
497 | |
487 | URxvt_Color_IT = 704, // change actual 'Italic' colour |
498 | URxvt_Color_IT = 704, // change actual 'Italic' colour |
488 | URxvt_Color_tint = 705, // change actual tint colour |
499 | URxvt_Color_tint = 705, // change actual tint colour |
489 | URxvt_Color_BD = 706, |
500 | URxvt_Color_BD = 706, |
490 | URxvt_Color_UL = 707, |
501 | URxvt_Color_UL = 707, |
491 | |
502 | |
… | |
… | |
709 | /* |
720 | /* |
710 | ***************************************************************************** |
721 | ***************************************************************************** |
711 | * MACRO DEFINES |
722 | * MACRO DEFINES |
712 | ***************************************************************************** |
723 | ***************************************************************************** |
713 | */ |
724 | */ |
|
|
725 | #define dLocal(type,name) type const name = this->name |
714 | #define dDisp Display *disp = display->display |
726 | #define dDisp Display *disp = this->display->display |
715 | |
727 | |
716 | /* convert pixel dimensions to row/column values. Everything as int32_t */ |
728 | /* convert pixel dimensions to row/column values. Everything as int32_t */ |
717 | #define Pixel2Col(x) Pixel2Width((int32_t)(x)) |
729 | #define Pixel2Col(x) Pixel2Width((int32_t)(x)) |
718 | #define Pixel2Row(y) Pixel2Height((int32_t)(y)) |
730 | #define Pixel2Row(y) Pixel2Height((int32_t)(y)) |
719 | #define Pixel2Width(x) ((int32_t)(x) / (int32_t)fwidth) |
731 | #define Pixel2Width(x) ((int32_t)(x) / (int32_t)fwidth) |
… | |
… | |
796 | |
808 | |
797 | #ifdef XPM_BACKGROUND |
809 | #ifdef XPM_BACKGROUND |
798 | # define XPMClearArea(a, b, c, d, e, f, g) XClearArea((a), (b), (c), (d), (e), (f), (g)) |
810 | # define XPMClearArea(a, b, c, d, e, f, g) XClearArea((a), (b), (c), (d), (e), (f), (g)) |
799 | #else |
811 | #else |
800 | # define XPMClearArea(a, b, c, d, e, f, g) |
812 | # define XPMClearArea(a, b, c, d, e, f, g) |
801 | #endif |
|
|
802 | |
|
|
803 | #ifdef UTMP_SUPPORT |
|
|
804 | # if !defined(RXVT_UTMPX_FILE) || !defined(HAVE_STRUCT_UTMPX) |
|
|
805 | # undef HAVE_UTMPX_H |
|
|
806 | # undef HAVE_STRUCT_UTMPX |
|
|
807 | # endif |
|
|
808 | # if !defined(RXVT_UTMP_FILE) || !defined(HAVE_STRUCT_UTMP) |
|
|
809 | # undef HAVE_UTMP_H |
|
|
810 | # undef HAVE_STRUCT_UTMP |
|
|
811 | # endif |
|
|
812 | |
|
|
813 | # ifdef HAVE_UTMPX_H |
|
|
814 | # include <utmpx.h> |
|
|
815 | # endif |
|
|
816 | # ifdef HAVE_UTMP_H |
|
|
817 | # include <utmp.h> |
|
|
818 | # endif |
|
|
819 | #endif |
813 | #endif |
820 | |
814 | |
821 | #ifdef DEBUG_CMD |
815 | #ifdef DEBUG_CMD |
822 | # define D_CMD(x) fprintf x ; fputc('\n', stderr) |
816 | # define D_CMD(x) fprintf x ; fputc('\n', stderr) |
823 | #else |
817 | #else |
… | |
… | |
1107 | const char *key_delete; |
1101 | const char *key_delete; |
1108 | #endif |
1102 | #endif |
1109 | struct mouse_event MEvent; |
1103 | struct mouse_event MEvent; |
1110 | XComposeStatus compose; |
1104 | XComposeStatus compose; |
1111 | ttymode_t tio; |
1105 | ttymode_t tio; |
1112 | #ifdef UTMP_SUPPORT |
|
|
1113 | # ifdef HAVE_STRUCT_UTMP |
|
|
1114 | struct utmp ut; |
|
|
1115 | # endif |
|
|
1116 | # ifdef HAVE_STRUCT_UTMPX |
|
|
1117 | struct utmpx utx; |
|
|
1118 | # endif |
|
|
1119 | # if (defined(HAVE_STRUCT_UTMP) && defined(HAVE_UTMP_PID)) || defined(HAVE_STRUCT_UTMPX) |
|
|
1120 | char ut_id[5]; |
|
|
1121 | # endif |
|
|
1122 | int utmp_pos; |
|
|
1123 | #endif |
|
|
1124 | row_col_t oldcursor; |
1106 | row_col_t oldcursor; |
1125 | #ifdef XPM_BACKGROUND |
1107 | #ifdef XPM_BACKGROUND |
1126 | bgPixmap_t bgPixmap; |
1108 | bgPixmap_t bgPixmap; |
1127 | XpmAttributes xpmAttr; /* originally loaded pixmap and its scaling */ |
1109 | XpmAttributes xpmAttr; /* originally loaded pixmap and its scaling */ |
1128 | #endif |
1110 | #endif |
… | |
… | |
1161 | const char *rs[NUM_RESOURCES]; |
1143 | const char *rs[NUM_RESOURCES]; |
1162 | /* command input buffering */ |
1144 | /* command input buffering */ |
1163 | char *cmdbuf_ptr, *cmdbuf_endp; |
1145 | char *cmdbuf_ptr, *cmdbuf_endp; |
1164 | char cmdbuf_base[CBUFSIZ]; |
1146 | char cmdbuf_base[CBUFSIZ]; |
1165 | |
1147 | |
|
|
1148 | rxvt_ptytty *pty; |
|
|
1149 | |
1166 | rxvt_salloc *talloc; // text line allocator |
1150 | rxvt_salloc *talloc; // text line allocator |
1167 | rxvt_salloc *ralloc; // rend line allocator |
1151 | rxvt_salloc *ralloc; // rend line allocator |
1168 | |
1152 | |
1169 | static vector<rxvt_term *> termlist; // a vector of all running rxvt_term's |
1153 | static vector<rxvt_term *> termlist; // a vector of all running rxvt_term's |
1170 | |
1154 | |
… | |
… | |
1200 | xevent_watcher vt_ev; |
1184 | xevent_watcher vt_ev; |
1201 | #ifdef HAVE_SCROLLBARS |
1185 | #ifdef HAVE_SCROLLBARS |
1202 | xevent_watcher scrollbar_ev; |
1186 | xevent_watcher scrollbar_ev; |
1203 | #endif |
1187 | #endif |
1204 | |
1188 | |
|
|
1189 | void child_cb (child_watcher &w, int status); child_watcher child_ev; |
1205 | void check_cb (check_watcher &w); check_watcher check_ev; |
1190 | void check_cb (check_watcher &w); check_watcher check_ev; |
1206 | void destroy_cb (time_watcher &w); time_watcher destroy_ev; |
1191 | void destroy_cb (time_watcher &w); time_watcher destroy_ev; |
1207 | void flush_cb (time_watcher &w); time_watcher flush_ev; |
1192 | void flush_cb (time_watcher &w); time_watcher flush_ev; |
1208 | |
1193 | |
1209 | void pty_cb (io_watcher &w, short revents); io_watcher pty_ev; |
1194 | void pty_cb (io_watcher &w, short revents); io_watcher pty_ev; |
… | |
… | |
1239 | |
1224 | |
1240 | void tt_winch (); |
1225 | void tt_winch (); |
1241 | |
1226 | |
1242 | rxvt_term (); |
1227 | rxvt_term (); |
1243 | ~rxvt_term (); |
1228 | ~rxvt_term (); |
1244 | void child_exit (); // child has exited, usually destroys |
|
|
1245 | void destroy (); |
1229 | void destroy (); |
1246 | void emergency_cleanup (); |
1230 | void emergency_cleanup (); |
1247 | |
1231 | |
1248 | bool init (int argc, const char *const *argv); |
1232 | bool init (int argc, const char *const *argv); |
1249 | bool init_vars (); |
1233 | bool init_vars (); |
… | |
… | |
1338 | void process_sgr_mode (unsigned int nargs, const int *arg); |
1322 | void process_sgr_mode (unsigned int nargs, const int *arg); |
1339 | void process_graphics (); |
1323 | void process_graphics (); |
1340 | // init.C |
1324 | // init.C |
1341 | void Get_Colours (); |
1325 | void Get_Colours (); |
1342 | void get_ourmods (); |
1326 | void get_ourmods (); |
1343 | // logging.C |
|
|
1344 | void makeutent (const char *pty, const char *hostname); |
|
|
1345 | void cleanutent (); |
|
|
1346 | // main.C |
1327 | // main.C |
1347 | void privileged_utmp (rxvt_privaction action); |
|
|
1348 | bool set_fonts (); |
1328 | bool set_fonts (); |
1349 | void set_string_property (Atom prop, const char *str, int len = -1); |
1329 | void set_string_property (Atom prop, const char *str, int len = -1); |
1350 | void set_utf8_property (Atom prop, const char *str, int len = -1); |
1330 | void set_utf8_property (Atom prop, const char *str, int len = -1); |
1351 | void set_title (const char *str); |
1331 | void set_title (const char *str); |
1352 | void set_icon_name (const char *str); |
1332 | void set_icon_name (const char *str); |
… | |
… | |
1430 | void scr_blank_screen_mem (line_t &l, rend_t efs) const; |
1410 | void scr_blank_screen_mem (line_t &l, rend_t efs) const; |
1431 | int scr_scroll_text (int row1, int row2, int count); |
1411 | int scr_scroll_text (int row1, int row2, int count); |
1432 | void scr_reset (); |
1412 | void scr_reset (); |
1433 | void scr_release (); |
1413 | void scr_release (); |
1434 | void scr_clear (bool really = false); |
1414 | void scr_clear (bool really = false); |
1435 | void scr_refresh (unsigned char refresh_type); |
1415 | void scr_refresh (); |
1436 | bool scr_refresh_rend (rend_t mask, rend_t value); |
1416 | bool scr_refresh_rend (rend_t mask, rend_t value); |
1437 | void scr_erase_screen (int mode); |
1417 | void scr_erase_screen (int mode); |
1438 | #if ENABLE_FRILLS |
1418 | #if ENABLE_FRILLS |
1439 | void scr_erase_savelines (); |
1419 | void scr_erase_savelines (); |
1440 | void scr_backindex (); |
1420 | void scr_backindex (); |
… | |
… | |
1445 | rxvt_fontset *scr_find_fontset (rend_t r = DEFAULT_RSTYLE); |
1425 | rxvt_fontset *scr_find_fontset (rend_t r = DEFAULT_RSTYLE); |
1446 | void scr_recolour (); |
1426 | void scr_recolour (); |
1447 | void scr_remap_chars (); |
1427 | void scr_remap_chars (); |
1448 | void scr_remap_chars (line_t &l); |
1428 | void scr_remap_chars (line_t &l); |
1449 | |
1429 | |
|
|
1430 | enum cursor_mode { SAVE, RESTORE }; |
|
|
1431 | |
1450 | void scr_poweron (); |
1432 | void scr_poweron (); |
1451 | void scr_cursor (int mode); |
1433 | void scr_cursor (cursor_mode mode); |
1452 | void scr_do_wrap (); |
1434 | void scr_do_wrap (); |
1453 | int scr_change_screen (int scrn); |
1435 | int scr_change_screen (int scrn); |
1454 | void scr_color (unsigned int color, int fgbg); |
1436 | void scr_color (unsigned int color, int fgbg); |
1455 | void scr_rendition (int set, int style); |
1437 | void scr_rendition (int set, int style); |
1456 | void scr_add_lines (const wchar_t *str, int len, int minlines = 0); |
1438 | void scr_add_lines (const wchar_t *str, int len, int minlines = 0); |
… | |
… | |
1483 | void scr_reverse_selection (); |
1465 | void scr_reverse_selection (); |
1484 | void scr_dump (int fd); |
1466 | void scr_dump (int fd); |
1485 | void selection_check (int check_more); |
1467 | void selection_check (int check_more); |
1486 | void selection_paste (Window win, Atom prop, bool delete_prop); |
1468 | void selection_paste (Window win, Atom prop, bool delete_prop); |
1487 | void selection_property (Window win, Atom prop); |
1469 | void selection_property (Window win, Atom prop); |
1488 | void selection_request (Time tm, int x, int y); |
1470 | void selection_request (Time tm); |
1489 | int selection_request_other (Atom target, int selnum); |
1471 | int selection_request_other (Atom target, int selnum); |
1490 | void selection_clear (); |
1472 | void selection_clear (); |
1491 | void selection_make (Time tm); |
1473 | void selection_make (Time tm); |
1492 | bool selection_grab (Time tm); |
1474 | bool selection_grab (Time tm); |
1493 | void selection_start_colrow (int col, int row); |
1475 | void selection_start_colrow (int col, int row); |
… | |
… | |
1504 | int scrollbar_show_next (int update, int last_top, int last_bot, int scrollbar_len); |
1486 | int scrollbar_show_next (int update, int last_top, int last_bot, int scrollbar_len); |
1505 | #endif |
1487 | #endif |
1506 | |
1488 | |
1507 | #if defined(RXVT_SCROLLBAR) |
1489 | #if defined(RXVT_SCROLLBAR) |
1508 | // scrollbar-rxvt.C |
1490 | // scrollbar-rxvt.C |
1509 | void Draw_button (int x, int y, int state, int dirn); |
|
|
1510 | int scrollbar_show_rxvt (int update, int last_top, int last_bot, int scrollbar_len); |
1491 | int scrollbar_show_rxvt (int update, int last_top, int last_bot, int scrollbar_len); |
1511 | #endif |
1492 | #endif |
1512 | |
1493 | |
1513 | #if defined(XTERM_SCROLLBAR) |
1494 | #if defined(XTERM_SCROLLBAR) |
1514 | // scrollbar-xterm.C |
1495 | // scrollbar-xterm.C |