repo: rxvt-unicode-sixel action: commit revision: path_from: revision_from: 5ba9e280e819cc01ed4db8b5e0297052761fdcce: path_to: revision_to:
commit 5ba9e280e819cc01ed4db8b5e0297052761fdcce Author: Marc LehmannDate: Tue Jan 31 19:53:31 2006 +0000 *** empty log message *** diff --git a/src/command.C b/src/command.C
--- a/src/command.C
+++ b/src/command.C
@@ -2543,7 +2543,7 @@ rxvt_term::check_our_parents ()
int shade = rs[Rs_shade] ? atoi (rs[Rs_shade]) : 100;
rgba c;
- pix_colors_focused [Color_tint].get (this, c);
+ pix_colors_focused [Color_tint].get (c);
ShadeXImage (this, image, shade, c.r, c.g, c.b);
}
@@ -3721,7 +3721,7 @@ rxvt_term::process_color_seq (int report, int color, const char *str, char resp)
if (str[0] == '?' && !str[1])
{
rgba c;
- pix_colors_focused[color].get (this, c);
+ pix_colors_focused[color].get (c);
#if XFT
if (c.a != rgba::MAX_CC)
diff --git a/src/init.C b/src/init.C
--- a/src/init.C
+++ b/src/init.C
@@ -299,6 +299,7 @@ rxvt_term::init_resources (int argc, const char *const *argv)
if (!(display = displays.get (rs[Rs_display_name])))
rxvt_fatal ("can't open display %s, aborting.\n", rs[Rs_display_name]);
+ // using a local pointer decreases code size a lot
xa = display->xa;
#if XFT
@@ -310,6 +311,10 @@ rxvt_term::init_resources (int argc, const char *const *argv)
extract_resources ();
+ for (int i = NUM_RESOURCES; i--; )
+ if (rs [i] == resval_undef)
+ rs [i] = 0;
+
free (r_argv);
#if ENABLE_PERL
@@ -710,7 +715,7 @@ rxvt_term::Get_Colours ()
for (i = 0; i < (depth <= 2 ? 2 : NRS_COLORS); i++)
{
rgba c;
- pix_colors[Color_fade].get (this, c);
+ pix_colors[Color_fade].get (c);
pix_colors_focused[i].fade (this, atoi (rs[Rs_fade]), pix_colors_unfocused[i],c);
}
#endif
@@ -749,8 +754,8 @@ rxvt_term::Get_Colours ()
rgba c0, c1;
- xcol[0].get (this, c0);
- xcol[1].get (this, c1);
+ xcol[0].get (c0);
+ xcol[1].get (c1);
xcol[1].fade (this, 50, pix_colors[Color_bottomShadow]);
diff --git a/src/main.C b/src/main.C
--- a/src/main.C
+++ b/src/main.C
@@ -934,7 +934,7 @@ done:
if (rs[Rs_fade])
{
rgba c;
- pix_colors [Color_fade].get (this, c);
+ pix_colors [Color_fade].get (c);
pix_colors_focused [idx].fade (this, atoi (rs[Rs_fade]), pix_colors_unfocused [idx], c);
}
#endif
diff --git a/src/rxvt.h b/src/rxvt.h
--- a/src/rxvt.h
+++ b/src/rxvt.h
@@ -890,11 +890,17 @@ extern class rxvt_composite_vec rxvt_composite;
/****************************************************************************/
#ifdef KEYSYM_RESOURCE
- class keyboard_manager;
+class keyboard_manager;
#endif
struct rxvt_term : zero_initialized, rxvt_vars, rxvt_screen {
- log_callback *log_hook; // log error messages through this hook, if != 0
+
+ // special markers with magic addresses
+ static const char resval_undef []; // options specifically unset
+ static const char resval_on []; // boolean options switched on
+ static const char resval_off []; // or off
+
+ log_callback *log_hook; // log error messages through this hook, if != 0
getfd_callback *getfd_hook; // convert remote to local fd, if != 0
#if ENABLE_PERL
rxvt_perl_term perl;
diff --git a/src/rxvttoolkit.C b/src/rxvttoolkit.C
--- a/src/rxvttoolkit.C
+++ b/src/rxvttoolkit.C
@@ -721,7 +721,7 @@ rxvt_color::set (rxvt_screen *screen, const rgba &color)
}
void
-rxvt_color::get (rxvt_screen *screen, rgba &color)
+rxvt_color::get (rgba &color)
{
#if XFT
color.r = c.color.red;
@@ -750,7 +750,7 @@ void
rxvt_color::fade (rxvt_screen *screen, int percent, rxvt_color &result, const rgba &to)
{
rgba c;
- get (screen, c);
+ get (c);
result.set (
screen,
diff --git a/src/rxvttoolkit.h b/src/rxvttoolkit.h
--- a/src/rxvttoolkit.h
+++ b/src/rxvttoolkit.h
@@ -252,7 +252,7 @@ struct rxvt_color {
bool alloc (rxvt_screen *screen, const rgba &color);
void free (rxvt_screen *screen);
- void get (rxvt_screen *screen, rgba &color);
+ void get (rgba &color);
bool set (rxvt_screen *screen, const char *name);
bool set (rxvt_screen *screen, const rgba &color);
diff --git a/src/scrollbar-plain.C b/src/scrollbar-plain.C
--- a/src/scrollbar-plain.C
+++ b/src/scrollbar-plain.C
@@ -50,12 +50,12 @@ rxvt_term::scrollbar_show_plain (int update, int last_top, int last_bot, int scr
if (last_top < scrollBar.top)
XClearArea (xdisp, scrollBar.win,
sb_shadow, last_top,
- sbwidth + 1, (scrollBar.top - last_top), False);
+ sbwidth + 1, scrollBar.top - last_top, False);
if (scrollBar.bot < last_bot)
XClearArea (xdisp, scrollBar.win,
sb_shadow, scrollBar.bot,
- sbwidth + 1, (last_bot - scrollBar.bot), False);
+ sbwidth + 1, last_bot - scrollBar.bot, False);
}
else
XClearWindow (xdisp, scrollBar.win);
diff --git a/src/xdefaults.C b/src/xdefaults.C
--- a/src/xdefaults.C +++ b/src/xdefaults.C @@ -23,8 +23,8 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *----------------------------------------------------------------------*/ -#include "../config.h" /* NECESSARY */ -#include "rxvt.h" /* NECESSARY */ +#include "../config.h" +#include "rxvt.h" #include "version.h" #ifdef KEYSYM_RESOURCE @@ -388,6 +388,10 @@ static const char optionsstring[] = "options: " #define INDENT 18 +const char rxvt_term::resval_undef [] = ""; +const char rxvt_term::resval_on [] = "on"; +const char rxvt_term::resval_off [] = "off"; + /*{{{ usage: */ /*----------------------------------------------------------------------*/ static void @@ -483,7 +487,6 @@ void rxvt_term::get_options (int argc, const char *const *argv) { int i, bad_option = 0; - static const char On[3] = "ON", Off[4] = "OFF"; for (i = 1; i < argc; i++) { @@ -494,13 +497,15 @@ rxvt_term::get_options (int argc, const char *const *argv) if (*opt == '-') { - flag = On; + flag = resval_on; + if (*++opt == '-') longopt = *opt++; /* long option */ } else if (*opt == '+') { - flag = Off; + flag = resval_off; + if (*++opt == '+') longopt = *opt++; /* long option */ } @@ -513,6 +518,7 @@ rxvt_term::get_options (int argc, const char *const *argv) if (!strcmp (opt, "help")) rxvt_usage (longopt ? 2 : 1); + if (!strcmp (opt, "h")) rxvt_usage (0); @@ -526,7 +532,7 @@ rxvt_term::get_options (int argc, const char *const *argv) if (entry < optList_size) { if (optList_isReverse (entry)) - flag = flag == On ? Off : On; + flag = flag == resval_on ? resval_off : resval_on; if (optList_strlen (entry)) { @@ -537,12 +543,14 @@ rxvt_term::get_options (int argc, const char *const *argv) */ if (optList[entry].doff != -1) - rs[optList[entry].doff] = flag == On && argv[i+1] - ? argv[++i] : 0; + rs[optList[entry].doff] = flag == resval_on && argv[i+1] + ? argv[++i] : resval_undef; + + if (optList[entry].doff == Rs_color + Color_tint) printf ("doff %d is %s\n",optList[entry].doff,rs[optList[entry].doff]);//D } else { /* boolean value */ - set_option (optList[entry].flag & Optflag_mask, flag == On); + set_option (optList[entry].flag & Optflag_mask, flag == resval_on); if (optList[entry].doff != -1) rs[optList[entry].doff] = flag;
-----END OF PAGE-----