From 0321822e6a7c862eb33b4992ef57dd8ad3e724da Mon Sep 17 00:00:00 2001 From: root Date: Fri, 30 Jul 2004 14:59:11 +0000 Subject: [PATCH] *** empty log message *** --- README.configure | 2 ++ autoconf/config.h.in | 3 +++ autoconf/configure.in | 11 +++++++++++ doc/rxvt.1 | 2 ++ doc/rxvt.tbl | 2 ++ doc/yodl/rxvt-options.yo | 4 +++- reconf | 6 +++--- src/main.C | 21 +++++++++++++-------- src/rxvtcolor.C | 15 +++++++++++++++ src/rxvtcolor.h | 2 ++ src/rxvtlib.h.in | 4 ++++ 11 files changed, 60 insertions(+), 12 deletions(-) diff --git a/README.configure b/README.configure index d2409c91..16568c2c 100644 --- a/README.configure +++ b/README.configure @@ -73,6 +73,8 @@ report when a combination doesn't work, so it can be fixed. Marc Lehmann --enable-transparency add support for inheriting parent backgrounds thus giving a fake transparency to the term +--enable-fading + add support for fading the text when focus is lost. --enable-tinting add support for tinting of transparent backgrounds. --enable-menubar diff --git a/autoconf/config.h.in b/autoconf/config.h.in index 3dc48fe5..51321cef 100644 --- a/autoconf/config.h.in +++ b/autoconf/config.h.in @@ -331,6 +331,9 @@ /* Define if you want 8 bit control sequences */ #undef EIGHT_BIT_CONTROLS +/* Define if you want faded colors when focus is lost */ +#undef OFF_FOCUS_FADING + /* Define if you want your background to be tinted */ #undef TINTING diff --git a/autoconf/configure.in b/autoconf/configure.in index 98f15cc1..b0bb2306 100644 --- a/autoconf/configure.in +++ b/autoconf/configure.in @@ -70,6 +70,7 @@ support_frills=no support_linespace=no support_inheritpixmap=no support_tinting=no +support_fading=no support_keepscrolling=no support_selectionscrolling=no support_menubar=no @@ -113,6 +114,7 @@ AC_ARG_ENABLE(everything, support_linespace=yes support_inheritpixmap=yes support_tinting=yes + support_fading=yes support_keepscrolling=yes support_selectionscrolling=yes support_lastlog=yes @@ -191,6 +193,12 @@ AC_ARG_ENABLE(tinting, support_tinting=$enableval fi]) +AC_ARG_ENABLE(fading, + [ --enable-tinting enable colors fading when off focus], + [if test x$enableval = xyes -o x$enableval = xno; then + support_fading=$enableval + fi]) + AC_ARG_ENABLE(menubar, [ --enable-menubar enable menubar], [if test x$enableval = xyes -o x$enableval = xno; then @@ -1175,6 +1183,9 @@ dnl# -------------------------------------------------------------------------- if test x$support_8bitctrls = xyes; then AC_DEFINE(EIGHT_BIT_CONTROLS, 1, Define if you want 8 bit control sequences) fi +if test x$support_fading = xyes; then + AC_DEFINE(OFF_FOCUS_FADING, 1, Define if you want faded colors when focus is lost) +fi if test x$support_tinting = xyes; then AC_DEFINE(TINTING, 1, Define if you want your background to be tinted) fi diff --git a/doc/rxvt.1 b/doc/rxvt.1 index fd43fc8f..9c84b111 100644 --- a/doc/rxvt.1 +++ b/doc/rxvt.1 @@ -56,6 +56,8 @@ resource \fBjumpScroll\fP\&. Turn on/off inheriting parent window\&'s pixmap\&. Alternative form is \fB-tr\fP; resource \fBinheritPixmap\fP\&. +.IP "\fB-fade\fP \fInumber\fP" +Fade the text by the given percentage when focus is lost\&. .IP "\fB-tint\fP \fIcolour\fP" Tint the transparent background pixmap with the given colour\&. .IP "\fB-bg\fP \fIcolour\fP" diff --git a/doc/rxvt.tbl b/doc/rxvt.tbl index 49661a23..8a987330 100644 --- a/doc/rxvt.tbl +++ b/doc/rxvt.tbl @@ -53,6 +53,8 @@ resource \fBjumpScroll\fP\&. Turn on/off inheriting parent window\&'s pixmap\&. Alternative form is \fB-tr\fP; resource \fBinheritPixmap\fP\&. +.IP "\fB-fade\fP \fInumber\fP" +Fade the text by the given percentage when focus is lost\&. .IP "\fB-tint\fP \fIcolour\fP" Tint the transparent background pixmap with the given colour\&. .IP "\fB-bg\fP \fIcolour\fP" diff --git a/doc/yodl/rxvt-options.yo b/doc/yodl/rxvt-options.yo index ea152cd3..085c6380 100644 --- a/doc/yodl/rxvt-options.yo +++ b/doc/yodl/rxvt-options.yo @@ -1,4 +1,4 @@ -COMMENT(-- $Id: rxvt-options.yo,v 1.12 2004-07-26 14:57:12 root Exp $ --) +COMMENT(-- $Id: rxvt-options.yo,v 1.13 2004-07-30 14:59:12 root Exp $ --) COMMENT(----------------------------------------------------------------------) manpageoptions() @@ -39,6 +39,8 @@ startdit() Turn on/off inheriting parent window's pixmap. Alternative form is bf(-tr); resource bf(inheritPixmap). + dit(bf(-fade) em(number)) + Fade the text by the given percentage when focus is lost. dit(bf(-tint) em(colour)) Tint the transparent background pixmap with the given colour. dit(bf(-bg) em(colour)) diff --git a/reconf b/reconf index 957cc7d6..b4d860db 100755 --- a/reconf +++ b/reconf @@ -6,9 +6,9 @@ ./configure --prefix=/opt/rxvt --enable-utmp \ --enable-wtmp --enable-lastlog --enable-xim --disable-strings \ --with-term=rxvt --disable-keepscrolling --enable-xft --enable-mousewheel \ - --with-name=rxvt --enable-selectionscrolling \ - --enable-frills --enable-swapscreen --enable-transparency \ + --with-name=rxvt --enable-selectionscrolling --enable-pointer-blank \ + --enable-frills --enable-swapscreen --enable-transparency --enable-slipwheeling \ --with-codesets=eu,jp --enable-menubar --enable-tinting \ - --enable-cursor-blink --enable-pointer-blank --enable-text-blink \ + --enable-cursor-blink --enable-text-blink --enable-fading \ --enable-plain-scroll --enable-rxvt-scroll --enable-combining \ "$@" diff --git a/src/main.C b/src/main.C index a52028f2..b5df58d1 100644 --- a/src/main.C +++ b/src/main.C @@ -244,7 +244,10 @@ rxvt_term::~rxvt_term () // TODO: free pixcolours, colours should become part of rxvt_display - delete PixColors; + delete PixColorsFocused; +#ifdef OFF_FOCUS_FADING + delete PixColorsUnFocused; +#endif displays.put (display); @@ -957,7 +960,7 @@ rxvt_term::set_window_color (int idx, const char *color) { /* bright colors */ i -= 8; # ifndef NO_BRIGHTCOLOR - PixColors[idx] = PixColors[minBrightCOLOR + i]; + PixColorsFocused[idx] = PixColorsFocused[minBrightCOLOR + i]; SET_PIXCOLOR (idx); goto Done; # endif @@ -965,7 +968,7 @@ rxvt_term::set_window_color (int idx, const char *color) } if (i >= 0 && i <= 7) { /* normal colors */ - PixColors[idx] = PixColors[minCOLOR + i]; + PixColorsFocused[idx] = PixColorsFocused[minCOLOR + i]; SET_PIXCOLOR (idx); goto Done; } @@ -992,15 +995,17 @@ rxvt_term::set_window_color (int idx, const char *color) } # endif - PixColors[idx] = xcol; + PixColorsFocused[idx] = xcol; SET_PIXCOLOR (idx); /* XSetWindowAttributes attr; */ /* Cursor cursor; */ Done: +#ifdef OFF_FOCUS_FADING + PixColorsUnFocused[idx] = PixColorsFocused[idx].fade (display, atoi (rs[Rs_fade])); +#endif if (idx == Color_bg && ! (Options & Opt_transparent)) - XSetWindowBackground (display->display, TermWin.vt, - PixColors[Color_bg]); + XSetWindowBackground (display->display, TermWin.vt, PixColors[Color_bg]); /* handle Color_BD, scrollbar background, etc. */ @@ -1018,8 +1023,8 @@ rxvt_term::recolour_cursor () { XColor xcol[2]; - xcol[0].pixel = ISSET_PIXCOLOR (Color_pointer_fg) ? PixColors[Color_pointer_fg] : PixColors[Color_fg]; - xcol[1].pixel = ISSET_PIXCOLOR (Color_pointer_bg) ? PixColors[Color_pointer_bg] : PixColors[Color_bg]; + xcol[0].pixel = ISSET_PIXCOLOR (Color_pointer_fg) ? PixColorsFocused[Color_pointer_fg] : PixColorsFocused[Color_fg]; + xcol[1].pixel = ISSET_PIXCOLOR (Color_pointer_bg) ? PixColorsFocused[Color_pointer_bg] : PixColorsFocused[Color_bg]; XQueryColors (display->display, XCMAP, xcol, 2); XRecolorCursor (display->display, TermWin_cursor, xcol + 0, xcol + 1); } diff --git a/src/rxvtcolor.C b/src/rxvtcolor.C index dfa3e876..84005715 100644 --- a/src/rxvtcolor.C +++ b/src/rxvtcolor.C @@ -409,3 +409,18 @@ rxvt_color::free (rxvt_display *display) #endif } +rxvt_color +rxvt_color::fade (rxvt_display *display, int percent) +{ + unsigned short cr, cg, cb; + rxvt_color faded; + + get (display, cr, cg, cb); + faded.set (display, + cr * percent / 100, + cg * percent / 100, + cb * percent / 100); + + return faded; +} + diff --git a/src/rxvtcolor.h b/src/rxvtcolor.h index 1adedfb4..9edac7db 100644 --- a/src/rxvtcolor.h +++ b/src/rxvtcolor.h @@ -168,6 +168,8 @@ struct rxvt_color { bool set (rxvt_display *display, const char *name); bool set (rxvt_display *display, unsigned short cr, unsigned short cg, unsigned short cb); + rxvt_color fade (rxvt_display *, int percent); + void free (rxvt_display *display); }; diff --git a/src/rxvtlib.h.in b/src/rxvtlib.h.in index f390e217..1fd0a367 100644 --- a/src/rxvtlib.h.in +++ b/src/rxvtlib.h.in @@ -252,6 +252,10 @@ struct rxvt_vars { XSizeHints szHint; rxvt_display *display; rxvt_color *PixColors; + rxvt_color *PixColorsFocused; +#ifdef OFF_FOCUS_FADING + rxvt_color *PixColorsUnFocused; +#endif short numPixColors; Cursor TermWin_cursor; /* cursor for vt window */ int sb_shadow; /* scrollbar shadow width */ -- 2.34.1