Sun Aug 24 11:07:54 2003 Michael Jennings (mej)

I redid the options variables and constants to try and make things
more standardized, and to make room for future toggles as well.  This
should make David Lloyd a bit happier, 'cause now we can get his patch
in here. :)

Hopefully I didn't break anything....


SVN revision: 7370
eterm-0.10
Michael Jennings 20 years ago
parent 4e5e3617be
commit 243e65e5a2
  1. 9
      ChangeLog
  2. 2
      Eterm.spec
  3. 21
      src/command.c
  4. 2
      src/eterm_debug.h
  5. 8
      src/events.c
  6. 2
      src/font.c
  7. 224
      src/options.c
  8. 71
      src/options.h
  9. 12
      src/pixmap.c
  10. 32
      src/screen.c
  11. 4
      src/screen.h
  12. 16
      src/scrollbar.c
  13. 4
      src/startup.c
  14. 44
      src/term.c
  15. 18
      src/windows.c

@ -5093,3 +5093,12 @@ Fri Aug 22 00:09:04 2003 Michael Jennings (mej)
Had I done it right the first time, this would not have happened. >:I
----------------------------------------------------------------------
Sun Aug 24 11:07:54 2003 Michael Jennings (mej)
I redid the options variables and constants to try and make things
more standardized, and to make room for future toggles as well. This
should make David Lloyd a bit happier, 'cause now we can get his patch
in here. :)
Hopefully I didn't break anything....
----------------------------------------------------------------------

@ -4,7 +4,7 @@
Summary: Enlightened terminal emulator
Name: Eterm
Version: 0.9.2
Release: 3
Release: 4
Copyright: BSD
Group: User Interface/X
Requires: imlib2, imlib2-loader_jpeg, imlib2-loader_png

