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.370 by root, Tue Nov 4 14:25:10 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};
555#define CBUFCNT 8 // never call pty_fill/cmd_parse more than this often in a row 556#define CBUFCNT 8 // never call pty_fill/cmd_parse more than this often in a row
556#define UBUFSIZ 2048 // character buffer 557#define UBUFSIZ 2048 // character buffer
557 558
558#if ENABLE_FRILLS 559#if ENABLE_FRILLS
559# include <X11/Xmd.h> 560# include <X11/Xmd.h>
560typedef struct _mwmhints { 561typedef struct _mwmhints
562{
561 CARD32 flags; 563 CARD32 flags;
562 CARD32 functions; 564 CARD32 functions;
563 CARD32 decorations; 565 CARD32 decorations;
564 INT32 input_mode; 566 INT32 input_mode;
565 CARD32 status; 567 CARD32 status;
612#define Col2Pixel(col) ((int32_t)Width2Pixel(col)) 614#define Col2Pixel(col) ((int32_t)Width2Pixel(col))
613#define Row2Pixel(row) ((int32_t)Height2Pixel(row)) 615#define Row2Pixel(row) ((int32_t)Height2Pixel(row))
614#define Width2Pixel(n) ((int32_t)(n) * (int32_t)fwidth) 616#define Width2Pixel(n) ((int32_t)(n) * (int32_t)fwidth)
615#define Height2Pixel(n) ((int32_t)(n) * (int32_t)fheight) 617#define Height2Pixel(n) ((int32_t)(n) * (int32_t)fheight)
616 618
617#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)
618#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)
619 624
620/* how to build & extract colors and attributes */ 625/* how to build & extract colors and attributes */
621#define GET_BASEFG(x) (((x) & RS_fgMask)) 626#define GET_BASEFG(x) (((x) & RS_fgMask))
622#define GET_BASEBG(x) (((x) & RS_bgMask)>>Color_Bits) 627#define GET_BASEBG(x) (((x) & RS_bgMask)>>Color_Bits)
623 628
640 645
641#define PIXCOLOR_NAME(idx) rs[Rs_color + (idx)] 646#define PIXCOLOR_NAME(idx) rs[Rs_color + (idx)]
642#define ISSET_PIXCOLOR(idx) (!!rs[Rs_color + (idx)]) 647#define ISSET_PIXCOLOR(idx) (!!rs[Rs_color + (idx)])
643 648
644#if ENABLE_STYLES 649#if ENABLE_STYLES
645# define FONTSET(style) fontset[GET_STYLE (style)] 650# define FONTSET_of(t,style) (t)->fontset[GET_STYLE (style)]
646#else 651#else
647# define FONTSET(style) fontset[0] 652# define FONTSET_of(t,style) (t)->fontset[0]
648#endif 653#endif
654
655#define FONTSET(style) FONTSET_of (this, style)
649 656
650typedef callback<void (const char *)> log_callback; 657typedef callback<void (const char *)> log_callback;
651typedef callback<int (int)> getfd_callback; 658typedef callback<int (int)> getfd_callback;
652 659
653/****************************************************************************/ 660/****************************************************************************/
656#define LINE_FILTERED 0x0002 // line has been filtered 663#define LINE_FILTERED 0x0002 // line has been filtered
657#define LINE_COMPRESSED 0x0004 // line has been compressed (NYI) 664#define LINE_COMPRESSED 0x0004 // line has been compressed (NYI)
658#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)
659#define LINE_BIDI 0x0010 // line needs bidi (NYI) 666#define LINE_BIDI 0x0010 // line needs bidi (NYI)
660 667
661struct line_t { 668struct line_t
669{
662 text_t *t; // terminal the text 670 text_t *t; // terminal the text
663 rend_t *r; // rendition, uses RS_ flags 671 rend_t *r; // rendition, uses RS_ flags
664 tlen_t_ l; // length of each text line 672 tlen_t_ l; // length of each text line
665 uint32_t f; // flags 673 uint32_t f; // flags
666 674
700}; 708};
701 709
702/****************************************************************************/ 710/****************************************************************************/
703 711
704// primitive wrapper around mbstate_t to ensure initialisation 712// primitive wrapper around mbstate_t to ensure initialisation
705struct mbstate { 713struct mbstate
714{
706 mbstate_t mbs; 715 mbstate_t mbs;
707 716
708 operator mbstate_t *() { return &mbs; } 717 operator mbstate_t *() { return &mbs; }
709 void reset () { memset (&mbs, 0, sizeof (mbs)); } 718 void reset () { memset (&mbs, 0, sizeof (mbs)); }
710 mbstate () { reset (); } 719 mbstate () { reset (); }
731 740
732#if ENABLE_COMBINING 741#if ENABLE_COMBINING
733// compose chars are used to represent composite characters 742// compose chars are used to represent composite characters
734// that are not representable in unicode, as well as characters 743// that are not representable in unicode, as well as characters
735// not fitting in the BMP. 744// not fitting in the BMP.
736struct compose_char { 745struct compose_char
746{
737 unicode_t c1, c2; // any chars != NOCHAR are valid 747 unicode_t c1, c2; // any chars != NOCHAR are valid
738 compose_char (unicode_t c1, unicode_t c2) 748 compose_char (unicode_t c1, unicode_t c2)
739 : c1(c1), c2(c2) 749 : c1(c1), c2(c2)
740 { } 750 { }
741}; 751};
742 752
743class rxvt_composite_vec { 753class rxvt_composite_vec
754{
744 vector<compose_char> v; 755 vector<compose_char> v;
745public: 756public:
746 text_t compose (unicode_t c1, unicode_t c2 = NOCHAR); 757 text_t compose (unicode_t c1, unicode_t c2 = NOCHAR);
747 int expand (unicode_t c, wchar_t *r); 758 int expand (unicode_t c, wchar_t *r);
748 compose_char *operator [](text_t c) 759 compose_char *operator [](text_t c)
767extern rxvt_t rxvt_current_term; 778extern rxvt_t rxvt_current_term;
768 779
769#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)
770#define GET_R rxvt_current_term 781#define GET_R rxvt_current_term
771 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
772typedef struct { 795typedef struct
796{
773 int row; 797 int row;
774 int col; 798 int col;
775} row_col_t; 799} row_col_t;
776 800
777/* 801/*
808 * | 832 * |
809 * | 833 * |
810 * END······················= total_rows 834 * END······················= total_rows
811 */ 835 */
812 836
813struct TermWin_t { 837struct TermWin_t
838{
814 int width; /* window width [pixels] */ 839 int width; /* window width [pixels] */
815 int height; /* window height [pixels] */ 840 int height; /* window height [pixels] */
816 int fwidth; /* font width [pixels] */ 841 int fwidth; /* font width [pixels] */
817 int fheight; /* font height [pixels] */ 842 int fheight; /* font height [pixels] */
818 int fbase; /* font ascent (baseline) [pixels] */ 843 int fbase; /* font ascent (baseline) [pixels] */
852 * end: row/column of one character past end of selection 877 * end: row/column of one character past end of selection
853 * * Note: top_row <= beg.row <= mark.row <= end.row < nrow 878 * * Note: top_row <= beg.row <= mark.row <= end.row < nrow
854 * * Note: col == -1 ==> we're left of screen 879 * * Note: col == -1 ==> we're left of screen
855 * 880 *
856 */ 881 */
857typedef struct { 882struct screen_t
883{
858 row_col_t cur; /* cursor position on the screen */ 884 row_col_t cur; /* cursor position on the screen */
859 int tscroll; /* top of settable scroll region */ 885 int tscroll; /* top of settable scroll region */
860 int bscroll; /* bottom of settable scroll region */ 886 int bscroll; /* bottom of settable scroll region */
861 unsigned int charset; /* character set number [0..3] */ 887 unsigned int charset; /* character set number [0..3] */
862 unsigned int flags; /* see below */ 888 unsigned int flags; /* see below */
863 row_col_t s_cur; /* saved cursor position */ 889 row_col_t s_cur; /* saved cursor position */
864 unsigned int s_charset; /* saved character set number [0..3] */ 890 unsigned int s_charset; /* saved character set number [0..3] */
865 char s_charset_char; 891 char s_charset_char;
866 rend_t s_rstyle; /* saved rendition style */ 892 rend_t s_rstyle; /* saved rendition style */
867} screen_t; 893};
868 894
869enum selection_op_t { 895enum selection_op_t
896{
870 SELECTION_CLEAR = 0, /* nothing selected */ 897 SELECTION_CLEAR = 0, /* nothing selected */
871 SELECTION_INIT, /* marked a point */ 898 SELECTION_INIT, /* marked a point */
872 SELECTION_BEGIN, /* started a selection */ 899 SELECTION_BEGIN, /* started a selection */
873 SELECTION_CONT, /* continued selection */ 900 SELECTION_CONT, /* continued selection */
874 SELECTION_DONE /* selection put in CUT_BUFFER0 */ 901 SELECTION_DONE /* selection put in CUT_BUFFER0 */
875}; 902};
876 903
877typedef struct { 904struct selection_t
905{
878 wchar_t *text; /* selected text */ 906 wchar_t *text; /* selected text */
879 unsigned int len; /* length of selected text */ 907 unsigned int len; /* length of selected text */
880 unsigned int screen; /* screen being used */ 908 unsigned int screen; /* screen being used */
881 unsigned int clicks; /* number of clicks */ 909 unsigned int clicks; /* number of clicks */
882 selection_op_t op; /* current operation */ 910 selection_op_t op; /* current operation */
883 bool rect; /* rectangular selection? */ 911 bool rect; /* rectangular selection? */
884 row_col_t beg; /* beginning of selection <= mark */ 912 row_col_t beg; /* beginning of selection <= mark */
885 row_col_t mark; /* point of initial click <= end */ 913 row_col_t mark; /* point of initial click <= end */
886 row_col_t end; /* one character past end point */ 914 row_col_t end; /* one character past end point */
887} selection_t; 915};
888 916
889/* ------------------------------------------------------------------------- */ 917/* ------------------------------------------------------------------------- */
890 918
891/* screen_t flags */ 919/* screen_t flags */
892#define Screen_Relative (1<<0) /* relative origin mode flag */ 920#define Screen_Relative (1<<0) /* relative origin mode flag */
906Opt_count 934Opt_count
907}; 935};
908 936
909/* ------------------------------------------------------------------------- */ 937/* ------------------------------------------------------------------------- */
910 938
911struct rxvt_vars : TermWin_t { 939struct rxvt_vars : TermWin_t
940{
912 scrollBar_t scrollBar; 941 scrollBar_t scrollBar;
913 uint8_t options[(Opt_count + 7) >> 3]; 942 uint8_t options[(Opt_count + 7) >> 3];
914 XSizeHints szHint; 943 XSizeHints szHint;
915 rxvt_color *pix_colors; 944 rxvt_color *pix_colors;
916 Cursor TermWin_cursor; /* cursor for vt window */ 945 Cursor TermWin_cursor; /* cursor for vt window */
926#ifdef OFF_FOCUS_FADING 955#ifdef OFF_FOCUS_FADING
927 rxvt_color pix_colors_unfocused[TOTAL_COLORS]; 956 rxvt_color pix_colors_unfocused[TOTAL_COLORS];
928#endif 957#endif
929}; 958};
930 959
931struct rxvt_term : zero_initialized, rxvt_vars, rxvt_screen { 960struct rxvt_term : zero_initialized, rxvt_vars, rxvt_screen
961{
932 962
933 // special markers with magic addresses 963 // special markers with magic addresses
934 static const char resval_undef []; // options specifically unset 964 static const char resval_undef []; // options specifically unset
935 static const char resval_on []; // boolean options switched on 965 static const char resval_on []; // boolean options switched on
936 static const char resval_off []; // or off 966 static const char resval_off []; // or off
1036 asv = create_asvisual_for_id (dpy, display->screen, depth, XVisualIDFromVisual (visual), cmap, NULL); 1066 asv = create_asvisual_for_id (dpy, display->screen, depth, XVisualIDFromVisual (visual), cmap, NULL);
1037 } 1067 }
1038#endif 1068#endif
1039 1069
1040#if ENABLE_OVERLAY 1070#if ENABLE_OVERLAY
1041 int ov_x, ov_y, ov_w, ov_h; // overlay dimensions 1071 overlay_base ov;
1042 text_t **ov_text;
1043 rend_t **ov_rend;
1044 1072
1045 void scr_swap_overlay () NOTHROW; 1073 void scr_swap_overlay () NOTHROW;
1046 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;
1047 void scr_overlay_off () NOTHROW; 1075 void scr_overlay_off () NOTHROW;
1048 void scr_overlay_set (int x, int y, 1076 void scr_overlay_set (int x, int y,
1375 void scr_remap_chars (line_t &l) NOTHROW; 1403 void scr_remap_chars (line_t &l) NOTHROW;
1376 1404
1377 enum cursor_mode { SAVE, RESTORE }; 1405 enum cursor_mode { SAVE, RESTORE };
1378 1406
1379 void scr_poweron (); 1407 void scr_poweron ();
1408 void scr_soft_reset () NOTHROW;
1380 void scr_cursor (cursor_mode mode) NOTHROW; 1409 void scr_cursor (cursor_mode mode) NOTHROW;
1381 void scr_do_wrap () NOTHROW; 1410 void scr_do_wrap () NOTHROW;
1382 void scr_swap_screen () NOTHROW; 1411 void scr_swap_screen () NOTHROW;
1383 void scr_change_screen (int scrn); 1412 void scr_change_screen (int scrn);
1384 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