aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-05-02 20:57:12 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-05-02 20:57:12 +0000
commitac58d05c6b4cf8776b53109352eb5a0f3bd59131 (patch)
treecd3ddc3e7e9399d67b45f9f38a6427763187de92
parentrender: don't re-instantiate the foreground pixman source (diff)
osc: fix scaling of legacy formatted color specifiers
-rw-r--r--CHANGELOG.md2
-rw-r--r--osc.c6
2 files changed, 4 insertions, 4 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index bebf664e..1bffeb18 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -63,7 +63,7 @@
* Trackpad sloooow scrolling to eventually scroll a line.
* Memory leak in terminal reset.
* Translation of cursor coordinates on resize
-
+* Scaling of legacy formatted color specifiers in OSC sequences.
### Security
diff --git a/osc.c b/osc.c
index 98de86f7..800385ab 100644
--- a/osc.c
+++ b/osc.c
@@ -239,9 +239,9 @@ parse_legacy_color(const char *string, uint32_t *color)
}
/* Re-scale to 8-bit */
- uint8_t r = 255 * (rgb[0] / 65535.);
- uint8_t g = 255 * (rgb[1] / 65535.);
- uint8_t b = 255 * (rgb[2] / 65535.);
+ uint8_t r = 256 * (rgb[0] / 65536.);
+ uint8_t g = 256 * (rgb[1] / 65536.);
+ uint8_t b = 256 * (rgb[2] / 65536.);
LOG_DBG("legacy: %02x%02x%02x", r, g, b);
*color = r << 16 | g << 8 | b;