📄 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/* type of unicode_t */typedef uint32_t unicode_t;/***************************************************************************** * SECTION 2 * * DO NOT TOUCH ANYTHING BELOW HERE * *****************************************************************************/struct rxvt_vars; /* defined later on */struct rxvt_hidden; /* not defined here */typedef struct { int32_t row; int32_t col;} row_col_t;typedef unsigned char text_t;#if defined(TTY_256COLOR) || defined(MULTICHAR_SET)# define rend_t uint32_t#else# define rend_t uint16_t#endif/* Size of the FIFO buffer */#define FIFO_BUF_SIZE (512)/* * TermWin elements limits * ncol : 1 <= ncol <= MAX(int16_t) * nrow : 1 <= nrow <= MAX(int16_t) * saveLines : 0 <= saveLines <= MAX(int16_t) * nscrolled : 0 <= nscrolled <= saveLines * view_start: 0 <= view_start <= nscrolled */typedef struct { uint16_t fwidth, /* font width [pixels] */ fheight; /* font height [pixels] */#ifdef XFT_SUPPORT uint16_t pwidth, /* propotionally spaced font width / height */ pheight;#endif uint16_t propfont; /* font proportional flags */ uint16_t ncol; /* window columns [characters] */ uint16_t nrow; /* window rows [characters] */ uint16_t mapped; /* TermWin is mapped? */ uint16_t int_bwidth; /* internal border width */ uint16_t ext_bwidth; /* external border width */ uint16_t maxTabWidth, /* max width of tab title to display */ minVisibleTabs; /* Minimum number of tabs to try and keep visible */#ifndef NO_LINESPACE uint16_t 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 XftFont* xftbfont;# 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 int fade; /* off-focus fading percentage */#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#ifndef NO_BELL unsigned long vBellDuration;#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 */ int16_t* tlen; /* length of each text line */ rend_t** rend; /* rendition, uses RS_ flags */ row_col_t cur; /* cursor position on the screen */ uint16_t tscroll; /* top of settable scroll region */ uint16_t bscroll; /* bottom of settable scroll region */ uint16_t charset; /* character set number [0..3] */ unsigned int flags; /* see below */ row_col_t s_cur; /* saved cursor position */ uint16_t 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 */ uint32_t 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)#define IS_OPTION1 (0x00000000)#define IS_OPTION2 (0x00000001)#define IS_OPTION3 (0x00000002)#define IS_OPTION4 (0x00000003)#define OPTION_MASK (0x00000003)#define MAX_OPTION_ARRAY (4)/* rxvt_vars.Options *//* * Bits corresponding to 1<<2 through 1<<30 can be used for option flags. 1<<31 * is reserved for "reverse" options (which I think is obsolete), and the least * two significant bits are used to get the array index of r->Options. */#define Opt_console ((1LU<<2) | IS_OPTION1)#define Opt_loginShell ((1LU<<3) | IS_OPTION1)#define Opt_iconic ((1LU<<4) | IS_OPTION1)#define Opt_visualBell ((1LU<<5) | IS_OPTION1)#define Opt_currentTabVBell ((1LU<<6) | IS_OPTION1)#define Opt_mapAlert ((1LU<<7) | IS_OPTION1)#define Opt_reverseVideo ((1LU<<8) | IS_OPTION1)#define Opt_utmpInhibit ((1LU<<9) | IS_OPTION1)#define Opt_scrollBar ((1LU<<10) | IS_OPTION1)#define Opt_scrollBar_right ((1LU<<11) | IS_OPTION1)#define Opt_scrollBar_floating ((1LU<<12) | IS_OPTION1)#define Opt_meta8 ((1LU<<13) | IS_OPTION1)#define Opt_scrollTtyOutputInhibit ((1LU<<14) | IS_OPTION1)#define Opt_scrollTtyKeypress ((1LU<<15) | IS_OPTION1)#define Opt_transparent ((1LU<<16) | IS_OPTION1)#define Opt_forceTransparent ((1LU<<17) | IS_OPTION1)#define Opt_mc_hack ((1LU<<18) | IS_OPTION1)#define Opt_tripleclickwords ((1LU<<19) | IS_OPTION1)#define Opt_mouseWheelScrollPage ((1LU<<20) | IS_OPTION1)#define Opt_pointerBlank ((1LU<<21) | IS_OPTION1)#define Opt_cursorBlink ((1LU<<22) | IS_OPTION1)#ifdef HAVE_SCROLLBARS# define Opt_transparent_scrollbar ((1LU<<23) | IS_OPTION1)#endif#ifdef HAVE_MENUBAR# define Opt_transparent_menubar ((1LU<<24) | IS_OPTION1)# define Opt_showMenu ((1LU<<25) | IS_OPTION1)#endif#define Opt_transparent_tabbar ((1LU<<26) | IS_OPTION1)#define Opt_tabPixmap ((1LU<<27) | IS_OPTION1)#ifdef XFT_SUPPORT# define Opt_xft ((1LU<<28) | IS_OPTION1)#endif#ifdef USE_FIFO# define Opt_useFifo ((1LU<<29) | IS_OPTION1)#endif/*USE_FIFO*/#define DEFAULT_OPTIONS \ (Opt_scrollBar)/* rxvt_vars.Options2 */#define Opt2_protectSecondary ((1LU<<2) | IS_OPTION2)#define Opt2_cmdAllTabs ((1LU<<3) | IS_OPTION2)#ifdef XFT_SUPPORT# ifdef MULTICHAR_SET# define Opt2_xftNomFont ((1LU<<4) | IS_OPTION2)# define Opt2_xftSlowOutput ((1LU<<5) | IS_OPTION2)# endif# define Opt2_xftAntialias ((1LU<<6) | IS_OPTION2)# define Opt2_xftHinting ((1LU<<7) | IS_OPTION2)# define Opt2_xftAutoHint ((1LU<<8) | IS_OPTION2)# define Opt2_xftGlobalAdvance ((1LU<<9) | IS_OPTION2)#endif#define Opt2_syncTabTitle ((1LU<<10) | IS_OPTION2)#define Opt2_syncTabIcon ((1LU<<11) | IS_OPTION2)#define Opt2_hideTabbar ((1LU<<12) | IS_OPTION2)#define Opt2_bottomTabbar ((1LU<<13) | IS_OPTION2)#define Opt2_borderLess ((1LU<<14) | IS_OPTION2)#define Opt2_overrideRedirect ((1LU<<15) | IS_OPTION2)#define Opt2_broadcast ((1LU<<16) | IS_OPTION2)#define Opt2_hideButtons ((1LU<<17) | IS_OPTION2)#define Opt2_veryBold ((1LU<<18) | IS_OPTION2)#ifndef NO_BRIGHTCOLOR# define Opt2_boldColors ((1LU<<19) | IS_OPTION2)# define Opt_veryBright ((1LU<<20) | IS_OPTION2)#endif#define Opt2_noSysConfig ((1LU<<21) | IS_OPTION2)#define Opt2_disableMacros ((1LU<<22) | IS_OPTION2)#ifdef HAVE_X11_SM_SMLIB_H# define Opt2_enableSessionMgt ((1LU<<23) | IS_OPTION2)#endif#define Opt2_linuxHomeEndKey ((1LU<<24) | IS_OPTION2)#define Opt2_hlTabOnBell ((1LU<<25) | IS_OPTION2)#define Opt2_smoothResize ((1LU<<26) | IS_OPTION2)#define Opt2_smartResize ((1LU<<27) | IS_OPTION2)#define Opt2_autohideTabbar ((1LU<<28) | IS_OPTION2)#define Opt2_maximized ((1LU<<29) | IS_OPTION2)#define Opt2_fullscreen ((1LU<<30) | IS_OPTION2)#ifdef XFT_SUPPORT# define DEFAULT_OPTIONS2 \ (Opt2_veryBold | Opt2_smartResize | Opt2_xftAntialias)#else# define DEFAULT_OPTIONS2 \ (Opt2_veryBold | Opt2_smartResize)#endif#define DEFAULT_OPTIONS3 \ (IS_OPTION3)#define DEFAULT_OPTIONS4 \ (IS_OPTION4)/* place holder used for parsing command-line options */#define Opt_Reverse (1LU<<31)/* Macros to manipulate options (given an option array) */#define ISSET_ARRAYOPT( array, option ) \ ( (array)[ (option) & OPTION_MASK ] & ( (option) & ~OPTION_MASK ) )#define NOTSET_ARRAYOPT( array, option ) \ !ISSET_ARRAYOPT( array, option )
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -