rxvt-unicode with 24 bit colors cleanup
This commit is contained in:
parent
f7a4380ef0
commit
aa5ae9e46c
17 changed files with 0 additions and 1185 deletions
|
@ -1,337 +0,0 @@
|
||||||
From 703cbdc9de7d9e037403064a37c5c70b0cbcb2cb Mon Sep 17 00:00:00 2001
|
|
||||||
From: Emanuele Giaquinta <e.giaquinta@glauco.it>
|
|
||||||
Date: Tue, 21 Jun 2016 12:03:55 +0000
|
|
||||||
Subject: [PATCH] 24-bit direct color support (patch by Fengguang Wu)
|
|
||||||
|
|
||||||
Support directly setting RGB fg/bg colors via ISO-8613-3 24-bit
|
|
||||||
ANSI color escapes:
|
|
||||||
|
|
||||||
ESC[38;2;<r>;<g>;<b>m Select RGB foreground color
|
|
||||||
ESC[48;2;<r>;<g>;<b>m Select RGB background color
|
|
||||||
|
|
||||||
The killer applications for me are vim in tmux. It'll not only modernize
|
|
||||||
their look and feeling, but also bring more eye friendly color schemes.
|
|
||||||
Very helpful for long time programmers.
|
|
||||||
|
|
||||||
To avoid memory overheads and keep the patch non-intrusive, it takes the
|
|
||||||
approach to adapt the nearest color in an hidden 6x6x4 (88-color mode)
|
|
||||||
or 7x7x5 (256-color mode) color cube to the new 24-bit RGB color.
|
|
||||||
|
|
||||||
The pros/cons are:
|
|
||||||
|
|
||||||
+) least memory footprint (close to 0)
|
|
||||||
comparing to konsole, gnome-terminal etc. real 24-bit arrays
|
|
||||||
|
|
||||||
+) exact colors and excellent user feelings
|
|
||||||
comparing to xterm, mlterm, etc. approximating to 256 palette
|
|
||||||
|
|
||||||
+) usable in both the existing 88/256-color modes
|
|
||||||
|
|
||||||
Most vim GUI color schemes show up the same as gvim in rxvt-unicode's
|
|
||||||
88-color mode, not to mention the 256-color mode. Typical applications
|
|
||||||
only use one or two dozens of colors at the same time.
|
|
||||||
|
|
||||||
-) may not be able to show 2+ close 24-bit colors
|
|
||||||
|
|
||||||
RGB colors close to each other will likely fall into the same slot in
|
|
||||||
the 6x6x4 or 7x7x5 color cube. If necessary, it could be improved
|
|
||||||
effectively by implementing some collision avoidance logic, trying to
|
|
||||||
find empty/eldest slot in the +1/-1 r/g/b indices (ie. 3-8 neighbors).
|
|
||||||
|
|
||||||
The CPU overheads of map_rgb24_color() look ignorable: I feel no
|
|
||||||
perceptible slow down when doing vim operations in 24-bit color mode.
|
|
||||||
|
|
||||||
A micro benchmark running a test script from [1]:
|
|
||||||
|
|
||||||
% time (for i in {1..100}; do 24-bit-color.sh; done)
|
|
||||||
|
|
||||||
vanilla rxvt-unicode
|
|
||||||
====================
|
|
||||||
2.42s user 1.88s system 31% cpu 13.555 total
|
|
||||||
2.59s user 1.74s system 31% cpu 13.615 total
|
|
||||||
2.46s user 1.85s system 31% cpu 13.631 total
|
|
||||||
|
|
||||||
THIS PATCH (adapt hidden color cube to 24-bit)
|
|
||||||
==============================================
|
|
||||||
2.33s user 1.97s system 31% cpu 13.598 total
|
|
||||||
2.46s user 1.89s system 31% cpu 13.613 total
|
|
||||||
2.51s user 1.82s system 31% cpu 13.556 total
|
|
||||||
|
|
||||||
https://github.com/spudowiar/rxvt-unicode (real 24-bit array)
|
|
||||||
=============================================================
|
|
||||||
2.61s user 1.75s system 31% cpu 13.721 total
|
|
||||||
2.48s user 1.82s system 31% cpu 13.566 total
|
|
||||||
2.60s user 1.76s system 31% cpu 13.631 total
|
|
||||||
|
|
||||||
USE_256_COLORS is defined in all the above rxvt-unicode builds.
|
|
||||||
|
|
||||||
References:
|
|
||||||
|
|
||||||
[1] True Colour (16 million colours) support in various terminal
|
|
||||||
applications and terminals
|
|
||||||
https://gist.github.com/XVilka/8346728
|
|
||||||
|
|
||||||
[2] https://en.wikipedia.org/wiki/ANSI_escape_code#Colors
|
|
||||||
---
|
|
||||||
doc/rxvt.1.pod | 9 +++++++++
|
|
||||||
doc/rxvt.7.pod | 2 ++
|
|
||||||
src/command.C | 43 +++++++++++++++++++++++++++++++++++++++++++
|
|
||||||
src/init.C | 35 +++++++++++++++++++++++++++++++++++
|
|
||||||
src/rxvt.h | 27 +++++++++++++++++++++++++--
|
|
||||||
src/rxvtfont.h | 4 ++--
|
|
||||||
src/screen.C | 2 +-
|
|
||||||
7 files changed, 117 insertions(+), 5 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/doc/rxvt.1.pod b/doc/rxvt.1.pod
|
|
||||||
index 19317ef0..c6f951fb 100644
|
|
||||||
--- a/doc/rxvt.1.pod
|
|
||||||
+++ b/doc/rxvt.1.pod
|
|
||||||
@@ -1598,6 +1598,15 @@ high-intensity (potentially bold/blink) versions of the same, and 72 (or
|
|
||||||
240 in 256 colour mode) colours arranged in an 4x4x4 (or 6x6x6) colour RGB
|
|
||||||
cube plus a 8 (24) colour greyscale ramp.
|
|
||||||
|
|
||||||
+B<@@RXVT_NAME@@> supports direct 24-bit fg/bg RGB colour escapes
|
|
||||||
+C< ESC [ 38 ; 2 ; R ; G ; Bm > / C< ESC [ 48 ; 2; R ; G ; Bm >. However the
|
|
||||||
+number of 24-bit colours that can be used is limited: an internal 7x7x5 (256
|
|
||||||
+colour mode) or 6x6x4 (88 colour mode) colour cube is used to index into the
|
|
||||||
+24-bit colour space. When indexing collisions happen, the nearest old colour in
|
|
||||||
+the cube will be adapted to the new 24-bit RGB colour. That means one cannot
|
|
||||||
+use many similar 24-bit colours. It's typically not a problem in common
|
|
||||||
+scenarios.
|
|
||||||
+
|
|
||||||
Here is a list of the ANSI colours with their names.
|
|
||||||
|
|
||||||
=begin table
|
|
||||||
diff --git a/doc/rxvt.7.pod b/doc/rxvt.7.pod
|
|
||||||
index 7ee8b727..0c5d2b75 100644
|
|
||||||
--- a/doc/rxvt.7.pod
|
|
||||||
+++ b/doc/rxvt.7.pod
|
|
||||||
@@ -1605,6 +1605,8 @@ Character Attributes (SGR)
|
|
||||||
B<< C<Pm = 36 / 46> >> fg/bg Cyan
|
|
||||||
B<< C<Pm = 37 / 47> >> fg/bg White
|
|
||||||
B<< C<Pm = 38;5 / 48;5> >> set fg/bg to colour #m (ISO 8613-6)
|
|
||||||
+ B<< C<Pm = 38;2;R;G;B> >> set fg to 24-bit colour #RGB (ISO 8613-3)
|
|
||||||
+ B<< C<Pm = 48;2;R;G;B> >> set bg to 24-bit colour #RGB (ISO 8613-3)
|
|
||||||
B<< C<Pm = 39 / 49> >> fg/bg Default
|
|
||||||
B<< C<Pm = 90 / 100> >> fg/bg Bright Black
|
|
||||||
B<< C<Pm = 91 / 101> >> fg/bg Bright Red
|
|
||||||
diff --git a/src/command.C b/src/command.C
|
|
||||||
index 6dcb1832..c5a3d6dc 100644
|
|
||||||
--- a/src/command.C
|
|
||||||
+++ b/src/command.C
|
|
||||||
@@ -3336,6 +3336,31 @@ rxvt_term::process_osc_seq ()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
+/*
|
|
||||||
+ * Find the nearest color slot in the hidden color cube,
|
|
||||||
+ * adapt its value to the 24bit RGB color.
|
|
||||||
+ */
|
|
||||||
+unsigned int
|
|
||||||
+rxvt_term::map_rgb24_color (unsigned int r, unsigned int g, unsigned int b)
|
|
||||||
+{
|
|
||||||
+ unsigned int idx_r = (r & 0xff) / (0xff / (Red_levels - 1));
|
|
||||||
+ unsigned int idx_g = (g & 0xff) / (0xff / (Green_levels - 1));
|
|
||||||
+ unsigned int idx_b = (b & 0xff) / (0xff / (Blue_levels - 1));
|
|
||||||
+ unsigned int idx;
|
|
||||||
+
|
|
||||||
+ idx = minTermCOLOR24 + idx_r * Blue_levels * Green_levels +
|
|
||||||
+ idx_g * Blue_levels +
|
|
||||||
+ idx_b;
|
|
||||||
+
|
|
||||||
+ pix_colors_focused [idx].free (this);
|
|
||||||
+ pix_colors_focused [idx].set (this, rgba (r * 0x0101,
|
|
||||||
+ g * 0x0101,
|
|
||||||
+ b * 0x0101));
|
|
||||||
+ update_fade_color (idx, false);
|
|
||||||
+
|
|
||||||
+ return idx;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
void
|
|
||||||
rxvt_term::process_color_seq (int report, int color, const char *str, char resp)
|
|
||||||
{
|
|
||||||
@@ -3978,6 +4003,15 @@ rxvt_term::process_sgr_mode (unsigned int nargs, const int *arg)
|
|
||||||
scr_color ((unsigned int) (minCOLOR + arg[i + 2]), Color_fg);
|
|
||||||
i += 2;
|
|
||||||
}
|
|
||||||
+ else if (nargs > i + 4 && arg[i + 1] == 2)
|
|
||||||
+ {
|
|
||||||
+ unsigned int r = arg[i + 2];
|
|
||||||
+ unsigned int g = arg[i + 3];
|
|
||||||
+ unsigned int b = arg[i + 4];
|
|
||||||
+ unsigned int idx = map_rgb24_color (r, g, b);
|
|
||||||
+ scr_color (idx, Color_fg);
|
|
||||||
+ i += 4;
|
|
||||||
+ }
|
|
||||||
break;
|
|
||||||
case 39: /* default fg */
|
|
||||||
scr_color (Color_fg, Color_fg);
|
|
||||||
@@ -3999,6 +4033,15 @@ rxvt_term::process_sgr_mode (unsigned int nargs, const int *arg)
|
|
||||||
scr_color ((unsigned int) (minCOLOR + arg[i + 2]), Color_bg);
|
|
||||||
i += 2;
|
|
||||||
}
|
|
||||||
+ else if (nargs > i + 4 && arg[i + 1] == 2)
|
|
||||||
+ {
|
|
||||||
+ unsigned int r = arg[i + 2];
|
|
||||||
+ unsigned int g = arg[i + 3];
|
|
||||||
+ unsigned int b = arg[i + 4];
|
|
||||||
+ unsigned int idx = map_rgb24_color (r, g, b);
|
|
||||||
+ scr_color (idx, Color_bg);
|
|
||||||
+ i += 4;
|
|
||||||
+ }
|
|
||||||
break;
|
|
||||||
case 49: /* default bg */
|
|
||||||
scr_color (Color_bg, Color_bg);
|
|
||||||
diff --git a/src/init.C b/src/init.C
|
|
||||||
index 5a96603f..8e642142 100644
|
|
||||||
--- a/src/init.C
|
|
||||||
+++ b/src/init.C
|
|
||||||
@@ -153,6 +153,31 @@ rxvt_network_display (const char *display)
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
+#define NULL_5 \
|
|
||||||
+ NULL, \
|
|
||||||
+ NULL, \
|
|
||||||
+ NULL, \
|
|
||||||
+ NULL, \
|
|
||||||
+ NULL,
|
|
||||||
+
|
|
||||||
+#define NULL_10 \
|
|
||||||
+ NULL_5 \
|
|
||||||
+ NULL_5
|
|
||||||
+
|
|
||||||
+#define NULL_40 \
|
|
||||||
+ NULL_10 \
|
|
||||||
+ NULL_10 \
|
|
||||||
+ NULL_10 \
|
|
||||||
+ NULL_10
|
|
||||||
+
|
|
||||||
+#define NULL_50 \
|
|
||||||
+ NULL_40 \
|
|
||||||
+ NULL_10
|
|
||||||
+
|
|
||||||
+#define NULL_100 \
|
|
||||||
+ NULL_50 \
|
|
||||||
+ NULL_50
|
|
||||||
+
|
|
||||||
static const char *const def_colorName[] =
|
|
||||||
{
|
|
||||||
COLOR_FOREGROUND,
|
|
||||||
@@ -258,6 +283,12 @@ static const char *const def_colorName[] =
|
|
||||||
"rgb:b9/b9/b9",
|
|
||||||
"rgb:d0/d0/d0",
|
|
||||||
"rgb:e7/e7/e7",
|
|
||||||
+ NULL_100
|
|
||||||
+ NULL_40
|
|
||||||
+ NULL,
|
|
||||||
+ NULL,
|
|
||||||
+ NULL,
|
|
||||||
+ NULL,
|
|
||||||
#else
|
|
||||||
// 256 xterm colours
|
|
||||||
"rgb:00/00/00",
|
|
||||||
@@ -500,6 +531,10 @@ static const char *const def_colorName[] =
|
|
||||||
"rgb:da/da/da",
|
|
||||||
"rgb:e4/e4/e4",
|
|
||||||
"rgb:ee/ee/ee",
|
|
||||||
+ NULL_100
|
|
||||||
+ NULL_100
|
|
||||||
+ NULL_40
|
|
||||||
+ NULL_5
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef NO_CURSORCOLOR
|
|
||||||
diff --git a/src/rxvt.h b/src/rxvt.h
|
|
||||||
index 4b0a47ea..c896deb4 100644
|
|
||||||
--- a/src/rxvt.h
|
|
||||||
+++ b/src/rxvt.h
|
|
||||||
@@ -357,6 +357,21 @@ struct mouse_event
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
+// Hidden color cube for indexed 24-bit colors. There are less Green levels
|
|
||||||
+// because normal human eye is less sensitive to the blue component than to
|
|
||||||
+// the red or green. (https://en.m.wikipedia.org/wiki/Color_depth#8-bit_color)
|
|
||||||
+#if USE_256_COLORS
|
|
||||||
+// 7x7x5=245 < 254 unused color indices
|
|
||||||
+# define Red_levels 7
|
|
||||||
+# define Green_levels 7
|
|
||||||
+# define Blue_levels 5
|
|
||||||
+#else
|
|
||||||
+// 6x6x4=144 < 166 unused color indices
|
|
||||||
+# define Red_levels 6
|
|
||||||
+# define Green_levels 6
|
|
||||||
+# define Blue_levels 4
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
#if defined (NO_MOUSE_REPORT) && !defined (NO_MOUSE_REPORT_SCROLLBAR)
|
|
||||||
# define NO_MOUSE_REPORT_SCROLLBAR 1
|
|
||||||
#endif
|
|
||||||
@@ -560,6 +575,9 @@ enum colour_list {
|
|
||||||
#else
|
|
||||||
maxTermCOLOR = Color_White + 72,
|
|
||||||
#endif
|
|
||||||
+ minTermCOLOR24,
|
|
||||||
+ maxTermCOLOR24 = minTermCOLOR24 +
|
|
||||||
+ (Red_levels * Green_levels * Blue_levels) - 1,
|
|
||||||
#ifndef NO_CURSORCOLOR
|
|
||||||
Color_cursor,
|
|
||||||
Color_cursor2,
|
|
||||||
@@ -601,9 +619,13 @@ enum colour_list {
|
|
||||||
};
|
|
||||||
|
|
||||||
#if USE_256_COLORS
|
|
||||||
-# define Color_Bits 9 // 0 .. maxTermCOLOR
|
|
||||||
+# define Color_Bits 9 // 0 .. maxTermCOLOR24
|
|
||||||
#else
|
|
||||||
-# define Color_Bits 7 // 0 .. maxTermCOLOR
|
|
||||||
+# define Color_Bits 8 // 0 .. maxTermCOLOR24
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
+#if maxTermCOLOR24 >= (1 << Color_Bits)
|
|
||||||
+# error color index overflow
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
@@ -1389,6 +1411,7 @@ struct rxvt_term : zero_initialized, rxvt_vars, rxvt_screen
|
|
||||||
void process_osc_seq ();
|
|
||||||
void process_color_seq (int report, int color, const char *str, char resp);
|
|
||||||
void process_xterm_seq (int op, char *str, char resp);
|
|
||||||
+ unsigned int map_rgb24_color (unsigned int r, unsigned int g, unsigned int b);
|
|
||||||
int privcases (int mode, unsigned long bit);
|
|
||||||
void process_terminal_mode (int mode, int priv, unsigned int nargs, const int *arg);
|
|
||||||
void process_sgr_mode (unsigned int nargs, const int *arg);
|
|
||||||
diff --git a/src/rxvtfont.h b/src/rxvtfont.h
|
|
||||||
index 239c0ee9..efb15095 100644
|
|
||||||
--- a/src/rxvtfont.h
|
|
||||||
+++ b/src/rxvtfont.h
|
|
||||||
@@ -73,9 +73,9 @@ struct rxvt_fontset
|
|
||||||
|
|
||||||
// must be power-of-two - 1, also has to match RS_fontMask in rxvt.h
|
|
||||||
#if USE_256_COLORS
|
|
||||||
- enum { fontCount = 7 }; // 4 extra colors bits, 4 fewer fontcount bits
|
|
||||||
+ enum { fontCount = 7 }; // 2 extra colors bits, 2 fewer fontcount bits
|
|
||||||
#else
|
|
||||||
- enum { fontCount = 127 };
|
|
||||||
+ enum { fontCount = 31 };
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// index of first font in set
|
|
||||||
diff --git a/src/screen.C b/src/screen.C
|
|
||||||
index 9eb375ac..115afbf2 100644
|
|
||||||
--- a/src/screen.C
|
|
||||||
+++ b/src/screen.C
|
|
||||||
@@ -617,7 +617,7 @@ rxvt_term::scr_do_wrap () NOTHROW
|
|
||||||
void
|
|
||||||
rxvt_term::scr_color (unsigned int color, int fgbg) NOTHROW
|
|
||||||
{
|
|
||||||
- if (!IN_RANGE_INC (color, minCOLOR, maxTermCOLOR))
|
|
||||||
+ if (!IN_RANGE_INC (color, minCOLOR, maxTermCOLOR24))
|
|
||||||
color = fgbg;
|
|
||||||
|
|
||||||
if (fgbg == Color_fg)
|
|
||||||
--
|
|
||||||
2.13.0
|
|
||||||
|
|
|
@ -1,150 +0,0 @@
|
||||||
From b53eb4f5367920b76ca916f9fdf2210051a5b795 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Emanuele Giaquinta <e.giaquinta@glauco.it>
|
|
||||||
Date: Thu, 30 Jun 2016 11:33:42 +0000
|
|
||||||
Subject: [PATCH 01/11] 24-bit color cube collision avoidance (patch by
|
|
||||||
Fengguang Wu)
|
|
||||||
|
|
||||||
When the color cube slot is found to be already occupied by a similar
|
|
||||||
24-bit color, search through the -1, 0, +1 R/G/B indices trying to find
|
|
||||||
an empty slot, or the oldest used one (which hopefully is no longer in
|
|
||||||
active use).
|
|
||||||
|
|
||||||
This effectively reduces random collisions, hence make it pretty hard to
|
|
||||||
hit a vim GUI color scheme that cannot be correctly showed in urxvt.
|
|
||||||
---
|
|
||||||
src/command.C | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++++------
|
|
||||||
src/rxvt.h | 8 ++++++-
|
|
||||||
2 files changed, 76 insertions(+), 8 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/src/command.C b/src/command.C
|
|
||||||
index c5a3d6dc..caf939d2 100644
|
|
||||||
--- a/src/command.C
|
|
||||||
+++ b/src/command.C
|
|
||||||
@@ -3336,6 +3336,20 @@ rxvt_term::process_osc_seq ()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
+static unsigned int
|
|
||||||
+colorcube_index (unsigned int idx_r,
|
|
||||||
+ unsigned int idx_g,
|
|
||||||
+ unsigned int idx_b)
|
|
||||||
+{
|
|
||||||
+ assert (idx_r < Red_levels);
|
|
||||||
+ assert (idx_g < Green_levels);
|
|
||||||
+ assert (idx_b < Blue_levels);
|
|
||||||
+
|
|
||||||
+ return idx_r * Blue_levels * Green_levels +
|
|
||||||
+ idx_g * Blue_levels +
|
|
||||||
+ idx_b;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
/*
|
|
||||||
* Find the nearest color slot in the hidden color cube,
|
|
||||||
* adapt its value to the 24bit RGB color.
|
|
||||||
@@ -3343,15 +3357,63 @@ rxvt_term::process_osc_seq ()
|
|
||||||
unsigned int
|
|
||||||
rxvt_term::map_rgb24_color (unsigned int r, unsigned int g, unsigned int b)
|
|
||||||
{
|
|
||||||
- unsigned int idx_r = (r & 0xff) / (0xff / (Red_levels - 1));
|
|
||||||
- unsigned int idx_g = (g & 0xff) / (0xff / (Green_levels - 1));
|
|
||||||
- unsigned int idx_b = (b & 0xff) / (0xff / (Blue_levels - 1));
|
|
||||||
- unsigned int idx;
|
|
||||||
+ r &= 0xff;
|
|
||||||
+ g &= 0xff;
|
|
||||||
+ b &= 0xff;
|
|
||||||
+
|
|
||||||
+ unsigned int color = (r << 16) | (g << 8) | b;
|
|
||||||
+ unsigned int idx_r = r / (0xff / (Red_levels - 1));
|
|
||||||
+ unsigned int idx_g = g / (0xff / (Green_levels - 1));
|
|
||||||
+ unsigned int idx_b = b / (0xff / (Blue_levels - 1));
|
|
||||||
+ unsigned int idx = colorcube_index (idx_r, idx_g, idx_b);
|
|
||||||
+
|
|
||||||
+ // minor issue: could update idx 0 few more times
|
|
||||||
+ if (rgb24_seqno[idx] == 0
|
|
||||||
+ && rgb24_color[idx] == 0)
|
|
||||||
+ goto update;
|
|
||||||
+
|
|
||||||
+ if (rgb24_color[idx] == color)
|
|
||||||
+ return idx + minTermCOLOR24;
|
|
||||||
+
|
|
||||||
+ for (int i = idx_r - 1; i <= (signed) idx_r + 1; i++)
|
|
||||||
+ {
|
|
||||||
+ if (!IN_RANGE_EXC (i, 0, Red_levels))
|
|
||||||
+ continue;
|
|
||||||
+
|
|
||||||
+ for (int j = idx_g - 1; j <= (signed) idx_g + 1; j++)
|
|
||||||
+ {
|
|
||||||
+ if (!IN_RANGE_EXC (j, 0, Green_levels))
|
|
||||||
+ continue;
|
|
||||||
+
|
|
||||||
+ for (int k = idx_b - 1; k <= (signed) idx_b + 1; k++)
|
|
||||||
+ {
|
|
||||||
+ if (!IN_RANGE_EXC (k, 0, Blue_levels))
|
|
||||||
+ continue;
|
|
||||||
+
|
|
||||||
+ unsigned int index = colorcube_index (i, j, k);
|
|
||||||
+
|
|
||||||
+ // minor issue: could update index 0 few more times
|
|
||||||
+ if (rgb24_seqno[index] == 0
|
|
||||||
+ && rgb24_color[index] == 0)
|
|
||||||
+ {
|
|
||||||
+ idx = index;
|
|
||||||
+ goto update;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (rgb24_color[index] == color)
|
|
||||||
+ return index + minTermCOLOR24;
|
|
||||||
+
|
|
||||||
+ if (IN_RANGE_INC (rgb24_seqno[idx], rgb24_seqno[index], 0x7fff))
|
|
||||||
+ idx = index;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
|
|
||||||
- idx = minTermCOLOR24 + idx_r * Blue_levels * Green_levels +
|
|
||||||
- idx_g * Blue_levels +
|
|
||||||
- idx_b;
|
|
||||||
+update:
|
|
||||||
+ rgb24_color[idx] = color;
|
|
||||||
+ rgb24_seqno[idx] = ++rgb24_sequence;
|
|
||||||
|
|
||||||
+ idx += minTermCOLOR24;
|
|
||||||
pix_colors_focused [idx].free (this);
|
|
||||||
pix_colors_focused [idx].set (this, rgba (r * 0x0101,
|
|
||||||
g * 0x0101,
|
|
||||||
diff --git a/src/rxvt.h b/src/rxvt.h
|
|
||||||
index 8c190253..d10e6a4f 100644
|
|
||||||
--- a/src/rxvt.h
|
|
||||||
+++ b/src/rxvt.h
|
|
||||||
@@ -372,6 +372,8 @@ struct mouse_event
|
|
||||||
# define Blue_levels 4
|
|
||||||
#endif
|
|
||||||
|
|
||||||
+#define RGB24_CUBE_SIZE (Red_levels * Green_levels * Blue_levels)
|
|
||||||
+
|
|
||||||
#if defined (NO_MOUSE_REPORT) && !defined (NO_MOUSE_REPORT_SCROLLBAR)
|
|
||||||
# define NO_MOUSE_REPORT_SCROLLBAR 1
|
|
||||||
#endif
|
|
||||||
@@ -577,7 +579,7 @@ enum colour_list {
|
|
||||||
#endif
|
|
||||||
minTermCOLOR24,
|
|
||||||
maxTermCOLOR24 = minTermCOLOR24 +
|
|
||||||
- (Red_levels * Green_levels * Blue_levels) - 1,
|
|
||||||
+ RGB24_CUBE_SIZE - 1,
|
|
||||||
#ifndef NO_CURSORCOLOR
|
|
||||||
Color_cursor,
|
|
||||||
Color_cursor2,
|
|
||||||
@@ -1272,6 +1274,10 @@ struct rxvt_term : zero_initialized, rxvt_vars, rxvt_screen
|
|
||||||
void *chunk;
|
|
||||||
size_t chunk_size;
|
|
||||||
|
|
||||||
+ uint32_t rgb24_color[RGB24_CUBE_SIZE]; // the 24-bit color value
|
|
||||||
+ uint16_t rgb24_seqno[RGB24_CUBE_SIZE]; // which one is older?
|
|
||||||
+ uint16_t rgb24_sequence;
|
|
||||||
+
|
|
||||||
static vector<rxvt_term *> termlist; // a vector of all running rxvt_term's
|
|
||||||
|
|
||||||
#if ENABLE_FRILLS || ISO_14755
|
|
||||||
--
|
|
||||||
2.13.0
|
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
From df4d3d7d5c99a2021962abe82345c3739b5ec209 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Emanuele Giaquinta <e.giaquinta@glauco.it>
|
|
||||||
Date: Thu, 30 Jun 2016 12:50:36 +0000
|
|
||||||
Subject: [PATCH 02/11] Fix test.
|
|
||||||
|
|
||||||
---
|
|
||||||
src/command.C | 4 +++-
|
|
||||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/src/command.C b/src/command.C
|
|
||||||
index caf939d2..89f51cd4 100644
|
|
||||||
--- a/src/command.C
|
|
||||||
+++ b/src/command.C
|
|
||||||
@@ -3403,7 +3403,9 @@ rxvt_term::map_rgb24_color (unsigned int r, unsigned int g, unsigned int b)
|
|
||||||
if (rgb24_color[index] == color)
|
|
||||||
return index + minTermCOLOR24;
|
|
||||||
|
|
||||||
- if (IN_RANGE_INC (rgb24_seqno[idx], rgb24_seqno[index], 0x7fff))
|
|
||||||
+ // like (rgb24_seqno[idx] > rgb24_seqno[index])
|
|
||||||
+ // but also handles wrap around values good enough
|
|
||||||
+ if ((uint16_t) (rgb24_seqno[idx] - rgb24_seqno[index]) < 0x7fff)
|
|
||||||
idx = index;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
--
|
|
||||||
2.13.0
|
|
||||||
|
|
|
@ -1,99 +0,0 @@
|
||||||
From 60d7bf8d906ac64dcce79981e5fc382d4454898f Mon Sep 17 00:00:00 2001
|
|
||||||
From: Marc Lehmann <schmorp@schmorp.de>
|
|
||||||
Date: Thu, 30 Jun 2016 14:01:11 +0000
|
|
||||||
Subject: [PATCH 03/11] truecolour replacement tuning
|
|
||||||
|
|
||||||
---
|
|
||||||
src/command.C | 64 +++++++++++++++++++++++++++++++----------------------------
|
|
||||||
1 file changed, 34 insertions(+), 30 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/src/command.C b/src/command.C
|
|
||||||
index 89f51cd4..dca5e51e 100644
|
|
||||||
--- a/src/command.C
|
|
||||||
+++ b/src/command.C
|
|
||||||
@@ -3367,48 +3367,52 @@ rxvt_term::map_rgb24_color (unsigned int r, unsigned int g, unsigned int b)
|
|
||||||
unsigned int idx_b = b / (0xff / (Blue_levels - 1));
|
|
||||||
unsigned int idx = colorcube_index (idx_r, idx_g, idx_b);
|
|
||||||
|
|
||||||
- // minor issue: could update idx 0 few more times
|
|
||||||
- if (rgb24_seqno[idx] == 0
|
|
||||||
- && rgb24_color[idx] == 0)
|
|
||||||
- goto update;
|
|
||||||
-
|
|
||||||
if (rgb24_color[idx] == color)
|
|
||||||
return idx + minTermCOLOR24;
|
|
||||||
|
|
||||||
- for (int i = idx_r - 1; i <= (signed) idx_r + 1; i++)
|
|
||||||
+ /* we allow one of the 6 directly neighbouring colours */
|
|
||||||
+ /* to replace the current color, if they not used recently */
|
|
||||||
+ static const signed char dxyz[][3] = {
|
|
||||||
+ 0, 0, 0,
|
|
||||||
+ 0, 0, -1,
|
|
||||||
+ 0, 0, +1,
|
|
||||||
+ 0, -1, 0,
|
|
||||||
+ 0, +1, 0,
|
|
||||||
+ -1, 0, 0,
|
|
||||||
+ +1, 0, 0,
|
|
||||||
+ };
|
|
||||||
+
|
|
||||||
+ for (int n = 0; n < ecb_array_length (dxyz); ++n)
|
|
||||||
{
|
|
||||||
+ int i = idx_r + dxyz[n][0];
|
|
||||||
+ int j = idx_r + dxyz[n][1];
|
|
||||||
+ int k = idx_r + dxyz[n][2];
|
|
||||||
+
|
|
||||||
if (!IN_RANGE_EXC (i, 0, Red_levels))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
- for (int j = idx_g - 1; j <= (signed) idx_g + 1; j++)
|
|
||||||
- {
|
|
||||||
- if (!IN_RANGE_EXC (j, 0, Green_levels))
|
|
||||||
- continue;
|
|
||||||
+ if (!IN_RANGE_EXC (j, 0, Green_levels))
|
|
||||||
+ continue;
|
|
||||||
|
|
||||||
- for (int k = idx_b - 1; k <= (signed) idx_b + 1; k++)
|
|
||||||
- {
|
|
||||||
- if (!IN_RANGE_EXC (k, 0, Blue_levels))
|
|
||||||
- continue;
|
|
||||||
+ if (!IN_RANGE_EXC (k, 0, Blue_levels))
|
|
||||||
+ continue;
|
|
||||||
|
|
||||||
- unsigned int index = colorcube_index (i, j, k);
|
|
||||||
+ unsigned int index = colorcube_index (i, j, k);
|
|
||||||
|
|
||||||
- // minor issue: could update index 0 few more times
|
|
||||||
- if (rgb24_seqno[index] == 0
|
|
||||||
- && rgb24_color[index] == 0)
|
|
||||||
- {
|
|
||||||
- idx = index;
|
|
||||||
- goto update;
|
|
||||||
- }
|
|
||||||
+ // minor issue: could update index 0 few more times
|
|
||||||
+ if ((rgb24_seqno[index] | rgb24_color[index]) == 0)
|
|
||||||
+ {
|
|
||||||
+ idx = index;
|
|
||||||
+ goto update;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
- if (rgb24_color[index] == color)
|
|
||||||
- return index + minTermCOLOR24;
|
|
||||||
+ if (rgb24_color[index] == color)
|
|
||||||
+ return index + minTermCOLOR24;
|
|
||||||
|
|
||||||
- // like (rgb24_seqno[idx] > rgb24_seqno[index])
|
|
||||||
- // but also handles wrap around values good enough
|
|
||||||
- if ((uint16_t) (rgb24_seqno[idx] - rgb24_seqno[index]) < 0x7fff)
|
|
||||||
- idx = index;
|
|
||||||
- }
|
|
||||||
- }
|
|
||||||
+ // like (rgb24_seqno[idx] > rgb24_seqno[index])
|
|
||||||
+ // but also handles wrap around values good enough
|
|
||||||
+ if ((uint16_t)(rgb24_seqno[idx] - rgb24_seqno[index]) < 0x7fff)
|
|
||||||
+ idx = index;
|
|
||||||
}
|
|
||||||
|
|
||||||
update:
|
|
||||||
--
|
|
||||||
2.13.0
|
|
||||||
|
|
|
@ -1,44 +0,0 @@
|
||||||
From a620077e13f16a6ddbdede774fdc2915fbfc364d Mon Sep 17 00:00:00 2001
|
|
||||||
From: Marc Lehmann <schmorp@schmorp.de>
|
|
||||||
Date: Thu, 30 Jun 2016 14:07:43 +0000
|
|
||||||
Subject: [PATCH 04/11] *** empty log message ***
|
|
||||||
|
|
||||||
---
|
|
||||||
src/command.C | 14 +++++++-------
|
|
||||||
1 file changed, 7 insertions(+), 7 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/src/command.C b/src/command.C
|
|
||||||
index dca5e51e..70ff277c 100644
|
|
||||||
--- a/src/command.C
|
|
||||||
+++ b/src/command.C
|
|
||||||
@@ -3384,20 +3384,20 @@ rxvt_term::map_rgb24_color (unsigned int r, unsigned int g, unsigned int b)
|
|
||||||
|
|
||||||
for (int n = 0; n < ecb_array_length (dxyz); ++n)
|
|
||||||
{
|
|
||||||
- int i = idx_r + dxyz[n][0];
|
|
||||||
- int j = idx_r + dxyz[n][1];
|
|
||||||
- int k = idx_r + dxyz[n][2];
|
|
||||||
+ int r = idx_r + dxyz[n][0];
|
|
||||||
+ int g = idx_r + dxyz[n][1];
|
|
||||||
+ int b = idx_r + dxyz[n][2];
|
|
||||||
|
|
||||||
- if (!IN_RANGE_EXC (i, 0, Red_levels))
|
|
||||||
+ if (!IN_RANGE_EXC (r, 0, Red_levels))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
- if (!IN_RANGE_EXC (j, 0, Green_levels))
|
|
||||||
+ if (!IN_RANGE_EXC (g, 0, Green_levels))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
- if (!IN_RANGE_EXC (k, 0, Blue_levels))
|
|
||||||
+ if (!IN_RANGE_EXC (b, 0, Blue_levels))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
- unsigned int index = colorcube_index (i, j, k);
|
|
||||||
+ unsigned int index = colorcube_index (r, g, b);
|
|
||||||
|
|
||||||
// minor issue: could update index 0 few more times
|
|
||||||
if ((rgb24_seqno[index] | rgb24_color[index]) == 0)
|
|
||||||
--
|
|
||||||
2.13.0
|
|
||||||
|
|
|
@ -1,43 +0,0 @@
|
||||||
From da6020f5f607e6d555717db91da5939bd0c58252 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Marc Lehmann <schmorp@schmorp.de>
|
|
||||||
Date: Thu, 30 Jun 2016 16:56:41 +0000
|
|
||||||
Subject: [PATCH 05/11] *** empty log message ***
|
|
||||||
|
|
||||||
---
|
|
||||||
src/command.C | 10 ++++------
|
|
||||||
1 file changed, 4 insertions(+), 6 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/src/command.C b/src/command.C
|
|
||||||
index 70ff277c..c5febcd3 100644
|
|
||||||
--- a/src/command.C
|
|
||||||
+++ b/src/command.C
|
|
||||||
@@ -3374,12 +3374,12 @@ rxvt_term::map_rgb24_color (unsigned int r, unsigned int g, unsigned int b)
|
|
||||||
/* to replace the current color, if they not used recently */
|
|
||||||
static const signed char dxyz[][3] = {
|
|
||||||
0, 0, 0,
|
|
||||||
- 0, 0, -1,
|
|
||||||
0, 0, +1,
|
|
||||||
- 0, -1, 0,
|
|
||||||
+ 0, 0, -1,
|
|
||||||
0, +1, 0,
|
|
||||||
- -1, 0, 0,
|
|
||||||
+ 0, -1, 0,
|
|
||||||
+1, 0, 0,
|
|
||||||
+ -1, 0, 0,
|
|
||||||
};
|
|
||||||
|
|
||||||
for (int n = 0; n < ecb_array_length (dxyz); ++n)
|
|
||||||
@@ -3421,9 +3421,7 @@ update:
|
|
||||||
|
|
||||||
idx += minTermCOLOR24;
|
|
||||||
pix_colors_focused [idx].free (this);
|
|
||||||
- pix_colors_focused [idx].set (this, rgba (r * 0x0101,
|
|
||||||
- g * 0x0101,
|
|
||||||
- b * 0x0101));
|
|
||||||
+ pix_colors_focused [idx].set (this, rgba (r * 0x0101, g * 0x0101, b * 0x0101));
|
|
||||||
update_fade_color (idx, false);
|
|
||||||
|
|
||||||
return idx;
|
|
||||||
--
|
|
||||||
2.13.0
|
|
||||||
|
|
|
@ -1,29 +0,0 @@
|
||||||
From 8372eb82a448724ed677e9f7af18ef7d5fc6c58d Mon Sep 17 00:00:00 2001
|
|
||||||
From: Marc Lehmann <schmorp@schmorp.de>
|
|
||||||
Date: Thu, 30 Jun 2016 16:59:02 +0000
|
|
||||||
Subject: [PATCH 06/11] *** empty log message ***
|
|
||||||
|
|
||||||
---
|
|
||||||
src/command.C | 6 +++---
|
|
||||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/src/command.C b/src/command.C
|
|
||||||
index c5febcd3..3106bc9b 100644
|
|
||||||
--- a/src/command.C
|
|
||||||
+++ b/src/command.C
|
|
||||||
@@ -3362,9 +3362,9 @@ rxvt_term::map_rgb24_color (unsigned int r, unsigned int g, unsigned int b)
|
|
||||||
b &= 0xff;
|
|
||||||
|
|
||||||
unsigned int color = (r << 16) | (g << 8) | b;
|
|
||||||
- unsigned int idx_r = r / (0xff / (Red_levels - 1));
|
|
||||||
- unsigned int idx_g = g / (0xff / (Green_levels - 1));
|
|
||||||
- unsigned int idx_b = b / (0xff / (Blue_levels - 1));
|
|
||||||
+ unsigned int idx_r = r * (Red_levels - 1) / 0xff;
|
|
||||||
+ unsigned int idx_g = g * (Green_levels - 1) / 0xff;
|
|
||||||
+ unsigned int idx_b = b * (Blue_levels - 1) / 0xff;
|
|
||||||
unsigned int idx = colorcube_index (idx_r, idx_g, idx_b);
|
|
||||||
|
|
||||||
if (rgb24_color[idx] == color)
|
|
||||||
--
|
|
||||||
2.13.0
|
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
From 39e99fd1b2d9275e059a7e56d18ee5cb3bd92ff5 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Marc Lehmann <schmorp@schmorp.de>
|
|
||||||
Date: Thu, 30 Jun 2016 17:00:18 +0000
|
|
||||||
Subject: [PATCH 07/11] *** empty log message ***
|
|
||||||
|
|
||||||
---
|
|
||||||
src/command.C | 11 +++--------
|
|
||||||
1 file changed, 3 insertions(+), 8 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/src/command.C b/src/command.C
|
|
||||||
index 3106bc9b..92add58e 100644
|
|
||||||
--- a/src/command.C
|
|
||||||
+++ b/src/command.C
|
|
||||||
@@ -3388,14 +3388,9 @@ rxvt_term::map_rgb24_color (unsigned int r, unsigned int g, unsigned int b)
|
|
||||||
int g = idx_r + dxyz[n][1];
|
|
||||||
int b = idx_r + dxyz[n][2];
|
|
||||||
|
|
||||||
- if (!IN_RANGE_EXC (r, 0, Red_levels))
|
|
||||||
- continue;
|
|
||||||
-
|
|
||||||
- if (!IN_RANGE_EXC (g, 0, Green_levels))
|
|
||||||
- continue;
|
|
||||||
-
|
|
||||||
- if (!IN_RANGE_EXC (b, 0, Blue_levels))
|
|
||||||
- continue;
|
|
||||||
+ if (!IN_RANGE_EXC (r, 0, Red_levels )) continue;
|
|
||||||
+ if (!IN_RANGE_EXC (g, 0, Green_levels)) continue;
|
|
||||||
+ if (!IN_RANGE_EXC (b, 0, Blue_levels )) continue;
|
|
||||||
|
|
||||||
unsigned int index = colorcube_index (r, g, b);
|
|
||||||
|
|
||||||
--
|
|
||||||
2.13.0
|
|
||||||
|
|
|
@ -1,49 +0,0 @@
|
||||||
From 519a3a9a95ce3ddc5f84fe2a304be14dd1472c07 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Marc Lehmann <schmorp@schmorp.de>
|
|
||||||
Date: Thu, 30 Jun 2016 17:02:22 +0000
|
|
||||||
Subject: [PATCH 08/11] *** empty log message ***
|
|
||||||
|
|
||||||
---
|
|
||||||
src/command.C | 12 ++++++------
|
|
||||||
1 file changed, 6 insertions(+), 6 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/src/command.C b/src/command.C
|
|
||||||
index 92add58e..35b321fc 100644
|
|
||||||
--- a/src/command.C
|
|
||||||
+++ b/src/command.C
|
|
||||||
@@ -3367,9 +3367,6 @@ rxvt_term::map_rgb24_color (unsigned int r, unsigned int g, unsigned int b)
|
|
||||||
unsigned int idx_b = b * (Blue_levels - 1) / 0xff;
|
|
||||||
unsigned int idx = colorcube_index (idx_r, idx_g, idx_b);
|
|
||||||
|
|
||||||
- if (rgb24_color[idx] == color)
|
|
||||||
- return idx + minTermCOLOR24;
|
|
||||||
-
|
|
||||||
/* we allow one of the 6 directly neighbouring colours */
|
|
||||||
/* to replace the current color, if they not used recently */
|
|
||||||
static const signed char dxyz[][3] = {
|
|
||||||
@@ -3394,6 +3391,12 @@ rxvt_term::map_rgb24_color (unsigned int r, unsigned int g, unsigned int b)
|
|
||||||
|
|
||||||
unsigned int index = colorcube_index (r, g, b);
|
|
||||||
|
|
||||||
+ if (rgb24_color[index] == color)
|
|
||||||
+ {
|
|
||||||
+ rgb24_seqno[idx] = ++rgb24_sequence;
|
|
||||||
+ return index + minTermCOLOR24;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
// minor issue: could update index 0 few more times
|
|
||||||
if ((rgb24_seqno[index] | rgb24_color[index]) == 0)
|
|
||||||
{
|
|
||||||
@@ -3401,9 +3404,6 @@ rxvt_term::map_rgb24_color (unsigned int r, unsigned int g, unsigned int b)
|
|
||||||
goto update;
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (rgb24_color[index] == color)
|
|
||||||
- return index + minTermCOLOR24;
|
|
||||||
-
|
|
||||||
// like (rgb24_seqno[idx] > rgb24_seqno[index])
|
|
||||||
// but also handles wrap around values good enough
|
|
||||||
if ((uint16_t)(rgb24_seqno[idx] - rgb24_seqno[index]) < 0x7fff)
|
|
||||||
--
|
|
||||||
2.13.0
|
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
From 86603d481fc7716509171edfe4ac727d26db1f8f Mon Sep 17 00:00:00 2001
|
|
||||||
From: Marc Lehmann <schmorp@schmorp.de>
|
|
||||||
Date: Thu, 30 Jun 2016 17:03:45 +0000
|
|
||||||
Subject: [PATCH 09/11] *** empty log message ***
|
|
||||||
|
|
||||||
---
|
|
||||||
src/command.C | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/src/command.C b/src/command.C
|
|
||||||
index 35b321fc..68831f16 100644
|
|
||||||
--- a/src/command.C
|
|
||||||
+++ b/src/command.C
|
|
||||||
@@ -3393,7 +3393,7 @@ rxvt_term::map_rgb24_color (unsigned int r, unsigned int g, unsigned int b)
|
|
||||||
|
|
||||||
if (rgb24_color[index] == color)
|
|
||||||
{
|
|
||||||
- rgb24_seqno[idx] = ++rgb24_sequence;
|
|
||||||
+ rgb24_seqno[index] = ++rgb24_sequence;
|
|
||||||
return index + minTermCOLOR24;
|
|
||||||
}
|
|
||||||
|
|
||||||
--
|
|
||||||
2.13.0
|
|
||||||
|
|
|
@ -1,149 +0,0 @@
|
||||||
From 7f77cdb274572d4e5ab30817d713268bc757496b Mon Sep 17 00:00:00 2001
|
|
||||||
From: Marc Lehmann <schmorp@schmorp.de>
|
|
||||||
Date: Thu, 30 Jun 2016 17:22:54 +0000
|
|
||||||
Subject: [PATCH 10/11] *** empty log message ***
|
|
||||||
|
|
||||||
---
|
|
||||||
src/command.C | 73 ++++++++++++++++++++++++++++-------------------------------
|
|
||||||
src/rxvt.h | 2 +-
|
|
||||||
2 files changed, 36 insertions(+), 39 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/src/command.C b/src/command.C
|
|
||||||
index 68831f16..338690d1 100644
|
|
||||||
--- a/src/command.C
|
|
||||||
+++ b/src/command.C
|
|
||||||
@@ -3352,16 +3352,18 @@ colorcube_index (unsigned int idx_r,
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Find the nearest color slot in the hidden color cube,
|
|
||||||
- * adapt its value to the 24bit RGB color.
|
|
||||||
+ * adapt its value to the 32bit RGBA color.
|
|
||||||
*/
|
|
||||||
unsigned int
|
|
||||||
-rxvt_term::map_rgb24_color (unsigned int r, unsigned int g, unsigned int b)
|
|
||||||
+rxvt_term::map_rgb24_color (unsigned int r, unsigned int g, unsigned int b, unsigned int a)
|
|
||||||
{
|
|
||||||
r &= 0xff;
|
|
||||||
g &= 0xff;
|
|
||||||
b &= 0xff;
|
|
||||||
+ a &= 0xff;
|
|
||||||
+
|
|
||||||
+ uint32_t color = (a << 24) | (r << 16) | (g << 8) | b;
|
|
||||||
|
|
||||||
- unsigned int color = (r << 16) | (g << 8) | b;
|
|
||||||
unsigned int idx_r = r * (Red_levels - 1) / 0xff;
|
|
||||||
unsigned int idx_g = g * (Green_levels - 1) / 0xff;
|
|
||||||
unsigned int idx_b = b * (Blue_levels - 1) / 0xff;
|
|
||||||
@@ -3382,8 +3384,8 @@ rxvt_term::map_rgb24_color (unsigned int r, unsigned int g, unsigned int b)
|
|
||||||
for (int n = 0; n < ecb_array_length (dxyz); ++n)
|
|
||||||
{
|
|
||||||
int r = idx_r + dxyz[n][0];
|
|
||||||
- int g = idx_r + dxyz[n][1];
|
|
||||||
- int b = idx_r + dxyz[n][2];
|
|
||||||
+ int g = idx_g + dxyz[n][1];
|
|
||||||
+ int b = idx_b + dxyz[n][2];
|
|
||||||
|
|
||||||
if (!IN_RANGE_EXC (r, 0, Red_levels )) continue;
|
|
||||||
if (!IN_RANGE_EXC (g, 0, Green_levels)) continue;
|
|
||||||
@@ -3416,7 +3418,7 @@ update:
|
|
||||||
|
|
||||||
idx += minTermCOLOR24;
|
|
||||||
pix_colors_focused [idx].free (this);
|
|
||||||
- pix_colors_focused [idx].set (this, rgba (r * 0x0101, g * 0x0101, b * 0x0101));
|
|
||||||
+ pix_colors_focused [idx].set (this, rgba (r * 0x0101, g * 0x0101, b * 0x0101, a * 0x0101));
|
|
||||||
update_fade_color (idx, false);
|
|
||||||
|
|
||||||
return idx;
|
|
||||||
@@ -4058,22 +4060,6 @@ rxvt_term::process_sgr_mode (unsigned int nargs, const int *arg)
|
|
||||||
case 37:
|
|
||||||
scr_color ((unsigned int) (minCOLOR + (arg[i] - 30)), Color_fg);
|
|
||||||
break;
|
|
||||||
- case 38: // set fg color, ISO 8613-6
|
|
||||||
- if (nargs > i + 2 && arg[i + 1] == 5)
|
|
||||||
- {
|
|
||||||
- scr_color ((unsigned int) (minCOLOR + arg[i + 2]), Color_fg);
|
|
||||||
- i += 2;
|
|
||||||
- }
|
|
||||||
- else if (nargs > i + 4 && arg[i + 1] == 2)
|
|
||||||
- {
|
|
||||||
- unsigned int r = arg[i + 2];
|
|
||||||
- unsigned int g = arg[i + 3];
|
|
||||||
- unsigned int b = arg[i + 4];
|
|
||||||
- unsigned int idx = map_rgb24_color (r, g, b);
|
|
||||||
- scr_color (idx, Color_fg);
|
|
||||||
- i += 4;
|
|
||||||
- }
|
|
||||||
- break;
|
|
||||||
case 39: /* default fg */
|
|
||||||
scr_color (Color_fg, Color_fg);
|
|
||||||
break;
|
|
||||||
@@ -4088,26 +4074,37 @@ rxvt_term::process_sgr_mode (unsigned int nargs, const int *arg)
|
|
||||||
case 47:
|
|
||||||
scr_color ((unsigned int) (minCOLOR + (arg[i] - 40)), Color_bg);
|
|
||||||
break;
|
|
||||||
- case 48: // set bg color, ISO 8613-6
|
|
||||||
- if (nargs > i + 2 && arg[i + 1] == 5)
|
|
||||||
- {
|
|
||||||
- scr_color ((unsigned int) (minCOLOR + arg[i + 2]), Color_bg);
|
|
||||||
- i += 2;
|
|
||||||
- }
|
|
||||||
- else if (nargs > i + 4 && arg[i + 1] == 2)
|
|
||||||
- {
|
|
||||||
- unsigned int r = arg[i + 2];
|
|
||||||
- unsigned int g = arg[i + 3];
|
|
||||||
- unsigned int b = arg[i + 4];
|
|
||||||
- unsigned int idx = map_rgb24_color (r, g, b);
|
|
||||||
- scr_color (idx, Color_bg);
|
|
||||||
- i += 4;
|
|
||||||
- }
|
|
||||||
- break;
|
|
||||||
case 49: /* default bg */
|
|
||||||
scr_color (Color_bg, Color_bg);
|
|
||||||
break;
|
|
||||||
|
|
||||||
+ case 38: // set fg color, ISO 8613-6
|
|
||||||
+ case 48: // set bg color, ISO 8613-6
|
|
||||||
+ {
|
|
||||||
+ unsigned int fgbg = arg[i] == 38 ? Color_fg : Color_bg;
|
|
||||||
+ unsigned int idx;
|
|
||||||
+
|
|
||||||
+ if (nargs > i + 2 && arg[i + 1] == 5)
|
|
||||||
+ {
|
|
||||||
+ idx = minCOLOR + arg[i + 2];
|
|
||||||
+ i += 2;
|
|
||||||
+ }
|
|
||||||
+ else if (nargs > i + 4 && arg[i + 1] == 2)
|
|
||||||
+ {
|
|
||||||
+ unsigned int r = arg[i + 2];
|
|
||||||
+ unsigned int g = arg[i + 3];
|
|
||||||
+ unsigned int b = arg[i + 4];
|
|
||||||
+ unsigned int a = 0xff;
|
|
||||||
+
|
|
||||||
+ idx = map_rgb24_color (r, g, b, a);
|
|
||||||
+
|
|
||||||
+ i += 4;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ scr_color (idx, fgbg);
|
|
||||||
+ }
|
|
||||||
+ break;
|
|
||||||
+
|
|
||||||
//case 50: // not variable spacing
|
|
||||||
|
|
||||||
#if !ENABLE_MINIMAL
|
|
||||||
diff --git a/src/rxvt.h b/src/rxvt.h
|
|
||||||
index d10e6a4f..707eb47c 100644
|
|
||||||
--- a/src/rxvt.h
|
|
||||||
+++ b/src/rxvt.h
|
|
||||||
@@ -1417,7 +1417,7 @@ struct rxvt_term : zero_initialized, rxvt_vars, rxvt_screen
|
|
||||||
void process_osc_seq ();
|
|
||||||
void process_color_seq (int report, int color, const char *str, char resp);
|
|
||||||
void process_xterm_seq (int op, char *str, char resp);
|
|
||||||
- unsigned int map_rgb24_color (unsigned int r, unsigned int g, unsigned int b);
|
|
||||||
+ unsigned int map_rgb24_color (unsigned int r, unsigned int g, unsigned int b, unsigned int a);
|
|
||||||
int privcases (int mode, unsigned long bit);
|
|
||||||
void process_terminal_mode (int mode, int priv, unsigned int nargs, const int *arg);
|
|
||||||
void process_sgr_mode (unsigned int nargs, const int *arg);
|
|
||||||
--
|
|
||||||
2.13.0
|
|
||||||
|
|
|
@ -1,37 +0,0 @@
|
||||||
From 5da2b333f74b8bd17bd4803c30143af03dc7dc3b Mon Sep 17 00:00:00 2001
|
|
||||||
From: Marc Lehmann <schmorp@schmorp.de>
|
|
||||||
Date: Tue, 5 Jul 2016 16:42:21 +0000
|
|
||||||
Subject: [PATCH 11/11] *** empty log message ***
|
|
||||||
|
|
||||||
---
|
|
||||||
src/command.C | 6 ++++--
|
|
||||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/src/command.C b/src/command.C
|
|
||||||
index 338690d1..21fde58c 100644
|
|
||||||
--- a/src/command.C
|
|
||||||
+++ b/src/command.C
|
|
||||||
@@ -4088,6 +4088,8 @@ rxvt_term::process_sgr_mode (unsigned int nargs, const int *arg)
|
|
||||||
{
|
|
||||||
idx = minCOLOR + arg[i + 2];
|
|
||||||
i += 2;
|
|
||||||
+
|
|
||||||
+ scr_color (idx, fgbg);
|
|
||||||
}
|
|
||||||
else if (nargs > i + 4 && arg[i + 1] == 2)
|
|
||||||
{
|
|
||||||
@@ -4099,9 +4101,9 @@ rxvt_term::process_sgr_mode (unsigned int nargs, const int *arg)
|
|
||||||
idx = map_rgb24_color (r, g, b, a);
|
|
||||||
|
|
||||||
i += 4;
|
|
||||||
- }
|
|
||||||
|
|
||||||
- scr_color (idx, fgbg);
|
|
||||||
+ scr_color (idx, fgbg);
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
--
|
|
||||||
2.13.0
|
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
From cb3bccef52541725a904a11ed7c30006d41d1f01 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Marc Lehmann <schmorp@schmorp.de>
|
|
||||||
Date: Thu, 18 May 2017 02:43:18 +0000
|
|
||||||
Subject: [PATCH] *** empty log message ***
|
|
||||||
|
|
||||||
---
|
|
||||||
src/command.C | 4 ++--
|
|
||||||
1 files changed, 2 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/src/command.C b/src/command.C
|
|
||||||
index 19e4fccf..ed376ed1 100644
|
|
||||||
--- a/src/command.C
|
|
||||||
+++ b/src/command.C
|
|
||||||
@@ -2695,7 +2695,7 @@ rxvt_term::process_escape_seq ()
|
|
||||||
/* kidnapped escape sequence: Should be 8.3.48 */
|
|
||||||
case C1_ESA: /* ESC G */
|
|
||||||
// used by original rxvt for rob nations own graphics mode
|
|
||||||
- if (cmd_getc () == 'Q')
|
|
||||||
+ if (cmd_getc () == 'Q' && option (Opt_insecure))
|
|
||||||
tt_printf ("\033G0\012"); /* query graphics - no graphics */
|
|
||||||
break;
|
|
||||||
|
|
||||||
@@ -2914,7 +2914,7 @@ rxvt_term::process_csi_seq ()
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CSI_CUB: /* 8.3.18: (1) CURSOR LEFT */
|
|
||||||
- case CSI_HPB: /* 8.3.59: (1) CHARACTER POSITION BACKWARD */
|
|
||||||
+ case CSI_HPB: /* 8.3.59: (1) CHARACTER POSITION BACKWARD */
|
|
||||||
#ifdef ISO6429
|
|
||||||
arg[0] = -arg[0];
|
|
||||||
#else /* emulate common DEC VTs */
|
|
||||||
--
|
|
||||||
2.13.0
|
|
||||||
|
|
|
@ -1,101 +0,0 @@
|
||||||
# $Id$
|
|
||||||
# Original maintainer: Sébastien Luttringer
|
|
||||||
# Contributor: Angel Velasquez <angvp@archlinux.org>
|
|
||||||
# Contributor: tobias <tobias@archlinux.org>
|
|
||||||
# Contributor: dibblethewrecker dibblethewrecker.at.jiwe.dot.org
|
|
||||||
|
|
||||||
pkgbase=rxvt-unicode
|
|
||||||
pkgname=('rxvt-unicode' 'rxvt-unicode-terminfo')
|
|
||||||
pkgver=9.22
|
|
||||||
pkgrel=3
|
|
||||||
arch=('i686' 'x86_64')
|
|
||||||
url='http://software.schmorp.de/pkg/rxvt-unicode.html'
|
|
||||||
license=('GPL')
|
|
||||||
makedepends=('libxft' 'perl' 'startup-notification' 'gdk-pixbuf2')
|
|
||||||
source=(
|
|
||||||
"http://dist.schmorp.de/rxvt-unicode/$pkgname-$pkgver.tar.bz2"
|
|
||||||
'urxvt.desktop'
|
|
||||||
'urxvtc.desktop'
|
|
||||||
'urxvt-tabbed.desktop'
|
|
||||||
)
|
|
||||||
md5sums=('93782dec27494eb079467dacf6e48185'
|
|
||||||
'fec94dc986fa37ec380079d81de3e0b2'
|
|
||||||
'fac55f0a8404c86dad3e702146762332'
|
|
||||||
'8a5599197568c63720e282b9722a7990')
|
|
||||||
|
|
||||||
build() {
|
|
||||||
cd $pkgname-$pkgver
|
|
||||||
# do some patching: truecolor + a security fix
|
|
||||||
patch -p1 < ../../0000-24-bit-direct-color-support-patch-by-Fengguang-Wu.patch
|
|
||||||
patch -p1 < ../../0001-24-bit-color-cube-collision-avoidance-patch-by-Fengg.patch
|
|
||||||
patch -p1 < ../../0002-Fix-test.patch
|
|
||||||
patch -p1 < ../../0003-truecolour-replacement-tuning.patch
|
|
||||||
patch -p1 < ../../0004-empty-log-message.patch
|
|
||||||
patch -p1 < ../../0005-empty-log-message.patch
|
|
||||||
patch -p1 < ../../0006-empty-log-message.patch
|
|
||||||
patch -p1 < ../../0007-empty-log-message.patch
|
|
||||||
patch -p1 < ../../0008-empty-log-message.patch
|
|
||||||
patch -p1 < ../../0009-empty-log-message.patch
|
|
||||||
patch -p1 < ../../0010-empty-log-message.patch
|
|
||||||
patch -p1 < ../../0011-empty-log-message.patch
|
|
||||||
patch -p1 < ../../0012-empty-log-message.patch
|
|
||||||
|
|
||||||
# we disable smart-resize (FS#34807)
|
|
||||||
# do not specify --with-terminfo (FS#46424)
|
|
||||||
./configure \
|
|
||||||
--prefix=/usr \
|
|
||||||
--enable-256-color \
|
|
||||||
--enable-combining \
|
|
||||||
--enable-fading \
|
|
||||||
--enable-font-styles \
|
|
||||||
--enable-iso14755 \
|
|
||||||
--enable-keepscrolling \
|
|
||||||
--enable-lastlog \
|
|
||||||
--enable-mousewheel \
|
|
||||||
--enable-next-scroll \
|
|
||||||
--enable-perl \
|
|
||||||
--enable-pointer-blank \
|
|
||||||
--enable-rxvt-scroll \
|
|
||||||
--enable-selectionscrolling \
|
|
||||||
--enable-slipwheeling \
|
|
||||||
--disable-smart-resize \
|
|
||||||
--enable-startup-notification \
|
|
||||||
--enable-transparency \
|
|
||||||
--enable-unicode3 \
|
|
||||||
--enable-utmp \
|
|
||||||
--enable-wtmp \
|
|
||||||
--enable-xft \
|
|
||||||
--enable-xim \
|
|
||||||
--enable-xterm-scroll \
|
|
||||||
--enable-pixbuf \
|
|
||||||
--disable-frills
|
|
||||||
make
|
|
||||||
}
|
|
||||||
|
|
||||||
package_rxvt-unicode() {
|
|
||||||
pkgdesc='A unicode enabled rxvt-clone terminal emulator (urxvt)'
|
|
||||||
depends=('rxvt-unicode-terminfo' 'libxft' 'perl' 'startup-notification' 'gdk-pixbuf2')
|
|
||||||
optdepends=('gtk2-perl: to use the urxvt-tabbed')
|
|
||||||
|
|
||||||
# install freedesktop menu
|
|
||||||
for _f in urxvt urxvtc urxvt-tabbed; do
|
|
||||||
install -Dm644 $_f.desktop "$pkgdir/usr/share/applications/$_f.desktop"
|
|
||||||
done
|
|
||||||
cd $pkgname-$pkgver
|
|
||||||
# workaround terminfo installation
|
|
||||||
export TERMINFO="$srcdir/terminfo"
|
|
||||||
install -d "$TERMINFO"
|
|
||||||
make DESTDIR="$pkgdir" install
|
|
||||||
# install the tabbing wrapper ( requires gtk2-perl! )
|
|
||||||
sed -i 's/\"rxvt\"/"urxvt"/' doc/rxvt-tabbed
|
|
||||||
install -Dm 755 doc/rxvt-tabbed "$pkgdir/usr/bin/urxvt-tabbed"
|
|
||||||
}
|
|
||||||
|
|
||||||
package_rxvt-unicode-terminfo() {
|
|
||||||
pkgdesc='Terminfo files for urxvt'
|
|
||||||
conflict=('rxvt-unicode<=9.18-6')
|
|
||||||
install -dm 755 "$pkgdir/usr/share/"
|
|
||||||
mv terminfo "$pkgdir/usr/share/"
|
|
||||||
}
|
|
||||||
|
|
||||||
# vim:set ts=2 sw=2 et:
|
|
|
@ -1,9 +0,0 @@
|
||||||
[Desktop Entry]
|
|
||||||
Version=1.0
|
|
||||||
Name=urxvt (tabbed)
|
|
||||||
Comment=An unicode capable and tabbed rxvt clone
|
|
||||||
Exec=urxvt-tabbed
|
|
||||||
Icon=utilities-terminal
|
|
||||||
Terminal=false
|
|
||||||
Type=Application
|
|
||||||
Categories=System;TerminalEmulator;
|
|
|
@ -1,9 +0,0 @@
|
||||||
[Desktop Entry]
|
|
||||||
Version=1.0
|
|
||||||
Name=urxvt
|
|
||||||
Comment=An unicode capable rxvt clone
|
|
||||||
Exec=urxvt
|
|
||||||
Icon=utilities-terminal
|
|
||||||
Terminal=false
|
|
||||||
Type=Application
|
|
||||||
Categories=System;TerminalEmulator;
|
|
|
@ -1,9 +0,0 @@
|
||||||
[Desktop Entry]
|
|
||||||
Version=1.0
|
|
||||||
Name=urxvt (client)
|
|
||||||
Comment=An unicode capable rxvt clone client for urxvtd
|
|
||||||
Exec=urxvtc
|
|
||||||
Icon=utilities-terminal
|
|
||||||
Terminal=false
|
|
||||||
Type=Application
|
|
||||||
Categories=System;TerminalEmulator;
|
|
Loading…
Reference in a new issue