Graphics protocol: Allow suppressing responses from the terminal to graphics commands

This commit is contained in:
Kovid Goyal
2020-12-03 20:42:03 +05:30
parent c9828dfece
commit 23420adfa6
8 changed files with 79 additions and 52 deletions

View File

@@ -1,4 +1,5 @@
// This file is generated by ./gen-apc-parsers.py do not edit!
// This file is generated by /home/kovid/work/kitty/./gen-apc-parsers.py do not
// edit!
#pragma once
@@ -24,6 +25,7 @@ static inline void parse_graphics_code(Screen *screen,
more = 'm',
id = 'i',
placement_id = 'p',
quiet = 'q',
width = 'w',
height = 'h',
x_offset = 'x',
@@ -73,6 +75,9 @@ static inline void parse_graphics_code(Screen *screen,
case placement_id:
value_state = UINT;
break;
case quiet:
value_state = UINT;
break;
case width:
value_state = UINT;
break;
@@ -135,8 +140,8 @@ static inline void parse_graphics_code(Screen *screen,
case action: {
g.action = screen->parser_buf[pos++] & 0xff;
if (g.action != 'p' && g.action != 'q' && g.action != 't' &&
g.action != 'T' && g.action != 'd') {
if (g.action != 'q' && g.action != 'd' && g.action != 'p' &&
g.action != 'T' && g.action != 't') {
REPORT_ERROR("Malformed GraphicsCommand control block, unknown flag "
"value for action: 0x%x",
g.action);
@@ -146,14 +151,14 @@ static inline void parse_graphics_code(Screen *screen,
case delete_action: {
g.delete_action = screen->parser_buf[pos++] & 0xff;
if (g.delete_action != 'p' && g.delete_action != 'q' &&
g.delete_action != 'Z' && g.delete_action != 'x' &&
g.delete_action != 'Q' && g.delete_action != 'C' &&
g.delete_action != 'y' && g.delete_action != 'Y' &&
g.delete_action != 'i' && g.delete_action != 'I' &&
g.delete_action != 'a' && g.delete_action != 'z' &&
g.delete_action != 'A' && g.delete_action != 'X' &&
g.delete_action != 'P' && g.delete_action != 'c') {
if (g.delete_action != 'y' && g.delete_action != 'q' &&
g.delete_action != 'z' && g.delete_action != 'Z' &&
g.delete_action != 'a' && g.delete_action != 'A' &&
g.delete_action != 'Q' && g.delete_action != 'X' &&
g.delete_action != 'i' && g.delete_action != 'p' &&
g.delete_action != 'Y' && g.delete_action != 'P' &&
g.delete_action != 'c' && g.delete_action != 'x' &&
g.delete_action != 'C' && g.delete_action != 'I') {
REPORT_ERROR("Malformed GraphicsCommand control block, unknown flag "
"value for delete_action: 0x%x",
g.delete_action);
@@ -163,8 +168,8 @@ static inline void parse_graphics_code(Screen *screen,
case transmission_type: {
g.transmission_type = screen->parser_buf[pos++] & 0xff;
if (g.transmission_type != 'd' && g.transmission_type != 'f' &&
g.transmission_type != 't' && g.transmission_type != 's') {
if (g.transmission_type != 'f' && g.transmission_type != 's' &&
g.transmission_type != 't' && g.transmission_type != 'd') {
REPORT_ERROR("Malformed GraphicsCommand control block, unknown flag "
"value for transmission_type: 0x%x",
g.transmission_type);
@@ -238,6 +243,7 @@ static inline void parse_graphics_code(Screen *screen,
U(more);
U(id);
U(placement_id);
U(quiet);
U(width);
U(height);
U(x_offset);
@@ -308,21 +314,21 @@ static inline void parse_graphics_code(Screen *screen,
}
REPORT_VA_COMMAND(
"s {sc sc sc sc sI sI sI sI sI sI sI sI sI sI sI sI sI sI sI sI si sI} "
"y#",
"s {sc sc sc sc sI sI sI sI sI sI sI sI sI sI sI sI sI sI sI sI sI si "
"sI} y#",
"graphics_command", "action", g.action, "delete_action", g.delete_action,
"transmission_type", g.transmission_type, "compressed", g.compressed,
"format", (unsigned int)g.format, "more", (unsigned int)g.more, "id",
(unsigned int)g.id, "placement_id", (unsigned int)g.placement_id, "width",
(unsigned int)g.width, "height", (unsigned int)g.height, "x_offset",
(unsigned int)g.x_offset, "y_offset", (unsigned int)g.y_offset,
"data_height", (unsigned int)g.data_height, "data_width",
(unsigned int)g.data_width, "data_sz", (unsigned int)g.data_sz,
"data_offset", (unsigned int)g.data_offset, "num_cells",
(unsigned int)g.num_cells, "num_lines", (unsigned int)g.num_lines,
"cell_x_offset", (unsigned int)g.cell_x_offset, "cell_y_offset",
(unsigned int)g.cell_y_offset, "z_index", (int)g.z_index, "payload_sz",
g.payload_sz, payload, g.payload_sz);
(unsigned int)g.id, "placement_id", (unsigned int)g.placement_id, "quiet",
(unsigned int)g.quiet, "width", (unsigned int)g.width, "height",
(unsigned int)g.height, "x_offset", (unsigned int)g.x_offset, "y_offset",
(unsigned int)g.y_offset, "data_height", (unsigned int)g.data_height,
"data_width", (unsigned int)g.data_width, "data_sz",
(unsigned int)g.data_sz, "data_offset", (unsigned int)g.data_offset,
"num_cells", (unsigned int)g.num_cells, "num_lines",
(unsigned int)g.num_lines, "cell_x_offset", (unsigned int)g.cell_x_offset,
"cell_y_offset", (unsigned int)g.cell_y_offset, "z_index", (int)g.z_index,
"payload_sz", g.payload_sz, payload, g.payload_sz);
screen_handle_graphics_command(screen, &g, payload);
}