… | |
… | |
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 |
… | |
… | |
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 | |
242 | # ifdef HAVE_PIXBUF |
240 | # ifdef HAVE_PIXBUF |
243 | auto_ptr<GdkPixbuf> pixbuf; |
241 | GdkPixbuf *pixbuf; |
|
|
242 | |
|
|
243 | void destroy () |
|
|
244 | { |
|
|
245 | if (pixbuf) |
|
|
246 | g_object_unref (pixbuf); |
|
|
247 | } |
244 | |
248 | |
245 | int width () |
249 | int width () |
246 | { |
250 | { |
247 | return gdk_pixbuf_get_width (pixbuf); |
251 | return gdk_pixbuf_get_width (pixbuf); |
248 | } |
252 | } |
… | |
… | |
745 | { |
749 | { |
746 | text_t *t; // terminal the text |
750 | text_t *t; // terminal the text |
747 | rend_t *r; // rendition, uses RS_ flags |
751 | rend_t *r; // rendition, uses RS_ flags |
748 | tlen_t_ l; // length of each text line |
752 | tlen_t_ l; // length of each text line |
749 | uint32_t f; // flags |
753 | uint32_t f; // flags |
|
|
754 | |
|
|
755 | bool valid () |
|
|
756 | { |
|
|
757 | return l >= 0; |
|
|
758 | } |
|
|
759 | |
|
|
760 | void alloc () |
|
|
761 | { |
|
|
762 | l = 0; |
|
|
763 | } |
750 | |
764 | |
751 | bool is_longer () |
765 | bool is_longer () |
752 | { |
766 | { |
753 | return f & LINE_LONGER; |
767 | return f & LINE_LONGER; |
754 | } |
768 | } |
… | |
… | |
1025 | scrollBar_t scrollBar; |
1039 | scrollBar_t scrollBar; |
1026 | uint8_t options[(Opt_count + 7) >> 3]; |
1040 | uint8_t options[(Opt_count + 7) >> 3]; |
1027 | XSizeHints szHint; |
1041 | XSizeHints szHint; |
1028 | rxvt_color *pix_colors; |
1042 | rxvt_color *pix_colors; |
1029 | Cursor TermWin_cursor; /* cursor for vt window */ |
1043 | Cursor TermWin_cursor; /* cursor for vt window */ |
|
|
1044 | |
1030 | line_t *row_buf; // all lines, scrollback + terminal, circular |
1045 | line_t *row_buf; // all lines, scrollback + terminal, circular |
1031 | line_t *drawn_buf; // text on screen |
1046 | line_t *drawn_buf; // text on screen |
1032 | line_t *swap_buf; // lines for swap buffer |
1047 | line_t *swap_buf; // lines for swap buffer |
1033 | char *tabs; /* per location: 1 == tab-stop */ |
1048 | char *tabs; /* per location: 1 == tab-stop */ |
1034 | screen_t screen; |
1049 | screen_t screen; |
… | |
… | |
1241 | char *cmdbuf_ptr, *cmdbuf_endp; |
1256 | char *cmdbuf_ptr, *cmdbuf_endp; |
1242 | char cmdbuf_base[CBUFSIZ]; |
1257 | char cmdbuf_base[CBUFSIZ]; |
1243 | |
1258 | |
1244 | ptytty *pty; |
1259 | ptytty *pty; |
1245 | |
1260 | |
1246 | rxvt_salloc *talloc; // text line allocator |
1261 | // chunk contains all line_t's as well as rend_t and text_t buffers |
1247 | rxvt_salloc *ralloc; // rend line allocator |
1262 | // for drawn_buf, swap_buf and row_buf, in this order |
|
|
1263 | void *chunk; |
|
|
1264 | size_t chunk_size; |
1248 | |
1265 | |
1249 | static vector<rxvt_term *> termlist; // a vector of all running rxvt_term's |
1266 | static vector<rxvt_term *> termlist; // a vector of all running rxvt_term's |
1250 | |
1267 | |
1251 | #if ENABLE_FRILLS || ISO_14755 |
1268 | #if ENABLE_FRILLS || ISO_14755 |
1252 | // ISO 14755 entry support |
1269 | // ISO 14755 entry support |
… | |
… | |
1426 | void get_window_origin (int &x, int &y); |
1443 | void get_window_origin (int &x, int &y); |
1427 | Pixmap get_pixmap_property (Atom property); |
1444 | Pixmap get_pixmap_property (Atom property); |
1428 | |
1445 | |
1429 | // screen.C |
1446 | // screen.C |
1430 | |
1447 | |
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 |
1448 | int fgcolor_of (rend_t r) const NOTHROW |
1460 | { |
1449 | { |
1461 | int base = GET_BASEFG (r); |
1450 | int base = GET_BASEFG (r); |
1462 | #ifndef NO_BRIGHTCOLOR |
1451 | #ifndef NO_BRIGHTCOLOR |
1463 | if (r & RS_Bold |
1452 | if (r & RS_Bold |
… | |
… | |
1492 | void set_option (uint8_t opt, bool set = true) NOTHROW; |
1481 | void set_option (uint8_t opt, bool set = true) NOTHROW; |
1493 | |
1482 | |
1494 | // modifies first argument(!) |
1483 | // modifies first argument(!) |
1495 | void tt_paste (char *data, unsigned int len) NOTHROW; |
1484 | void tt_paste (char *data, unsigned int len) NOTHROW; |
1496 | void paste (char *data, unsigned int len) NOTHROW; |
1485 | void paste (char *data, unsigned int len) NOTHROW; |
|
|
1486 | void scr_alloc () NOTHROW; |
1497 | void scr_blank_line (line_t &l, unsigned int col, unsigned int width, rend_t efs) const NOTHROW; |
1487 | 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; |
1488 | 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; |
1489 | void scr_kill_char (line_t &l, int col) const NOTHROW; |
1500 | int scr_scroll_text (int row1, int row2, int count) NOTHROW; |
1490 | int scr_scroll_text (int row1, int row2, int count) NOTHROW; |
1501 | void scr_reset (); |
1491 | void scr_reset (); |