xnest: replace XConfigureWindow() calls by xcb_configure_window()

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2024-07-30 21:02:24 +02:00
parent e30eefaa43
commit 9cf63422e2
3 changed files with 37 additions and 6 deletions

View File

@ -191,7 +191,7 @@ void
xnestConfigureWindow(WindowPtr pWin, unsigned int mask)
{
unsigned int valuemask;
XWindowChanges values;
XnWindowChanges values;
if (mask & XCB_CONFIG_WINDOW_SIBLING &&
xnestWindowPriv(pWin)->parent != xnestWindowParent(pWin)) {
@ -241,8 +241,7 @@ xnestConfigureWindow(WindowPtr pWin, unsigned int mask)
xnestWindowPriv(pWin)->border_width = pWin->borderWidth;
}
if (valuemask)
XConfigureWindow(xnestDisplay, xnestWindow(pWin), valuemask, &values);
xnest_configure_window(xnestUpstreamInfo.conn, xnestWindow(pWin), valuemask, values);
if (mask & XCB_CONFIG_WINDOW_SIBLING &&
xnestWindowPriv(pWin)->sibling_above != xnestWindowSiblingAbove(pWin)) {
@ -254,7 +253,8 @@ xnestConfigureWindow(WindowPtr pWin, unsigned int mask)
/* the top sibling */
valuemask = XCB_CONFIG_WINDOW_STACK_MODE;
values.stack_mode = Above;
XConfigureWindow(xnestDisplay, xnestWindow(pSib), valuemask, &values);
xnest_configure_window(xnestUpstreamInfo.conn, xnestWindow(pSib), valuemask, values);
xnestWindowPriv(pSib)->sibling_above = XCB_WINDOW_NONE;
/* the rest of siblings */
@ -262,8 +262,7 @@ xnestConfigureWindow(WindowPtr pWin, unsigned int mask)
valuemask = XCB_CONFIG_WINDOW_SIBLING | XCB_CONFIG_WINDOW_STACK_MODE;
values.sibling = xnestWindowSiblingAbove(pSib);
values.stack_mode = Below;
XConfigureWindow(xnestDisplay, xnestWindow(pSib), valuemask,
&values);
xnest_configure_window(xnestUpstreamInfo.conn, xnestWindow(pSib), valuemask, values);
xnestWindowPriv(pSib)->sibling_above =
xnestWindowSiblingAbove(pSib);
}

View File

@ -66,3 +66,25 @@ void xnest_encode_window_attr(XnSetWindowAttr attr, uint32_t mask, uint32_t *val
EXTRA_VALUE(XCB_CW_CURSOR, cursor);
#undef EXTRA_VALUE
}
void xnest_configure_window(xcb_connection_t *conn, uint32_t window,
uint32_t mask, XnWindowChanges values)
{
if (mask) {
uint32_t value_list[16] = { 0 };
int idx = 0;
#define EXTRA_VALUE(flag,val) if (mask & flag) { value_list[idx++] = values.val; }
EXTRA_VALUE(XCB_CONFIG_WINDOW_X, x);
EXTRA_VALUE(XCB_CONFIG_WINDOW_Y, y);
EXTRA_VALUE(XCB_CONFIG_WINDOW_WIDTH, width);
EXTRA_VALUE(XCB_CONFIG_WINDOW_HEIGHT, height);
EXTRA_VALUE(XCB_CONFIG_WINDOW_BORDER_WIDTH, border_width);
EXTRA_VALUE(XCB_CONFIG_WINDOW_SIBLING, sibling);
EXTRA_VALUE(XCB_CONFIG_WINDOW_STACK_MODE, stack_mode);
#undef EXTRA_VALUE
xcb_configure_window(conn, window, mask, value_list);
}
}

View File

@ -27,4 +27,14 @@ uint32_t xnestUpstreamGC(GCPtr pGC);
typedef XSetWindowAttributes XnSetWindowAttr;
void xnest_encode_window_attr(XnSetWindowAttr attr, uint32_t mask, uint32_t *values);
typedef struct {
int x, y;
int width, height;
int border_width;
uint32_t sibling;
int stack_mode;
} XnWindowChanges;
void xnest_configure_window(xcb_connection_t *conn, uint32_t window, uint32_t mask, XnWindowChanges values);
#endif /* __XNEST__XCB_H */