From 7f648df8af5761c56082a6281fb3df8d780815a9 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Wed, 20 Aug 2025 11:07:58 +0200 Subject: [PATCH] dix: rpcbuf: add x_rpcbuf_write_rect() for writing RECTANGLE PDU The `RECTANGLE` PDU is pretty common, so it's good to have a helper for writing this, so it doesn't need to be open-coded everywhere. Signed-off-by: Enrico Weigelt, metux IT consult --- dix/rpcbuf_priv.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/dix/rpcbuf_priv.h b/dix/rpcbuf_priv.h index bd81439ff1..2f83b33bcd 100644 --- a/dix/rpcbuf_priv.h +++ b/dix/rpcbuf_priv.h @@ -315,4 +315,22 @@ static inline void x_rpcbuf_write_rpcbuf_pad( x_rpcbuf_clear(source); } +/* + * write an X11 RECTANGLE protocol structure into the buffer + * + * @param rpcbuf pointer to the x_rpcbuf_t to operate on + * @param x X value of the rectangle + * @param y Y value of the rectangle + * @param width WIDTH value of the rectangle + * @param height HEIGHT value of the rectangle + */ +static inline void x_rpcbuf_write_rect( + x_rpcbuf_t *rpcbuf, INT16 x, INT16 y, CARD16 width, CARD16 height) +{ + x_rpcbuf_write_INT16(rpcbuf, x); + x_rpcbuf_write_INT16(rpcbuf, y); + x_rpcbuf_write_CARD16(rpcbuf, width); + x_rpcbuf_write_CARD16(rpcbuf, height); +} + #endif /* _XSERVER_DIX_RPCBUF_PRIV_H */