From d7e5f08aa8b1a403b3379b35ff2cc270bb005f52 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Tue, 30 Jul 2024 15:42:02 +0200 Subject: [PATCH] Xnest: converter from XSetWindowAttributes struct to uint32_t list Signed-off-by: Enrico Weigelt, metux IT consult --- hw/xnest/xcb.c | 22 ++++++++++++++++++++++ hw/xnest/xnest-xcb.h | 5 +++++ 2 files changed, 27 insertions(+) diff --git a/hw/xnest/xcb.c b/hw/xnest/xcb.c index 10e43b783..5ae1cfed3 100644 --- a/hw/xnest/xcb.c +++ b/hw/xnest/xcb.c @@ -44,3 +44,25 @@ uint32_t xnestUpstreamGC(GCPtr pGC) { XFlushGC(xnestDisplay, priv->gc); return priv->gc->gid; } + +void xnest_encode_window_attr(XnSetWindowAttr attr, uint32_t mask, uint32_t *values) +{ + int idx = 0; +#define EXTRA_VALUE(flag,val) if (mask & flag) { values[idx++] = attr.val; } + EXTRA_VALUE(XCB_CW_BACK_PIXMAP, background_pixmap); + EXTRA_VALUE(XCB_CW_BACK_PIXEL, background_pixel) + EXTRA_VALUE(XCB_CW_BORDER_PIXMAP, border_pixmap) + EXTRA_VALUE(XCB_CW_BORDER_PIXEL, border_pixel) + EXTRA_VALUE(XCB_CW_BIT_GRAVITY, bit_gravity) + EXTRA_VALUE(XCB_CW_WIN_GRAVITY, win_gravity); + EXTRA_VALUE(XCB_CW_BACKING_STORE, backing_store); + EXTRA_VALUE(XCB_CW_BACKING_PLANES, backing_planes); + EXTRA_VALUE(XCB_CW_BACKING_PIXEL, backing_pixel); + EXTRA_VALUE(XCB_CW_OVERRIDE_REDIRECT, override_redirect); + EXTRA_VALUE(XCB_CW_SAVE_UNDER, save_under); + EXTRA_VALUE(XCB_CW_EVENT_MASK, event_mask); + EXTRA_VALUE(XCB_CW_DONT_PROPAGATE, do_not_propagate_mask); + EXTRA_VALUE(XCB_CW_COLORMAP, colormap); + EXTRA_VALUE(XCB_CW_CURSOR, cursor); +#undef EXTRA_VALUE +} diff --git a/hw/xnest/xnest-xcb.h b/hw/xnest/xnest-xcb.h index 66064c691..85816faee 100644 --- a/hw/xnest/xnest-xcb.h +++ b/hw/xnest/xnest-xcb.h @@ -7,6 +7,8 @@ #include +#include "Xnest.h" + typedef struct { xcb_connection_t *conn; uint32_t screenId; @@ -22,4 +24,7 @@ void xnest_upstream_setup(void); /* retrieve upstream GC XID for our xserver GC */ uint32_t xnestUpstreamGC(GCPtr pGC); +typedef XSetWindowAttributes XnSetWindowAttr; +void xnest_encode_window_attr(XnSetWindowAttr attr, uint32_t mask, uint32_t *values); + #endif /* __XNEST__XCB_H */