@ -1050,7 +1050,7 @@ handle_child_signal(int sig)
|| ((pid == -1) && (errno == ECHILD))
|| ((pid == 0) && ((kill(cmd_pid, 0)) < 0)))) {
cmd_pid = -1;
if (eterm_options & OPT_PAUSE) {
if (BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_PAUSE)) {
paused = 1;
return;
}
@ -1850,13 +1850,14 @@ xim_send_spot(void)
static void
xim_get_area(XRectangle * preedit_rect, XRectangle * status_rect, XRectangle * needed_rect)
{
preedit_rect->x = needed_rect->width + (scrollbar_is_visible() && !(eterm_options & OPT_SCROLLBAR_RIGHT) ? (scrollbar_trough_width()) : 0);
preedit_rect->x = needed_rect->width + (scrollbar_is_visible() && !(BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SCROLLBAR_RIGHT))
? (scrollbar_trough_width()) : (0));
preedit_rect->y = Height2Pixel(TERM_WINDOW_GET_ROWS() - 1);
preedit_rect->width = Width2Pixel(TERM_WINDOW_GET_COLS() + 1) - needed_rect->width + (!(eterm_options & OPT_SCROLLBAR_RIGHT) ? (scrollbar_trough_width()) : 0);
preedit_rect->width = Width2Pixel(TERM_WINDOW_GET_COLS() + 1) - needed_rect->width + (!(BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SCROLLBAR_RIGHT)) ? (scrollbar_trough_width()) : 0);
preedit_rect->height = Height2Pixel(1);
status_rect->x = (scrollbar_is_visible() && !(eterm_options & OPT_SCROLLBAR_RIGHT)) ? (scrollbar_trough_width()) : 0;
status_rect->x = (scrollbar_is_visible() && !(BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SCROLLBAR_RIGHT))) ? (scrollbar_trough_width()) : 0;
status_rect->y = Height2Pixel(TERM_WINDOW_GET_ROWS() - 1);
status_rect->width = needed_rect->width ? needed_rect->width : Width2Pixel(TERM_WINDOW_GET_COLS() + 1);
@ -2190,7 +2191,7 @@ run_command(char **argv)
tt_winsize(0);
/* become virtual console, fail silently */
if (eterm_options & OPT_CONSOLE) {
if (BITFIELD_IS_SET(vt_options, VT_OPTIONS_CONSOLE)) {
int fd = 1;
privileges(INVOKE);
@ -2255,7 +2256,7 @@ run_command(char **argv)
shell = "/bin/sh";
argv0 = my_basename(shell);
if (eterm_options & OPT_LOGIN_SHELL) {
if (BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_LOGIN_SHELL)) {
char *p = MALLOC(strlen(argv0) + 2);
p[0] = '-';
@ -2270,7 +2271,7 @@ run_command(char **argv)
}
#ifdef UTMP_SUPPORT
privileges(RESTORE);
if (eterm_options & OPT_WRITE_UTMP) {
if (BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_WRITE_UTMP)) {
add_utmp_entry(ttydev, display_name, ptyfd);
}
privileges(IGNORE);
@ -2985,7 +2986,7 @@ init_command(char **argv)
init_locale();
#ifdef META8_OPTION
meta_char = (eterm_options & OPT_META8 ? 0x80 : 033);
meta_char = (BITFIELD_IS_SET(vt_options, VT_OPTIONS_META8) ? 0x80 : 033);
#endif
#ifdef GREEK_SUPPORT
@ -3330,7 +3331,7 @@ cmd_getc(void)
} else {
/* Our file descriptor went bye-bye. */
cmd_fd = -1;
if (!paused && (eterm_options & OPT_PAUSE)) {
if (!paused && (BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_PAUSE))) {
paused = 1;
}
break;
@ -3338,7 +3339,7 @@ cmd_getc(void)
} else if (n == 0) {
/* EOF */
cmd_fd = -1;
if (!paused && (eterm_options & OPT_PAUSE)) {
if (!paused && (BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_PAUSE))) {
paused = 1;
}
break;

@ -39,7 +39,7 @@
# define DEBUG_UTMP 1
# define D_UTMP(x) DPRINTF1(x)
# define DEBUG_OPTIONS 1
# define D_OPTIONS(x) DPRINTF1(x)
# define D_OPTIONS(x) DPRINTF1(x)
# define DEBUG_IMLIB 1
# define D_IMLIB(x) DPRINTF1(x)
# define DEBUG_PIXMAP 1

@ -208,7 +208,7 @@ handle_key_press(event_t *ev)
REQUIRE_RVAL(XEVENT_IS_MYWIN(ev, &primary_data), 0);
COUNT_EVENT(keypress_cnt);
if (!(eterm_options & OPT_NO_INPUT)) {
if (!(BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_NO_INPUT))) {
lookup_key(ev);
}
PROF_DONE(handle_key_press);
@ -470,8 +470,8 @@ handle_focus_in(event_t *ev)
redraw_image(image_bg);
}
}
if (eterm_options & OPT_SCROLLBAR_POPUP) {
map_scrollbar(eterm_options & OPT_SCROLLBAR);
if (BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SCROLLBAR_POPUP)) {
map_scrollbar(BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SCROLLBAR));
} else {
scrollbar_set_focus(TermWin.focus);
scrollbar_draw(IMAGE_STATE_NORMAL, MODE_SOLID);
@ -498,7 +498,7 @@ handle_focus_out(event_t *ev)
images[image_bg].current = images[image_bg].disabled;
redraw_image(image_bg);
}
if (eterm_options & OPT_SCROLLBAR_POPUP) {
if (BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SCROLLBAR_POPUP)) {
map_scrollbar(0);
} else {
scrollbar_set_focus(TermWin.focus);

@ -588,7 +588,7 @@ change_font(int init, const char *fontname)
TermWin.fprop = 1; /* Proportional font */
/* For proportional fonts with large size variations, do some math-fu to try and help the appearance */
if (TermWin.fprop && (eterm_options & OPT_PROPORTIONAL) && TermWin.font->per_char && (TermWin.font->max_bounds.width - TermWin.font->min_bounds.width >= 3)) {
if (TermWin.fprop && (BITFIELD_IS_SET(vt_options, VT_OPTIONS_PROPORTIONAL)) && TermWin.font->per_char && (TermWin.font->max_bounds.width - TermWin.font->min_bounds.width >= 3)) {
int cw, n = 0, sum = 0, sumsq = 0, min_w, max_w;
unsigned int i;
double dev;

@ -96,7 +96,9 @@ static char *rs_multichar_encoding = NULL;
static char *rs_greek_keyboard = NULL;
#endif
unsigned long eterm_options = (OPT_SCROLLBAR | OPT_SELECT_TRAILING_SPACES | OPT_SECONDARY_SCREEN), image_toggles = 0;
unsigned long eterm_options = (ETERM_OPTIONS_SCROLLBAR | ETERM_OPTIONS_SELECT_TRAILING_SPACES);
unsigned long vt_options = (VT_OPTIONS_SECONDARY_SCREEN);
unsigned long image_options = 0;
char *theme_dir = NULL, *user_dir = NULL;
char **rs_exec_args = NULL; /* Args to exec (-e or --exec) */
char *rs_title = NULL; /* Window title */
@ -176,13 +178,13 @@ spifopt_t option_list[] = {
#else
SPIFOPT_INT_LONG_PP("debug", "level of debugging information to show (0-5)", DEBUG_LEVEL),
#endif
SPIFOPT_BOOL_LONG_PP("install", "install a private colormap", eterm_options, OPT_INSTALL),
SPIFOPT_BOOL_LONG_PP("install", "install a private colormap", eterm_options, ETERM_OPTIONS_INSTALL),
SPIFOPT_ABST_PP('h', "help", "display usage information", usage),
SPIFOPT_ABST_LONG_PP("version", "display version and configuration information", version),
/* =======[ Color options ]======= */
SPIFOPT_BOOL('r', "reverse-video", "reverse video", eterm_options, OPT_REVERSE_VIDEO),
SPIFOPT_BOOL('r', "reverse-video", "reverse video", vt_options, VT_OPTIONS_REVERSE_VIDEO),
SPIFOPT_STR('b', "background-color", "background color", rs_color[bgColor]),
SPIFOPT_STR('f', "foreground-color", "foreground color", rs_color[fgColor]),
SPIFOPT_STR_LONG("color0", "color 0", rs_color[minColor]),
@ -215,7 +217,7 @@ spifopt_t option_list[] = {
/* =======[ X11 options ]======= */
SPIFOPT_STR('g', "geometry", "WxH+X+Y = size and position", rs_geometry),
SPIFOPT_BOOL('i', "iconic", "start iconified", eterm_options, OPT_ICONIC),
SPIFOPT_BOOL('i', "iconic", "start iconified", eterm_options, ETERM_OPTIONS_ICONIC),
SPIFOPT_STR('n', "name", "client instance, icon, and title strings", rs_name),
SPIFOPT_STR('T', "title", "title string", rs_title),
SPIFOPT_STR_LONG("icon-name", "icon name", rs_iconName),
@ -232,7 +234,7 @@ spifopt_t option_list[] = {
SPIFOPT_STR_LONG("font2", "font 2", rs_font[2]),
SPIFOPT_STR_LONG("font3", "font 3", rs_font[3]),
SPIFOPT_STR_LONG("font4", "font 4", rs_font[4]),
SPIFOPT_BOOL_LONG("proportional", "toggle proportional font optimizations", eterm_options, OPT_PROPORTIONAL),
SPIFOPT_BOOL_LONG("proportional", "toggle proportional font optimizations", vt_options, VT_OPTIONS_PROPORTIONAL),
SPIFOPT_STR_LONG("font-fx", "specify font effects for the terminal fonts", rs_font_effects),
/* =======[ Pixmap options ]======= */
@ -244,9 +246,9 @@ spifopt_t option_list[] = {
SPIFOPT_STR_LONG("trough-pixmap", "scrollbar background (trough) pixmap", rs_pixmaps[image_sb]),
SPIFOPT_STR_LONG("anchor-pixmap", "scrollbar anchor pixmap", rs_pixmaps[image_sa]),
SPIFOPT_STR_LONG("menu-pixmap", "menu pixmap", rs_pixmaps[image_menu]),
SPIFOPT_BOOL('O', "trans", "creates a pseudo-transparent Eterm", image_toggles, IMOPT_TRANS),
SPIFOPT_BOOL('0', "itrans", "use immotile-optimized transparency", image_toggles, IMOPT_ITRANS),
SPIFOPT_BOOL_LONG("viewport-mode", "use viewport mode for the background image", image_toggles, IMOPT_VIEWPORT),
SPIFOPT_BOOL('O', "trans", "creates a pseudo-transparent Eterm", image_options, IMAGE_OPTIONS_TRANS),
SPIFOPT_BOOL('0', "itrans", "use immotile-optimized transparency", image_options, IMAGE_OPTIONS_ITRANS),
SPIFOPT_BOOL_LONG("viewport-mode", "use viewport mode for the background image", image_options, IMAGE_OPTIONS_VIEWPORT),
SPIFOPT_INT_LONG("shade", "old-style shade percentage (deprecated)", rs_shade),
SPIFOPT_STR_LONG("tint", "old-style tint mask (deprecated)", rs_tint),
SPIFOPT_STR_LONG("cmod", "image color modifier (\"brightness contrast gamma\")", rs_cmod_image),
@ -275,35 +277,35 @@ spifopt_t option_list[] = {
#endif
/* =======[ Toggles ]======= */
SPIFOPT_BOOL('l', "login-shell", "login shell, prepend - to shell name", eterm_options, OPT_LOGIN_SHELL),
SPIFOPT_BOOL('s', "scrollbar", "display scrollbar", eterm_options, OPT_SCROLLBAR),
SPIFOPT_BOOL('u', "utmp-logging", "make a utmp entry", eterm_options, OPT_WRITE_UTMP),
SPIFOPT_BOOL('v', "visual-bell", "visual bell", eterm_options, OPT_VISUAL_BELL),
SPIFOPT_BOOL('H', "home-on-output", "jump to bottom on output", eterm_options, OPT_HOME_ON_OUTPUT),
SPIFOPT_BOOL_LONG("home-on-input", "jump to bottom on input", eterm_options, OPT_HOME_ON_INPUT),
SPIFOPT_BOOL('q', "no-input", "configure for output only", eterm_options, OPT_NO_INPUT),
SPIFOPT_BOOL_LONG("scrollbar-right", "display the scrollbar on the right", eterm_options, OPT_SCROLLBAR_RIGHT),
SPIFOPT_BOOL_LONG("scrollbar-floating", "display the scrollbar with no trough", eterm_options, OPT_SCROLLBAR_FLOATING),
SPIFOPT_BOOL_LONG("scrollbar-popup", "popup the scrollbar only when focused", eterm_options, OPT_SCROLLBAR_POPUP),
SPIFOPT_BOOL('x', "borderless", "force Eterm to have no borders", eterm_options, OPT_BORDERLESS),
SPIFOPT_BOOL('l', "login-shell", "login shell, prepend - to shell name", eterm_options, ETERM_OPTIONS_LOGIN_SHELL),
SPIFOPT_BOOL('s', "scrollbar", "display scrollbar", eterm_options, ETERM_OPTIONS_SCROLLBAR),
SPIFOPT_BOOL('u', "utmp-logging", "make a utmp entry", eterm_options, ETERM_OPTIONS_WRITE_UTMP),
SPIFOPT_BOOL('v', "visual-bell", "visual bell", vt_options, VT_OPTIONS_VISUAL_BELL),
SPIFOPT_BOOL('H', "home-on-output", "jump to bottom on output", vt_options, VT_OPTIONS_HOME_ON_OUTPUT),
SPIFOPT_BOOL_LONG("home-on-input", "jump to bottom on input", vt_options, VT_OPTIONS_HOME_ON_INPUT),
SPIFOPT_BOOL('q', "no-input", "configure for output only", eterm_options, ETERM_OPTIONS_NO_INPUT),
SPIFOPT_BOOL_LONG("scrollbar-right", "display the scrollbar on the right", eterm_options, ETERM_OPTIONS_SCROLLBAR_RIGHT),
SPIFOPT_BOOL_LONG("scrollbar-floating", "display the scrollbar with no trough", eterm_options, ETERM_OPTIONS_SCROLLBAR_FLOATING),
SPIFOPT_BOOL_LONG("scrollbar-popup", "popup the scrollbar only when focused", eterm_options, ETERM_OPTIONS_SCROLLBAR_POPUP),
SPIFOPT_BOOL('x', "borderless", "force Eterm to have no borders", eterm_options, ETERM_OPTIONS_BORDERLESS),
#ifndef NO_MAPALERT
# ifdef MAPALERT_OPTION
SPIFOPT_BOOL('m', "map-alert", "uniconify on beep", eterm_options, OPT_MAP_ALERT),
SPIFOPT_BOOL('m', "map-alert", "uniconify on beep", vt_options, VT_OPTIONS_MAP_ALERT),
# endif
#endif
#ifdef META8_OPTION
SPIFOPT_BOOL('8', "meta-8", "Meta key toggles 8-bit", eterm_options, OPT_META8),
#endif
SPIFOPT_BOOL_LONG("double-buffer", "reduce exposes using double-buffering (and more memory)", eterm_options, OPT_DOUBLE_BUFFER),
SPIFOPT_BOOL_LONG("no-cursor", "disable the text cursor", eterm_options, OPT_NO_CURSOR),
SPIFOPT_BOOL_LONG("pause", "pause after the child process exits", eterm_options, OPT_PAUSE),
SPIFOPT_BOOL_LONG("xterm-select", "duplicate xterm's selection behavior", eterm_options, OPT_XTERM_SELECT),
SPIFOPT_BOOL_LONG("select-line", "triple-click selects whole line", eterm_options, OPT_SELECT_WHOLE_LINE),
SPIFOPT_BOOL_LONG("select-trailing-spaces", "do not skip trailing spaces when selecting", eterm_options, OPT_SELECT_TRAILING_SPACES),
SPIFOPT_BOOL_LONG("report-as-keysyms", "report special keys as keysyms", eterm_options, OPT_REPORT_AS_KEYSYMS),
SPIFOPT_BOOL('8', "meta-8", "Meta key toggles 8-bit", vt_options, VT_OPTIONS_META8),
#endif
SPIFOPT_BOOL_LONG("double-buffer", "reduce exposes using double-buffering (and more memory)", eterm_options, ETERM_OPTIONS_DOUBLE_BUFFER),
SPIFOPT_BOOL_LONG("no-cursor", "disable the text cursor", eterm_options, ETERM_OPTIONS_NO_CURSOR),
SPIFOPT_BOOL_LONG("pause", "pause after the child process exits", eterm_options, ETERM_OPTIONS_PAUSE),
SPIFOPT_BOOL_LONG("xterm-select", "duplicate xterm's selection behavior", eterm_options, ETERM_OPTIONS_XTERM_SELECT),
SPIFOPT_BOOL_LONG("select-line", "triple-click selects whole line", eterm_options, ETERM_OPTIONS_SELECT_WHOLE_LINE),
SPIFOPT_BOOL_LONG("select-trailing-spaces", "do not skip trailing spaces when selecting", eterm_options, ETERM_OPTIONS_SELECT_TRAILING_SPACES),
SPIFOPT_BOOL_LONG("report-as-keysyms", "report special keys as keysyms", vt_options, VT_OPTIONS_REPORT_AS_KEYSYMS),
SPIFOPT_BOOL_LONG("buttonbar", "toggle the display of all buttonbars", rs_buttonbars, BBAR_FORCE_TOGGLE),
SPIFOPT_BOOL_LONG("resize-gravity", "toggle gravitation to nearest corner on resize", eterm_options, OPT_RESIZE_GRAVITY),
SPIFOPT_BOOL_LONG("secondary-screen", "toggle use of secondary screen", eterm_options, OPT_SECONDARY_SCREEN),
SPIFOPT_BOOL_LONG("resize-gravity", "toggle gravitation to nearest corner on resize", eterm_options, ETERM_OPTIONS_RESIZE_GRAVITY),
SPIFOPT_BOOL_LONG("secondary-screen", "toggle use of secondary screen", vt_options, VT_OPTIONS_SECONDARY_SCREEN),
/* =======[ Keyboard options ]======= */
#if defined (HOTKEY_CTRL) || defined (HOTKEY_META)
@ -341,7 +343,7 @@ spifopt_t option_list[] = {
SPIFOPT_INT('z', "delay", "initial delay in seconds", rs_delay),
#endif
SPIFOPT_ABST('a', "attribute", "parse an attribute in the specified context", handle_attribute),
SPIFOPT_BOOL('C', "console", "grab console messages", eterm_options, OPT_CONSOLE),
SPIFOPT_BOOL('C', "console", "grab console messages", vt_options, VT_OPTIONS_CONSOLE),
SPIFOPT_ARGS('e', "exec", "execute a command rather than a shell", rs_exec_args)
};
@ -845,7 +847,7 @@ parse_color(char *buff, void *state)
char *tmp = get_pword(2, buff);
if (!BEG_STRCASECMP(tmp, "reverse")) {
eterm_options |= OPT_REVERSE_VIDEO;
BITFIELD_SET(vt_options, VT_OPTIONS_REVERSE_VIDEO);
} else if (BEG_STRCASECMP(tmp, "normal")) {
print_error("Parse error in file %s, line %lu: Invalid value \"%s\" for attribute video\n",
file_peek_path(), file_peek_line(), tmp);
@ -994,9 +996,9 @@ parse_attributes(char *buff, void *state)
} else if (!BEG_STRCASECMP(tmp, "prop")) {
tmp = get_pword(2, tmp);
if (BOOL_OPT_ISTRUE(tmp)) {
eterm_options |= OPT_PROPORTIONAL;
BITFIELD_SET(vt_options, VT_OPTIONS_PROPORTIONAL);
} else if (BOOL_OPT_ISFALSE(tmp)) {
eterm_options &= ~(OPT_PROPORTIONAL);
BITFIELD_CLEAR(vt_options, VT_OPTIONS_PROPORTIONAL);
} else {
print_error("Parse error in file %s, line %lu: Invalid/missing boolean value for attribute proportional\n",
file_peek_path(), file_peek_line());
@ -1057,9 +1059,9 @@ parse_toggles(char *buff, void *state)
if (!BEG_STRCASECMP(buff, "map_alert ")) {
#if !defined(NO_MAPALERT) && defined(MAPALERT_OPTION)
if (bool_val) {
eterm_options |= OPT_MAP_ALERT;
BITFIELD_SET(vt_options, VT_OPTIONS_MAP_ALERT);
} else {
eterm_options &= ~(OPT_MAP_ALERT);
BITFIELD_CLEAR(vt_options, VT_OPTIONS_MAP_ALERT);
}
#else
print_warning("Support for the map_alert attribute was not compiled in, ignoring\n");
@ -1067,29 +1069,29 @@ parse_toggles(char *buff, void *state)
} else if (!BEG_STRCASECMP(buff, "visual_bell ")) {
if (bool_val) {
eterm_options |= OPT_VISUAL_BELL;
BITFIELD_SET(vt_options, VT_OPTIONS_VISUAL_BELL);
} else {
eterm_options &= ~(OPT_VISUAL_BELL);
BITFIELD_CLEAR(vt_options, VT_OPTIONS_VISUAL_BELL);
}
} else if (!BEG_STRCASECMP(buff, "login_shell ")) {
if (bool_val) {
eterm_options |= OPT_LOGIN_SHELL;
BITFIELD_SET(eterm_options, ETERM_OPTIONS_LOGIN_SHELL);
} else {
eterm_options &= ~(OPT_LOGIN_SHELL);
BITFIELD_CLEAR(eterm_options, ETERM_OPTIONS_LOGIN_SHELL);
}
} else if (!BEG_STRCASECMP(buff, "scrollbar ")) {
if (bool_val) {
eterm_options |= OPT_SCROLLBAR;
BITFIELD_SET(eterm_options, ETERM_OPTIONS_SCROLLBAR);
} else {
eterm_options &= ~(OPT_SCROLLBAR);
BITFIELD_CLEAR(eterm_options, ETERM_OPTIONS_SCROLLBAR);
}
} else if (!BEG_STRCASECMP(buff, "utmp_logging ")) {
#ifdef UTMP_SUPPORT
if (bool_val) {
eterm_options |= OPT_WRITE_UTMP;
BITFIELD_SET(eterm_options, ETERM_OPTIONS_WRITE_UTMP);
} else {
eterm_options &= ~(OPT_WRITE_UTMP);
BITFIELD_CLEAR(eterm_options, ETERM_OPTIONS_WRITE_UTMP);
}
#else
print_warning("Support for the utmp_logging attribute was not compiled in, ignoring\n");
@ -1098,9 +1100,9 @@ parse_toggles(char *buff, void *state)
} else if (!BEG_STRCASECMP(buff, "meta8 ")) {
#ifdef META8_OPTION
if (bool_val) {
eterm_options |= OPT_META8;
BITFIELD_SET(vt_options, VT_OPTIONS_META8);
} else {
eterm_options &= ~(OPT_META8);
BITFIELD_CLEAR(vt_options, VT_OPTIONS_META8);
}
#else
print_warning("Support for the meta8 attribute was not compiled in, ignoring\n");
@ -1108,118 +1110,118 @@ parse_toggles(char *buff, void *state)
} else if (!BEG_STRCASECMP(buff, "iconic ")) {
if (bool_val) {
eterm_options |= OPT_ICONIC;
BITFIELD_SET(eterm_options, ETERM_OPTIONS_ICONIC);
} else {
eterm_options &= ~(OPT_ICONIC);
BITFIELD_CLEAR(eterm_options, ETERM_OPTIONS_ICONIC);
}
} else if (!BEG_STRCASECMP(buff, "home_on_output ")) {
if (bool_val) {
eterm_options |= OPT_HOME_ON_OUTPUT;
BITFIELD_SET(vt_options, VT_OPTIONS_HOME_ON_OUTPUT);
} else {
eterm_options &= ~(OPT_HOME_ON_OUTPUT);
BITFIELD_CLEAR(vt_options, VT_OPTIONS_HOME_ON_OUTPUT);
}
} else if (!BEG_STRCASECMP(buff, "home_on_input ")) {
if (bool_val) {
eterm_options |= OPT_HOME_ON_INPUT;
BITFIELD_SET(vt_options, VT_OPTIONS_HOME_ON_INPUT);
} else {
eterm_options &= ~(OPT_HOME_ON_INPUT);
BITFIELD_CLEAR(vt_options, VT_OPTIONS_HOME_ON_INPUT);
}
} else if (!BEG_STRCASECMP(buff, "no_input ")) {
if (bool_val) {
eterm_options |= OPT_NO_INPUT;
BITFIELD_SET(eterm_options, ETERM_OPTIONS_NO_INPUT);
} else {
eterm_options &= ~(OPT_NO_INPUT);
BITFIELD_CLEAR(eterm_options, ETERM_OPTIONS_NO_INPUT);
}
} else if (!BEG_STRCASECMP(buff, "scrollbar_floating ")) {
if (bool_val) {
eterm_options |= OPT_SCROLLBAR_FLOATING;
BITFIELD_SET(eterm_options, ETERM_OPTIONS_SCROLLBAR_FLOATING);
} else {
eterm_options &= ~(OPT_SCROLLBAR_FLOATING);
BITFIELD_CLEAR(eterm_options, ETERM_OPTIONS_SCROLLBAR_FLOATING);
}
} else if (!BEG_STRCASECMP(buff, "scrollbar_right ")) {
if (bool_val) {
eterm_options |= OPT_SCROLLBAR_RIGHT;
BITFIELD_SET(eterm_options, ETERM_OPTIONS_SCROLLBAR_RIGHT);
} else {
eterm_options &= ~(OPT_SCROLLBAR_RIGHT);
BITFIELD_CLEAR(eterm_options, ETERM_OPTIONS_SCROLLBAR_RIGHT);
}
} else if (!BEG_STRCASECMP(buff, "scrollbar_popup ")) {
if (bool_val) {
eterm_options |= OPT_SCROLLBAR_POPUP;
BITFIELD_SET(eterm_options, ETERM_OPTIONS_SCROLLBAR_POPUP);
} else {
eterm_options &= ~(OPT_SCROLLBAR_POPUP);
BITFIELD_CLEAR(eterm_options, ETERM_OPTIONS_SCROLLBAR_POPUP);
}
} else if (!BEG_STRCASECMP(buff, "borderless ")) {
if (bool_val) {
eterm_options |= OPT_BORDERLESS;
BITFIELD_SET(eterm_options, ETERM_OPTIONS_BORDERLESS);
} else {
eterm_options &= ~(OPT_BORDERLESS);
BITFIELD_CLEAR(eterm_options, ETERM_OPTIONS_BORDERLESS);
}
} else if (!BEG_STRCASECMP(buff, "double_buffer ")) {
if (bool_val) {
eterm_options |= OPT_DOUBLE_BUFFER;
BITFIELD_SET(eterm_options, ETERM_OPTIONS_DOUBLE_BUFFER);
} else {
eterm_options &= ~(OPT_DOUBLE_BUFFER);
BITFIELD_CLEAR(eterm_options, ETERM_OPTIONS_DOUBLE_BUFFER);
}
} else if (!BEG_STRCASECMP(buff, "no_cursor ")) {
if (bool_val) {
eterm_options |= OPT_NO_CURSOR;
BITFIELD_SET(eterm_options, ETERM_OPTIONS_NO_CURSOR);
} else {
eterm_options &= ~(OPT_NO_CURSOR);
BITFIELD_CLEAR(eterm_options, ETERM_OPTIONS_NO_CURSOR);
}
} else if (!BEG_STRCASECMP(buff, "pause ")) {
if (bool_val) {
eterm_options |= OPT_PAUSE;
BITFIELD_SET(eterm_options, ETERM_OPTIONS_PAUSE);
} else {
eterm_options &= ~(OPT_PAUSE);
BITFIELD_CLEAR(eterm_options, ETERM_OPTIONS_PAUSE);
}
} else if (!BEG_STRCASECMP(buff, "xterm_select ")) {
if (bool_val) {
eterm_options |= OPT_XTERM_SELECT;
BITFIELD_SET(eterm_options, ETERM_OPTIONS_XTERM_SELECT);
} else {
eterm_options &= ~(OPT_XTERM_SELECT);
BITFIELD_CLEAR(eterm_options, ETERM_OPTIONS_XTERM_SELECT);
}
} else if (!BEG_STRCASECMP(buff, "select_line ")) {
if (bool_val) {
eterm_options |= OPT_SELECT_WHOLE_LINE;
BITFIELD_SET(eterm_options, ETERM_OPTIONS_SELECT_WHOLE_LINE);
} else {
eterm_options &= ~(OPT_SELECT_WHOLE_LINE);
BITFIELD_CLEAR(eterm_options, ETERM_OPTIONS_SELECT_WHOLE_LINE);
}
} else if (!BEG_STRCASECMP(buff, "select_trailing_spaces ")) {
if (bool_val) {
eterm_options |= OPT_SELECT_TRAILING_SPACES;
BITFIELD_SET(eterm_options, ETERM_OPTIONS_SELECT_TRAILING_SPACES);
} else {
eterm_options &= ~(OPT_SELECT_TRAILING_SPACES);
BITFIELD_CLEAR(eterm_options, ETERM_OPTIONS_SELECT_TRAILING_SPACES);
}
} else if (!BEG_STRCASECMP(buff, "report_as_keysyms ")) {
if (bool_val) {
eterm_options |= OPT_REPORT_AS_KEYSYMS;
BITFIELD_SET(vt_options, VT_OPTIONS_REPORT_AS_KEYSYMS);
} else {
eterm_options &= ~(OPT_REPORT_AS_KEYSYMS);
BITFIELD_CLEAR(vt_options, VT_OPTIONS_REPORT_AS_KEYSYMS);
}
} else if (!BEG_STRCASECMP(buff, "mbyte_cursor ")) {
if (bool_val) {
eterm_options |= OPT_MBYTE_CURSOR;
BITFIELD_SET(eterm_options, ETERM_OPTIONS_MBYTE_CURSOR);
} else {
eterm_options &= ~(OPT_MBYTE_CURSOR);
BITFIELD_CLEAR(eterm_options, ETERM_OPTIONS_MBYTE_CURSOR);
}
} else if (!BEG_STRCASECMP(buff, "itrans ") || !BEG_STRCASECMP(buff, "immotile_trans ")) {
if (bool_val) {
image_toggles |= IMOPT_ITRANS;
BITFIELD_SET(image_options, IMAGE_OPTIONS_ITRANS);
} else {
image_toggles &= ~IMOPT_ITRANS;
BITFIELD_CLEAR(image_options, IMAGE_OPTIONS_ITRANS);
}
} else if (!BEG_STRCASECMP(buff, "buttonbar")) {
@ -1233,9 +1235,9 @@ parse_toggles(char *buff, void *state)
} else if (!BEG_STRCASECMP(buff, "resize_gravity")) {
if (bool_val) {
eterm_options |= OPT_RESIZE_GRAVITY;
BITFIELD_SET(eterm_options, ETERM_OPTIONS_RESIZE_GRAVITY);
} else {
eterm_options &= ~(OPT_RESIZE_GRAVITY);
BITFIELD_CLEAR(eterm_options, ETERM_OPTIONS_RESIZE_GRAVITY);
}
} else {
print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context toggles\n", file_peek_path(),
@ -2581,7 +2583,7 @@ post_parse(void)
}
/* no point having a scrollbar without having any scrollback! */
if (!TermWin.saveLines) {
eterm_options &= ~OPT_SCROLLBAR;
BITFIELD_CLEAR(eterm_options, ETERM_OPTIONS_SCROLLBAR);
}
#ifdef PRINTPIPE
if (!rs_print_pipe) {
@ -2785,10 +2787,10 @@ post_parse(void)
D_PIXMAP(("No \"disabled\" state for image %s. Setting fallback to the normal state.\n", get_image_type(i)));
images[i].disabled = images[i].norm;
}
if ((image_toggles & IMOPT_TRANS) && (image_mode_is(i, ALLOW_TRANS))) {
if ((BITFIELD_IS_SET(image_options, IMAGE_OPTIONS_TRANS)) && (image_mode_is(i, ALLOW_TRANS))) {
D_PIXMAP(("Detected transparency option. Enabling transparency on image %s\n", get_image_type(i)));
image_set_mode(i, MODE_TRANS);
} else if ((image_toggles & IMOPT_VIEWPORT) && (image_mode_is(i, ALLOW_VIEWPORT))) {
} else if ((BITFIELD_IS_SET(image_options, IMAGE_OPTIONS_VIEWPORT)) && (image_mode_is(i, ALLOW_VIEWPORT))) {
D_PIXMAP(("Detected viewport option. Enabling viewport mode on image %s\n", get_image_type(i)));
image_set_mode(i, MODE_VIEWPORT);
}
@ -2941,7 +2943,7 @@ post_parse(void)
}
#endif
if (eterm_options & OPT_REVERSE_VIDEO) {
if (BITFIELD_IS_SET(vt_options, VT_OPTIONS_REVERSE_VIDEO)) {
char *tmp;
/* swap foreground/background colors */
@ -3164,7 +3166,7 @@ save_config(char *path, unsigned char save_theme)
(scrollbar_get_type() == SCROLLBAR_XTERM ? "xterm" : (scrollbar_get_type() == SCROLLBAR_MOTIF ? "motif" : "next")));
fprintf(fp, " scrollbar_width %d\n", scrollbar_anchor_width());
fprintf(fp, " font default %u\n", (unsigned int) font_idx);
fprintf(fp, " font proportional %d\n", ((eterm_options & OPT_PROPORTIONAL) ? 1 : 0));
fprintf(fp, " font proportional %d\n", ((BITFIELD_IS_SET(vt_options, VT_OPTIONS_PROPORTIONAL)) ? 1 : 0));
for (i = 0; i < font_cnt; i++) {
if (etfonts[i]) {
fprintf(fp, " font %d %s\n", i, etfonts[i]);
@ -3732,30 +3734,30 @@ save_config(char *path, unsigned char save_theme)
}
fprintf(fp, "begin toggles\n");
fprintf(fp, " map_alert %d\n", (eterm_options & OPT_MAP_ALERT ? 1 : 0));
fprintf(fp, " visual_bell %d\n", (eterm_options & OPT_VISUAL_BELL ? 1 : 0));
fprintf(fp, " login_shell %d\n", (eterm_options & OPT_LOGIN_SHELL ? 1 : 0));
fprintf(fp, " scrollbar %d\n", (eterm_options & OPT_SCROLLBAR ? 1 : 0));
fprintf(fp, " utmp_logging %d\n", (eterm_options & OPT_WRITE_UTMP ? 1 : 0));
fprintf(fp, " meta8 %d\n", (eterm_options & OPT_META8 ? 1 : 0));
fprintf(fp, " iconic %d\n", (eterm_options & OPT_ICONIC ? 1 : 0));
fprintf(fp, " home_on_output %d\n", (eterm_options & OPT_HOME_ON_OUTPUT ? 1 : 0));
fprintf(fp, " home_on_input %d\n", (eterm_options & OPT_HOME_ON_INPUT ? 1 : 0));
fprintf(fp, " no_input %d\n", (eterm_options & OPT_NO_INPUT ? 1 : 0));
fprintf(fp, " scrollbar_floating %d\n", (eterm_options & OPT_SCROLLBAR_FLOATING ? 1 : 0));
fprintf(fp, " scrollbar_right %d\n", (eterm_options & OPT_SCROLLBAR_RIGHT ? 1 : 0));
fprintf(fp, " scrollbar_popup %d\n", (eterm_options & OPT_SCROLLBAR_POPUP ? 1 : 0));
fprintf(fp, " borderless %d\n", (eterm_options & OPT_BORDERLESS ? 1 : 0));
fprintf(fp, " double_buffer %d\n", (eterm_options & OPT_DOUBLE_BUFFER ? 1 : 0));
fprintf(fp, " no_cursor %d\n", (eterm_options & OPT_NO_CURSOR ? 1 : 0));
fprintf(fp, " pause %d\n", (eterm_options & OPT_PAUSE ? 1 : 0));
fprintf(fp, " xterm_select %d\n", (eterm_options & OPT_XTERM_SELECT ? 1 : 0));
fprintf(fp, " select_line %d\n", (eterm_options & OPT_SELECT_WHOLE_LINE ? 1 : 0));
fprintf(fp, " select_trailing_spaces %d\n", (eterm_options & OPT_SELECT_TRAILING_SPACES ? 1 : 0));
fprintf(fp, " report_as_keysyms %d\n", (eterm_options & OPT_REPORT_AS_KEYSYMS ? 1 : 0));
fprintf(fp, " itrans %d\n", (image_toggles & IMOPT_ITRANS ? 1 : 0));
fprintf(fp, " map_alert %d\n", (BITFIELD_IS_SET(vt_options, VT_OPTIONS_MAP_ALERT) ? 1 : 0));
fprintf(fp, " visual_bell %d\n", (BITFIELD_IS_SET(vt_options, VT_OPTIONS_VISUAL_BELL) ? 1 : 0));
fprintf(fp, " login_shell %d\n", (BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_LOGIN_SHELL) ? 1 : 0));
fprintf(fp, " scrollbar %d\n", (BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SCROLLBAR) ? 1 : 0));
fprintf(fp, " utmp_logging %d\n", (BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_WRITE_UTMP) ? 1 : 0));
fprintf(fp, " meta8 %d\n", (BITFIELD_IS_SET(vt_options, VT_OPTIONS_META8) ? 1 : 0));
fprintf(fp, " iconic %d\n", (BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_ICONIC) ? 1 : 0));
fprintf(fp, " home_on_output %d\n", (BITFIELD_IS_SET(vt_options, VT_OPTIONS_HOME_ON_OUTPUT) ? 1 : 0));
fprintf(fp, " home_on_input %d\n", (BITFIELD_IS_SET(vt_options, VT_OPTIONS_HOME_ON_INPUT) ? 1 : 0));
fprintf(fp, " no_input %d\n", (BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_NO_INPUT) ? 1 : 0));
fprintf(fp, " scrollbar_floating %d\n", (BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SCROLLBAR_FLOATING) ? 1 : 0));
fprintf(fp, " scrollbar_right %d\n", (BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SCROLLBAR_RIGHT) ? 1 : 0));
fprintf(fp, " scrollbar_popup %d\n", (BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SCROLLBAR_POPUP) ? 1 : 0));
fprintf(fp, " borderless %d\n", (BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_BORDERLESS) ? 1 : 0));
fprintf(fp, " double_buffer %d\n", (BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_DOUBLE_BUFFER) ? 1 : 0));
fprintf(fp, " no_cursor %d\n", (BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_NO_CURSOR) ? 1 : 0));
fprintf(fp, " pause %d\n", (BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_PAUSE) ? 1 : 0));
fprintf(fp, " xterm_select %d\n", (BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_XTERM_SELECT) ? 1 : 0));
fprintf(fp, " select_line %d\n", (BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SELECT_WHOLE_LINE) ? 1 : 0));
fprintf(fp, " select_trailing_spaces %d\n", (BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SELECT_TRAILING_SPACES) ? 1 : 0));
fprintf(fp, " report_as_keysyms %d\n", (BITFIELD_IS_SET(vt_options, VT_OPTIONS_REPORT_AS_KEYSYMS) ? 1 : 0));
fprintf(fp, " itrans %d\n", (BITFIELD_IS_SET(image_options, IMAGE_OPTIONS_ITRANS) ? 1 : 0));
fprintf(fp, " buttonbar %d\n", ((buttonbar && bbar_is_visible(buttonbar)) ? 1 : 0));
fprintf(fp, " resize_gravity %d\n", (eterm_options & OPT_RESIZE_GRAVITY ? 1 : 0));
fprintf(fp, " resize_gravity %d\n", (BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_RESIZE_GRAVITY) ? 1 : 0));
fprintf(fp, "end toggles\n\n");
fprintf(fp, "begin keyboard\n");

@ -28,38 +28,39 @@
#include <X11/Intrinsic.h> /* Xlib, Xutil, Xresource, Xfuncproto */
/************ Macros and Definitions ************/
# define OPT_CONSOLE (1LU << 0)
# define OPT_LOGIN_SHELL (1LU << 1)
# define OPT_ICONIC (1LU << 2)
# define OPT_VISUAL_BELL (1LU << 3)
# define OPT_MAP_ALERT (1LU << 4)
# define OPT_REVERSE_VIDEO (1LU << 5)
# define OPT_WRITE_UTMP (1LU << 6)
# define OPT_SCROLLBAR (1LU << 7)
# define OPT_META8 (1LU << 8)
# define OPT_HOME_ON_OUTPUT (1LU << 9)
# define OPT_SCROLLBAR_RIGHT (1LU << 10)
# define OPT_BORDERLESS (1LU << 11)
# define OPT_NO_INPUT (1LU << 12)
# define OPT_NO_CURSOR (1LU << 13)
# define OPT_PAUSE (1LU << 14)
# define OPT_HOME_ON_INPUT (1LU << 15)
# define OPT_REPORT_AS_KEYSYMS (1LU << 16)
# define OPT_XTERM_SELECT (1LU << 17)
# define OPT_SELECT_WHOLE_LINE (1LU << 18)
# define OPT_SCROLLBAR_POPUP (1LU << 19)
# define OPT_SELECT_TRAILING_SPACES (1LU << 20)
# define OPT_INSTALL (1LU << 21)
# define OPT_SCROLLBAR_FLOATING (1LU << 22)
# define OPT_DOUBLE_BUFFER (1LU << 23)
# define OPT_MBYTE_CURSOR (1LU << 24)
# define OPT_PROPORTIONAL (1LU << 25)
# define OPT_RESIZE_GRAVITY (1LU << 26)
# define OPT_SECONDARY_SCREEN (1LU << 27)
# define IMOPT_TRANS (1U << 0)
# define IMOPT_ITRANS (1U << 1)
# define IMOPT_VIEWPORT (1U << 2)
# define VT_OPTIONS_CONSOLE (1LU << 0)
# define VT_OPTIONS_VISUAL_BELL (1LU << 1)
# define VT_OPTIONS_MAP_ALERT (1LU << 2)
# define VT_OPTIONS_REVERSE_VIDEO (1LU << 3)
# define VT_OPTIONS_META8 (1LU << 4)
# define VT_OPTIONS_HOME_ON_OUTPUT (1LU << 5)
# define VT_OPTIONS_HOME_ON_INPUT (1LU << 6)
# define VT_OPTIONS_REPORT_AS_KEYSYMS (1LU << 7)
# define VT_OPTIONS_PROPORTIONAL (1LU << 8)
# define VT_OPTIONS_SECONDARY_SCREEN (1LU << 9)
# define ETERM_OPTIONS_LOGIN_SHELL (1LU << 0)
# define ETERM_OPTIONS_ICONIC (1LU << 1)
# define ETERM_OPTIONS_WRITE_UTMP (1LU << 2)
# define ETERM_OPTIONS_SCROLLBAR (1LU << 3)
# define ETERM_OPTIONS_SCROLLBAR_RIGHT (1LU << 4)
# define ETERM_OPTIONS_BORDERLESS (1LU << 5)
# define ETERM_OPTIONS_NO_INPUT (1LU << 6)
# define ETERM_OPTIONS_NO_CURSOR (1LU << 7)
# define ETERM_OPTIONS_PAUSE (1LU << 8)
# define ETERM_OPTIONS_XTERM_SELECT (1LU << 9)
# define ETERM_OPTIONS_SELECT_WHOLE_LINE (1LU << 10)
# define ETERM_OPTIONS_SCROLLBAR_POPUP (1LU << 11)
# define ETERM_OPTIONS_SELECT_TRAILING_SPACES (1LU << 12)
# define ETERM_OPTIONS_INSTALL (1LU << 13)
# define ETERM_OPTIONS_SCROLLBAR_FLOATING (1LU << 14)
# define ETERM_OPTIONS_DOUBLE_BUFFER (1LU << 15)
# define ETERM_OPTIONS_MBYTE_CURSOR (1LU << 16)
# define ETERM_OPTIONS_RESIZE_GRAVITY (1LU << 17)
# define IMAGE_OPTIONS_TRANS (1U << 0)
# define IMAGE_OPTIONS_ITRANS (1U << 1)
# define IMAGE_OPTIONS_VIEWPORT (1U << 2)
# define BBAR_FORCE_TOGGLE (0x03)
@ -78,10 +79,14 @@
#define RESET_AND_ASSIGN(var, val) do {if ((var) != NULL) FREE(var); (var) = (val);} while (0)
#define BITFIELD_SET(var, field) ((var) |= (field))
#define BITFIELD_CLEAR(var, field) ((var) &= ~(field))
#define BITFIELD_IS_SET(var, field) ((var) & (field))
/************ Structures ************/
/************ Variables ************/
extern unsigned long eterm_options, image_toggles;
extern unsigned long eterm_options, vt_options, image_options;
extern char *theme_dir, *user_dir;
extern char **rs_exec_args; /* Args to exec (-e or --exec) */
extern char *rs_title; /* Window title */

@ -680,7 +680,7 @@ create_trans_pixmap(simage_t *simg, unsigned char which, Drawable d, int x, int
D_PIXMAP(("Copying %hux%hu rectangle at %d, %d from %ux%u desktop pixmap 0x%08x onto p.\n", width, height, x, y, pw, ph, desktop_pixmap));
XCopyArea(Xdisplay, desktop_pixmap, p, gc, x, y, width, height, 0, 0);
}
if ((which != image_bg || (image_toggles & IMOPT_ITRANS) || images[image_bg].current != images[image_bg].norm)
if ((which != image_bg || (BITFIELD_IS_SET(image_options, IMAGE_OPTIONS_ITRANS)) || images[image_bg].current != images[image_bg].norm)
&& need_colormod(simg->iml)) {
colormod_trans(p, simg->iml, gc, width, height);
}
@ -1091,7 +1091,7 @@ render_simage(simage_t *simg, Window win, unsigned short width, unsigned short h
}
simg->pmap->pixmap = create_trans_pixmap(simg, which, win, 0, 0, width, height);
if (simg->pmap->pixmap != None) {
if ((which == image_bg) && (eterm_options & OPT_DOUBLE_BUFFER)) {
if ((which == image_bg) && (BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_DOUBLE_BUFFER))) {
copy_buffer_pixmap(MODE_TRANS, (unsigned long) simg->pmap->pixmap, width, height);
XSetWindowBackgroundPixmap(Xdisplay, win, buffer_pixmap);
} else {
@ -1117,7 +1117,7 @@ render_simage(simage_t *simg, Window win, unsigned short width, unsigned short h
}
if (simg->pmap->pixmap != None) {
D_PIXMAP(("Setting background of window 0x%08x to 0x%08x\n", win, simg->pmap->pixmap));
if ((which == image_bg) && (eterm_options & OPT_DOUBLE_BUFFER)) {
if ((which == image_bg) && (BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_DOUBLE_BUFFER))) {
copy_buffer_pixmap(MODE_VIEWPORT, (unsigned long) simg->pmap->pixmap, width, height);
XSetWindowBackgroundPixmap(Xdisplay, win, buffer_pixmap);
} else {
@ -1228,7 +1228,7 @@ render_simage(simage_t *simg, Window win, unsigned short width, unsigned short h
bevel_pixmap(simg->pmap->pixmap, width, height, simg->iml->bevel->edges, simg->iml->bevel->up);
}
D_PIXMAP(("Setting background of window 0x%08x to 0x%08x\n", win, simg->pmap->pixmap));
if ((which == image_bg) && (eterm_options & OPT_DOUBLE_BUFFER)) {
if ((which == image_bg) && (BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_DOUBLE_BUFFER))) {
copy_buffer_pixmap(MODE_VIEWPORT, (unsigned long) simg->pmap->pixmap, width, height);
XSetWindowBackgroundPixmap(Xdisplay, win, buffer_pixmap);
} else {
@ -1254,7 +1254,7 @@ render_simage(simage_t *simg, Window win, unsigned short width, unsigned short h
/* Fall back to solid mode if all else fails. */
if (!image_mode_is(which, MODE_MASK)) {
if ((which == image_bg) && (eterm_options & OPT_DOUBLE_BUFFER)) {
if ((which == image_bg) && (BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_DOUBLE_BUFFER))) {
copy_buffer_pixmap(MODE_SOLID, (unsigned long) PixColors[bgColor], width, height);
XSetWindowBackgroundPixmap(Xdisplay, win, buffer_pixmap);
} else {
@ -2027,7 +2027,7 @@ get_desktop_pixmap(void)
D_PIXMAP(("Desktop pixmap has changed. Updating desktop_pixmap\n"));
free_desktop_pixmap();
orig_desktop_pixmap = p;
if (!(image_toggles & IMOPT_ITRANS) && need_colormod(images[image_bg].current->iml)) {
if (!(BITFIELD_IS_SET(image_options, IMAGE_OPTIONS_ITRANS)) && need_colormod(images[image_bg].current->iml)) {
int px, py;
unsigned int pw, ph, pb, pd;
Window w;

@ -357,7 +357,7 @@ scr_poweron(void)
/* Reset the rendering style to the default colors/style */
scr_rendition(0, ~RS_None);
#if NSCREENS
if (eterm_options & OPT_SECONDARY_SCREEN) {
if (BITFIELD_IS_SET(vt_options, VT_OPTIONS_SECONDARY_SCREEN)) {
/* Reset the secondary screen */
scr_change_screen(SECONDARY);
scr_erase_screen(2);
@ -432,7 +432,7 @@ scr_change_screen(int scrn)
SWAP_IT(current_screen, scrn, tmp);
#if NSCREENS
if (eterm_options & OPT_SECONDARY_SCREEN) {
if (BITFIELD_IS_SET(vt_options, VT_OPTIONS_SECONDARY_SCREEN)) {
offset = TermWin.saveLines;
if (!screen.text || !screen.rend)
return (current_screen);
@ -1525,11 +1525,11 @@ scr_bell(void)
{
#ifndef NO_MAPALERT
#ifdef MAPALERT_OPTION
if (eterm_options & OPT_MAP_ALERT)
if (BITFIELD_IS_SET(vt_options, VT_OPTIONS_MAP_ALERT))
#endif
XMapWindow(Xdisplay, TermWin.parent);
#endif
if (eterm_options & OPT_VISUAL_BELL) {
if (BITFIELD_IS_SET(vt_options, VT_OPTIONS_VISUAL_BELL)) {
scr_rvideo_mode(!rvideo);
scr_rvideo_mode(!rvideo);
} else
@ -2690,7 +2690,7 @@ selection_make(Time tm)
*str++ = *t++;
col = 0;
if (screen.text[row][TERM_WINDOW_GET_REPORTED_COLS()] != WRAP_CHAR) {
if (!(eterm_options & OPT_SELECT_TRAILING_SPACES)) {
if (!(BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SELECT_TRAILING_SPACES))) {
for (str--; *str == ' ' || *str == '\t'; str--);
str++;
}
@ -2710,7 +2710,7 @@ selection_make(Time tm)
UPPER_BOUND(end_col, TERM_WINDOW_GET_REPORTED_COLS());
for (; col < end_col; col++)
*str++ = *t++;
if (!(eterm_options & OPT_SELECT_TRAILING_SPACES)) {
if (!(BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SELECT_TRAILING_SPACES))) {
for (str--; *str == ' ' || *str == '\t'; str--);
str++;
}
@ -2830,7 +2830,7 @@ selection_delimit_word(int col, int row, row_col_t *beg, row_col_t *end)
for (;;) {
for (; beg_col > 0; beg_col--) {
t = *--stp;
if (DELIMIT_TEXT(t) != w1 || (w1 && *stp1 != t && eterm_options & OPT_XTERM_SELECT))
if (DELIMIT_TEXT(t) != w1 || (w1 && *stp1 != t && BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_XTERM_SELECT)))
break;
#ifdef MULTI_CHARSET
r = *--srp;
@ -2838,7 +2838,7 @@ selection_delimit_word(int col, int row, row_col_t *beg, row_col_t *end)
break;
#endif
}
if (!(eterm_options & OPT_XTERM_SELECT)) {
if (!(BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_XTERM_SELECT))) {
if (beg_col == col && beg_col > 0) {
if (DELIMIT_TEXT(*stp)) /* space or tab or cutchar */
break;
@ -2864,10 +2864,10 @@ selection_delimit_word(int col, int row, row_col_t *beg, row_col_t *end)
#ifdef MULTI_CHARSET
srp = &(screen.rend[beg_row + row_offset - 1][last_col + 1]);
r = *(srp - 1);
if (DELIMIT_TEXT(t) == w1 && (!w1 || *stp == t || !(eterm_options & OPT_XTERM_SELECT)) && DELIMIT_REND(r) == w2) {
if (DELIMIT_TEXT(t) == w1 && (!w1 || *stp == t || !(BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_XTERM_SELECT))) && DELIMIT_REND(r) == w2) {
srp--;
#else
if (DELIMIT_TEXT(t) == w1 && (!w1 || *stp == t || !(eterm_options & OPT_XTERM_SELECT))) {
if (DELIMIT_TEXT(t) == w1 && (!w1 || *stp == t || !(BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_XTERM_SELECT)))) {
#endif
stp--;
beg_row--;
@ -2893,7 +2893,7 @@ selection_delimit_word(int col, int row, row_col_t *beg, row_col_t *end)
for (;;) {
for (; end_col < last_col; end_col++) {
t = *++stp;
if (DELIMIT_TEXT(t) != w1 || (w1 && *stp1 != t && eterm_options & OPT_XTERM_SELECT))
if (DELIMIT_TEXT(t) != w1 || (w1 && *stp1 != t && BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_XTERM_SELECT)))
break;
#ifdef MULTI_CHARSET
r = *++srp;
@ -2901,7 +2901,7 @@ selection_delimit_word(int col, int row, row_col_t *beg, row_col_t *end)
break;
#endif
}
if (!(eterm_options & OPT_XTERM_SELECT)) {
if (!(BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_XTERM_SELECT))) {
if (end_col == col && end_col < last_col) {
if (DELIMIT_TEXT(*stp)) /* space or tab or cutchar */
break;
@ -2925,9 +2925,9 @@ selection_delimit_word(int col, int row, row_col_t *beg, row_col_t *end)
stp = screen.text[end_row + row_offset + 1];
#ifdef MULTI_CHARSET
srp = screen.rend[end_row + row_offset + 1];
if (DELIMIT_TEXT(*stp) == w1 && (!w1 || *stp1 == *stp || !(eterm_options & OPT_XTERM_SELECT)) && DELIMIT_REND(*srp) == w2) {
if (DELIMIT_TEXT(*stp) == w1 && (!w1 || *stp1 == *stp || !(BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_XTERM_SELECT))) && DELIMIT_REND(*srp) == w2) {
#else
if (DELIMIT_TEXT(*stp) == w1 && (!w1 || *stp1 == *stp || !(eterm_options & OPT_XTERM_SELECT))) {
if (DELIMIT_TEXT(*stp) == w1 && (!w1 || *stp1 == *stp || !(BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_XTERM_SELECT)))) {
#endif
end_row++;
end_col = 0;
@ -3157,7 +3157,7 @@ selection_extend_colrow(int col, int row, int flag, int cont)
selection.beg.row = selection.mark.row;
selection.end.row = row;
}
if (eterm_options & OPT_SELECT_WHOLE_LINE) {
if (BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SELECT_WHOLE_LINE)) {
selection.beg.col = 0;
} else {
selection.clicks = 2;
@ -3363,7 +3363,7 @@ void
xim_get_position(XPoint * pos)
{
pos->x = Col2Pixel(screen.col);
if (scrollbar_is_visible() && !(eterm_options & OPT_SCROLLBAR_RIGHT)) {
if (scrollbar_is_visible() && !(BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SCROLLBAR_RIGHT))) {
pos->x += scrollbar_trough_width();
}
pos->y = (Height2Pixel(screen.row)

@ -29,10 +29,10 @@
#define IS_CUT_BUFFER(a) (((a) >= XA_CUT_BUFFER0) && ((a) <= XA_CUT_BUFFER7))
#define ZERO_SCROLLBACK do { \
if (eterm_options & OPT_HOME_ON_OUTPUT) TermWin.view_start = 0; \
if (BITFIELD_IS_SET(vt_options, VT_OPTIONS_HOME_ON_OUTPUT)) TermWin.view_start = 0; \
} while (0)
#define REFRESH_ZERO_SCROLLBACK do { \
if (eterm_options & OPT_HOME_ON_OUTPUT) TermWin.view_start = 0; \
if (BITFIELD_IS_SET(vt_options, VT_OPTIONS_HOME_ON_OUTPUT)) TermWin.view_start = 0; \
} while (0)
#define CHECK_SELECTION do { \
if (selection.op) selection_check(); \

@ -383,7 +383,7 @@ scrollbar_draw_uparrow(unsigned char image_state, unsigned char force_modes)
}
if (!image_mode_is(image_up, MODE_MASK)) {
/* Solid mode. Redraw every time since it's cheap. */
if (eterm_options & OPT_SCROLLBAR_FLOATING) {
if (BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SCROLLBAR_FLOATING)) {
XSetWindowBackground(Xdisplay, scrollbar.up_win, PixColors[bgColor]);
XClearWindow(Xdisplay, scrollbar.up_win);
} else {
@ -453,7 +453,7 @@ scrollbar_draw_downarrow(unsigned char image_state, unsigned char force_modes)
}
if (!image_mode_is(image_down, MODE_MASK)) {
/* Solid mode. Redraw every time since it's cheap. */
if (eterm_options & OPT_SCROLLBAR_FLOATING) {
if (BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SCROLLBAR_FLOATING)) {
XSetWindowBackground(Xdisplay, scrollbar.dn_win, PixColors[bgColor]);
XClearWindow(Xdisplay, scrollbar.dn_win);
} else {
@ -538,7 +538,7 @@ scrollbar_draw_anchor(unsigned char image_state, unsigned char force_modes)
/* Solid mode. Redraw every time since it's cheap. */
#ifdef XTERM_SCROLLBAR
if (scrollbar.type == SCROLLBAR_XTERM) {
int x = ((eterm_options & OPT_SCROLLBAR_RIGHT) ? 1 : 0);
int x = ((BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SCROLLBAR_RIGHT)) ? 1 : 0);
XSetForeground(Xdisplay, gc_stipple, images[image_sa].current->bg);
XFillRectangle(Xdisplay, scrollbar.sa_win, gc_stipple, x + 1, 0, scrollbar_anchor_width() - x - 1, scrollbar_anchor_height());
@ -547,7 +547,7 @@ scrollbar_draw_anchor(unsigned char image_state, unsigned char force_modes)
#endif /* XTERM_SCROLLBAR */
#if defined(MOTIF_SCROLLBAR) || defined(NEXT_SCROLLBAR)
if (scrollbar.type == SCROLLBAR_MOTIF || scrollbar.type == SCROLLBAR_NEXT) {
if (eterm_options & OPT_SCROLLBAR_FLOATING) {
if (BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SCROLLBAR_FLOATING)) {
XSetWindowBackground(Xdisplay, scrollbar.sa_win, PixColors[bgColor]);
XClearWindow(Xdisplay, scrollbar.sa_win);
} else {
@ -656,7 +656,7 @@ scrollbar_draw_trough(unsigned char image_state, unsigned char force_modes)
}
if (!image_mode_is(image_sb, MODE_MASK)) {
/* Solid mode. Redraw every time since it's cheap. */
if ((eterm_options & OPT_SCROLLBAR_FLOATING) || (scrollbar.type == SCROLLBAR_XTERM)) {
if ((BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SCROLLBAR_FLOATING)) || (scrollbar.type == SCROLLBAR_XTERM)) {
XSetWindowBackground(Xdisplay, scrollbar.win, PixColors[bgColor]);
XClearWindow(Xdisplay, scrollbar.win);
} else {
@ -695,7 +695,7 @@ scrollbar_init(int width, int height)
/* Create the scrollbar trough window. It will be the parent to the other windows. */
scrollbar.win =
XCreateWindow(Xdisplay, TermWin.parent, ((eterm_options & OPT_SCROLLBAR_RIGHT) ? (width - scrollbar_trough_width()) : (0)),
XCreateWindow(Xdisplay, TermWin.parent, ((BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SCROLLBAR_RIGHT)) ? (width - scrollbar_trough_width()) : (0)),
bbar_calc_docked_height(BBAR_DOCKED_TOP), scrollbar_trough_width(), height, 0, Xdepth, InputOutput, CopyFromParent,
CWOverrideRedirect | CWBackPixel | CWBorderPixel | CWColormap, &Attributes);
XDefineCursor(Xdisplay, scrollbar.win, cursor);
@ -817,9 +817,9 @@ scrollbar_resize(int width, int height)
D_SCROLLBAR(("scrollbar_resize(%d, %d)\n", width, height));
scrollbar_calc_size(width, height);
D_SCROLLBAR((" -> XMoveResizeWindow(Xdisplay, 0x%08x, %d, y, %d, %d)\n", scrollbar.win,
((eterm_options & OPT_SCROLLBAR_RIGHT) ? (width - scrollbar_trough_width()) : (0)),
((BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SCROLLBAR_RIGHT)) ? (width - scrollbar_trough_width()) : (0)),
scrollbar_trough_width(), scrollbar_trough_height()));
XMoveResizeWindow(Xdisplay, scrollbar.win, ((eterm_options & OPT_SCROLLBAR_RIGHT) ? (width - scrollbar_trough_width()) : (0)),
XMoveResizeWindow(Xdisplay, scrollbar.win, ((BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SCROLLBAR_RIGHT)) ? (width - scrollbar_trough_width()) : (0)),
bbar_calc_docked_height(BBAR_DOCKED_TOP), scrollbar_trough_width(), scrollbar_trough_height());
scrollbar_draw_trough(IMAGE_STATE_CURRENT, MODE_MASK);
scrollbar_reposition_and_draw(MODE_MASK);

@ -118,7 +118,7 @@ eterm_bootstrap(int argc, char *argv[])
}
XSetErrorHandler((XErrorHandler) xerror_handler);
if (eterm_options & OPT_INSTALL) {
if (BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_INSTALL)) {
cmap = XCreateColormap(Xdisplay, Xroot, Xvisual, AllocNone);
XInstallColormap(Xdisplay, cmap);
} else {
@ -235,7 +235,7 @@ eterm_bootstrap(int argc, char *argv[])
/* Initialize the scrollbar */
scrollbar_init(szHint.width, szHint.height - bbar_calc_docked_height(BBAR_DOCKED));
scrollbar_mapping((eterm_options & OPT_SCROLLBAR) && !((eterm_options & OPT_SCROLLBAR_POPUP) && !TermWin.focus));
scrollbar_mapping((BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SCROLLBAR)) && !((BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SCROLLBAR_POPUP)) && !TermWin.focus));
/* Initialize the menu subsystem. */
menu_init();

@ -290,14 +290,14 @@ lookup_key(XEvent * ev)
}
if (len) {
/* Only home for keypresses with length. */
if (eterm_options & OPT_HOME_ON_INPUT) {
if (BITFIELD_IS_SET(vt_options, VT_OPTIONS_HOME_ON_INPUT)) {
TermWin.view_start = 0;
}
}
/* This is a special mode that reports all extended keysyms (above 0xff00) to the application
as escape sequences. Very few applications use it, but it can be a handy thing to have. */
if ((eterm_options & OPT_REPORT_AS_KEYSYMS) && (keysym >= 0xff00)) {
if ((BITFIELD_IS_SET(vt_options, VT_OPTIONS_REPORT_AS_KEYSYMS)) && (keysym >= 0xff00)) {
len = sprintf((char *) kbuf, "\033[k%X;%X~", (unsigned int) (ev->xkey.state & 0xff), (unsigned int) (keysym & 0xff));
tt_write(kbuf, len);
LK_RET();
@ -468,7 +468,7 @@ lookup_key(XEvent * ev)
kbuf[0] = (((PrivateModes & PrivMode_BackSpace) ? !(shft | ctrl) : (shft | ctrl)) ? '\b' : '\177');
#endif
#ifdef MULTI_CHARSET
if ((eterm_options & OPT_MBYTE_CURSOR) && scr_multi2()) {
if ((BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_MBYTE_CURSOR)) && scr_multi2()) {
memmove(kbuf + len, kbuf, len);
len *= 2;
}
@ -530,7 +530,7 @@ lookup_key(XEvent * ev)
kbuf[2] = ("dacb"[keysym - XK_Left]);
}
#ifdef MULTI_CHARSET
if ((eterm_options & OPT_MBYTE_CURSOR)
if ((BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_MBYTE_CURSOR))
&& ((keysym == XK_Left && scr_multi2())
|| (keysym == XK_Right && scr_multi1()))) {
memmove(kbuf + len, kbuf, len);
@ -624,7 +624,7 @@ lookup_key(XEvent * ev)
#ifdef KS_DELETE
len = strlen(strcpy(kbuf, KS_DELETE));
#ifdef MULTI_CHARSET
if ((eterm_options & OPT_MBYTE_CURSOR) && scr_multi1()) {
if ((BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_MBYTE_CURSOR)) && scr_multi1()) {
memmove(kbuf + len, kbuf, len);
len *= 2;
}