From fcd79d90ee0b7ddf46e5e4d76c54b686aa615d3c Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Tue, 20 Aug 2024 08:53:20 +0200 Subject: [PATCH] (!1654) Xnest: replace XQueryBestSize() by xcb_query_best_size() Signed-off-by: Enrico Weigelt, metux IT consult --- hw/xnest/GCOps.c | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/hw/xnest/GCOps.c b/hw/xnest/GCOps.c index 43052542f..0845d4d2f 100644 --- a/hw/xnest/GCOps.c +++ b/hw/xnest/GCOps.c @@ -32,7 +32,6 @@ is" without express or implied warranty. #include "region.h" #include "servermd.h" -#include "Xnest.h" #include "xnest-xcb.h" #include "Display.h" @@ -67,17 +66,31 @@ void xnestQueryBestSize(int class, unsigned short *pWidth, unsigned short *pHeight, ScreenPtr pScreen) { - unsigned int width, height; + xcb_generic_error_t *err = NULL; + xcb_query_best_size_reply_t *reply = xcb_query_best_size_reply( + xnestUpstreamInfo.conn, + xcb_query_best_size( + xnestUpstreamInfo.conn, + class, + xnestDefaultWindows[pScreen->myNum], + *pWidth, + *pHeight), + &err); - width = *pWidth; - height = *pHeight; + if (err) { + ErrorF("QueryBestSize request failed: %d\n", err->error_code); + free(err); + return; + } - XQueryBestSize(xnestDisplay, class, - xnestDefaultWindows[pScreen->myNum], - width, height, &width, &height); + if (!reply) { + ErrorF("QueryBestSize request failed: no reply\n"); + return; + } - *pWidth = width; - *pHeight = height; + *pWidth = reply->width; + *pHeight = reply->height; + free(reply); } void