From 5293f13f39197d16dfd93a64916fdd9d9a1bb024 Mon Sep 17 00:00:00 2001 From: Nexarian Date: Mon, 8 Jan 2024 17:59:22 -0500 Subject: [PATCH] Fix resize-on-the-fly by processing memory allocation complete. --- xup/xup.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/xup/xup.c b/xup/xup.c index 0b6cbd04..b40b1e9e 100644 --- a/xup/xup.c +++ b/xup/xup.c @@ -1665,6 +1665,9 @@ lib_mod_process_message(struct mod *mod, struct stream *s) int type; char *phold; + int width; + int height; + LOG_DEVEL(LOG_LEVEL_TRACE, "lib_mod_process_message:"); in_uint16_le(s, type); in_uint16_le(s, num_orders); @@ -1674,7 +1677,7 @@ lib_mod_process_message(struct mod *mod, struct stream *s) rv = 0; if (type == 1) /* original order list */ { - for (index = 0; index < num_orders; index++) + for (index = 0; index < num_orders; ++index) { in_uint16_le(s, type); rv = lib_mod_process_orders(mod, type, s); @@ -1727,6 +1730,29 @@ lib_mod_process_message(struct mod *mod, struct stream *s) s->p = phold + len; } } + else if (type == 100) // metadata commands. + { + LOG_DEVEL(LOG_LEVEL_INFO, + "lib_mod_process_message: type 100 len %d", len); + for (index = 0; index < num_orders; ++index) + { + phold = s->p; + in_uint16_le(s, type); + in_uint16_le(s, len); + switch (type) + { + case 3: // memory allocation complete + in_uint16_le(s, width); + in_uint16_le(s, height); + LOG(LOG_LEVEL_INFO, "Received memory_allocation_complete" + " command. width: %d, height: %d", + width, height); + rv = mod->server_reset(mod, width, height, 0); + break; + } + s->p = phold + len; + } + } else { LOG_DEVEL(LOG_LEVEL_TRACE, "unknown type %d", type);