repo: rxvt-unicode-sixel action: commit revision: path_from: revision_from: e2156e87226738be6e5c27de42e7ca895aaaa154: path_to: revision_to:
commit e2156e87226738be6e5c27de42e7ca895aaaa154 Author: Marc LehmannDate: Sat Dec 13 12:24:33 2014 +0000 *** empty log message *** diff --git a/Changes b/Changes
--- a/Changes
+++ b/Changes
@@ -36,6 +36,7 @@ TODO IMPL: recalc bg always on bg colour change
TODO: document typical actions in rxvt.1.pod keysyms
TODO: warn with a graphical message when env has been modified
+TODO: open question, what does the nested set_color calls in get_coplours actualyl do? we can fail, but we always allocyte a replacement color.
- NOTICE: this release updates terminfo.
- fix pixel droppings on overdraw when a secondary core font has the
same height but different ascent.
@@ -86,6 +87,8 @@ TODO: warn with a graphical message when env has been modified
only relevant for antique 8bpp frame buffers).
- do not specialcase 2 or 4 colour visuals, leading to
simpler and actually more correct code.
+ - hopefully no longer leak colours on !truecolor visuals.
+ - use consistent method names (scr_recolour => scr_recolor).
9.20 Sat Apr 26 16:22:27 CEST 2014
- (libptytty) fix bug that prevented urxvtd from writing utmp
diff --git a/src/background.C b/src/background.C
--- a/src/background.C
+++ b/src/background.C
@@ -504,7 +504,7 @@ rxvt_term::bg_render ()
render_image (fimage);
# endif
- scr_recolour (false);
+ scr_recolor (false);
bg_flags |= BG_NEEDS_REFRESH;
bg_valid_since = ev::now ();
diff --git a/src/command.C b/src/command.C
--- a/src/command.C
+++ b/src/command.C
@@ -1241,7 +1241,7 @@ void ecb_cold
rxvt_term::pointer_unblank ()
{
XDefineCursor (dpy, vt, TermWin_cursor);
- recolour_cursor ();
+ recolor_cursor ();
#ifdef POINTER_BLANK
hidden_pointer = 0;
@@ -1781,7 +1781,7 @@ rxvt_term::focus_in ()
if (rs[Rs_fade])
{
pix_colors = pix_colors_focused;
- scr_recolour ();
+ scr_recolor ();
}
#endif
#if ENABLE_FRILLS
@@ -1828,7 +1828,7 @@ rxvt_term::focus_out ()
if (rs[Rs_fade])
{
pix_colors = pix_colors_unfocused;
- scr_recolour ();
+ scr_recolor ();
}
#endif
@@ -1837,11 +1837,14 @@ rxvt_term::focus_out ()
}
void ecb_cold
-rxvt_term::update_fade_color (unsigned int idx)
+rxvt_term::update_fade_color (unsigned int idx, bool first_time)
{
#if OFF_FOCUS_FADING
if (rs[Rs_fade])
{
+ if (!first_time)
+ pix_colors_focused [idx].free (this);
+
rgba c;
pix_colors [Color_fade].get (c);
pix_colors_focused [idx].fade (this, atoi (rs[Rs_fade]), pix_colors_unfocused [idx], c);
diff --git a/src/init.C b/src/init.C
--- a/src/init.C
+++ b/src/init.C
@@ -1058,7 +1058,7 @@ rxvt_term::init_command (const char *const *argv)
/*----------------------------------------------------------------------*/
void
-rxvt_term::get_colours ()
+rxvt_term::get_colors ()
{
int i;
@@ -1066,7 +1066,7 @@ rxvt_term::get_colours ()
pix_colors = pix_colors_focused;
#endif
- for (i = 0; i < (depth <= 2 ? 2 : NRS_COLORS); i++)
+ for (i = 0; i < NRS_COLORS; i++)
{
const char *name = rs[Rs_color + i];
@@ -1087,6 +1087,8 @@ rxvt_term::get_colours ()
if (!name)
continue;
+ xcol.free (this);
+
if (!set_color (xcol, name))
{
switch (i)
@@ -1115,13 +1117,6 @@ rxvt_term::get_colours ()
rs[Rs_color + i] = name;
}
- if (depth <= 2)
- {
- if (!rs[Rs_color + Color_pointer_fg]) alias_color (Color_pointer_fg, Color_fg);
- if (!rs[Rs_color + Color_pointer_bg]) alias_color (Color_pointer_bg, Color_bg);
- if (!rs[Rs_color + Color_border] ) alias_color (Color_border, Color_fg);
- }
-
/*
* get scrollBar shadow colors
*
@@ -1129,35 +1124,25 @@ rxvt_term::get_colours ()
* from the fvwm window manager.
*/
#ifdef RXVT_SCROLLBAR
- if (depth <= 2)
- {
- /* Monochrome */
- alias_color (Color_scroll, Color_fg);
- alias_color (Color_topShadow, Color_bg);
- alias_color (Color_bottomShadow, Color_bg);
- }
- else
- {
- pix_colors [Color_scroll].fade (this, 50, pix_colors [Color_bottomShadow]);
-
- rgba cscroll;
- pix_colors [Color_scroll].get (cscroll);
-
- /* topShadowColor */
- if (!pix_colors[Color_topShadow].set (this,
- rgba (
- min ((int)rgba::MAX_CC, max (cscroll.r / 5, cscroll.r) * 7 / 5),
- min ((int)rgba::MAX_CC, max (cscroll.g / 5, cscroll.g) * 7 / 5),
- min ((int)rgba::MAX_CC, max (cscroll.b / 5, cscroll.b) * 7 / 5),
- cscroll.a)
- ))
- alias_color (Color_topShadow, Color_White);
- }
+ pix_colors [Color_scroll].fade (this, 50, pix_colors [Color_bottomShadow]);
+
+ rgba cscroll;
+ pix_colors [Color_scroll].get (cscroll);
+
+ /* topShadowColor */
+ if (!pix_colors[Color_topShadow].set (this,
+ rgba (
+ min ((int)rgba::MAX_CC, max (cscroll.r / 5, cscroll.r) * 7 / 5),
+ min ((int)rgba::MAX_CC, max (cscroll.g / 5, cscroll.g) * 7 / 5),
+ min ((int)rgba::MAX_CC, max (cscroll.b / 5, cscroll.b) * 7 / 5),
+ cscroll.a)
+ ))
+ alias_color (Color_topShadow, Color_White);
#endif
#ifdef OFF_FOCUS_FADING
- for (i = 0; i < (depth <= 2 ? 2 : NRS_COLORS); i++)
- update_fade_color (i);
+ for (i = 0; i < NRS_COLORS; i++)
+ update_fade_color (i, true);
#endif
}
@@ -1346,7 +1331,7 @@ rxvt_term::create_windows (int argc, const char *const *argv)
dLocal (Display *, dpy);
/* grab colors before netscape does */
- get_colours ();
+ get_colors ();
if (!set_fonts ())
rxvt_fatal ("unable to load base fontset, please specify a valid one using -fn, aborting.\n");
@@ -1509,7 +1494,7 @@ rxvt_term::create_windows (int argc, const char *const *argv)
#endif
pointer_unblank ();
- scr_recolour ();
+ scr_recolor ();
}
/*----------------------------------------------------------------------*/
diff --git a/src/main.C b/src/main.C
--- a/src/main.C
+++ b/src/main.C
@@ -944,8 +944,6 @@ void
rxvt_term::set_window_color (int idx, const char *color)
{
#ifdef XTERM_COLOR_CHANGE
- rxvt_color xcol;
-
if (color == NULL || *color == '\0')
return;
@@ -961,38 +959,32 @@ rxvt_term::set_window_color (int idx, const char *color)
if (i >= 8 && i <= 15)
{
/* bright colors */
- pix_colors_focused[idx] = pix_colors_focused[minBrightCOLOR + i - 8];
+ alias_color (idx, minBrightCOLOR + i - 8);
goto done;
}
if (i >= 0 && i <= 7)
{
/* normal colors */
- pix_colors_focused[idx] = pix_colors_focused[minCOLOR + i];
+ alias_color (idx, minCOLOR + i);
goto done;
}
}
- set_color (xcol, color);
-
- /*
- * FIXME: should free colors here, but no idea how to do it so instead,
- * so just keep gobbling up the colormap
- */
-
- pix_colors_focused[idx] = xcol;
+ pix_colors_focused[idx].free (this);
+ set_color (pix_colors_focused[idx], color);
done:
/*TODO: handle Color_BD, scrollbar background, etc. */
update_fade_color (idx);
- recolour_cursor ();
- scr_recolour ();
+ recolor_cursor ();
+ scr_recolor ();
#endif /* XTERM_COLOR_CHANGE */
}
void
-rxvt_term::recolour_cursor ()
+rxvt_term::recolor_cursor ()
{
XColor fg, bg;
diff --git a/src/perl/background b/src/perl/background
--- a/src/perl/background
+++ b/src/perl/background
@@ -1188,7 +1188,7 @@ sub recalculate {
# set background pixmap
$self->set_background ($img, $self->{border});
- $self->scr_recolour (0);
+ $self->scr_recolor (0);
$self->want_refresh;
}
diff --git a/src/rxvt.h b/src/rxvt.h
--- a/src/rxvt.h
+++ b/src/rxvt.h
@@ -1373,7 +1373,7 @@ struct rxvt_term : zero_initialized, rxvt_vars, rxvt_screen
#else
void set_urgency (bool enable) { }
#endif
- void update_fade_color (unsigned int idx);
+ void update_fade_color (unsigned int idx, bool first_time = false);
#ifdef PRINTPIPE
FILE *popen_printer ();
int pclose_printer (FILE *stream);
@@ -1407,7 +1407,7 @@ struct rxvt_term : zero_initialized, rxvt_vars, rxvt_screen
int run_child (const char *const *argv);
void color_aliases (int idx);
void create_windows (int argc, const char *const *argv);
- void get_colours ();
+ void get_colors ();
void get_ourmods ();
void set_icon (const char *file);
// main.C
@@ -1416,7 +1416,7 @@ struct rxvt_term : zero_initialized, rxvt_vars, rxvt_screen
~rxvt_term ();
void destroy ();
void emergency_cleanup ();
- void recolour_cursor ();
+ void recolor_cursor ();
void resize_all_windows (unsigned int newwidth, unsigned int newheight, int ignoreparent);
void window_calc (unsigned int newwidth, unsigned int newheight);
bool set_fonts ();
@@ -1492,7 +1492,7 @@ struct rxvt_term : zero_initialized, rxvt_vars, rxvt_screen
#endif
void scr_touch (bool refresh) NOTHROW;
void scr_expose (int x, int y, int width, int height, bool refresh) NOTHROW;
- void scr_recolour (bool refresh = true) NOTHROW;
+ void scr_recolor (bool refresh = true) NOTHROW;
void scr_remap_chars () NOTHROW;
void scr_remap_chars (line_t &l) NOTHROW;
diff --git a/src/rxvtperl.xs b/src/rxvtperl.xs
--- a/src/rxvtperl.xs +++ b/src/rxvtperl.xs @@ -1997,7 +1997,7 @@ void rxvt_term::scr_bell () void -rxvt_term::scr_recolour (bool refresh = true); +rxvt_term::scr_recolor (bool refresh = true); void rxvt_term::scr_change_screen (int screen) diff --git a/src/screen.C b/src/screen.C
--- a/src/screen.C
+++ b/src/screen.C
@@ -2514,7 +2514,7 @@ rxvt_term::scr_remap_chars () NOTHROW
}
void ecb_cold
-rxvt_term::scr_recolour (bool refresh) NOTHROW
+rxvt_term::scr_recolor (bool refresh) NOTHROW
{
bool transparent = false;
-----END OF PAGE-----