… | |
… | |
85 | #include "rxvtutil.h" |
85 | #include "rxvtutil.h" |
86 | #include "rxvtfont.h" |
86 | #include "rxvtfont.h" |
87 | #include "rxvttoolkit.h" |
87 | #include "rxvttoolkit.h" |
88 | #include "scrollbar.h" |
88 | #include "scrollbar.h" |
89 | #include "ev_cpp.h" |
89 | #include "ev_cpp.h" |
90 | #include "salloc.h" |
|
|
91 | #include "libptytty.h" |
90 | #include "libptytty.h" |
92 | |
91 | |
93 | #include "rxvtperl.h" |
92 | #include "rxvtperl.h" |
94 | |
93 | |
95 | // try to avoid some macros to decrease code size, on some systems |
94 | // try to avoid some macros to decrease code size, on some systems |
… | |
… | |
148 | |
147 | |
149 | const char * rxvt_basename (const char *str) NOTHROW; |
148 | const char * rxvt_basename (const char *str) NOTHROW; |
150 | void rxvt_vlog (const char *fmt, va_list arg_ptr) NOTHROW; |
149 | void rxvt_vlog (const char *fmt, va_list arg_ptr) NOTHROW; |
151 | void rxvt_log (const char *fmt,...) NOTHROW; |
150 | void rxvt_log (const char *fmt,...) NOTHROW; |
152 | void rxvt_warn (const char *fmt,...) NOTHROW; |
151 | void rxvt_warn (const char *fmt,...) NOTHROW; |
153 | void rxvt_fatal (const char *fmt, ...) THROW ((class rxvt_failure_exception)) ecb_noreturn; |
152 | void rxvt_fatal (const char *fmt, ...) THROW ((class rxvt_failure_exception)) ecb_noreturn ecb_cold; |
154 | void rxvt_exit_failure () THROW ((class rxvt_failure_exception)) ecb_noreturn; |
153 | void rxvt_exit_failure () THROW ((class rxvt_failure_exception)) ecb_noreturn ecb_cold; |
155 | |
154 | |
156 | char * rxvt_strtrim (char *str) NOTHROW; |
155 | char * rxvt_strtrim (char *str) NOTHROW; |
157 | char ** rxvt_strsplit (char delim, const char *str) NOTHROW; |
156 | char ** rxvt_strsplit (char delim, const char *str) NOTHROW; |
158 | |
157 | |
159 | static inline void |
158 | static inline void |
… | |
… | |
230 | defaultAlign = centerAlign, |
229 | defaultAlign = centerAlign, |
231 | }; |
230 | }; |
232 | |
231 | |
233 | struct rxvt_image |
232 | struct rxvt_image |
234 | { |
233 | { |
235 | int id; |
|
|
236 | unsigned short alpha; |
234 | unsigned short alpha; |
237 | uint8_t flags; |
235 | uint8_t flags; |
238 | unsigned int h_scale, v_scale; /* percents of the window size */ |
236 | unsigned int h_scale, v_scale; /* percents of the window size */ |
239 | int h_align, v_align; /* percents of the window size: |
237 | int h_align, v_align; /* percents of the window size: |
240 | 0 - left align, 50 - center, 100 - right */ |
238 | 0 - left align, 50 - center, 100 - right */ |
241 | |
239 | |
|
|
240 | bool is_size_sensitive () |
|
|
241 | { |
|
|
242 | return (!(flags & IM_TILE) |
|
|
243 | || h_scale || v_scale |
|
|
244 | || (!(flags & IM_ROOT_ALIGN) && (h_align || v_align))); |
|
|
245 | } |
|
|
246 | |
242 | # ifdef HAVE_PIXBUF |
247 | # ifdef HAVE_PIXBUF |
243 | auto_ptr<GdkPixbuf> pixbuf; |
248 | GdkPixbuf *pixbuf; |
|
|
249 | |
|
|
250 | void destroy () |
|
|
251 | { |
|
|
252 | if (pixbuf) |
|
|
253 | g_object_unref (pixbuf); |
|
|
254 | } |
244 | |
255 | |
245 | int width () |
256 | int width () |
246 | { |
257 | { |
247 | return gdk_pixbuf_get_width (pixbuf); |
258 | return gdk_pixbuf_get_width (pixbuf); |
248 | } |
259 | } |
… | |
… | |
745 | { |
756 | { |
746 | text_t *t; // terminal the text |
757 | text_t *t; // terminal the text |
747 | rend_t *r; // rendition, uses RS_ flags |
758 | rend_t *r; // rendition, uses RS_ flags |
748 | tlen_t_ l; // length of each text line |
759 | tlen_t_ l; // length of each text line |
749 | uint32_t f; // flags |
760 | uint32_t f; // flags |
|
|
761 | |
|
|
762 | bool valid () |
|
|
763 | { |
|
|
764 | return l >= 0; |
|
|
765 | } |
|
|
766 | |
|
|
767 | void alloc () |
|
|
768 | { |
|
|
769 | l = 0; |
|
|
770 | } |
750 | |
771 | |
751 | bool is_longer () |
772 | bool is_longer () |
752 | { |
773 | { |
753 | return f & LINE_LONGER; |
774 | return f & LINE_LONGER; |
754 | } |
775 | } |
… | |
… | |
1025 | scrollBar_t scrollBar; |
1046 | scrollBar_t scrollBar; |
1026 | uint8_t options[(Opt_count + 7) >> 3]; |
1047 | uint8_t options[(Opt_count + 7) >> 3]; |
1027 | XSizeHints szHint; |
1048 | XSizeHints szHint; |
1028 | rxvt_color *pix_colors; |
1049 | rxvt_color *pix_colors; |
1029 | Cursor TermWin_cursor; /* cursor for vt window */ |
1050 | Cursor TermWin_cursor; /* cursor for vt window */ |
|
|
1051 | |
1030 | line_t *row_buf; // all lines, scrollback + terminal, circular |
1052 | line_t *row_buf; // all lines, scrollback + terminal, circular |
1031 | line_t *drawn_buf; // text on screen |
1053 | line_t *drawn_buf; // text on screen |
1032 | line_t *swap_buf; // lines for swap buffer |
1054 | line_t *swap_buf; // lines for swap buffer |
1033 | char *tabs; /* per location: 1 == tab-stop */ |
1055 | char *tabs; /* per location: 1 == tab-stop */ |
1034 | screen_t screen; |
1056 | screen_t screen; |
… | |
… | |
1241 | char *cmdbuf_ptr, *cmdbuf_endp; |
1263 | char *cmdbuf_ptr, *cmdbuf_endp; |
1242 | char cmdbuf_base[CBUFSIZ]; |
1264 | char cmdbuf_base[CBUFSIZ]; |
1243 | |
1265 | |
1244 | ptytty *pty; |
1266 | ptytty *pty; |
1245 | |
1267 | |
1246 | rxvt_salloc *talloc; // text line allocator |
1268 | // chunk contains all line_t's as well as rend_t and text_t buffers |
1247 | rxvt_salloc *ralloc; // rend line allocator |
1269 | // for drawn_buf, swap_buf and row_buf, in this order |
|
|
1270 | void *chunk; |
|
|
1271 | size_t chunk_size; |
1248 | |
1272 | |
1249 | static vector<rxvt_term *> termlist; // a vector of all running rxvt_term's |
1273 | static vector<rxvt_term *> termlist; // a vector of all running rxvt_term's |
1250 | |
1274 | |
1251 | #if ENABLE_FRILLS || ISO_14755 |
1275 | #if ENABLE_FRILLS || ISO_14755 |
1252 | // ISO 14755 entry support |
1276 | // ISO 14755 entry support |
… | |
… | |
1426 | void get_window_origin (int &x, int &y); |
1450 | void get_window_origin (int &x, int &y); |
1427 | Pixmap get_pixmap_property (Atom property); |
1451 | Pixmap get_pixmap_property (Atom property); |
1428 | |
1452 | |
1429 | // screen.C |
1453 | // screen.C |
1430 | |
1454 | |
1431 | void lalloc (line_t &l) const |
|
|
1432 | { |
|
|
1433 | l.t = (text_t *)talloc->alloc (); |
|
|
1434 | l.r = (rend_t *)ralloc->alloc (); |
|
|
1435 | } |
|
|
1436 | |
|
|
1437 | #if 0 |
|
|
1438 | void lfree (line_t &l) |
|
|
1439 | { |
|
|
1440 | talloc->free (l.t); |
|
|
1441 | ralloc->free (l.r); |
|
|
1442 | } |
|
|
1443 | #endif |
|
|
1444 | |
|
|
1445 | void lresize (line_t &l) const |
|
|
1446 | { |
|
|
1447 | if (!l.t) |
|
|
1448 | return; |
|
|
1449 | |
|
|
1450 | l.t = (text_t *)talloc->alloc (l.t, prev_ncol * sizeof (text_t)); |
|
|
1451 | l.r = (rend_t *)ralloc->alloc (l.r, prev_ncol * sizeof (rend_t)); |
|
|
1452 | |
|
|
1453 | l.l = min (l.l, ncol); |
|
|
1454 | |
|
|
1455 | if (ncol > prev_ncol) |
|
|
1456 | scr_blank_line (l, prev_ncol, ncol - prev_ncol, DEFAULT_RSTYLE); |
|
|
1457 | } |
|
|
1458 | |
|
|
1459 | int fgcolor_of (rend_t r) const NOTHROW |
1455 | int fgcolor_of (rend_t r) const NOTHROW |
1460 | { |
1456 | { |
1461 | int base = GET_BASEFG (r); |
1457 | int base = GET_BASEFG (r); |
1462 | #ifndef NO_BRIGHTCOLOR |
1458 | #ifndef NO_BRIGHTCOLOR |
1463 | if (r & RS_Bold |
1459 | if (r & RS_Bold |
… | |
… | |
1492 | void set_option (uint8_t opt, bool set = true) NOTHROW; |
1488 | void set_option (uint8_t opt, bool set = true) NOTHROW; |
1493 | |
1489 | |
1494 | // modifies first argument(!) |
1490 | // modifies first argument(!) |
1495 | void tt_paste (char *data, unsigned int len) NOTHROW; |
1491 | void tt_paste (char *data, unsigned int len) NOTHROW; |
1496 | void paste (char *data, unsigned int len) NOTHROW; |
1492 | void paste (char *data, unsigned int len) NOTHROW; |
|
|
1493 | void scr_alloc () NOTHROW; |
1497 | void scr_blank_line (line_t &l, unsigned int col, unsigned int width, rend_t efs) const NOTHROW; |
1494 | void scr_blank_line (line_t &l, unsigned int col, unsigned int width, rend_t efs) const NOTHROW; |
1498 | void scr_blank_screen_mem (line_t &l, rend_t efs) const NOTHROW; |
1495 | void scr_blank_screen_mem (line_t &l, rend_t efs) const NOTHROW; |
1499 | void scr_kill_char (line_t &l, int col) const NOTHROW; |
1496 | void scr_kill_char (line_t &l, int col) const NOTHROW; |
1500 | int scr_scroll_text (int row1, int row2, int count) NOTHROW; |
1497 | int scr_scroll_text (int row1, int row2, int count) NOTHROW; |
1501 | void scr_reset (); |
1498 | void scr_reset (); |