Unify format of responses to OSC 10 and OSC 11 / 12 queries

This commit is contained in:
Tau 2024-04-09 20:45:05 +02:00
parent 6e064dd0b4
commit 881999fe2c
Signed by: bash
SSH Key Fingerprint: SHA256:DhHTqCegRLHjk/51BZS4JD764q8aas6t2oJKGRcd2IQ
1 changed files with 10 additions and 10 deletions

View File

@ -4221,6 +4221,14 @@ _handle_xterm_777_command(Termpty *ty,
*title_end = ';';
}
static void
_write_xterm_color_response(Termpty *ty, uint8_t number, int r, int g, int b)
{
char buf[64];
int l = snprintf(buf, sizeof(buf), "\033]%d;rgb:%.2x%.2x/%.2x%.2x/%.2x%.2x\033\\", number, r, r, g, g, b, b);
termpty_write(ty, buf, l);
}
static void
_handle_xterm_10_command(Termpty *ty, Eina_Unicode *p, int len)
{
@ -4229,8 +4237,6 @@ _handle_xterm_10_command(Termpty *ty, Eina_Unicode *p, int len)
if (*p == '?')
{
int r, g, b;
char bf[32];
int l;
#if !defined(BINARY_TYFUZZ) && !defined(BINARY_TYTEST)
evas_object_textgrid_palette_get(
termio_textgrid_get(ty->obj),
@ -4242,8 +4248,7 @@ _handle_xterm_10_command(Termpty *ty, Eina_Unicode *p, int len)
g = config->colors[0].g;
b = config->colors[0].b;
#endif
l = snprintf(bf, sizeof(bf), "\033]10;#%.2X%.2X%.2X\007", r, g, b);
termpty_write(ty, bf, l);
_write_xterm_color_response(ty, 10, r, g, b);
}
else
{
@ -4278,8 +4283,6 @@ _handle_xterm_set_color_class(Termpty *ty, Eina_Unicode *p, int len,
if (*p == '?')
{
int r = 0, g = 0, b = 0;
char buf[64];
int l;
if (edje_object_color_class_get(obj, color_class, &r, &g, &b, NULL,
NULL, NULL, NULL, NULL,
@ -4287,10 +4290,7 @@ _handle_xterm_set_color_class(Termpty *ty, Eina_Unicode *p, int len,
{
ERR("error getting color class '%s' on obj %p", color_class, obj);
}
l = snprintf(buf, sizeof(buf),
"\033]%d;rgb:%.2x%.2x/%.2x%.2x/%.2x%.2x\033\\",
number, r, r, g, g, b, b);
termpty_write(ty, buf, l);
_write_xterm_color_response(ty, number, r, g, b);
}
else
{