eterm/src/term.h

193 lines
6.2 KiB
C
Raw Normal View History

/*
* Copyright (C) 1997-2000, Michael Jennings
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies of the Software, its documentation and marketing & publicity
* materials, and acknowledgment shall be given in the documentation, materials
* and software packages that this Software was used.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef _TERM_H_
#define _TERM_H_
#include <stdio.h>
#include <X11/Xfuncproto.h>
#include <X11/Intrinsic.h> /* Xlib, Xutil, Xresource, Xfuncproto */
/************ Macros and Definitions ************/
/* Macros to make parsing escape sequences slightly more readable.... <G> */
#define OPT_SET_OR_TOGGLE(s, mask, bit) do { \
if (!(s) || !(*(s))) { \
if ((mask) & (bit)) { \
(mask) &= ~(bit); \
} else { \
(mask) |= (bit); \
} \
} else if (BOOL_OPT_ISTRUE(s)) { \
if ((mask) & (bit)) return; \
(mask) |= (bit); \
} else if (BOOL_OPT_ISFALSE(s)) { \
if (!((mask) & (bit))) return; \
(mask) &= ~(bit); \
} \
} while (0)
/* The macro below forces bit to the opposite state from what we want, so that the
code that follows will set it right. Hackish, but saves space. :) Use this
if you need to do some processing other than just setting the flag right. */
#define OPT_SET_OR_TOGGLE_NEG(s, mask, bit) do { if (s) { \
if (BOOL_OPT_ISTRUE(s)) { \
if ((mask) & (bit)) return; \
(mask) &= ~(bit); \
} else if (BOOL_OPT_ISFALSE(s)) { \
if (!((mask) & (bit))) return; \
(mask) |= (bit); \
} \
} } while (0)
/* XTerm escape sequences: ESC ] Ps;Pt BEL */
# define XTerm_name 0
# define XTerm_iconName 1
# define XTerm_title 2
# define XTerm_prop 3
# define XTerm_logfile 46
# define XTerm_font 50
/* rxvt/Eterm extensions of XTerm escape sequences: ESC ] Ps;Pt BEL */
# define XTerm_Takeover 5 /* Steal keyboard focus and raise window */
# define XTerm_EtermSeq 6 /* Eterm proprietary escape sequences */
# define XTerm_EtermIPC 7 /* Eterm escape code/text IPC interface */
# define XTerm_Pixmap 20 /* new bg pixmap */
# define XTerm_DumpScreen 30 /* Dump contents of scrollback to a file */
# define XTerm_restoreFG 39 /* change default fg color */
# define XTerm_restoreBG 49 /* change default bg color */
# define restoreFG 39 /* restore default fg color */
# define restoreBG 49 /* restore default bg color */
enum color_list {
fgColor,
bgColor,
minColor, /* 2 */
BlackColor = minColor,
Red3Color,
Green3Color,
Yellow3Color,
Blue3Color,
Magenta3Color,
Cyan3Color,
maxColor, /* minColor + 7 */
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org> This is the first public availability of the work thus far on Eterm 0.9.1. There's quite a bit of new stuff here. * Added scrollbar thumb support. * Completely redid the terminfo/termcap stuff. The terminfo file is now compiled (by tic) and installed by default (unless you specify --without-terminfo). The config files still say xterm, though, because some programs (like SLang and GNU mc) use the silly algorithm of "Is $TERM set to xterm?" to detect mouse reporting support in a terminal. =P But if you don't ever use xterm, you can use Eterm's termcap and just name it "xterm" instead. Thanks to Marius Gedminas <mgedmin@takas.lt> for his patch that started this whole revamp. * Added the kEsetroot script for KDE users from Dax Games <dgames@isoc.net>. * You can now configure the Home and End emulation via --with-home= and --with-end= options to configure. The --with-terminfo option is also new, and --enable-xim is now the default. * Added a new image state, disabled, for when Eterm loses focus. This is supported by all widgets (well, all those that could possibly be on screen when Eterm lost focus), even the background image. So you could actually have all your images darken on focus out and restore to normal on focus in. * Widget colors formerly dealt with as colors (menu text color, scrollbar color, etc.) are now handled by the imageclasses. Each image state can have a foreground and background color defined. The current exception is the background image; I hope to add that later. The foreground is the text color and the background is the object color (for solid color mode). So menu text color is set by the menu imageclass. And again, for unfocused colors, use the disabled state of the imageclass. * Proportionally-spaced fonts are now handled much better. They are still forced into evenly-spaced columns (it's a terminal for crying out loud!) but at least you don't end up with Eterm's wider than your screen. :-) * Home on refresh is gone, as is home on echo. It's now much simpler. There are two options: home on output, and home on input, the former being a combination of echo and refresh. Also, keypresses that don't necessarily have corresonding output can trigger a home on input, like Ctrl-End or whatever...ones that don't have special meaning. Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out this issue and the one with "m-" in font names. * I finally got around to re-merging the new parser stuff from my work on the Not Game. Closed up some old potential behavior quirks with theme parsing. * Added a new escape sequence to fork-and-exec a program. Also added a scrollback search capability to highlight all occurances of a string in your scrollback buffer. Use the new "Etsearch" utility to access it. "Etsearch string" to search for a string, then "Etsearch" by itself to reset the highlighting. * And of course, the biggie. Eterm now supports a completely- customizeable buttonbar. Not a menubar, a buttonbar. It can have an arbitrary number of buttons, and each button can perform an action, just like a menuitem. So a button could bring up a menu (like a menubar) or launch a program (like a launchbar) or perform an operation (like a toolbar). Each button can have an icon, text, or both. And you can have buttons left- or right-justified in the buttonbar. You will eventually be able to have an arbitrary number of buttonbars, but I'm still working on that. As with any change this big, things could very easily be broken. So beware. :-) I have tested this myself, and everything seems to work, but I can't test every possibility. Let me know if you find anything that's broken, and enjoy! SVN revision: 2048
2000-02-10 16:25:07 -08:00
# ifdef NO_BRIGHTCOLOR
WhiteColor = maxColor,
maxBright = maxColor,
# else
AntiqueWhiteColor = maxColor,
minBright, /* maxColor + 1 */
Grey25Color = minBright,
RedColor,
GreenColor,
YellowColor,
BlueColor,
MagentaColor,
CyanColor,
maxBright, /* minBright + 7 */
WhiteColor = maxBright,
# endif
# ifndef NO_CURSORCOLOR
cursorColor,
cursorColor2,
# endif
pointerColor,
borderColor,
# ifndef NO_BOLDUNDERLINE
colorBD,
colorUL,
# endif
menuTextColor,
scrollColor,
menuColor,
unfocusedScrollColor,
unfocusedMenuColor,
NRS_COLORS, /* */
topShadowColor = NRS_COLORS,
bottomShadowColor,
unfocusedTopShadowColor,
unfocusedBottomShadowColor,
menuTopShadowColor,
menuBottomShadowColor,
unfocusedMenuTopShadowColor,
unfocusedMenuBottomShadowColor,
TOTAL_COLORS /* */
};
# define NSHADOWCOLORS (TOTAL_COLORS - NRS_COLORS)
#ifdef HOTKEY_CTRL
# define HOTKEY ctrl
#elif defined(HOTKEY_META)
# define HOTKEY meta
#endif
#define PrivCases(bit) do {if (mode == 't') state = !(PrivateModes & bit); else state = mode; \
switch (state) { \
case 's': SavedModes |= (PrivateModes & bit); continue; break; \
case 'r': state = (SavedModes & bit) ? 1 : 0; \
default: PrivMode(state, bit); break; \
}} while (0)
/************ Variables ************/
#ifdef META8_OPTION
extern unsigned char meta_char; /* Alt-key prefix */
#endif
extern unsigned long PrivateModes;
extern unsigned long SavedModes;
extern char *def_colorName[];
extern char *rs_color[NRS_COLORS];
extern Pixel PixColors[NRS_COLORS + NSHADOWCOLORS];
extern unsigned int MetaMask, AltMask, NumLockMask;
extern unsigned int modmasks[];
/************ Function Prototypes ************/
_XFUNCPROTOBEGIN
extern void get_modifiers(void);
extern void lookup_key(XEvent *);
#ifdef PRINTPIPE
extern FILE *popen_printer(void);
extern int pclose_printer(FILE *);
extern void process_print_pipe(void);
#endif
extern void process_escape_seq(void);
extern void process_csi_seq(void);
extern void process_xterm_seq(void);
extern void process_window_mode(unsigned int, int []);
extern void process_terminal_mode(int, int, unsigned int, int []);
extern void process_sgr_mode(unsigned int, int []);
#ifndef NO_BRIGHTCOLOR
extern void set_colorfgbg(void);
#else
# define set_colorfgbg() ((void)0)
#endif /* NO_BRIGHTCOLOR */
extern void set_title(const char *);
extern void set_icon_name(const char *);
extern void append_to_title(const char *);
extern void append_to_icon_name(const char *);
extern void xterm_seq(int, const char *);
_XFUNCPROTOEND
#endif /* _TERM_H_ */