Send responses when only a number and no id is specified

This commit is contained in:
Kovid Goyal 2020-12-16 18:31:30 +05:30
parent e96ff19a7a
commit d10681f27f
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
2 changed files with 5 additions and 3 deletions

View file

@ -520,14 +520,15 @@ finish_command_response(const GraphicsCommand *g, bool data_loaded, uint32_t iid
if (g->quiet) {
if (is_ok_response || g->quiet > 1) return NULL;
}
if (iid) {
if (iid || image_number) {
if (is_ok_response) {
if (!data_loaded) return NULL;
snprintf(command_response, 10, "OK");
}
size_t pos = 0;
rbuf[pos++] = 'G';
#define print(fmt, ...) pos += snprintf(rbuf + pos, arraysz(rbuf) - 1 - pos, fmt, __VA_ARGS__)
print("Gi=%u", iid);
if (iid) print("i=%u", iid);
if (image_number) print(",I=%u", image_number);
if (placement_id) print(",p=%u", placement_id);
print(";%s", command_response);

View file

@ -277,7 +277,8 @@ class TestGraphics(BaseTest):
code, idstr = put(c=2, r=2, I=93)
self.ae((code, idstr), ('OK', 'i=6,I=93'))
self.assertIsNone(put(c=2, r=2, I=94))
code, idstr = put(c=2, r=2, I=94)
self.ae(code, 'ENOENT')
def test_image_put(self):
cw, ch = 10, 20