Skip to content

Commit

Permalink
Merge branch 'osc-10-query'
Browse files Browse the repository at this point in the history
  • Loading branch information
borisfaure committed Apr 20, 2024
2 parents 865cf12 + e1ebc20 commit 87c0538
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
20 changes: 10 additions & 10 deletions src/bin/termptyesc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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),
Expand All @@ -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
{
Expand Down Expand Up @@ -4278,19 +4283,14 @@ _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,
NULL, NULL, NULL, NULL) != EINA_TRUE)
{
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
{
Expand Down
2 changes: 1 addition & 1 deletion tests/tests.results
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ color_link_edc.sh 06155942ad90e408ed11225b1e84b6a4
color_link_css_rgb.sh d465a1d5095e550b73e73266452068d9
color_link_css_hsl.sh 3a3dc638c80d5a2a9d5c804a778c09fb
crash_empty_osc.sh 3675247f0d0c1aa439bb5075237e3fe5
xterm-osc-10.sh 3782074fb92672b55351cc11f253b418
xterm-osc-10.sh e96950ab6c1e2df17dca8b55e34a5540
xterm-osc-11.sh 1039019667ac61b387f1436e7eff2398
xterm-osc-12.sh 9237a291abf73341d4e6a9cf94592c6d
xterm-colors-sharp.sh f034efaac9b49ea97e46e9ec4b139c23
Expand Down

0 comments on commit 87c0538

Please sign in to comment.