=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/tty.c,v retrieving revision 1.285 retrieving revision 1.286 diff -c -r1.285 -r1.286 *** src/usr.bin/tmux/tty.c 2017/05/15 16:44:04 1.285 --- src/usr.bin/tmux/tty.c 2017/05/31 08:43:44 1.286 *************** *** 1,4 **** ! /* $OpenBSD: tty.c,v 1.285 2017/05/15 16:44:04 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: tty.c,v 1.286 2017/05/31 08:43:44 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott *************** *** 473,478 **** --- 473,486 ---- } void + tty_putcode3(struct tty *tty, enum tty_code_code code, int a, int b, int c) + { + if (a < 0 || b < 0 || c < 0) + return; + tty_puts(tty, tty_term_string3(tty->term, code, a, b, c)); + } + + void tty_putcode_ptr1(struct tty *tty, enum tty_code_code code, const void *a) { if (a != NULL) *************** *** 1847,1853 **** /* Is this a 24-bit colour? */ if (gc->fg & COLOUR_FLAG_RGB) { /* Not a 24-bit terminal? Translate to 256-colour palette. */ ! if (!tty_term_flag(tty->term, TTYC_TC)) { colour_split_rgb(gc->fg, &r, &g, &b); gc->fg = colour_find_rgb(r, g, b); } else --- 1855,1861 ---- /* Is this a 24-bit colour? */ if (gc->fg & COLOUR_FLAG_RGB) { /* Not a 24-bit terminal? Translate to 256-colour palette. */ ! if (!tty_term_has(tty->term, TTYC_SETRGBF)) { colour_split_rgb(gc->fg, &r, &g, &b); gc->fg = colour_find_rgb(r, g, b); } else *************** *** 1900,1906 **** /* Is this a 24-bit colour? */ if (gc->bg & COLOUR_FLAG_RGB) { /* Not a 24-bit terminal? Translate to 256-colour palette. */ ! if (!tty_term_flag(tty->term, TTYC_TC)) { colour_split_rgb(gc->bg, &r, &g, &b); gc->bg = colour_find_rgb(r, g, b); } else --- 1908,1914 ---- /* Is this a 24-bit colour? */ if (gc->bg & COLOUR_FLAG_RGB) { /* Not a 24-bit terminal? Translate to 256-colour palette. */ ! if (!tty_term_has(tty->term, TTYC_SETRGBB)) { colour_split_rgb(gc->bg, &r, &g, &b); gc->bg = colour_find_rgb(r, g, b); } else *************** *** 2031,2043 **** } if (colour & COLOUR_FLAG_RGB) { ! if (!tty_term_flag(tty->term, TTYC_TC)) ! return (-1); ! ! colour_split_rgb(colour & 0xffffff, &r, &g, &b); ! xsnprintf(s, sizeof s, "\033[%s;2;%hhu;%hhu;%hhum", type, ! r, g, b); ! tty_puts(tty, s); return (0); } --- 2039,2055 ---- } if (colour & COLOUR_FLAG_RGB) { ! if (*type == '3') { ! if (!tty_term_has(tty->term, TTYC_SETRGBF)) ! return (-1); ! colour_split_rgb(colour & 0xffffff, &r, &g, &b); ! tty_putcode3(tty, TTYC_SETRGBF, r, g, b); ! } else { ! if (!tty_term_has(tty->term, TTYC_SETRGBB)) ! return (-1); ! colour_split_rgb(colour & 0xffffff, &r, &g, &b); ! tty_putcode3(tty, TTYC_SETRGBB, r, g, b); ! } return (0); }