📄 rxvtlib.h
字号:
/*--------------------------------*-H-*---------------------------------* * File: rxvtlib.h *----------------------------------------------------------------------* * * All portions of code are copyright by their respective author/s. * Copyright (c) 1997-2001 Geoff Wing <gcw@pobox.com> * Copyright (c) 2004 Terry Griffin <griffint@pobox.com> * Copyright (c) 2005 Teun Burgers <burgers@ecn.nl> * Copyright (c) 2004-2005 Jingmin Zhou <jimmyzhou@users.sourceforge.net> * Copyright (c) 2005 Gautam Iyer <gi1242@users.sourceforge.net> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *----------------------------------------------------------------------*/#ifndef __RXVTLIB_H__#define __RXVTLIB_H__/* * Boolean variables */#ifdef __GNUC__# define BOOLVAR(x, sz) x:sz#else# define BOOLVAR(x, sz) x#endif/* * If we haven't pulled in typedef's like RINT16T then do them ourself * type of (normal and unsigned) basic sizes */#if (SIZEOF_INT_P == 8)/* we have 8 byte pointers on 64bit systems */# if (SIZEOF_INT == 8)typedef int intp_t;typedef unsigned int u_intp_t;# elif (SIZEOF_LONG == 8)typedef long intp_t;typedef unsigned long u_intp_t;# else# error No 8 byte integer type available# endif#else/* * If we have <inttypes.h>, use *intptr_t instead of *INT32T. This eliminates * some problems on 64-bit systems. Reported by David Mosberger * (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=312710). Patch is applied * after slight modification. :-) */# ifdef HAVE_INTTYPES_Htypedef intptr_t intp_t;typedef uintptr_t u_intp_t;# else/* whatever normal size corresponds to a integer pointer */typedef RINT32T intp_t;/* whatever normal size corresponds to a unsigned integer pointer */typedef RUINT32T u_intp_t;# endif /* HAVE_INTTYPES_H */#endif/* type of unicode_t */typedef RUINT32T unicode_t;/***************************************************************************** * SECTION 2 * * DO NOT TOUCH ANYTHING BELOW HERE * *****************************************************************************/struct rxvt_vars; /* defined later on */struct rxvt_hidden; /* not defined here */typedef struct { RINT32T row; RINT32T col;} row_col_t;typedef unsigned char text_t;#if defined(TTY_256COLOR) || defined(MULTICHAR_SET)# define rend_t RUINT32T#else# define rend_t RUINT16T#endif/* * TermWin elements limits * ncol : 1 <= ncol <= MAX(RINT16T) * nrow : 1 <= nrow <= MAX(RINT16T) * saveLines : 0 <= saveLines <= MAX(RINT16T) * nscrolled : 0 <= nscrolled <= saveLines * view_start: 0 <= view_start <= nscrolled */typedef struct { RUINT16T fwidth, /* font width [pixels] */ fheight; /* font height [pixels] */#ifdef XFT_SUPPORT RUINT16T pwidth, /* propotionally spaced font width / height */ pheight;#endif RUINT16T propfont; /* font proportional flags */ RUINT16T ncol; /* window columns [characters] */ RUINT16T nrow; /* window rows [characters] */ RUINT16T mapped; /* TermWin is mapped? */ RUINT16T int_bwidth; /* internal border width */ RUINT16T ext_bwidth; /* external border width */ RUINT16T maxTabWidth, /* max width of tab title to display */ minVisibleTabs; /* Minimum number of tabs to try and keep visible */#ifndef NO_LINESPACE RUINT16T lineSpace; /* space between rows */#endif char BOOLVAR(focus,1); /* window is focused? */ char enter; /* pointer is in window? */ Window parent; /* parent window */ GC gc; /* GC for drawing text */ XFontStruct* font; /* main font structure */#ifndef NO_BOLDFONT XFontStruct* bfont; /* bold font */#endif#ifdef MULTICHAR_SET XFontStruct* mfont; /* Multichar font structure */#endif#ifdef USE_XIM XFontSet fontset;#endif#ifdef XFT_SUPPORT XftPattern* xftpattern; XftFont *xftfont, *xftpfont, *xftPfont;# ifdef MULTICHAR_SET XftPattern* xftmpattern; XftFont* xftmfont; int xftmsize;# ifdef HAVE_ICONV_H iconv_t xfticonv;# endif# endif# ifndef NO_BOLDFONT XftPattern* xftbpattern; XftFont* xftbfont; char bf_switched;/* bold and normal font switched? */# endif char xftfnmono; /* font is mono? */ char xftmono; /* font and mfont are mono? */ int xftsize, xftpsize;#endif /* XFT_SUPPORT */# define PARENT_NUMBER (6) int opacity; /* transluscent window opaque degree */ int opacity_degree; /* opaque change degree */#ifdef TRANSPARENT Window parenttree[PARENT_NUMBER];#endif#ifdef TINTING_SUPPORT int shade; /* tinting shade percentage */#endif#ifdef OFF_FOCUS_FADING int fade; /* off-focus fading percentage */#endif#ifdef TEXT_SHADOW enum { SHADOW_NONE = 0, SHADOW_LEFT, SHADOW_RIGHT, SHADOW_TOP, SHADOW_BOTTOM, SHADOW_TOPLEFT, SHADOW_BOTRIGHT, SHADOW_TOPRIGHT, SHADOW_BOTLEFT, } shadow_mode; unsigned long shadow; /* text shadow color */# ifdef XFT_SUPPORT XftColor xftshadow;# endif#endif#ifdef HAVE_X11_SM_SMLIB_H SmcConn sm_conn; IceConn ice_conn; int ice_fd; char* sm_client_id;#endif} TermWin_t;/* * screen accounting: * screen_t elements * text: Contains all text information including the scrollback buffer. * Each line is length TermWin.ncol * tlen: The length of the line or -1 for wrapped lines. * rend: Contains rendition information: font, bold, colour, etc. * * Note: Each line for both text and rend are only allocated on demand, and * text[x] is allocated <=> rend[x] is allocated for all x. * row: Cursor row position : 0 <= row < TermWin.nrow * col: Cursor column position : 0 <= col < TermWin.ncol * tscroll: Scrolling region top row inclusive : 0 <= row < TermWin.nrow * bscroll: Scrolling region bottom row inclusive : 0 <= row < TermWin.nrow * * selection_t elements * clicks: 1, 2 or 3 clicks - 4 indicates a special condition of 1 where * nothing is selected * beg: row/column of beginning of selection : never past mark * mark: row/column of initial click : never past end * end: row/column of one character past end of selection * * Note: -TermWin.nscrolled <= beg.row <= mark.row <= end.row < TermWin.nrow * * Note: col == -1 ==> we're left of screen * * Layout of text/rend information in the screen_t text/rend structures: * Rows [0] ... [TermWin.saveLines - 1] * scrollback region : we're only here if TermWin.view_start != 0 * Rows [TermWin.saveLines] ... [TermWin.saveLines + TermWin.nrow - 1] * normal `unscrolled' screen region */typedef struct { text_t** text; /* _all_ the text */ RINT16T* tlen; /* length of each text line */ rend_t** rend; /* rendition, uses RS_ flags */ row_col_t cur; /* cursor position on the screen */ RUINT16T tscroll; /* top of settable scroll region */ RUINT16T bscroll; /* bottom of settable scroll region */ RUINT16T charset; /* character set number [0..3] */ unsigned int flags; /* see below */ row_col_t s_cur; /* saved cursor position */ RUINT16T s_charset; /* saved character set number [0..3] */ char s_charset_char; rend_t s_rstyle; /* saved rendition style */} screen_t;typedef struct { unsigned char* text; /* selected text */ RUINT32T len; /* length of selected text */ enum { SELECTION_CLEAR = 0,/* nothing selected */ SELECTION_INIT, /* marked a point */ SELECTION_BEGIN, /* started a selection */ SELECTION_CONT, /* continued selection */ SELECTION_DONE /* selection put in CUT_BUFFER0 */ } op; /* current operation */ short vt; /* VT that has the selection */ short screen; /* screen being used */ short clicks; /* number of clicks */ row_col_t beg; /* beginning of selection <= mark */ row_col_t mark; /* point of initial click <= end */ row_col_t end; /* one character past end point */} selection_t;typedef enum { OLD_SELECT, OLD_WORD_SELECT, NEW_SELECT} sstyle_t;/* ------------------------------------------------------------------------- *//* screen_t flags */#define Screen_Relative (1<<0) /* relative origin mode flag */#define Screen_VisibleCursor (1<<1) /* cursor visible? */#define Screen_Autowrap (1<<2) /* auto-wrap flag */#define Screen_Insert (1<<3) /* insert mode (vs. overstrike) */#define Screen_WrapNext (1<<4) /* need to wrap for next char? */#define Screen_DefaultFlags (Screen_VisibleCursor|Screen_Autowrap)/* rxvt_vars.Options */#define Opt_console (1LU<<0)#define Opt_loginShell (1LU<<1)#define Opt_iconic (1LU<<2)#define Opt_visualBell (1LU<<3)#define Opt_mapAlert (1LU<<4)#define Opt_reverseVideo (1LU<<5)#define Opt_utmpInhibit (1LU<<6)#define Opt_scrollBar (1LU<<7)#define Opt_scrollBar_right (1LU<<8)#define Opt_scrollBar_floating (1LU<<9)#define Opt_meta8 (1LU<<10)#define Opt_scrollTtyOutputInhibit (1LU<<11)#define Opt_scrollTtyKeypress (1LU<<12)#define Opt_transparent (1LU<<13)#define Opt_forceTransparent (1LU<<14)#define Opt_mc_hack (1LU<<15)#define Opt_tripleclickwords (1LU<<16)#define Opt_scrollWithBuffer (1LU<<17)#define Opt_jumpScroll (1LU<<18)#define Opt_mouseWheelScrollPage (1LU<<19)#define Opt_pointerBlank (1LU<<20)#define Opt_cursorBlink (1LU<<21)#ifdef HAVE_SCROLLBARS# define Opt_transparent_scrollbar (1LU<<22)#endif#ifdef HAVE_MENUBAR# define Opt_transparent_menubar (1LU<<23)# define Opt_showMenu (1LU<<24)#endif#define Opt_transparent_tabbar (1LU<<25)#define Opt_tabPixmap (1LU<<26)#ifdef XFT_SUPPORT# define Opt_xft (1LU<<27)#endif#define DEFAULT_OPTIONS \ (Opt_scrollBar | Opt_jumpScroll)/* rxvt_vars.Options2 */#define Opt2_protectSecondary (1LU<<0)/* #define Opt2_cmdInitTabs (1LU<<1) OBSOLETE */#define Opt2_cmdAllTabs (1LU<<2)#ifdef XFT_SUPPORT# ifdef MULTICHAR_SET# define Opt2_xftNomFont (1LU<<3)# define Opt2_xftSlowOutput (1LU<<4)# endif# define Opt2_xftAntialias (1LU<<5)# define Opt2_xftHinting (1LU<<6)# define Opt2_xftAutoHint (1LU<<7)# define Opt2_xftGlobalAdvance (1LU<<8)#endif#define Opt2_syncTabTitle (1LU<<9)#define Opt2_syncTabIcon (1LU<<10)#define Opt2_hideTabbar (1LU<<11)#define Opt2_bottomTabbar (1LU<<12)#define Opt2_borderLess (1LU<<13)#define Opt2_overrideRedirect (1LU<<14)#define Opt2_holdExit (1LU<<15)#define Opt2_broadcast (1LU<<16)#define Opt2_hideButtons (1LU<<17)#define Opt2_veryBold (1LU<<18)#define Opt2_noSysConfig (1LU<<19)#define Opt2_disableMacros (1LU<<20)#ifdef HAVE_X11_SM_SMLIB_H# define Opt2_enableSessionMgt (1LU<<21)#endif/* #define Opt2_tabShell (1LU<<22) */#define Opt2_linuxHomeEndKey (1LU<<23)#define Opt2_hlTabOnBell (1LU<<24)#define Opt2_smoothResize (1LU<<25)#define Opt2_smartResize (1LU<<26)#define Opt2_autohideTabbar (1LU<<27)#define Opt2_maximized (1LU<<28)#define Opt2_fullscreen (1LU<<29)#ifdef XFT_SUPPORT# define DEFAULT_OPTIONS2 \ (Opt2_veryBold | Opt2_smartResize | Opt2_xftAntialias)#else# define DEFAULT_OPTIONS2 \ (Opt2_veryBold | Opt2_smartResize)#endif/* place holder used for parsing command-line options */#define Opt_Reverse (1LU<<30)#define Opt_Boolean (1LU<<31)#define PROPFONT_NORMAL (1<<0)#define PROPFONT_BOLD (1<<1)#define PROPFONT_MULTI (1<<2)/* * Weather or not we should use xftPfont / xftpfont while drawing text. This has * ABSOLUTELY NOTHING to do with PROPFONT_* or the propfont junk. This is used * for drawing tab titles / menubar / etc. */#define NO_PFONT (0)#define USE_PFONT (1)#define USE_BOLD_PFONT (2)/* ------------------------------------------------------------------------- */#ifdef HAVE_MENUBARtypedef struct { short state; Window win; GC gc;# ifdef BACKGROUND_IMAGE Pixmap pixmap;# endif unsigned long fg; unsigned long bg; unsigned long topshadow; unsigned long botshadow;# ifdef XFT_SUPPORT XftDraw *xftDraw; XftColor xftFore;# endif} menuBar_t;#endif#ifdef HAVE_SCROLLBARStypedef struct { char state; /* scrollbar state */ char init; /* scrollbar has been initialised */ short beg; /* slider sub-window begin height */ short end; /* slider sub-window end height */ short top; /* slider top position */ short bot; /* slider bottom position */ short style; /* style: rxvt, xterm, next */ short width; /* scrollbar width */ Window win; int (*update)(struct rxvt_vars *, int, int, int, int); GC gc;# ifdef BACKGROUND_IMAGE Pixmap pixmap;# endif# ifdef RXVT_SCROLLBAR unsigned long rxvt_fg; unsigned long rxvt_bg; unsigned long rxvt_topshadow; unsigned long rxvt_botshadow;# endif# ifdef XTERM_SCROLLBAR unsigned long xterm_fg; unsigned long xterm_bg; unsigned long xterm_shadow;# endif# ifdef PLAIN_SCROLLBAR unsigned long plain_fg; unsigned long plain_bg;# endif# ifdef NEXT_SCROLLBAR unsigned long next_fg; /* black */ unsigned long next_bg; /* gray */ unsigned long next_white; unsigned long next_dark; GC next_stippleGC; Pixmap next_dimple, next_upArrow, next_upArrowHi, next_downArrow, next_downArrowHi;# endif# ifdef SGI_SCROLLBAR unsigned long sgi_fg; /* medium */ unsigned long sgi_bg; /* light */ unsigned long sgi_black; unsigned long sgi_white; unsigned long sgi_lmedium; unsigned long sgi_dark; unsigned long sgi_vdark; GC sgi_stippleGC; Pixmap sgi_dimple, sgi_upArrow, sgi_upArrowHi, sgi_upArrowLow,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -