Repository: incubator-guacamole-server Updated Branches: refs/heads/master 6d2cfdabf -> 9ee224f2c
GUACAMOLE-280: Add support for faint (low) intensity SGR. Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/2146200d Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/2146200d Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/2146200d Branch: refs/heads/master Commit: 2146200dfde612029303787d40d1f53581d77a37 Parents: 6d2cfda Author: Michael Jumper <[email protected]> Authored: Sun May 21 13:34:30 2017 -0700 Committer: Michael Jumper <[email protected]> Committed: Sun May 21 13:46:21 2017 -0700 ---------------------------------------------------------------------- src/terminal/display.c | 7 +++++++ src/terminal/terminal.c | 11 ++++++----- src/terminal/terminal/types.h | 6 ++++++ src/terminal/terminal_handlers.c | 8 +++++++- 4 files changed, 26 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/2146200d/src/terminal/display.c ---------------------------------------------------------------------- diff --git a/src/terminal/display.c b/src/terminal/display.c index cd9f6a6..a1f37b3 100644 --- a/src/terminal/display.c +++ b/src/terminal/display.c @@ -128,6 +128,13 @@ int __guac_terminal_set_colors(guac_terminal_display* display, display->glyph_foreground = *foreground; display->glyph_background = *background; + /* Modify color if half-bright (low intensity) */ + if (attributes->half_bright) { + display->glyph_foreground.red /= 2; + display->glyph_foreground.green /= 2; + display->glyph_foreground.blue /= 2; + } + return 0; } http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/2146200d/src/terminal/terminal.c ---------------------------------------------------------------------- diff --git a/src/terminal/terminal.c b/src/terminal/terminal.c index 711a0fa..bba95f0 100644 --- a/src/terminal/terminal.c +++ b/src/terminal/terminal.c @@ -296,11 +296,12 @@ guac_terminal* guac_terminal_create(guac_client* client, guac_terminal_char default_char = { .value = 0, .attributes = { - .foreground = guac_terminal_palette[default_foreground], - .background = guac_terminal_palette[default_background], - .bold = false, - .reverse = false, - .underscore = false + .foreground = guac_terminal_palette[default_foreground], + .background = guac_terminal_palette[default_background], + .bold = false, + .half_bright = false, + .reverse = false, + .underscore = false }, .width = 1 }; http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/2146200d/src/terminal/terminal/types.h ---------------------------------------------------------------------- diff --git a/src/terminal/terminal/types.h b/src/terminal/terminal/types.h index 7d3cd53..0d054f8 100644 --- a/src/terminal/terminal/types.h +++ b/src/terminal/terminal/types.h @@ -47,6 +47,12 @@ typedef struct guac_terminal_attributes { bool bold; /** + * Whether the character should be rendered with half brightness (faint + * or low intensity). + */ + bool half_bright; + + /** * Whether the character should be rendered with reversed colors * (background becomes foreground and vice-versa). */ http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/2146200d/src/terminal/terminal_handlers.c ---------------------------------------------------------------------- diff --git a/src/terminal/terminal_handlers.c b/src/terminal/terminal_handlers.c index 55fd682..e0be18f 100644 --- a/src/terminal/terminal_handlers.c +++ b/src/terminal/terminal_handlers.c @@ -897,6 +897,10 @@ int guac_terminal_csi(guac_terminal* term, unsigned char c) { else if (value == 1) term->current_attributes.bold = true; + /* Faint (low intensity) */ + else if (value == 2) + term->current_attributes.half_bright = true; + /* Underscore on */ else if (value == 4) term->current_attributes.underscore = true; @@ -906,8 +910,10 @@ int guac_terminal_csi(guac_terminal* term, unsigned char c) { term->current_attributes.reverse = true; /* Normal intensity (not bold) */ - else if (value == 21 || value == 22) + else if (value == 21 || value == 22) { term->current_attributes.bold = false; + term->current_attributes.half_bright = false; + } /* Reset underscore */ else if (value == 24)
