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.15 by pcg, Thu Dec 18 02:07:12 2003 UTC vs.
Revision 1.22 by pcg, Mon Jan 19 17:26:43 2004 UTC

1/*
2 * $Id: rxvt.h,v 1.15 2003/12/18 02:07:12 pcg Exp $
3 */
4
5#ifndef _RXVT_H_ /* include once only */ 1#ifndef RXVT_H_ /* include once only */
6#define _RXVT_H_ 2#define RXVT_H_
7 3
8#include "rxvtlib.h" 4#include "rxvtlib.h"
9 5
10#include "feature.h" 6#include "feature.h"
11 7
16 12
17#include "defaultfont.h" 13#include "defaultfont.h"
18#include "rxvtcolor.h" 14#include "rxvtcolor.h"
19#include "iom.h" 15#include "iom.h"
20#include "salloc.h" 16#include "salloc.h"
17
18#include <wchar.h>
21 19
22/* 20/*
23 ***************************************************************************** 21 *****************************************************************************
24 * SYSTEM HACKS 22 * SYSTEM HACKS
25 ***************************************************************************** 23 *****************************************************************************
316enum { 314enum {
317 PRIMARY = 0, 315 PRIMARY = 0,
318 SECONDARY 316 SECONDARY
319}; 317};
320 318
321enum {
322 SBYTE = 0,
323 WBYTE
324};
325
326
327#define RS_None 0 /* Normal */ 319#define RS_None 0 /* Normal */
328 320
329#define RS_fgMask 0x000001FFu /* 512 colors */ 321#define RS_fgMask 0x000001FFu /* 512 colors */
330#define RS_bgMask 0x0003FE00u /* 512 colors */ 322#define RS_bgMask 0x0003FE00u /* 512 colors */
331#define RS_Bold 0x00040000u /* bold */ 323#define RS_Bold 0x00040000u /* bold */
332#define RS_Blink 0x00080000u /* blink */ 324#define RS_Blink 0x00080000u /* blink */
333#define RS_RVid 0x00100000u /* reverse video */ 325#define RS_RVid 0x00100000u /* reverse video */
334#define RS_Uline 0x00200000u /* underline */ 326#define RS_Uline 0x00200000u /* underline */
335 327
336#define RS_wide 0x00400000u /* only multibyte characters */
337#define IS_WIDE(r) ((r) & RS_wide)
338
339#define RS_fontMask 0xff000000u /* plenty(?) of fonts */ 328#define RS_fontMask 0xffc00000u /* plenty(?) of fonts */
340#define RS_fontShift 24 329#define RS_fontShift 22
341 330
342#define RS_baseattrMask (RS_Bold|RS_Blink|RS_RVid|RS_Uline) 331#define RS_baseattrMask (RS_Bold|RS_Blink|RS_RVid|RS_Uline)
343#define RS_attrMask (RS_baseattrMask|RS_fontMask|RS_wide) 332#define RS_attrMask (RS_baseattrMask|RS_fontMask)
344 333
345#define Sel_none 0 /* Not waiting */ 334#define Sel_none 0 /* Not waiting */
346#define Sel_normal 0x01 /* normal selection */ 335#define Sel_normal 0x01 /* normal selection */
347#define Sel_incr 0x02 /* incremental selection */ 336#define Sel_incr 0x02 /* incremental selection */
348#define Sel_direct 0x00 337#define Sel_direct 0x00
453 TOTAL_COLORS = NRS_COLORS /* */ 442 TOTAL_COLORS = NRS_COLORS /* */
454#endif 443#endif
455}; 444};
456 445
457#define Color_Bits 9 446#define Color_Bits 9
458#define NPIXCLR_SETS 9 /* (256 + 14) bits / 32 bits */ 447#define NPIXCLR_SETS ((TOTAL_COLORS + 31) / 32)
459#define NPIXCLR_BITS 32 448#define NPIXCLR_BITS 32
460 449
461#define DEFAULT_RSTYLE (RS_None | (Color_fg) | (Color_bg<<Color_Bits)) 450#define DEFAULT_RSTYLE (RS_None | (Color_fg) | (Color_bg<<Color_Bits))
462 451
463/* 452/*
464 * Resource list 453 * Resource list
465 */ 454 */
466enum { 455enum {
619#else 608#else
620# define PrivMode_Default \ 609# define PrivMode_Default \
621(PrivMode_Autowrap|PrivMode_aplKP|PrivMode_ShiftKeys|PrivMode_VisibleCursor) 610(PrivMode_Autowrap|PrivMode_aplKP|PrivMode_ShiftKeys|PrivMode_VisibleCursor)
622#endif 611#endif
623 612
624#ifdef PREFER_24BIT
625# define XDEPTH R->Xdepth 613#define XDEPTH R->Xdepth
626# define XCMAP R->Xcmap 614#define XCMAP R->Xcmap
627# define XVISUAL R->Xvisual 615#define XVISUAL R->Xvisual
628#else 616
629# ifdef DEBUG_DEPTH
630# define XDEPTH DEBUG_DEPTH
631# else
632# define XDEPTH DefaultDepth(R->Xdisplay,Xscreen)
633# define XCMAP DefaultColormap(R->Xdisplay,Xscreen)
634# define XVISUAL DefaultVisual(R->Xdisplay,Xscreen)
635# endif
636#endif
637#define IMBUFSIZ 128 /* input modifier buffer sizes */ 617#define IMBUFSIZ 128 /* input modifier buffer sizes */
638#ifndef BUFSIZ 618#ifndef BUFSIZ
639# define BUFSIZ 4096 619# define BUFSIZ 4096
640#endif 620#endif
641#define KBUFSZ 512 /* size of keyboard mapping buffer */ 621#define KBUFSZ 512 /* size of keyboard mapping buffer */
642 622
643/* 623/*
644 ***************************************************************************** 624 *****************************************************************************
645 * MACRO DEFINES 625 * MACRO DEFINES
646 ***************************************************************************** 626 *****************************************************************************
660#define STRLEN(x) strlen((const char *)(x)) 640#define STRLEN(x) strlen((const char *)(x))
661#define STRCHR(x, y) strchr((const char *)(x), (int)(y)) 641#define STRCHR(x, y) strchr((const char *)(x), (int)(y))
662#define STRRCHR(x, y) strrchr((const char *)(x), (int)(y)) 642#define STRRCHR(x, y) strrchr((const char *)(x), (int)(y))
663 643
664/* convert pixel dimensions to row/column values. Everything as int32_t */ 644/* convert pixel dimensions to row/column values. Everything as int32_t */
665#define Pixel2Col(x) Pixel2Width((int32_t)(x) - (int32_t)R->TermWin.int_bwidth) 645#define Pixel2Col(x) Pixel2Width((int32_t)(x) - (int32_t)TermWin.int_bwidth)
666#define Pixel2Row(y) Pixel2Height((int32_t)(y) - (int32_t)R->TermWin.int_bwidth) 646#define Pixel2Row(y) Pixel2Height((int32_t)(y) - (int32_t)TermWin.int_bwidth)
667#define Pixel2Width(x) ((int32_t)(x) / (int32_t)R->TermWin.fwidth) 647#define Pixel2Width(x) ((int32_t)(x) / (int32_t)TermWin.fwidth)
668#define Pixel2Height(y) ((int32_t)(y) / (int32_t)R->TermWin.fheight) 648#define Pixel2Height(y) ((int32_t)(y) / (int32_t)TermWin.fheight)
669#define Col2Pixel(col) ((int32_t)Width2Pixel(col) + (int32_t)R->TermWin.int_bwidth) 649#define Col2Pixel(col) ((int32_t)Width2Pixel(col) + (int32_t)TermWin.int_bwidth)
670#define Row2Pixel(row) ((int32_t)Height2Pixel(row) + (int32_t)R->TermWin.int_bwidth) 650#define Row2Pixel(row) ((int32_t)Height2Pixel(row) + (int32_t)TermWin.int_bwidth)
671#define Width2Pixel(n) ((int32_t)(n) * (int32_t)R->TermWin.fwidth) 651#define Width2Pixel(n) ((int32_t)(n) * (int32_t)TermWin.fwidth)
672#define Height2Pixel(n) ((int32_t)(n) * (int32_t)R->TermWin.fheight) 652#define Height2Pixel(n) ((int32_t)(n) * (int32_t)TermWin.fheight)
673 653
674#define TermWin_TotalWidth() ((int32_t)R->TermWin.width + 2 * (int32_t)R->TermWin.int_bwidth) 654#define TermWin_TotalWidth() ((int32_t)TermWin.width + 2 * (int32_t)TermWin.int_bwidth)
675#define TermWin_TotalHeight() ((int32_t)R->TermWin.height + 2 * (int32_t)R->TermWin.int_bwidth) 655#define TermWin_TotalHeight() ((int32_t)TermWin.height + 2 * (int32_t)TermWin.int_bwidth)
676 656
677#define Xscreen DefaultScreen(R->Xdisplay)
678#define Xroot DefaultRootWindow(R->Xdisplay) 657#define Xroot DefaultRootWindow(R->Xdisplay)
679 658
680/* how to build & extract colors and attributes */ 659/* how to build & extract colors and attributes */
681#define GET_BASEFG(x) (((x) & RS_fgMask)) 660#define GET_BASEFG(x) (((x) & RS_fgMask))
682#define GET_BASEBG(x) (((x) & RS_bgMask)>>Color_Bits) 661#define GET_BASEBG(x) (((x) & RS_bgMask)>>Color_Bits)
709#define SET_FGCOLOR(x,fg) (((x) & ~RS_fgMask) | (fg)) 688#define SET_FGCOLOR(x,fg) (((x) & ~RS_fgMask) | (fg))
710#define SET_BGCOLOR(x,bg) (((x) & ~RS_bgMask) | ((bg)<<Color_Bits)) 689#define SET_BGCOLOR(x,bg) (((x) & ~RS_bgMask) | ((bg)<<Color_Bits))
711#define SET_ATTR(x,a) (((x) & ~RS_attrMask)| (a)) 690#define SET_ATTR(x,a) (((x) & ~RS_attrMask)| (a))
712 691
713#define SET_PIXCOLOR(h, x) ((h)->pixcolor_set[(x) / NPIXCLR_BITS] |= (1 << ((x) % NPIXCLR_BITS))) 692#define SET_PIXCOLOR(h, x) ((h)->pixcolor_set[(x) / NPIXCLR_BITS] |= (1 << ((x) % NPIXCLR_BITS)))
714#define ISSET_PIXCOLOR(h, x) ((h)->pixcolor_set[(x) / NPIXCLR_BITS] & (1 << ((x) % NPIXCLR_BITS))) 693#define ISSET_PIXCOLOR(h, x) ((h)->pixcolor_set[(x) / NPIXCLR_BITS] & (1 << ((x) % NPIXCLR_BITS)))
715 694
716#ifdef HAVE_SCROLLBARS 695#ifdef HAVE_SCROLLBARS
717# define scrollbar_TotalWidth() (R->scrollBar.width + R->sb_shadow * 2) 696# define scrollbar_TotalWidth() (scrollBar.width + sb_shadow * 2)
718#else 697#else
719# define scrollbar_TotalWidth() (0) 698# define scrollbar_TotalWidth() (0)
720#endif 699#endif
721#define scrollbar_isMotion() (R->scrollBar.state == 'm') 700#define scrollbar_isMotion() (R->scrollBar.state == 'm')
722#define scrollbar_isUp() (R->scrollBar.state == 'U') 701#define scrollbar_isUp() (R->scrollBar.state == 'U')
723#define scrollbar_isDn() (R->scrollBar.state == 'D') 702#define scrollbar_isDn() (R->scrollBar.state == 'D')
724#define scrollbar_isUpDn() isupper (R->scrollBar.state) 703#define scrollbar_isUpDn() isupper (R->scrollBar.state)
725#define isScrollbarWindow(w) (R->scrollBar.state && (w) == R->scrollBar.win) 704#define isScrollbarWindow(w) (R->scrollBar.state && (w) == R->scrollBar.win)
726
727#define scrollbar_setIdle() R->scrollBar.state = 1
728#define scrollbar_setMotion() R->scrollBar.state = 'm'
729#define scrollbar_setUp() R->scrollBar.state = 'U'
730#define scrollbar_setDn() R->scrollBar.state = 'D'
731 705
732#define scrollbarnext_dnval() (R->scrollBar.end + (R->scrollBar.width + 1)) 706#define scrollbarnext_dnval() (R->scrollBar.end + (R->scrollBar.width + 1))
733#define scrollbarnext_upButton(y) ((y) > R->scrollBar.end \ 707#define scrollbarnext_upButton(y) ((y) > R->scrollBar.end \
734 && (y) <= scrollbarnext_dnval()) 708 && (y) <= scrollbarnext_dnval())
735#define scrollbarnext_dnButton(y) ((y) > scrollbarnext_dnval()) 709#define scrollbarnext_dnButton(y) ((y) > scrollbarnext_dnval())
748#define scrollbar_size() (R->scrollBar.end - R->scrollBar.beg \ 722#define scrollbar_size() (R->scrollBar.end - R->scrollBar.beg \
749 - scrollbar_minheight()) 723 - scrollbar_minheight())
750 724
751#if (MENUBAR_MAX > 1) 725#if (MENUBAR_MAX > 1)
752/* rendition style flags */ 726/* rendition style flags */
753# define menuBar_height() (R->TermWin.fheight + SHADOW) 727# define menuBar_height() (TermWin.fheight + SHADOW)
754# define menuBar_TotalHeight() (menuBar_height() + SHADOW + menuBar_margin) 728# define menuBar_TotalHeight() (menuBar_height() + SHADOW + menuBar_margin)
755# define isMenuBarWindow(w) ((w) == R->menuBar.win) 729# define isMenuBarWindow(w) ((w) == R->menuBar.win)
756#else 730#else
757# define menuBar_height() (0) 731# define menuBar_height() (0)
758# define menuBar_TotalHeight() (0) 732# define menuBar_TotalHeight() (0)
836#endif 810#endif
837 811
838#define BLINK_INTERVAL 0.5 812#define BLINK_INTERVAL 0.5
839 813
840struct mbstate { 814struct mbstate {
841 unsigned char orig; 815 mbstate_t mbs;
842 uint32_t reg;
843 int cnt;
844 816
845 mbstate () 817 mbstate ()
846 { 818 {
847 cnt = 0; 819 MEMSET (&mbs, 0, sizeof (mbs));
848 } 820 }
849}; 821};
850 822
851struct rxvt_term : rxvt_vars { 823struct rxvt_term : rxvt_vars {
852 struct mbstate mbstate; 824 struct mbstate mbstate;
868#endif 840#endif
869#ifdef POINTER_BLANK 841#ifdef POINTER_BLANK
870 hidden_pointer:1, 842 hidden_pointer:1,
871#endif 843#endif
872 parsed_geometry:1, 844 parsed_geometry:1,
873 seen_input:1; /* wether any input has been seen so far */ 845 seen_input:1, /* wether any input has been seen so far */
846 enc_utf8:1; /* wether terminal reads/writes utf-8 */
874 847
875 unsigned char refresh_type, 848 unsigned char refresh_type,
876#ifdef UTMP_SUPPORT 849#ifdef UTMP_SUPPORT
877 next_utmp_action, 850 next_utmp_action,
878#endif 851#endif
889#ifdef GREEK_SUPPORT 862#ifdef GREEK_SUPPORT
890 short greek_mode; /* greek keyboard mode */ 863 short greek_mode; /* greek keyboard mode */
891#endif 864#endif
892 short rvideo; 865 short rvideo;
893 int16_t num_scr; /* screen: number lines scrolled */ 866 int16_t num_scr; /* screen: number lines scrolled */
894 uint16_t prev_ncol, /* screen: previous number of columns */ 867 unsigned int prev_ncol, /* screen: previous number of columns */
895 prev_nrow; /* screen: previous number of rows */ 868 prev_nrow; /* screen: previous number of rows */
896#ifdef RXVT_GRAPHICS 869#ifdef RXVT_GRAPHICS
897 uint16_t gr_prev_start; 870 uint16_t gr_prev_start;
898#endif 871#endif
899/* ---------- */ 872/* ---------- */
900 rend_t rstyle; 873 rend_t rstyle;
901/* ---------- */ 874/* ---------- */
902 uint32_t pixcolor_set[NPIXCLR_SETS]; 875 uint32_t pixcolor_set[NPIXCLR_SETS];
903/* ---------- */ 876/* ---------- */
904#ifdef SELECTION_SCROLLING 877#ifdef SELECTION_SCROLLING
905 int scroll_selection_delay, 878 int scroll_selection_delay,
906 scroll_selection_lines; 879 scroll_selection_lines;
907 enum page_dirn scroll_selection_dir; 880 enum page_dirn scroll_selection_dir;
952#endif 925#endif
953 ttymode; 926 ttymode;
954 unsigned long PrivateModes, 927 unsigned long PrivateModes,
955 SavedModes; 928 SavedModes;
956/* ---------- */ 929/* ---------- */
957#ifdef PREFER_24BIT
958 Visual *Xvisual;
959#endif
960/* ---------- */
961 Atom xa[NUM_XA]; 930 Atom xa[NUM_XA];
962/* ---------- */ 931/* ---------- */
963#ifdef MENUBAR 932#ifdef MENUBAR
964 GC menubarGC; 933 GC menubarGC;
965#endif 934#endif
1071 char *env_display; /* environmental variable DISPLAY */ 1040 char *env_display; /* environmental variable DISPLAY */
1072 char *env_term; /* environmental variable TERM */ 1041 char *env_term; /* environmental variable TERM */
1073 char *env_colorfgbg; 1042 char *env_colorfgbg;
1074 char *buffer; 1043 char *buffer;
1075 char *locale; 1044 char *locale;
1045 char *codeset;
1076 char charsets[4]; 1046 char charsets[4];
1077 unsigned char *v_buffer; /* pointer to physical buffer */ 1047 unsigned char *v_buffer; /* pointer to physical buffer */
1078 unsigned int v_buflen; /* size of area to write */ 1048 unsigned int v_buflen; /* size of area to write */
1079 char *newfont[MAX_NFONTS]; 1049 char *newfont[MAX_NFONTS];
1080#ifdef KEYSYM_RESOURCE 1050#ifdef KEYSYM_RESOURCE
1082#endif 1052#endif
1083 const char *rs[NUM_RESOURCES]; 1053 const char *rs[NUM_RESOURCES];
1084/* command input buffering */ 1054/* command input buffering */
1085 unsigned char *cmdbuf_ptr, *cmdbuf_endp; 1055 unsigned char *cmdbuf_ptr, *cmdbuf_endp;
1086 unsigned char cmdbuf_base[BUFSIZ]; 1056 unsigned char cmdbuf_base[BUFSIZ];
1087 unsigned char kbuf[KBUFSZ];
1088 1057
1089 rxvt_salloc *ralloc; 1058 rxvt_salloc *ralloc;
1090 rxvt_salloc *talloc; 1059 rxvt_salloc *talloc;
1091 1060
1092 void paste (const unsigned char *data, unsigned int len); 1061 void paste (const unsigned char *data, unsigned int len);
1128 bool pty_fill (); 1097 bool pty_fill ();
1129 void process_x_events (); 1098 void process_x_events ();
1130 1099
1131 void *operator new (size_t s); 1100 void *operator new (size_t s);
1132 void operator delete (void *p, size_t s); 1101 void operator delete (void *p, size_t s);
1102
1103 void init_secondary ();
1104 const char **init_resources (int argc, const char *const *argv);
1105 void init_env ();
1106 void set_locale (const char *locale);
1107 void init_xlocale ();
1108 void init_command (const char *const *argv);
1109 int run_command (const char *const *argv);
1110 int run_child (const char *const *argv);
1111
1112 void color_aliases(int idx);
1113 void recolour_cursor ();
1114 void create_windows (int argc, const char *const *argv);
1115 void resize_all_windows (unsigned int width, unsigned int height, int ignoreparent);
1116 void window_calc (unsigned int width, unsigned int height);
1117 void set_preedit_area (XRectangle * preedit_rect, XRectangle * status_rect, XRectangle * needed_rect);
1118
1119#if USE_XIM
1120 void set_size (XRectangle *size);
1121 void set_position (XPoint *pos);
1122 void set_color (unsigned long *fg, unsigned long *bg);
1123#endif
1124
1125 void resize_scrollbar ();
1126
1127 void pixel_position (int *x, int *y);
1128
1129 void selection_click (int clicks, int x, int y);
1130 void selection_extend (int x, int y, int flag);
1131 void selection_rotate (int x, int y);
1133 1132
1134 /* screen(!) */ 1133 /* screen(!) */
1135 void scr_blank_line (text_t *et, rend_t *er, unsigned int width, rend_t efs); 1134 void scr_blank_line (text_t *et, rend_t *er, unsigned int width, rend_t efs);
1136 void scr_blank_screen_mem (text_t **tp, rend_t **rp, unsigned int row, rend_t efs); 1135 void scr_blank_screen_mem (text_t **tp, rend_t **rp, unsigned int row, rend_t efs);
1137 int scr_scroll_text (int row1, int row2, int count, int spec); 1136 int scr_scroll_text (int row1, int row2, int count, int spec);
1138 void scr_reset (); 1137 void scr_reset ();
1139 void scr_reset_realloc (); 1138 void scr_reset_realloc ();
1140 void scr_release (); 1139 void scr_release ();
1140 void scr_clear ();
1141 void scr_refresh (unsigned char refresh_type);
1142 void scr_erase_screen (int mode);
1143 void scr_touch (bool refresh);
1144 void scr_expose (int x, int y, int width, int height, bool refresh);
1141}; 1145};
1146
1147#define SET_LOCALE(locale) rxvt_set_locale (locale)
1148extern void rxvt_set_locale (const char *locale);
1142 1149
1143#ifndef __attribute__ 1150#ifndef __attribute__
1144# ifdef __GNUC__ 1151# ifdef __GNUC__
1145# if (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || (__GNUC__ < 2) 1152# if (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || (__GNUC__ < 2)
1146# define __attribute__(x) 1153# define __attribute__(x)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines