From f32cc3cc9ecd5ff1f1dc7551062875e3e4dc88a1 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 31 Dec 2005 17:16:17 +0000 Subject: [PATCH] *** empty log message *** --- Changes | 1 + doc/rxvt.7.pod | 9 ++++++ src/command.C | 69 ++++++++++++++++++++++++------------------- src/init.C | 34 ++++++++++----------- src/logging.C | 6 ++-- src/main.C | 14 ++++----- src/rxvt.h | 4 +-- src/rxvtlib.h.in | 7 ++--- src/screen.C | 26 ++++++++-------- src/scrollbar-plain.C | 2 +- src/scrollbar-rxvt.C | 2 +- src/scrollbar-xterm.C | 2 +- src/scrollbar.C | 2 +- src/xdefaults.C | 25 +++++++++------- src/xpm.C | 2 +- 15 files changed, 113 insertions(+), 92 deletions(-) diff --git a/Changes b/Changes index 22277141..1272ea5b 100644 --- a/Changes +++ b/Changes @@ -26,6 +26,7 @@ WISH: just for fun, do shade and tint with XRender. - replaced callback.h by a fixed version from gvpe that correctly returns the callback result (affects new -pty-fd semantics in urxvtc on a few architectures). Reported by darix. + - further minor cleanups. 6.1 Tue Dec 27 13:23:40 CET 2005 - update iso8859-7 table (euro and drachma round-trip et al.). diff --git a/doc/rxvt.7.pod b/doc/rxvt.7.pod index 2a7ee6e8..ab1dbf07 100644 --- a/doc/rxvt.7.pod +++ b/doc/rxvt.7.pod @@ -1535,6 +1535,15 @@ X =end table +=item B<< C >> (B) + +=begin table + + B<< C >> Bold/italic implies high intensity (see option B<-is>) + B<< C >> Font styles have no effect on intensity. + +=end table + =item B<< C >> =begin table diff --git a/src/command.C b/src/command.C index 4a7af107..c2b66f76 100644 --- a/src/command.C +++ b/src/command.C @@ -868,7 +868,7 @@ rxvt_term::lookup_key (XKeyEvent &ev) if (len <= 0) return; /* not mapped */ - if (options & Opt_scrollTtyKeypress) + if (OPTION (Opt_scrollTtyKeypress)) if (view_start) { view_start = 0; @@ -1095,7 +1095,7 @@ rxvt_term::pty_fill () { pty_ev.stop (); - if (!(options & Opt_hold)) + if (!OPTION (Opt_hold)) destroy (); } @@ -1127,7 +1127,7 @@ rxvt_term::pointer_unblank () #ifdef POINTER_BLANK hidden_pointer = 0; - if (options & Opt_pointerBlank) + if (OPTION (Opt_pointerBlank)) pointer_ev.start (NOW + pointerBlankDelay); #endif } @@ -1136,7 +1136,7 @@ rxvt_term::pointer_unblank () void rxvt_term::pointer_blank () { - if (! (options & Opt_pointerBlank)) + if (! OPTION (Opt_pointerBlank)) return; XDefineCursor (display->display, vt, display->blank_cursor); @@ -1244,7 +1244,7 @@ rxvt_term::x_cb (XEvent &ev) SET_LOCALE (locale); #if defined(CURSOR_BLINK) - if ((options & Opt_cursorBlink) && ev.type == KeyPress) + if (OPTION (Opt_cursorBlink) && ev.type == KeyPress) { if (hidden_cursor) { @@ -1257,7 +1257,7 @@ rxvt_term::x_cb (XEvent &ev) #endif #if defined(POINTER_BLANK) - if ((options & Opt_pointerBlank) && pointerBlankDelay > 0) + if (OPTION (Opt_pointerBlank) && pointerBlankDelay > 0) { if (ev.type == MotionNotify || ev.type == ButtonPress @@ -1463,7 +1463,7 @@ rxvt_term::x_cb (XEvent &ev) } #ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */ - if (options & Opt_transparent) + if (OPTION (Opt_transparent)) check_our_parents (); #endif } @@ -1682,7 +1682,7 @@ rxvt_term::focus_in () } #endif #if CURSOR_BLINK - if (options & Opt_cursorBlink) + if (OPTION (Opt_cursorBlink)) cursor_blink_ev.start (NOW + BLINK_INTERVAL); #endif #if OFF_FOCUS_FADING @@ -1714,7 +1714,7 @@ rxvt_term::focus_out () XUnsetICFocus (Input_Context); #endif #if CURSOR_BLINK - if (options & Opt_cursorBlink) + if (OPTION (Opt_cursorBlink)) cursor_blink_ev.stop (); hidden_cursor = 0; #endif @@ -1748,7 +1748,7 @@ rxvt_term::rootwin_cb (XEvent &ev) /* FALLTHROUGH */ case ReparentNotify: - if ((options & Opt_transparent) && check_our_parents () && am_transparent) + if (OPTION (Opt_transparent) && check_our_parents () && am_transparent) want_refresh = want_full_refresh = 1; break; } @@ -2100,7 +2100,7 @@ rxvt_term::button_release (XButtonEvent &ev) if (ev.state & ShiftMask) i = 1; - else if (options & Opt_mouseWheelScrollPage) + else if (OPTION (Opt_mouseWheelScrollPage)) i = nrow - 1; else i = 5; @@ -2396,7 +2396,7 @@ rxvt_term::check_our_parents () pchanged = 0; - if (!(options & Opt_transparent)) + if (!OPTION (Opt_transparent)) return pchanged; /* Don't try any more */ XGetWindowAttributes (disp, display->root, &wrootattr); @@ -2684,7 +2684,7 @@ rxvt_term::cmd_parse () refresh_count++; - if (!(options & Opt_jumpScroll) + if (!OPTION (Opt_jumpScroll) || (refresh_count >= refresh_limit * (nrow - 1))) { refreshnow = true; @@ -2728,7 +2728,7 @@ rxvt_term::cmd_parse () */ if (refreshnow) { - if ((options & Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD) + if (OPTION (Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD) refresh_limit++; else { @@ -3402,7 +3402,7 @@ rxvt_term::process_csi_seq () scr_report_position (); break; case 7: /* unofficial extension */ - if (options & Opt_insecure) + if (OPTION (Opt_insecure)) tt_printf ("%-.250s\012", rs[Rs_display_name]); break; case 8: /* unofficial extension */ @@ -3576,7 +3576,7 @@ rxvt_term::process_window_ops (const int *args, unsigned int nargs) { char *s; XGetIconName (disp, parent[0], &s); - tt_printf ("\033]L%-.250s\234", (options & Opt_insecure) && s ? s : ""); /* 8bit ST */ + tt_printf ("\033]L%-.250s\234", OPTION (Opt_insecure) && s ? s : ""); /* 8bit ST */ XFree (s); } break; @@ -3584,7 +3584,7 @@ rxvt_term::process_window_ops (const int *args, unsigned int nargs) { char *s; XFetchName (disp, parent[0], &s); - tt_printf ("\033]l%-.250s\234", (options & Opt_insecure) && s ? s : ""); /* 8bit ST */ + tt_printf ("\033]l%-.250s\234", OPTION (Opt_insecure) && s ? s : ""); /* 8bit ST */ XFree (s); } break; @@ -3870,7 +3870,7 @@ rxvt_term::process_xterm_seq (int op, const char *str, unsigned char resp) #ifdef MENUBAR case URxvt_Menu: - if (options & Opt_insecure) + if (OPTION (Opt_insecure)) menubar_dispatch (const_cast(str)); // casting away constness is checked break; #endif @@ -3896,7 +3896,7 @@ rxvt_term::process_xterm_seq (int op, const char *str, unsigned char resp) #endif if (query) tt_printf ("\33]%d;%-.250s%c", saveop, - (options & Opt_insecure) && fontset[op - URxvt_font]->fontdesc + OPTION (Opt_insecure) && fontset[op - URxvt_font]->fontdesc ? fontset[op - URxvt_font]->fontdesc : "", resp); else @@ -3912,7 +3912,7 @@ rxvt_term::process_xterm_seq (int op, const char *str, unsigned char resp) #if ENABLE_FRILLS case URxvt_locale: if (query) - tt_printf ("\33]%d;%-.250s%c", URxvt_locale, (options & Opt_insecure) ? locale : "", resp); + tt_printf ("\33]%d;%-.250s%c", URxvt_locale, OPTION (Opt_insecure) ? locale : "", resp); else { set_locale (str); @@ -4052,7 +4052,7 @@ rxvt_term::process_terminal_mode (int mode, int priv __attribute__ ((unused)), u { case 1048: /* alternative cursor save */ case 1049: - if (options & Opt_secondaryScreen) + if (OPTION (Opt_secondaryScreen)) if (mode == 0) scr_cursor (RESTORE); else if (mode == 1) @@ -4077,10 +4077,10 @@ rxvt_term::process_terminal_mode (int mode, int priv __attribute__ ((unused)), u set_widthheight (((state ? 132 : 80) * fwidth), height); break; case 4: /* smooth scrolling */ - if (state) - options &= ~Opt_jumpScroll; + if (!state) + SET_OPTION (Opt_jumpScroll); else - options |= Opt_jumpScroll; + CLR_OPTION (Opt_jumpScroll); break; case 5: /* reverse video */ scr_rvideo_mode (state); @@ -4131,26 +4131,33 @@ rxvt_term::process_terminal_mode (int mode, int priv __attribute__ ((unused)), u break; /* X11 mouse highlighting */ #endif case 1010: /* scroll to bottom on TTY output inhibit */ - if (state) - options &= ~Opt_scrollTtyOutput; + if (!state) + SET_OPTION (Opt_scrollTtyOutput); else - options |= Opt_scrollTtyOutput; + CLR_OPTION (Opt_scrollTtyOutput); break; case 1011: /* scroll to bottom on key press */ if (state) - options |= Opt_scrollTtyKeypress; + SET_OPTION (Opt_scrollTtyKeypress); else - options &= ~Opt_scrollTtyKeypress; + CLR_OPTION (Opt_scrollTtyKeypress); break; +#if ENABLE_STYLES + case 1021: + if (state) + SET_OPTION (Opt_intensityStyles); + else + CLR_OPTION (Opt_intensityStyles); +#endif case 1047: /* secondary screen w/ clearing last */ - if (options & Opt_secondaryScreen) + if (OPTION (Opt_secondaryScreen)) if (current_screen != PRIMARY) scr_erase_screen (2); scr_change_screen (state); break; case 1049: /* secondary screen w/ clearing first */ scr_change_screen (state); - if (options & Opt_secondaryScreen) + if (OPTION (Opt_secondaryScreen)) if (current_screen != PRIMARY) scr_erase_screen (2); break; diff --git a/src/init.C b/src/init.C index 70e1b905..4d757577 100644 --- a/src/init.C +++ b/src/init.C @@ -395,7 +395,7 @@ rxvt_term::init_resources (int argc, const char *const *argv) /* no point having a scrollbar without having any scrollback! */ if (!saveLines) - options &= ~Opt_scrollBar; + CLR_OPTION (Opt_scrollBar); #ifdef PRINTPIPE if (!rs[Rs_print_pipe]) @@ -448,7 +448,7 @@ rxvt_term::init_resources (int argc, const char *const *argv) #ifdef XTERM_REVERSE_VIDEO /* this is how xterm implements reverseVideo */ - if (options & Opt_reverseVideo) + if (OPTION (Opt_reverseVideo)) { if (!rs[Rs_color + Color_fg]) rs[Rs_color + Color_fg] = def_colorName[Color_bg]; @@ -463,7 +463,7 @@ rxvt_term::init_resources (int argc, const char *const *argv) #ifndef XTERM_REVERSE_VIDEO /* this is how we implement reverseVideo */ - if (options & Opt_reverseVideo) + if (OPTION (Opt_reverseVideo)) ::swap (rs[Rs_color + Color_fg], rs[Rs_color + Color_bg]); #endif @@ -650,16 +650,16 @@ rxvt_term::init_command (const char *const *argv) */ #ifdef META8_OPTION - meta_char = (options & Opt_meta8 ? 0x80 : C0_ESC); + meta_char = OPTION ((Opt_meta8) ? 0x80 : C0_ESC); #endif get_ourmods (); - if (!(options & Opt_scrollTtyOutput)) + if (!OPTION (Opt_scrollTtyOutput)) priv_modes |= PrivMode_TtyOutputInh; - if (options & Opt_scrollTtyKeypress) + if (OPTION (Opt_scrollTtyKeypress)) priv_modes |= PrivMode_Keypress; - if (!(options & Opt_jumpScroll)) + if (!OPTION (Opt_jumpScroll)) priv_modes |= PrivMode_smoothScroll; #ifndef NO_BACKSPACE_KEY @@ -681,7 +681,7 @@ rxvt_term::init_command (const char *const *argv) } #ifdef CURSOR_BLINK - if (options & Opt_cursorBlink) + if (OPTION (Opt_cursorBlink)) (void)gettimeofday (&lastcursorchange, NULL); #endif @@ -708,7 +708,7 @@ rxvt_term::Get_Colours () if (!rXParseAllocColor (&xcol, rs[Rs_color + i])) { #ifndef XTERM_REVERSE_VIDEO - if (i < 2 && (options & Opt_reverseVideo)) + if (i < 2 && OPTION (Opt_reverseVideo)) rs[Rs_color + i] = def_colorName[!i]; else #endif @@ -941,14 +941,14 @@ rxvt_term::create_windows (int argc, const char *const *argv) assert (sizeof (xa_names) / sizeof (char *) == NUM_XA); XInternAtoms (disp, (char **)xa_names, NUM_XA, False, xa); - if (options & Opt_transparent) + if (OPTION (Opt_transparent)) { XGetWindowAttributes (disp, RootWindow (disp, display->screen), &gattr); display->depth = gattr.depth; // doh //TODO, per-term not per-display? } #if ENABLE_FRILLS - if (options & Opt_borderLess) + if (OPTION (Opt_borderLess)) { prop = XInternAtom(disp, "_MOTIF_WM_INFO", True); @@ -1028,7 +1028,7 @@ rxvt_term::create_windows (int argc, const char *const *argv) wmHint.flags = InputHint | StateHint | WindowGroupHint; wmHint.input = True; - wmHint.initial_state = options & Opt_iconic ? IconicState : NormalState; + wmHint.initial_state = OPTION (Opt_iconic) ? IconicState : NormalState; wmHint.window_group = top; XmbSetWMProperties (disp, top, NULL, NULL, (char **)argv, argc, @@ -1096,7 +1096,7 @@ rxvt_term::create_windows (int argc, const char *const *argv) vt_emask = ExposureMask | ButtonPressMask | ButtonReleaseMask | PropertyChangeMask; #ifdef POINTER_BLANK - if (options & Opt_pointerBlank) + if (OPTION (Opt_pointerBlank)) vt_emask |= PointerMotionMask; else #endif @@ -1133,7 +1133,7 @@ rxvt_term::create_windows (int argc, const char *const *argv) #ifdef XPM_BACKGROUND if (rs[Rs_backgroundPixmap] != NULL - && ! (options & Opt_transparent)) + && ! OPTION (Opt_transparent)) { const char *p = rs[Rs_backgroundPixmap]; @@ -1528,7 +1528,7 @@ rxvt_term::run_child (const char *const *argv) SET_TTYMODE (STDIN_FILENO, &tio); /* init terminal attributes */ - if (options & Opt_console) + if (OPTION (Opt_console)) { /* be virtual console, fail silently */ #ifdef TIOCCONS unsigned int on = 1; @@ -1588,7 +1588,7 @@ rxvt_term::run_child (const char *const *argv) argv0 = (const char *)rxvt_r_basename (shell); - if (options & Opt_loginShell) + if (OPTION (Opt_loginShell)) { login = (char *)rxvt_malloc ((strlen (argv0) + 2) * sizeof (char)); @@ -1633,7 +1633,7 @@ rxvt_term::run_child (const char *const *argv) arg_a[0] = my_basename (command); - if (options & Opt_loginShell) + if (OPTION (Opt_loginShell)) { login = rxvt_malloc ((strlen (arg_a[0]) + 2) * sizeof (char)); diff --git a/src/logging.C b/src/logging.C index a5276da4..ca280b4e 100644 --- a/src/logging.C +++ b/src/logging.C @@ -204,7 +204,7 @@ rxvt_term::makeutent (const char *pty, const char *hostname) #ifdef WTMP_SUPPORT # ifdef WTMP_ONLY_ON_LOGIN - if (options & Opt_loginShell) + if (OPTION (Opt_loginShell)) # endif { # ifdef HAVE_STRUCT_UTMP @@ -224,7 +224,7 @@ rxvt_term::makeutent (const char *pty, const char *hostname) } #endif #if defined(LASTLOG_SUPPORT) && defined(RXVT_LASTLOG_FILE) - if (options & Opt_loginShell) + if (OPTION (Opt_loginShell)) rxvt_update_lastlog (RXVT_LASTLOG_FILE, pty, hostname); #endif } @@ -285,7 +285,7 @@ rxvt_term::cleanutent () */ #ifdef WTMP_SUPPORT # ifdef WTMP_ONLY_ON_LOGIN - if (options & Opt_loginShell) + if (OPTION (Opt_loginShell)) # endif { # ifdef HAVE_STRUCT_UTMP diff --git a/src/main.C b/src/main.C index 8e3b184f..c6c44548 100644 --- a/src/main.C +++ b/src/main.C @@ -295,7 +295,7 @@ rxvt_term::child_exit () { cmd_pid = 0; - if (!(options & Opt_hold)) + if (!OPTION (Opt_hold)) destroy (); } @@ -471,7 +471,7 @@ rxvt_term::init (int argc, const char *const *argv) menubar_read (rs[Rs_menu]); #endif #ifdef HAVE_SCROLLBARS - if (options & Opt_scrollBar) + if (OPTION (Opt_scrollBar)) scrollBar.setIdle (); /* set existence for size calculations */ #endif @@ -488,7 +488,7 @@ rxvt_term::init (int argc, const char *const *argv) #endif #ifdef HAVE_SCROLLBARS - if (options & Opt_scrollBar) + if (OPTION (Opt_scrollBar)) resize_scrollbar (); /* create and map scrollbar */ #endif #if (MENUBAR_MAX) @@ -496,7 +496,7 @@ rxvt_term::init (int argc, const char *const *argv) XMapWindow (disp, menuBar.win); #endif #ifdef TRANSPARENT - if (options & Opt_transparent) + if (OPTION (Opt_transparent)) { XSelectInput (disp, display->root, PropertyChangeMask); check_our_parents (); @@ -683,7 +683,7 @@ rxvt_privileges (rxvt_privaction action) void rxvt_term::privileged_utmp (rxvt_privaction action) { - if ((options & Opt_utmpInhibit) + if (OPTION (Opt_utmpInhibit) || !pty.name || !*pty.name) return; @@ -785,7 +785,7 @@ rxvt_term::window_calc (unsigned int newwidth, unsigned int newheight) { sb_w = scrollbar_TotalWidth (); szHint.base_width += sb_w; - if (!(options & Opt_scrollBar_right)) + if (!OPTION (Opt_scrollBar_right)) window_vt_x += sb_w; } @@ -823,7 +823,7 @@ rxvt_term::window_calc (unsigned int newwidth, unsigned int newheight) szHint.height = szHint.base_height + height; } - if (scrollbar_visible () && (options & Opt_scrollBar_right)) + if (scrollbar_visible () && OPTION (Opt_scrollBar_right)) window_sb_x = szHint.width - sb_w; if (recalc_x) diff --git a/src/rxvt.h b/src/rxvt.h index dfd10634..ccce3fce 100644 --- a/src/rxvt.h +++ b/src/rxvt.h @@ -1485,7 +1485,7 @@ struct rxvt_term : zero_initialized, rxvt_vars { int base = GET_BASEFG (r); #ifndef NO_BRIGHTCOLOR if (r & RS_Bold - && (!ENABLE_STYLES || options & Opt_intensityStyles) + && (!ENABLE_STYLES || OPTION (Opt_intensityStyles)) && IN_RANGE_INC (base, minCOLOR, minBrightCOLOR)) base += minBrightCOLOR - minCOLOR; #endif @@ -1497,7 +1497,7 @@ struct rxvt_term : zero_initialized, rxvt_vars { int base = GET_BASEBG (r); #ifndef NO_BRIGHTCOLOR if (r & RS_Blink - && (!ENABLE_STYLES || options & Opt_intensityStyles) + && (!ENABLE_STYLES || OPTION (Opt_intensityStyles)) && IN_RANGE_INC (base, minCOLOR, minBrightCOLOR)) base += minBrightCOLOR - minCOLOR; #endif diff --git a/src/rxvtlib.h.in b/src/rxvtlib.h.in index d5cb975b..7e3d0322 100644 --- a/src/rxvtlib.h.in +++ b/src/rxvtlib.h.in @@ -266,11 +266,10 @@ typedef struct { #else # define Opt_intensityStyles 0 #endif -/* place holder used for parsing command-line options */ -#define Opt_Reverse (1UL<<30) -#define Opt_Boolean (1UL<<31) -#define OPTION(opt) (options && (opt)) +#define SET_OPTION(opt) (options |= (opt)) +#define CLR_OPTION(opt) (options &= ~(opt)) +#define OPTION(opt) (options & (opt)) #define DEFAULT_OPTIONS (Opt_scrollBar | Opt_scrollTtyOutput \ | Opt_jumpScroll | Opt_secondaryScreen \ | Opt_pastableTabs | Opt_intensityStyles) diff --git a/src/screen.C b/src/screen.C index 5b2d93dd..25c8c26c 100644 --- a/src/screen.C +++ b/src/screen.C @@ -48,7 +48,7 @@ inline void fill_text (text_t *start, text_t value, int len) * GENERAL SCREEN AND SELECTION UPDATE ROUTINES * * ------------------------------------------------------------------------- */ #define ZERO_SCROLLBACK() \ - if (options & Opt_scrollTtyOutput) \ + if (OPTION (Opt_scrollTtyOutput)) \ view_start = 0 #define CLEAR_SELECTION() \ selection.beg.row = selection.beg.col \ @@ -532,7 +532,7 @@ rxvt_term::scr_change_screen (int scrn) screen.cur.col = clamp (screen.cur.col, 0, prev_ncol - 1); #if NSCREENS - if (options & Opt_secondaryScreen) + if (OPTION (Opt_secondaryScreen)) { num_scr = 0; @@ -546,7 +546,7 @@ rxvt_term::scr_change_screen (int scrn) } else #endif - if (options & Opt_secondaryScroll) + if (OPTION (Opt_secondaryScroll)) scr_scroll_text (0, prev_nrow - 1, prev_nrow); return scrn; @@ -618,7 +618,7 @@ rxvt_term::scr_scroll_text (int row1, int row2, int count) if (count > 0 && row1 == 0 && row2 == nrow - 1 - && (current_screen == PRIMARY || options & Opt_secondaryScroll)) + && (current_screen == PRIMARY || OPTION (Opt_secondaryScroll))) { nsaved = min (nsaved + count, saveLines); term_start = (term_start + count) % total_rows; @@ -644,7 +644,7 @@ rxvt_term::scr_scroll_text (int row1, int row2, int count) scr_blank_screen_mem (ROW(row2 - i), rstyle); } - if ((options & Opt_scrollWithBuffer) + if (OPTION (Opt_scrollWithBuffer) && view_start != 0 && view_start != saveLines) scr_page (UP, count); @@ -1020,7 +1020,7 @@ rxvt_term::scr_tab (int count, bool ht) // store horizontal tab commands as characters inside the text // buffer so they can be selected and pasted. - if (ht && options & Opt_pastableTabs) + if (ht && OPTION (Opt_pastableTabs)) { base_rend = SET_FONT (base_rend, 0); @@ -1595,7 +1595,7 @@ rxvt_term::scr_rvideo_mode (int mode) if (bgPixmap.pixmap == None) #endif #if TRANSPARENT - if (! (options & Opt_transparent) || am_transparent == 0) + if (! OPTION (Opt_transparent) || am_transparent == 0) #endif XSetWindowBackground (display->display, vt, pix_colors[Color_bg]); @@ -1838,12 +1838,12 @@ rxvt_term::scr_bell () # ifndef NO_MAPALERT # ifdef MAPALERT_OPTION - if (options & Opt_mapAlert) + if (OPTION (Opt_mapAlert)) # endif XMapWindow (display->display, parent[0]); # endif - if (options & Opt_visualBell) + if (OPTION (Opt_visualBell)) { scr_rvideo_mode (!rvideo); /* refresh also done */ rxvt_usleep (VISUAL_BELL_DURATION); @@ -1944,7 +1944,7 @@ rxvt_term::scr_refresh (unsigned char refresh_type) must_clear |= bgPixmap.pixmap != None; #endif #if TRANSPARENT - must_clear |= (options & Opt_transparent) && am_transparent; + must_clear |= OPTION (Opt_transparent) && am_transparent; #endif ocrow = oldcursor.row; /* is there an old outline cursor on screen? */ @@ -1978,7 +1978,7 @@ rxvt_term::scr_refresh (unsigned char refresh_type) if (showcursor && focus) { - if (options & Opt_cursorUnderline) + if (OPTION (Opt_cursorUnderline)) *crp ^= RS_Uline; else { @@ -2321,7 +2321,7 @@ rxvt_term::scr_refresh (unsigned char refresh_type) { if (focus) { - if (options & Opt_cursorUnderline) + if (OPTION (Opt_cursorUnderline)) *crp ^= RS_Uline; else { @@ -3303,7 +3303,7 @@ rxvt_term::selection_extend_colrow (int32_t col, int32_t row, int button3, int b else if (selection.clicks == 3) { #if ENABLE_FRILLS - if (options & Opt_tripleclickwords) + if (OPTION (Opt_tripleclickwords)) { selection_delimit_word (UP, &selection.beg, &selection.beg); diff --git a/src/scrollbar-plain.C b/src/scrollbar-plain.C index d76427e1..c12df58a 100644 --- a/src/scrollbar-plain.C +++ b/src/scrollbar-plain.C @@ -44,7 +44,7 @@ rxvt_term::scrollbar_show_plain (int update, int last_top, int last_bot, int scr GCForeground, &gcvalue); } - xsb = (options & Opt_scrollBar_right) ? 1 : 0; + xsb = OPTION (Opt_scrollBar_right) ? 1 : 0; if (update) { diff --git a/src/scrollbar-rxvt.C b/src/scrollbar-rxvt.C index 04a701d5..a693842d 100644 --- a/src/scrollbar-rxvt.C +++ b/src/scrollbar-rxvt.C @@ -166,7 +166,7 @@ rxvt_term::scrollbar_show_rxvt (int update, int last_top, int last_bot, int scro { int xofs; - if (options & Opt_scrollBar_right) + if (OPTION (Opt_scrollBar_right)) xofs = 0; else xofs = sbshadow ? sbwidth : sbwidth - 1; diff --git a/src/scrollbar-xterm.C b/src/scrollbar-xterm.C index ae63e805..3ecaa6d4 100644 --- a/src/scrollbar-xterm.C +++ b/src/scrollbar-xterm.C @@ -61,7 +61,7 @@ rxvt_term::scrollbar_show_xterm (int update, int last_top, int last_bot, int scr if (update) { - xsb = (options & Opt_scrollBar_right) ? 1 : 0; + xsb = OPTION (Opt_scrollBar_right) ? 1 : 0; if (last_top < scrollBar.top) XClearArea (display->display, scrollBar.win, sb_shadow + xsb, last_top, diff --git a/src/scrollbar.C b/src/scrollbar.C index 7a6a6f49..4fad2b46 100644 --- a/src/scrollbar.C +++ b/src/scrollbar.C @@ -232,7 +232,7 @@ rxvt_term::setup_scrollbar (const char *scrollalign, const char *scrollstyle, co width = min (i, SB_WIDTH_MAXIMUM); # if defined(RXVT_SCROLLBAR) - if (! (options & Opt_scrollBar_floating) && style == R_SB_RXVT) + if (! OPTION (Opt_scrollBar_floating) && style == R_SB_RXVT) sb_shadow = SHADOW; # endif diff --git a/src/xdefaults.C b/src/xdefaults.C index be0dc439..a161b738 100644 --- a/src/xdefaults.C +++ b/src/xdefaults.C @@ -37,6 +37,11 @@ #include "keyboard.h" #endif +/* place holders used for parsing command-line options */ +#define Optflag_Reverse 0x40000000UL +#define Optflag_Boolean 0x80000000UL +#define Optflag_mask 0x3fffffffUL + /* #define DEBUG_RESOURCES */ /*{{{ monolithic option/resource structure: */ @@ -60,7 +65,7 @@ /* BOOL () - regular boolean `-/+' flag */ #define BOOL(rsp, kw, opt, flag, desc) \ - { (Opt_Boolean| (flag)), (rsp), (kw), (opt), NULL, (desc)} + { (Optflag_Boolean | (flag)), (rsp), (kw), (opt), NULL, (desc)} /* SWCH () - `-' flag */ #define SWCH(opt, flag, desc) \ @@ -70,9 +75,9 @@ #define optList_strlen(i) \ (optList[i].flag ? 0 : (optList[i].arg ? strlen (optList[i].arg) : 1)) #define optList_isBool(i) \ - (optList[i].flag & Opt_Boolean) + (optList[i].flag & Optflag_Boolean) #define optList_isReverse(i) \ - (optList[i].flag & Opt_Reverse) + (optList[i].flag & Optflag_Reverse) #define optList_size \ (sizeof (optList) / sizeof (optList[0])) @@ -107,7 +112,7 @@ optList[] = { STRG (Rs_scrollBar_thickness, "thickness", "sbt", "number", "scrollbar thickness/width in pixels"), #endif BOOL (Rs_scrollTtyOutput, "scrollTtyOutput", NULL, Opt_scrollTtyOutput, NULL), - BOOL (Rs_scrollTtyOutput, NULL, "si", Opt_Reverse | Opt_scrollTtyOutput, "scroll-on-tty-output inhibit"), + BOOL (Rs_scrollTtyOutput, NULL, "si", Optflag_Reverse | Opt_scrollTtyOutput, "scroll-on-tty-output inhibit"), BOOL (Rs_scrollTtyKeypress, "scrollTtyKeypress", "sk", Opt_scrollTtyKeypress, "scroll-on-keypress"), BOOL (Rs_scrollWithBuffer, "scrollWithBuffer", "sw", Opt_scrollWithBuffer, "scroll-with-buffer"), #if TRANSPARENT @@ -565,9 +570,9 @@ rxvt_term::get_options (int argc, const char *const *argv) optList[entry].opt, optList[entry].kw, flag); #endif if (flag == On) - options |= optList[entry].flag; + SET_OPTION (optList[entry].flag & Optflag_mask); else - options &= ~optList[entry].flag; + CLR_OPTION (optList[entry].flag & Optflag_mask); if (optList[entry].doff != -1) rs[optList[entry].doff] = flag; @@ -859,9 +864,9 @@ rxvt_term::get_xdefaults (FILE *stream, const char *name) s = !s; if (s) - options |= optList[entry].flag; + SET_OPTION (optList[entry].flag & Optflag_mask); else - options &= ~optList[entry].flag; + CLR_OPTION (optList[entry].flag & Optflag_mask); } } @@ -1031,9 +1036,9 @@ rxvt_term::extract_resources () s = !s; if (s) - options |= optList[entry].flag; + SET_OPTION (optList[entry].flag & Optflag_mask); else - options &= ~optList[entry].flag; + CLR_OPTION (optList[entry].flag & Optflag_mask); } } } diff --git a/src/xpm.C b/src/xpm.C index b9f88156..9e4aabfb 100644 --- a/src/xpm.C +++ b/src/xpm.C @@ -173,7 +173,7 @@ rxvt_term::resize_pixmap () { /* So be it: I'm not using pixmaps */ pixmap = None; - if (!(options & Opt_transparent) || !am_transparent) + if (!OPTION (Opt_transparent) || !am_transparent) XSetWindowBackground (disp, vt, pix_colors[Color_bg]); -- 2.34.1