1 /*--------------------------------*-H-*---------------------------------* 2 * File: rxvtlib.h 3 *----------------------------------------------------------------------* 4 * 5 * All portions of code are copyright by their respective author/s. 6 * Copyright (c) 1997-2001 Geoff Wing <gcw@pobox.com> 7 * Copyright (c) 2004 Terry Griffin <griffint@pobox.com> 8 * Copyright (c) 2005 Teun Burgers <burgers@ecn.nl> 9 * Copyright (c) 2004-2005 Jingmin Zhou <jimmyzhou@users.sourceforge.net> 10 * 11 * This program is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by 13 * the Free Software Foundation; either version 2 of the License, or 14 * (at your option) any later version. 15 * 16 * This program is distributed in the hope that it will be useful, 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details. 20 * 21 * You should have received a copy of the GNU General Public License 22 * along with this program; if not, write to the Free Software 23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 *----------------------------------------------------------------------*/ 25 /* 26 ** $Id: rxvtlib.h,v 1.137 2005/06/24 01:54:07 cvs Exp $ 27 */ 28 29 #ifndef __RXVTLIB_H__ 30 #define __RXVTLIB_H__ 31 32 33 /* 34 * If we haven't pulled in typedef's like RINT16T then do them ourself 35 * type of (normal and unsigned) basic sizes 36 */ 37 #if (SIZEOF_INT_P == 8) 38 /* we have 8 byte pointers on 64bit systems */ 39 # if (SIZEOF_INT == 8) 40 typedef int intp_t; 41 typedef unsigned int u_intp_t; 42 # elif (SIZEOF_LONG == 8) 43 typedef long intp_t; 44 typedef unsigned long u_intp_t; 45 # else 46 # error No 8 byte integer type available 47 # endif 48 #else 49 /* If we have <inttypes.h>, use *intptr_t instead of *INT32T. This 50 ** eliminates some problems on 64-bit systems. Reported by David 51 ** Mosberger (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=312710). 52 ** Patch is applied after slight modification. :-) */ 53 # ifdef HAVE_INTTYPES_H 54 typedef intptr_t intp_t; 55 typedef uintptr_t u_intp_t; 56 # else 57 /* whatever normal size corresponds to a integer pointer */ 58 typedef RINT32T intp_t; 59 /* whatever normal size corresponds to a unsigned integer pointer */ 60 typedef RUINT32T u_intp_t; 61 # endif /* HAVE_INTTYPES_H */ 62 #endif 63 /* type of unicode_t */ 64 typedef RUINT32T unicode_t; 65 66 67 /***************************************************************************** 68 * SECTION 2 * 69 * DO NOT TOUCH ANYTHING BELOW HERE * 70 *****************************************************************************/ 71 72 struct rxvt_vars; /* defined later on */ 73 struct rxvt_hidden; /* not defined here */ 74 75 typedef struct { 76 RINT32T row; 77 RINT32T col; 78 } row_col_t; 79 80 typedef unsigned char text_t; 81 #if defined(TTY_256COLOR) || defined(MULTICHAR_SET) 82 # define rend_t RUINT32T 83 #else 84 # define rend_t RUINT16T 85 #endif 86 87 /* 88 * TermWin elements limits 89 * ncol : 1 <= ncol <= MAX(RINT16T) 90 * nrow : 1 <= nrow <= MAX(RINT16T) 91 * saveLines : 0 <= saveLines <= MAX(RINT16T) 92 * nscrolled : 0 <= nscrolled <= saveLines 93 * view_start: 0 <= view_start <= nscrolled 94 */ 95 96 typedef struct { 97 RUINT16T fwidth; /* font width [pixels] */ 98 RUINT16T fheight; /* font height [pixels] */ 99 RUINT16T propfont; /* font proportional flags */ 100 RUINT16T ncol; /* window columns [characters] */ 101 RUINT16T nrow; /* window rows [characters] */ 102 RUINT16T mapped; /* TermWin is mapped? */ 103 RUINT16T int_bwidth; /* internal border width */ 104 RUINT16T ext_bwidth; /* external border width */ 105 RUINT16T saveLines; /* number of lines to save for all tabs */ 106 #ifndef NO_LINESPACE 107 RUINT16T lineSpace; /* space between rows */ 108 #endif 109 110 char focus; /* window is focused? */ 111 char enter; /* pointer is in window? */ 112 113 Window parent; /* parent window */ 114 GC gc; /* GC for drawing text */ 115 XFontStruct* font; /* main font structure */ 116 #ifndef NO_BOLDFONT 117 XFontStruct* bfont; /* bold font */ 118 #endif 119 #ifdef MULTICHAR_SET 120 XFontStruct* mfont; /* Multichar font structure */ 121 #endif 122 #ifdef USE_XIM 123 XFontSet fontset; 124 #endif 125 #ifdef XFT_SUPPORT 126 XftPattern* xftpattern; 127 XftFont* xftfont; 128 # ifdef MULTICHAR_SET 129 XftPattern* xftmpattern; 130 XftFont* xftmfont; 131 int xftmsize; 132 # ifdef HAVE_ICONV_H 133 iconv_t xfticonv; 134 # endif 135 # endif 136 # ifndef NO_BOLDFONT 137 XftPattern* xftbpattern; 138 XftFont* xftbfont; 139 char bf_switched;/* bold and normal font switched? */ 140 # endif 141 char xftfnmono; /* font is mono? */ 142 char xftmono; /* font and mfont are mono? */ 143 int xftsize; 144 #endif /* XFT_SUPPORT */ 145 146 # define PARENT_NUMBER (6) 147 int opacity; /* transluscent window opaque degree */ 148 int opacity_degree; /* opaque change degree */ 149 150 #ifdef TRANSPARENT 151 Pixmap pixmap; /* background image from XROOT, only 152 ** used for transparent window */ 153 Window parenttree[PARENT_NUMBER]; 154 #endif 155 156 #if defined(TRANSPARENT) || defined(BACKGROUND_IMAGE) 157 int bgfade; /* fade percentage */ 158 # ifdef TINTING_SUPPORT 159 int shade; /* tinting shade percentage */ 160 # endif 161 #endif 162 163 #ifdef OFF_FOCUS_FADING 164 int fade; /* off-focus fading percentage */ 165 #endif 166 167 #ifdef TEXT_SHADOW 168 enum { 169 SHADOW_NONE = 0, 170 SHADOW_LEFT, 171 SHADOW_RIGHT, 172 SHADOW_TOP, 173 SHADOW_BOTTOM, 174 SHADOW_TOPLEFT, 175 SHADOW_BOTRIGHT, 176 SHADOW_TOPRIGHT, 177 SHADOW_BOTLEFT, 178 } shadow_mode; 179 unsigned long shadow; /* text shadow color */ 180 # ifdef XFT_SUPPORT 181 XftColor xftshadow; 182 # endif 183 #endif 184 185 #ifdef HAVE_X11_SM_SMLIB_H 186 SmcConn sm_conn; 187 IceConn ice_conn; 188 int ice_fd; 189 char* sm_client_id; 190 #endif 191 } TermWin_t; 192 193 194 195 /* 196 * screen accounting: 197 * screen_t elements 198 * text: Contains all text information including the scrollback buffer. 199 * Each line is length TermWin.ncol 200 * tlen: The length of the line or -1 for wrapped lines. 201 * rend: Contains rendition information: font, bold, colour, etc. 202 * * Note: Each line for both text and rend are only allocated on demand, and 203 * text[x] is allocated <=> rend[x] is allocated for all x. 204 * row: Cursor row position : 0 <= row < TermWin.nrow 205 * col: Cursor column position : 0 <= col < TermWin.ncol 206 * tscroll: Scrolling region top row inclusive : 0 <= row < TermWin.nrow 207 * bscroll: Scrolling region bottom row inclusive : 0 <= row < TermWin.nrow 208 * 209 * selection_t elements 210 * clicks: 1, 2 or 3 clicks - 4 indicates a special condition of 1 where 211 * nothing is selected 212 * beg: row/column of beginning of selection : never past mark 213 * mark: row/column of initial click : never past end 214 * end: row/column of one character past end of selection 215 * * Note: -TermWin.nscrolled <= beg.row <= mark.row <= end.row < TermWin.nrow 216 * * Note: col == -1 ==> we're left of screen 217 * 218 * Layout of text/rend information in the screen_t text/rend structures: 219 * Rows [0] ... [TermWin.saveLines - 1] 220 * scrollback region : we're only here if TermWin.view_start != 0 221 * Rows [TermWin.saveLines] ... [TermWin.saveLines + TermWin.nrow - 1] 222 * normal `unscrolled' screen region 223 */ 224 typedef struct { 225 text_t** text; /* _all_ the text */ 226 RINT16T* tlen; /* length of each text line */ 227 rend_t** rend; /* rendition, uses RS_ flags */ 228 row_col_t cur; /* cursor position on the screen */ 229 RUINT16T tscroll; /* top of settable scroll region */ 230 RUINT16T bscroll; /* bottom of settable scroll region */ 231 RUINT16T charset; /* character set number [0..3] */ 232 unsigned int flags; /* see below */ 233 row_col_t s_cur; /* saved cursor position */ 234 RUINT16T s_charset; /* saved character set number [0..3] */ 235 char s_charset_char; 236 rend_t s_rstyle; /* saved rendition style */ 237 } screen_t; 238 239 240 typedef struct { 241 unsigned char* text; /* selected text */ 242 RUINT32T len; /* length of selected text */ 243 enum { 244 SELECTION_CLEAR = 0,/* nothing selected */ 245 SELECTION_INIT, /* marked a point */ 246 SELECTION_BEGIN, /* started a selection */ 247 SELECTION_CONT, /* continued selection */ 248 SELECTION_DONE /* selection put in CUT_BUFFER0 */ 249 } op; /* current operation */ 250 short vt; /* VT that has the selection */ 251 short screen; /* screen being used */ 252 short clicks; /* number of clicks */ 253 row_col_t beg; /* beginning of selection <= mark */ 254 row_col_t mark; /* point of initial click <= end */ 255 row_col_t end; /* one character past end point */ 256 } selection_t; 257 258 typedef enum { 259 OLD_SELECT, OLD_WORD_SELECT, NEW_SELECT 260 } sstyle_t; 261 262 /* ------------------------------------------------------------------------- */ 263 264 /* screen_t flags */ 265 #define Screen_Relative (1<<0) /* relative origin mode flag */ 266 #define Screen_VisibleCursor (1<<1) /* cursor visible? */ 267 #define Screen_Autowrap (1<<2) /* auto-wrap flag */ 268 #define Screen_Insert (1<<3) /* insert mode (vs. overstrike) */ 269 #define Screen_WrapNext (1<<4) /* need to wrap for next char? */ 270 #define Screen_DefaultFlags (Screen_VisibleCursor|Screen_Autowrap) 271 272 /* rxvt_vars.Options */ 273 #define Opt_console (1LU<<0) 274 #define Opt_loginShell (1LU<<1) 275 #define Opt_iconic (1LU<<2) 276 #define Opt_visualBell (1LU<<3) 277 #define Opt_mapAlert (1LU<<4) 278 #define Opt_reverseVideo (1LU<<5) 279 #define Opt_utmpInhibit (1LU<<6) 280 #define Opt_scrollBar (1LU<<7) 281 #define Opt_scrollBar_right (1LU<<8) 282 #define Opt_scrollBar_floating (1LU<<9) 283 #define Opt_meta8 (1LU<<10) 284 #define Opt_scrollTtyOutputInhibit (1LU<<11) 285 #define Opt_scrollTtyKeypress (1LU<<12) 286 #define Opt_transparent (1LU<<13) 287 #define Opt_transparent_all (1LU<<14) 288 #define Opt_mc_hack (1LU<<15) 289 #define Opt_tripleclickwords (1LU<<16) 290 #define Opt_scrollWithBuffer (1LU<<17) 291 #define Opt_jumpScroll (1LU<<18) 292 #define Opt_mouseWheelScrollPage (1LU<<19) 293 #define Opt_pointerBlank (1LU<<20) 294 #define Opt_cursorBlink (1LU<<21) 295 #ifdef HAVE_SCROLLBARS 296 # define Opt_transparent_scrollbar (1LU<<22) 297 #endif 298 #ifdef HAVE_MENUBAR 299 # define Opt_transparent_menubar (1LU<<23) 300 # define Opt_showMenu (1LU<<24) 301 #endif 302 #define Opt_transparent_tabbar (1LU<<25) 303 #define Opt_tabPixmap (1LU<<26) 304 #ifdef XFT_SUPPORT 305 # define Opt_xft (1LU<<27) 306 #endif 307 #ifdef THAI 308 # define Opt_thai (1LU<<28) 309 #endif 310 #define DEFAULT_OPTIONS \ 311 (Opt_scrollBar | Opt_jumpScroll) 312 313 /* rxvt_vars.Options2 */ 314 #define Opt2_protectSecondary (1LU<<0) 315 #define Opt2_cmdInitTabs (1LU<<1) 316 #define Opt2_cmdAllTabs (1LU<<2) 317 #ifdef XFT_SUPPORT 318 # ifdef MULTICHAR_SET 319 # define Opt2_xftNomFont (1LU<<3) 320 # define Opt2_xftSlowOutput (1LU<<4) 321 # endif 322 # define Opt2_xftAntialias (1LU<<5) 323 # define Opt2_xftHinting (1LU<<6) 324 # define Opt2_xftAutoHint (1LU<<7) 325 # define Opt2_xftGlobalAdvance (1LU<<8) 326 #endif 327 #define Opt2_syncTabTitle (1LU<<9) 328 #define Opt2_syncTabIcon (1LU<<10) 329 #define Opt2_hideTabbar (1LU<<11) 330 #define Opt2_bottomTabbar (1LU<<12) 331 #define Opt2_borderLess (1LU<<13) 332 #define Opt2_overrideRedirect (1LU<<14) 333 #define Opt2_holdExit (1LU<<15) 334 #define Opt2_broadcast (1LU<<16) 335 #define Opt2_hideButtons (1LU<<17) 336 #define Opt2_veryBold (1LU<<18) 337 #define Opt2_disableHotkeys (1LU<<19) 338 #define Opt2_disableDefaultHotkeys (1LU<<20) 339 #ifdef HAVE_X11_SM_SMLIB_H 340 # define Opt2_enableSessionMgt (1LU<<21) 341 #endif 342 #define Opt2_tabShell (1LU<<22) 343 #define Opt2_linuxHomeEndKey (1LU<<23) 344 #define DEFAULT_OPTIONS2 \ 345 (Opt2_veryBold) 346 347 /* place holder used for parsing command-line options */ 348 #define Opt_Reverse (1LU<<30) 349 #define Opt_Boolean (1LU<<31) 350 351 352 #define PROPFONT_NORMAL (1<<0) 353 #define PROPFONT_BOLD (1<<1) 354 #define PROPFONT_MULTI (1<<2) 355 356 /* ------------------------------------------------------------------------- */ 357 358 #ifdef HAVE_MENUBAR 359 typedef struct { 360 short state; 361 Window win; 362 GC gc; 363 # ifdef BACKGROUND_IMAGE 364 Pixmap pixmap; 365 # endif 366 unsigned long fg; 367 unsigned long bg; 368 unsigned long topshadow; 369 unsigned long botshadow; 370 } menuBar_t; 371 #endif 372 373 374 #ifdef HAVE_SCROLLBARS 375 typedef struct { 376 char state; /* scrollbar state */ 377 char init; /* scrollbar has been initialised */ 378 short beg; /* slider sub-window begin height */ 379 short end; /* slider sub-window end height */ 380 short top; /* slider top position */ 381 short bot; /* slider bottom position */ 382 short style; /* style: rxvt, xterm, next */ 383 short width; /* scrollbar width */ 384 Window win; 385 int (*update)(struct rxvt_vars *, int, int, int, int); 386 387 GC gc; 388 # ifdef BACKGROUND_IMAGE 389 Pixmap pixmap; 390 # endif 391 # ifdef RXVT_SCROLLBAR 392 unsigned long rxvt_fg; 393 unsigned long rxvt_bg; 394 unsigned long rxvt_topshadow; 395 unsigned long rxvt_botshadow; 396 # endif 397 # ifdef XTERM_SCROLLBAR 398 unsigned long xterm_fg; 399 unsigned long xterm_bg; 400 unsigned long xterm_shadow; 401 # endif 402 # ifdef PLAIN_SCROLLBAR 403 unsigned long plain_fg; 404 unsigned long plain_bg; 405 # endif 406 # ifdef NEXT_SCROLLBAR 407 unsigned long next_fg; /* black */ 408 unsigned long next_bg; /* gray */ 409 unsigned long next_white; 410 unsigned long next_dark; 411 GC next_stippleGC; 412 Pixmap next_dimple, 413 next_upArrow, 414 next_upArrowHi, 415 next_downArrow, 416 next_downArrowHi; 417 # endif 418 # ifdef SGI_SCROLLBAR 419 unsigned long sgi_fg; /* medium */ 420 unsigned long sgi_bg; /* light */ 421 unsigned long sgi_black; 422 unsigned long sgi_white; 423 unsigned long sgi_lmedium; 424 unsigned long sgi_dark; 425 unsigned long sgi_vdark; 426 GC sgi_stippleGC; 427 Pixmap sgi_dimple, 428 sgi_upArrow, 429 sgi_upArrowHi, 430 sgi_upArrowLow, 431 sgi_downArrow, 432 sgi_downArrowHi, 433 sgi_downArrowLow; 434 # endif 435 } scrollBar_t; 436 #endif /* HAVE_SCROLLBARS */ 437 438 439 typedef struct { 440 char state; /* tabbar state */ 441 442 short ltab; /* last tab */ 443 short atab; /* active tab */ 444 short ptab; /* previous active tab */ 445 short fvtab; /* first visible tab */ 446 short lvtab; /* last visible tab */ 447 448 Window win; 449 #ifdef BACKGROUND_IMAGE 450 Pixmap pixmap; /* tab background image */ 451 #endif 452 GC gc; /* tab background/foreground, grey25/black */ 453 unsigned long fg; /* foreground, black */ 454 unsigned long bg; /* background, grey25 */ 455 unsigned long ifg; /* inactive tab foreground, black */ 456 unsigned long ibg; /* inactive tab background, grey */ 457 char rsfg; /* fg resource has changed */ 458 char rsbg; /* bg resource has changed */ 459 char rsifg; /* ifg resource has changed */ 460 char rsibg; /* ibg resource has changed */ 461 unsigned long frame; /* tab frame, white */ 462 unsigned long delimit; /* delimit, dark grey */ 463 #ifdef XFT_SUPPORT 464 XftDraw* xftwin; /* XFT window */ 465 XftColor xftfg; /* foreground */ 466 XftColor xftifg; /* background */ 467 #endif 468 } tabBar_t; 469 470 471 #ifdef BACKGROUND_IMAGE 472 typedef struct { 473 short w, h, x, y; 474 Pixmap pixmap; 475 } bgPixmap_t; 476 #endif 477 478 479 /* To suppress compile warning without xpm library */ 480 #ifdef BACKGROUND_IMAGE 481 # ifndef HAVE_LIBXPM 482 # define XpmCloseness (0) 483 # define XpmColormap (0) 484 # define XpmVisual (0) 485 # define XpmDepth (0) 486 # define XpmSize (0) 487 # define XpmReturnPixels (0) 488 typedef struct { 489 unsigned long valuemask; 490 Visual* visual; 491 Colormap colormap; 492 unsigned int depth; 493 unsigned int width; 494 unsigned int height; 495 unsigned int closeness; 496 } XpmAttributes; 497 # endif /* HAVE_LIBXPM */ 498 #endif /* BACKGROUND_IMAGE */ 499 500 501 typedef enum { 502 TERMENV_XTERM = 0, 503 TERMENV_RXVT, 504 TERMENV_VT102, 505 TERMENV_VT100, 506 TERMENV_ANSI, 507 TERMENV_DUMB, 508 } termenv_t; 509 510 struct term_t; 511 typedef struct { 512 /* 513 ** Index to vts. If it's -1, then this term_t structure is not 514 ** used. Otherwise, it is used by pointer vts[vts_idx]. This 515 ** is to improve destroy performance so that we only need to 516 ** do (i = page..ltab) vts[i] = vts[i+1] instead of vterm[i] = 517 ** vterm[i+1]. 518 */ 519 short vts_idx; 520 521 /* moved from TermWin_t */ 522 RUINT16T saveLines; /* number of lines to save */ 523 RUINT16T num_scr; /* number of lines scrolled */ 524 RUINT16T nscrolled; /* number of line actually scrolled */ 525 RUINT16T view_start; /* scrollback view starts here */ 526 RUINT16T mapped; /* window state mapped? */ 527 RUINT16T init_screen; /* screen structure initialized? */ 528 529 Window vt; /* terminal window */ 530 #ifdef XFT_SUPPORT 531 XftDraw* xftvt; 532 #endif 533 #ifdef BACKGROUND_IMAGE 534 Pixmap pixmap; /* background image, NOT used by */ 535 bgPixmap_t bg; /* transparent window!!! */ 536 XpmAttributes xpm_attr; /* original attr of image */ 537 #endif 538 539 /* Apparently, people like fg/bg colors for individual terminal */ 540 unsigned long* p_fg; 541 unsigned long* p_bg; 542 #ifdef XFT_SUPPORT 543 XftColor* p_xftfg; 544 XftColor* p_xftbg; 545 #endif 546 547 /* moved from rxvt_t */ 548 text_t** drawn_text; /* text drawn on screen (characters) */ 549 rend_t** drawn_rend; /* text drawn on screen (rendition) */ 550 text_t** buf_text; 551 rend_t** buf_rend; 552 screen_t screen; 553 #if NSCREENS 554 screen_t swap; 555 #endif 556 /* move from hidden */ 557 rend_t rstyle; 558 559 RUINT16T prev_ncol; /* previous columns */ 560 RUINT16T prev_nrow; /* previous rows */ 561 /* moved from tab_t */ 562 short tab_width; /* tab width */ 563 char UNTAINTED * tab_title; /* tab title */ 564 565 /* moved from rxvt_t */ 566 int cmd_fd; /* pty file descriptor; connected to command */ 567 int tty_fd; /* tty file descriptor; connected to child */ 568 /* moved from hidden */ 569 int current_screen; 570 int hidden_pointer; /* pointer is hidden? */ 571 pid_t cmd_pid; 572 char* ttydev; 573 #ifndef RESET_TTY_TO_COMMON_DEFAULTS 574 struct stat ttyfd_stat; /* original status of our tty */ 575 #endif 576 #ifndef NO_SETOWNER_TTYDEV 577 unsigned char next_tty_action; 578 #endif 579 580 /* moved from hidden */ 581 unsigned long PrivateModes; 582 unsigned long SavedModes; 583 584 #ifdef UTMP_SUPPORT 585 #ifndef UTEMPTER_SUPPORT 586 # ifdef HAVE_STRUCT_UTMP 587 struct utmp ut; 588 # endif 589 # if defined(HAVE_STRUCT_UTMPX) && !defined(HAVE_STRUCT_UTMP) 590 struct utmpx utx; 591 # endif 592 # if (defined(HAVE_STRUCT_UTMP) && defined(HAVE_UTMP_PID)) || defined(HAVE_STRUCT_UTMPX) 593 char ut_id[5]; 594 # endif 595 int utmp_pos; 596 #endif /* UTEMPTER_SUPPORT */ 597 unsigned char next_utmp_action; 598 #endif 599 600 char** command_argv; 601 int command_argc; 602 603 /* move from rxvt_hidden */ 604 ttymode_t tio; 605 unsigned int ttymode; 606 char rvideo; 607 #ifdef MULTICHAR_SET 608 char chstat, 609 /* set ==> we only got half a glyph */ 610 lost_multi, 611 /* set ==> currently using 2 bytes per glyph */ 612 multi_byte; 613 #endif 614 char charsets[4]; 615 616 /* need to hold the terminal? 617 ** hold == 0: not hold 618 ** hold == 1: hold 619 ** hold > 1: can destroy the terminal now 620 */ 621 char hold; 622 /* the terminal is dead or alive? */ 623 char dead; 624 /* the terminal is highlighted? */ 625 char highlight; 626 627 /* the terminal TERM type */ 628 termenv_t termenv; 629 630 clock_t checksum; /* unique id of this terminal */ 631 632 /* write out buffer */ 633 unsigned char* v_buffer; /* pointer to physical buffer */ 634 unsigned char* v_bufstr; /* beginning of area to write */ 635 unsigned char* v_bufptr; /* end of area to write */ 636 unsigned char* v_bufend; /* end of physical buffer */ 637 638 /* command input buffering */ 639 unsigned char* cmdbuf_ptr; 640 unsigned char* cmdbuf_endp; 641 unsigned char cmdbuf_base[BUFSIZ]; 642 } term_t; 643 644 645 646 typedef enum { 647 HKF_DUMMY = 0, /* dummy hotkey, not used */ 648 HKF_CHANGE_TITLE, /* change tab title */ 649 HKF_NEW_TAB, /* create new tab */ 650 HKF_KILL_TAB, /* kill current tab */ 651 HKF_PREV_TAB, /* activate previous tab */ 652 HKF_NEXT_TAB, /* activate next tab */ 653 HKF_PREV_ATAB, /* activate previous active tab */ 654 HKF_TAB_1, /* activate tab 1 */ 655 HKF_TAB_2, /* activate tab 2 */ 656 HKF_TAB_3, /* activate tab 3 */ 657 HKF_TAB_4, /* activate tab 4 */ 658 HKF_TAB_5, /* activate tab 5 */ 659 HKF_TAB_6, /* activate tab 6 */ 660 HKF_TAB_7, /* activate tab 7 */ 661 HKF_TAB_8, /* activate tab 8 */ 662 HKF_TAB_9, /* activate tab 9 */ 663 HKF_TAB_10, /* activate tab 10 */ 664 HKF_TAB_11, /* activate tab 11 */ 665 HKF_TAB_12, /* activate tab 12 */ 666 HKF_LMOVE_TAB, /* move active tab to left */ 667 HKF_RMOVE_TAB, /* move active tab to right */ 668 HKF_DUMP_SCREEN, /* dump screen of current tab */ 669 HKF_INC_OPACITY, /* increase opacity */ 670 HKF_DEC_OPACITY, /* decrease opacity */ 671 HKF_TRANSPARENCY, /* toggle transparency */ 672 HKF_HIDE_TABBAR, /* hide/show tabbar */ 673 HKF_HIDE_SCROLLBAR, /* hide/show scrollbar */ 674 HKF_HIDE_MENUBAR, /* hide/show menubar */ 675 HKF_HIDE_BUTTON, /* hide/show tabbar buttons */ 676 HKF_VERYBOLD, /* toggle verybold font */ 677 HKF_HOLD_EXIT, /* toggle hold exit */ 678 HKF_BROADCAST, /* toggle input broadcasting */ 679 HKF_SMALL_FONT, /* use smaller font */ 680 HKF_LARGE_FONT, /* use large font */ 681 HKF_SCROLL_UP, /* scroll up one line */ 682 HKF_SCROLL_DOWN, /* scroll down one line */ 683 HKF_SCROLL_PGUP, /* scroll up one page */ 684 HKF_SCROLL_PGDOWN, /* scroll down one page */ 685 HKF_SAVE_CONFIG, /* save configuration */ 686 HKF_COPY_SEL, /* copy selection to clipboard */ 687 HKF_PASTE_SEL, /* paste selection */ 688 NUM_HKFUNCS, 689 } hk_funcs_t; /* hotkey functions */ 690 691 692 #define HK_CTRL ((unsigned short) (1<<0)) 693 #define HK_META ((unsigned short) (1<<1)) 694 #define HK_SHFT ((unsigned short) (1<<2)) 695 /* whether the hotkey should only work on primary screen */ 696 #define HK_PRIMARY ((unsigned short) (1<<14)) 697 /* whether the hotkey is an internal defined one */ 698 #define HK_INTERNAL ((unsigned short) (1<<15)) 699 #define HK_MASK (HK_CTRL|HK_META|HK_SHFT) 700 701 #define HK_SET_CTRL(F) ((F) |= HK_CTRL) 702 #define HK_SET_META(F) ((F) |= HK_META) 703 #define HK_SET_SHFT(F) ((F) |= HK_SHFT) 704 #define HK_SET_PRIMARY(F) ((F) |= HK_PRIMARY) 705 #define HK_SET_INTERNAL(F) ((F) |= HK_INTERNAL) 706 707 #define HK_IS_CTRL(F) ((F) & HK_CTRL) 708 #define HK_IS_META(F) ((F) & HK_META) 709 #define HK_IS_SHFT(F) ((F) & HK_SHFT) 710 #define HK_IS_PRIMARY(F) ((F) & HK_PRIMARY) 711 #define HK_IS_INTERNAL(F) ((F) & HK_INTERNAL) 712 713 typedef struct hotkeys { 714 unsigned short func; /* hotkey function */ 715 unsigned short flag; /* meta-key flags */ 716 KeySym keysym; /* key symbol pressed */ 717 } hotkeys_t; 718 719 typedef struct hotkeys_handler { 720 unsigned short func; /* hotkey function */ 721 int (*handler) (); /* function handler */ 722 char* res; /* X resource name */ 723 } hotkeys_handler_t; 724 725 extern hotkeys_handler_t hk_handlers[]; 726 727 728 /* 729 ** Maximal number of hotkeys. Now we make it a fix number, which is 730 ** 4 times of hotkey functions. It may waste certain memory, but is 731 ** easy to handle. BTW, who wants to define 4 hotkeys for just one 732 ** function? ;-) 733 */ 734 #define MAX_HOTKEYS ((unsigned long) (NUM_HKFUNCS << 2)) 735 736 737 typedef struct rxvt_vars { 738 /* 739 ** These ``hidden'' items are not for public consumption and 740 ** must not be accessed externally 741 */ 742 struct rxvt_hidden *h; 743 744 /* 745 ** Exposed items 746 ** Changes to structure here require library version number change 747 */ 748 TermWin_t TermWin; 749 #ifdef HAVE_SCROLLBARS 750 scrollBar_t scrollBar; 751 #endif 752 #ifdef HAVE_MENUBAR 753 menuBar_t menuBar; 754 #endif 755 tabBar_t tabBar; 756 Display* Xdisplay; 757 unsigned long Options; 758 unsigned long Options2; 759 XSizeHints szHint; 760 761 /* hotkeys */ 762 hotkeys_t* hotkeys; 763 764 Colormap Xcmap; 765 #ifdef OFF_FOCUS_FADING 766 /* TOTAL_COLORS + 2 * MAX_PAGES */ 767 unsigned long* PixColorsUnfocus; 768 /* PixColorsUnfocus and PixColor has been switched */ 769 char color_switched; 770 #endif 771 /* Bg and UfBg has been switched */ 772 char ufbg_switched; 773 /* TOTAL_COLORS + 2 * MAX_PAGES */ 774 unsigned long* PixColors; 775 #ifdef XFT_SUPPORT 776 XftColor* XftColors; /* number of colors + 2 * NPAGES */ 777 #endif 778 short numPixColors; /* TOTAL_COLORS */ 779 780 Cursor term_pointer; /* cursor for vt window */ 781 int Xdepth; 782 int sb_shadow; /* scrollbar shadow width */ 783 int Xfd; /* file descriptor of X connection */ 784 785 /* term_t structures and pointers */ 786 term_t vterm[MAX_PAGES]; 787 term_t* vts[MAX_PAGES]; 788 /* number of children that have died */ 789 short vt_died; 790 791 int num_fds; /* number of fd to monitor */ 792 selection_t selection; 793 sstyle_t selection_style; 794 int numlock_state; 795 char* tabstop; /* per location: 1 == tab-stop */ 796 enum enc_label encoding_method; 797 798 char** global_argv; 799 int global_argc; 800 } rxvt_t; 801 802 803 typedef enum { 804 HIDE_MENUBAR = 0, 805 SHOW_MENUBAR, 806 HIDE_TABBAR, 807 SHOW_TABBAR, 808 HIDE_SCROLLBAR, 809 SHOW_SCROLLBAR, 810 RESIZE_FONT, 811 X_CONFIGURE, 812 } resize_reason_t; 813 814 815 /* MACROS for colors of individual terminals */ 816 #define VTFG(R, P) \ 817 ((R)->PixColors[TOTAL_COLORS + (P)]) 818 #define VTBG(R, P) \ 819 ((R)->PixColors[TOTAL_COLORS + MAX_PAGES + (P)]) 820 #ifdef XFT_SUPPORT 821 # define VTXFTFG(R, P) \ 822 ((R)->XftColors[TOTAL_COLORS + (P)]) 823 # define VTXFTBG(R, P) \ 824 ((R)->XftColors[TOTAL_COLORS + MAX_PAGES + (P)]) 825 #endif /* XFT_SUPPORT */ 826 #define ISSET_VTFG(R, P) \ 827 (NULL != ((R)->h->rs[Rs_color + TOTAL_COLORS + (P)])) 828 #define ISSET_VTBG(R, P) \ 829 (NULL != ((R)->h->rs[Rs_color + TOTAL_COLORS + MAX_PAGES + (P)])) 830 831 832 /* MACROS for tab/page number */ 833 #define ATAB(R) ((R)->tabBar.atab) 834 #define LTAB(R) ((R)->tabBar.ltab) 835 #define FVTAB(R) ((R)->tabBar.fvtab) 836 #define LVTAB(R) ((R)->tabBar.lvtab) 837 #define PTAB(R) ((R)->tabBar.ptab) 838 839 #define APAGE(R) ((R)->tabBar.atab) 840 #define LPAGE(R) ((R)->tabBar.ltab) 841 #define FVPAGE(R) ((R)->tabBar.fvtab) 842 #define LVPAGE(R) ((R)->tabBar.lvtab) 843 #define PPAGE(R) ((R)->tabBar.ptab) 844 845 /* MACROS for vts structure */ 846 #define AVTS(R) ((R)->vts[(R)->tabBar.atab]) 847 #define LVTS(R) ((R)->vts[(R)->tabBar.ltab]) 848 #define PVTS(R, P) ((R)->vts[(P)]) 849 850 #define SEL(R) ((R)->selection) 851 852 #define ASCR(R) ((R)->vts[(R)->tabBar.atab]->screen) 853 #define PSCR(R, P) ((R)->vts[(P)]->screen) 854 855 856 /***************************************************************************** 857 * PROTOTYPES * 858 *****************************************************************************/ 859 void rxvt_main_loop(rxvt_t *); 860 rxvt_t* rxvt_init (int, const char *const *); 861 862 #endif /* __RXVTLIB_H__ */ 863 /*----------------------- end-of-file (H source) -----------------------*/ 864