ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/rxvt.h
(Generate patch)

Comparing rxvt-unicode/src/rxvt.h (file contents):
Revision 1.363 by ayin, Tue Feb 19 18:15:26 2008 UTC vs.
Revision 1.372 by root, Wed Nov 5 14:43:54 2008 UTC

204 204
205/* 205/*
206 * the 'essential' information for reporting Mouse Events 206 * the 'essential' information for reporting Mouse Events
207 * pared down from XButtonEvent 207 * pared down from XButtonEvent
208 */ 208 */
209struct mouse_event { 209struct mouse_event
210{
210 int clicks; 211 int clicks;
211 Time time; /* milliseconds */ 212 Time time; /* milliseconds */
212 unsigned int state; /* key or button mask */ 213 unsigned int state; /* key or button mask */
213 unsigned int button; /* detail */ 214 unsigned int button; /* detail */
214}; 215};
419 URxvt_boldItalicFont = 713, 420 URxvt_boldItalicFont = 713,
420 421
421 URxvt_view_up = 720, 422 URxvt_view_up = 720,
422 URxvt_view_down = 721, 423 URxvt_view_down = 721,
423 424
424 URxvt_perl = 777, 425 URxvt_perl = 777, // for use by perl extensions, starts with "extension-name;"
425}; 426};
426 427
427/* Words starting with `Color_' are colours. Others are counts */ 428/* Words starting with `Color_' are colours. Others are counts */
428/* 429/*
429 * The PixColor and rendition colour usage should probably be decoupled 430 * The PixColor and rendition colour usage should probably be decoupled
550 551
551// do not change these constants lightly, there are many interdependencies 552// do not change these constants lightly, there are many interdependencies
552#define IMBUFSIZ 128 // input modifier buffer sizes 553#define IMBUFSIZ 128 // input modifier buffer sizes
553#define KBUFSZ 512 // size of keyboard mapping buffer 554#define KBUFSZ 512 // size of keyboard mapping buffer
554#define CBUFSIZ 2048 // size of command buffer 555#define CBUFSIZ 2048 // size of command buffer
556#define CBUFCNT 8 // never call pty_fill/cmd_parse more than this often in a row
555#define UBUFSIZ 2048 // character buffer 557#define UBUFSIZ 2048 // character buffer
556 558
557#if ENABLE_FRILLS 559#if ENABLE_FRILLS
558# include <X11/Xmd.h> 560# include <X11/Xmd.h>
559typedef struct _mwmhints { 561typedef struct _mwmhints
562{
560 CARD32 flags; 563 CARD32 flags;
561 CARD32 functions; 564 CARD32 functions;
562 CARD32 decorations; 565 CARD32 decorations;
563 INT32 input_mode; 566 INT32 input_mode;
564 CARD32 status; 567 CARD32 status;
611#define Col2Pixel(col) ((int32_t)Width2Pixel(col)) 614#define Col2Pixel(col) ((int32_t)Width2Pixel(col))
612#define Row2Pixel(row) ((int32_t)Height2Pixel(row)) 615#define Row2Pixel(row) ((int32_t)Height2Pixel(row))
613#define Width2Pixel(n) ((int32_t)(n) * (int32_t)fwidth) 616#define Width2Pixel(n) ((int32_t)(n) * (int32_t)fwidth)
614#define Height2Pixel(n) ((int32_t)(n) * (int32_t)fheight) 617#define Height2Pixel(n) ((int32_t)(n) * (int32_t)fheight)
615 618
616#define LINENO(n) MOD (term_start + int(n), total_rows) 619#define LINENO_of(t,n) MOD ((t)->term_start + int(n), (t)->total_rows)
617#define ROW(n) row_buf [LINENO (n)] 620#define ROW_of(t,n) (t)->row_buf [LINENO_of ((t), n)]
621
622#define LINENO(n) LINENO_of (this, n)
623#define ROW(n) ROW_of (this, n)
618 624
619/* how to build & extract colors and attributes */ 625/* how to build & extract colors and attributes */
620#define GET_BASEFG(x) (((x) & RS_fgMask)) 626#define GET_BASEFG(x) (((x) & RS_fgMask))
621#define GET_BASEBG(x) (((x) & RS_bgMask)>>Color_Bits) 627#define GET_BASEBG(x) (((x) & RS_bgMask)>>Color_Bits)
622 628
639 645
640#define PIXCOLOR_NAME(idx) rs[Rs_color + (idx)] 646#define PIXCOLOR_NAME(idx) rs[Rs_color + (idx)]
641#define ISSET_PIXCOLOR(idx) (!!rs[Rs_color + (idx)]) 647#define ISSET_PIXCOLOR(idx) (!!rs[Rs_color + (idx)])
642 648
643#if ENABLE_STYLES 649#if ENABLE_STYLES
644# define FONTSET(style) fontset[GET_STYLE (style)] 650# define FONTSET_of(t,style) (t)->fontset[GET_STYLE (style)]
645#else 651#else
646# define FONTSET(style) fontset[0] 652# define FONTSET_of(t,style) (t)->fontset[0]
647#endif 653#endif
654
655#define FONTSET(style) FONTSET_of (this, style)
648 656
649typedef callback<void (const char *)> log_callback; 657typedef callback<void (const char *)> log_callback;
650typedef callback<int (int)> getfd_callback; 658typedef callback<int (int)> getfd_callback;
651 659
652/****************************************************************************/ 660/****************************************************************************/
655#define LINE_FILTERED 0x0002 // line has been filtered 663#define LINE_FILTERED 0x0002 // line has been filtered
656#define LINE_COMPRESSED 0x0004 // line has been compressed (NYI) 664#define LINE_COMPRESSED 0x0004 // line has been compressed (NYI)
657#define LINE_FILTER 0x0008 // line needs to be filtered before display (NYI) 665#define LINE_FILTER 0x0008 // line needs to be filtered before display (NYI)
658#define LINE_BIDI 0x0010 // line needs bidi (NYI) 666#define LINE_BIDI 0x0010 // line needs bidi (NYI)
659 667
660struct line_t { 668struct line_t
669{
661 text_t *t; // terminal the text 670 text_t *t; // terminal the text
662 rend_t *r; // rendition, uses RS_ flags 671 rend_t *r; // rendition, uses RS_ flags
663 tlen_t_ l; // length of each text line 672 tlen_t_ l; // length of each text line
664 uint32_t f; // flags 673 uint32_t f; // flags
665 674
699}; 708};
700 709
701/****************************************************************************/ 710/****************************************************************************/
702 711
703// primitive wrapper around mbstate_t to ensure initialisation 712// primitive wrapper around mbstate_t to ensure initialisation
704struct mbstate { 713struct mbstate
714{
705 mbstate_t mbs; 715 mbstate_t mbs;
706 716
707 operator mbstate_t *() { return &mbs; } 717 operator mbstate_t *() { return &mbs; }
708 void reset () { memset (&mbs, 0, sizeof (mbs)); } 718 void reset () { memset (&mbs, 0, sizeof (mbs)); }
709 mbstate () { reset (); } 719 mbstate () { reset (); }
730 740
731#if ENABLE_COMBINING 741#if ENABLE_COMBINING
732// compose chars are used to represent composite characters 742// compose chars are used to represent composite characters
733// that are not representable in unicode, as well as characters 743// that are not representable in unicode, as well as characters
734// not fitting in the BMP. 744// not fitting in the BMP.
735struct compose_char { 745struct compose_char
746{
736 unicode_t c1, c2; // any chars != NOCHAR are valid 747 unicode_t c1, c2; // any chars != NOCHAR are valid
737 compose_char (unicode_t c1, unicode_t c2) 748 compose_char (unicode_t c1, unicode_t c2)
738 : c1(c1), c2(c2) 749 : c1(c1), c2(c2)
739 { } 750 { }
740}; 751};
741 752
742class rxvt_composite_vec { 753class rxvt_composite_vec
754{
743 vector<compose_char> v; 755 vector<compose_char> v;
744public: 756public:
745 text_t compose (unicode_t c1, unicode_t c2 = NOCHAR); 757 text_t compose (unicode_t c1, unicode_t c2 = NOCHAR);
746 int expand (unicode_t c, wchar_t *r); 758 int expand (unicode_t c, wchar_t *r);
747 compose_char *operator [](text_t c) 759 compose_char *operator [](text_t c)
766extern rxvt_t rxvt_current_term; 778extern rxvt_t rxvt_current_term;
767 779
768#define SET_R(r) rxvt_current_term = const_cast<rxvt_term *>(r) 780#define SET_R(r) rxvt_current_term = const_cast<rxvt_term *>(r)
769#define GET_R rxvt_current_term 781#define GET_R rxvt_current_term
770 782
783/* ------------------------------------------------------------------------- */
784struct overlay_base
785{
786 int x, y, w, h; // overlay dimensions
787 text_t **text;
788 rend_t **rend;
789
790 // while tempting to add swap() etc. here, it effetcively only increases code size
791};
792
793/* ------------------------------------------------------------------------- */
794
771typedef struct { 795typedef struct
796{
772 int row; 797 int row;
773 int col; 798 int col;
774} row_col_t; 799} row_col_t;
775 800
776/* 801/*
801 * +------------+·display·+·= term_start 826 * +------------+·display·+·= term_start
802 * | terminal | display | 827 * | terminal | display |
803 * | terminal +---------+ 828 * | terminal +---------+
804 * | terminal | 829 * | terminal |
805 * | terminal | 830 * | terminal |
806 * +------------+···········= term_stat + nrow - 1 831 * +------------+···········= term_start + nrow - 1
807 * | 832 * |
808 * | 833 * |
809 * END······················= total_rows 834 * END······················= total_rows
810 */ 835 */
811 836
812struct TermWin_t { 837struct TermWin_t
838{
813 int width; /* window width [pixels] */ 839 int width; /* window width [pixels] */
814 int height; /* window height [pixels] */ 840 int height; /* window height [pixels] */
815 int fwidth; /* font width [pixels] */ 841 int fwidth; /* font width [pixels] */
816 int fheight; /* font height [pixels] */ 842 int fheight; /* font height [pixels] */
817 int fbase; /* font ascent (baseline) [pixels] */ 843 int fbase; /* font ascent (baseline) [pixels] */
847 * clicks: 1, 2 or 3 clicks - 4 indicates a special condition of 1 where 873 * clicks: 1, 2 or 3 clicks - 4 indicates a special condition of 1 where
848 * nothing is selected 874 * nothing is selected
849 * beg: row/column of beginning of selection : never past mark 875 * beg: row/column of beginning of selection : never past mark
850 * mark: row/column of initial click : never past end 876 * mark: row/column of initial click : never past end
851 * end: row/column of one character past end of selection 877 * end: row/column of one character past end of selection
852 * * Note: -nsaved <= beg.row <= mark.row <= end.row < nrow 878 * * Note: top_row <= beg.row <= mark.row <= end.row < nrow
853 * * Note: col == -1 ==> we're left of screen 879 * * Note: col == -1 ==> we're left of screen
854 * 880 *
855 */ 881 */
856typedef struct { 882struct screen_t
883{
857 row_col_t cur; /* cursor position on the screen */ 884 row_col_t cur; /* cursor position on the screen */
858 int tscroll; /* top of settable scroll region */ 885 int tscroll; /* top of settable scroll region */
859 int bscroll; /* bottom of settable scroll region */ 886 int bscroll; /* bottom of settable scroll region */
860 unsigned int charset; /* character set number [0..3] */ 887 unsigned int charset; /* character set number [0..3] */
861 unsigned int flags; /* see below */ 888 unsigned int flags; /* see below */
862 row_col_t s_cur; /* saved cursor position */ 889 row_col_t s_cur; /* saved cursor position */
863 unsigned int s_charset; /* saved character set number [0..3] */ 890 unsigned int s_charset; /* saved character set number [0..3] */
864 char s_charset_char; 891 char s_charset_char;
865 rend_t s_rstyle; /* saved rendition style */ 892 rend_t s_rstyle; /* saved rendition style */
866} screen_t; 893};
867 894
868enum selection_op_t { 895enum selection_op_t
896{
869 SELECTION_CLEAR = 0, /* nothing selected */ 897 SELECTION_CLEAR = 0, /* nothing selected */
870 SELECTION_INIT, /* marked a point */ 898 SELECTION_INIT, /* marked a point */
871 SELECTION_BEGIN, /* started a selection */ 899 SELECTION_BEGIN, /* started a selection */
872 SELECTION_CONT, /* continued selection */ 900 SELECTION_CONT, /* continued selection */
873 SELECTION_DONE /* selection put in CUT_BUFFER0 */ 901 SELECTION_DONE /* selection put in CUT_BUFFER0 */
874}; 902};
875 903
876typedef struct { 904struct selection_t
905{
877 wchar_t *text; /* selected text */ 906 wchar_t *text; /* selected text */
878 unsigned int len; /* length of selected text */ 907 unsigned int len; /* length of selected text */
879 unsigned int screen; /* screen being used */ 908 unsigned int screen; /* screen being used */
880 unsigned int clicks; /* number of clicks */ 909 unsigned int clicks; /* number of clicks */
881 selection_op_t op; /* current operation */ 910 selection_op_t op; /* current operation */
882 bool rect; /* rectangular selection? */ 911 bool rect; /* rectangular selection? */
883 row_col_t beg; /* beginning of selection <= mark */ 912 row_col_t beg; /* beginning of selection <= mark */
884 row_col_t mark; /* point of initial click <= end */ 913 row_col_t mark; /* point of initial click <= end */
885 row_col_t end; /* one character past end point */ 914 row_col_t end; /* one character past end point */
886} selection_t; 915};
887 916
888/* ------------------------------------------------------------------------- */ 917/* ------------------------------------------------------------------------- */
889 918
890/* screen_t flags */ 919/* screen_t flags */
891#define Screen_Relative (1<<0) /* relative origin mode flag */ 920#define Screen_Relative (1<<0) /* relative origin mode flag */
905Opt_count 934Opt_count
906}; 935};
907 936
908/* ------------------------------------------------------------------------- */ 937/* ------------------------------------------------------------------------- */
909 938
910struct rxvt_vars : TermWin_t { 939struct rxvt_vars : TermWin_t
940{
911 scrollBar_t scrollBar; 941 scrollBar_t scrollBar;
912 uint8_t options[(Opt_count + 7) >> 3]; 942 uint8_t options[(Opt_count + 7) >> 3];
913 XSizeHints szHint; 943 XSizeHints szHint;
914 rxvt_color *pix_colors; 944 rxvt_color *pix_colors;
915 Cursor TermWin_cursor; /* cursor for vt window */ 945 Cursor TermWin_cursor; /* cursor for vt window */
925#ifdef OFF_FOCUS_FADING 955#ifdef OFF_FOCUS_FADING
926 rxvt_color pix_colors_unfocused[TOTAL_COLORS]; 956 rxvt_color pix_colors_unfocused[TOTAL_COLORS];
927#endif 957#endif
928}; 958};
929 959
930struct rxvt_term : zero_initialized, rxvt_vars, rxvt_screen { 960struct rxvt_term : zero_initialized, rxvt_vars, rxvt_screen
961{
931 962
932 // special markers with magic addresses 963 // special markers with magic addresses
933 static const char resval_undef []; // options specifically unset 964 static const char resval_undef []; // options specifically unset
934 static const char resval_on []; // boolean options switched on 965 static const char resval_on []; // boolean options switched on
935 static const char resval_off []; // or off 966 static const char resval_off []; // or off
943 974
944 unsigned char want_refresh:1, 975 unsigned char want_refresh:1,
945 current_screen:1, /* primary or secondary */ 976 current_screen:1, /* primary or secondary */
946 num_scr_allow:1, 977 num_scr_allow:1,
947 bypass_keystate:1, 978 bypass_keystate:1,
979#ifdef ENABLE_FRILLS
980 urgency_hint:1,
981#endif
948#ifdef CURSOR_BLINK 982#ifdef CURSOR_BLINK
949 hidden_cursor:1, 983 hidden_cursor:1,
950#endif 984#endif
951#ifdef TEXT_BLINK 985#ifdef TEXT_BLINK
952 hidden_text:1, 986 hidden_text:1,
1023 bgPixmap_t bgPixmap; 1057 bgPixmap_t bgPixmap;
1024#endif 1058#endif
1025#ifdef HAVE_AFTERIMAGE 1059#ifdef HAVE_AFTERIMAGE
1026 ASVisual *asv; 1060 ASVisual *asv;
1027 ASImageManager *asimman; 1061 ASImageManager *asimman;
1062
1063 void init_asv ()
1064 {
1065 if (!asv)
1066 asv = create_asvisual_for_id (dpy, display->screen, depth, XVisualIDFromVisual (visual), cmap, NULL);
1067 }
1028#endif 1068#endif
1029 1069
1030#if ENABLE_OVERLAY 1070#if ENABLE_OVERLAY
1031 int ov_x, ov_y, ov_w, ov_h; // overlay dimensions 1071 overlay_base ov;
1032 text_t **ov_text;
1033 rend_t **ov_rend;
1034 1072
1035 void scr_swap_overlay () NOTHROW; 1073 void scr_swap_overlay () NOTHROW;
1036 void scr_overlay_new (int x, int y, int w, int h) NOTHROW; 1074 void scr_overlay_new (int x, int y, int w, int h) NOTHROW;
1037 void scr_overlay_off () NOTHROW; 1075 void scr_overlay_off () NOTHROW;
1038 void scr_overlay_set (int x, int y, 1076 void scr_overlay_set (int x, int y,
1189 wchar_t next_char () NOTHROW; 1227 wchar_t next_char () NOTHROW;
1190 wchar_t cmd_getc () THROW ((class out_of_input)); 1228 wchar_t cmd_getc () THROW ((class out_of_input));
1191 uint32_t next_octet () NOTHROW; 1229 uint32_t next_octet () NOTHROW;
1192 uint32_t cmd_get8 () THROW ((class out_of_input)); 1230 uint32_t cmd_get8 () THROW ((class out_of_input));
1193 1231
1194 bool cmd_parse (); 1232 void cmd_parse ();
1195 void mouse_report (XButtonEvent &ev); 1233 void mouse_report (XButtonEvent &ev);
1196 void button_press (XButtonEvent &ev); 1234 void button_press (XButtonEvent &ev);
1197 void button_release (XButtonEvent &ev); 1235 void button_release (XButtonEvent &ev);
1198 void focus_in (); 1236 void focus_in ();
1199 void focus_out (); 1237 void focus_out ();
1238 void set_urgency (bool enable);
1200 void update_fade_color (unsigned int idx); 1239 void update_fade_color (unsigned int idx);
1201#ifdef PRINTPIPE 1240#ifdef PRINTPIPE
1202 FILE *popen_printer (); 1241 FILE *popen_printer ();
1203 int pclose_printer (FILE *stream); 1242 int pclose_printer (FILE *stream);
1204#endif 1243#endif
1342 1381
1343 // modifies first argument(!) 1382 // modifies first argument(!)
1344 void paste (char *data, unsigned int len) NOTHROW; 1383 void paste (char *data, unsigned int len) NOTHROW;
1345 void scr_blank_line (line_t &l, unsigned int col, unsigned int width, rend_t efs) const NOTHROW; 1384 void scr_blank_line (line_t &l, unsigned int col, unsigned int width, rend_t efs) const NOTHROW;
1346 void scr_blank_screen_mem (line_t &l, rend_t efs) const NOTHROW; 1385 void scr_blank_screen_mem (line_t &l, rend_t efs) const NOTHROW;
1386 void scr_kill_char (line_t &l, int col) const NOTHROW;
1347 int scr_scroll_text (int row1, int row2, int count) NOTHROW; 1387 int scr_scroll_text (int row1, int row2, int count) NOTHROW;
1348 void scr_reset (); 1388 void scr_reset ();
1349 void scr_release () NOTHROW; 1389 void scr_release () NOTHROW;
1350 void scr_clear (bool really = false) NOTHROW; 1390 void scr_clear (bool really = false) NOTHROW;
1351 void scr_refresh () NOTHROW; 1391 void scr_refresh () NOTHROW;
1363 void scr_remap_chars (line_t &l) NOTHROW; 1403 void scr_remap_chars (line_t &l) NOTHROW;
1364 1404
1365 enum cursor_mode { SAVE, RESTORE }; 1405 enum cursor_mode { SAVE, RESTORE };
1366 1406
1367 void scr_poweron (); 1407 void scr_poweron ();
1408 void scr_soft_reset () NOTHROW;
1368 void scr_cursor (cursor_mode mode) NOTHROW; 1409 void scr_cursor (cursor_mode mode) NOTHROW;
1369 void scr_do_wrap () NOTHROW; 1410 void scr_do_wrap () NOTHROW;
1370 void scr_swap_screen () NOTHROW; 1411 void scr_swap_screen () NOTHROW;
1371 void scr_change_screen (int scrn); 1412 void scr_change_screen (int scrn);
1372 void scr_color (unsigned int color, int fgbg) NOTHROW; 1413 void scr_color (unsigned int color, int fgbg) NOTHROW;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines