diff --git a/hw/xnest/Screen.c b/hw/xnest/Screen.c index e912f0cda..a99e677d8 100644 --- a/hw/xnest/Screen.c +++ b/hw/xnest/Screen.c @@ -141,7 +141,6 @@ xnestOpenScreen(ScreenPtr pScreen, int argc, char *argv[]) int numVisuals, numDepths; int i, j, depthIndex; unsigned long valuemask; - XSetWindowAttributes attributes; XWindowAttributes gattributes; XSizeHints sizeHints; VisualID defaultVisual; @@ -364,29 +363,38 @@ xnestOpenScreen(ScreenPtr pScreen, int argc, char *argv[]) if (xnestDoFullGeneration) { + XnSetWindowAttr attributes = { + .background_pixel = xnestUpstreamInfo.screenInfo->white_pixel, + .event_mask = xnestEventMask, + .colormap = xnestDefaultVisualColormap(xnestDefaultVisual(pScreen)), + }; + valuemask = XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK | XCB_CW_COLORMAP; - attributes.background_pixel = xnestUpstreamInfo.screenInfo->white_pixel; - attributes.event_mask = xnestEventMask; - attributes.colormap = - xnestDefaultVisualColormap(xnestDefaultVisual(pScreen)); if (xnestParentWindow != 0) { xnestDefaultWindows[pScreen->myNum] = xnestParentWindow; XSelectInput(xnestDisplay, xnestDefaultWindows[pScreen->myNum], xnestEventMask); } - else - xnestDefaultWindows[pScreen->myNum] = - XCreateWindow(xnestDisplay, + else { + uint32_t values[32] = { 0 }; + xnest_encode_window_attr(attributes, valuemask, values); + + xnestDefaultWindows[pScreen->myNum] = xcb_generate_id(xnestUpstreamInfo.conn); + xcb_create_window(xnestUpstreamInfo.conn, + pScreen->rootDepth, + xnestDefaultWindows[pScreen->myNum], xnestUpstreamInfo.screenInfo->root, xnestX + POSITION_OFFSET, xnestY + POSITION_OFFSET, - xnestWidth, xnestHeight, + xnestWidth, + xnestHeight, xnestBorderWidth, - pScreen->rootDepth, - InputOutput, - xnestDefaultVisual(pScreen), - valuemask, &attributes); + XCB_WINDOW_CLASS_INPUT_OUTPUT, + xnestDefaultVisual(pScreen)->visualid, + valuemask, + values); + } if (!xnestWindowName) xnestWindowName = argv[0]; @@ -411,15 +419,24 @@ xnestOpenScreen(ScreenPtr pScreen, int argc, char *argv[]) valuemask = XCB_CW_BACK_PIXMAP | XCB_CW_COLORMAP; attributes.background_pixmap = xnestScreenSaverPixmap; attributes.colormap = xnestUpstreamInfo.screenInfo->default_colormap; - xnestScreenSaverWindows[pScreen->myNum] = - XCreateWindow(xnestDisplay, - xnestDefaultWindows[pScreen->myNum], - 0, 0, xnestWidth, xnestHeight, 0, + + uint32_t values[32] = { 0 }; + xnest_encode_window_attr(attributes, valuemask, values); + + xnestScreenSaverWindows[pScreen->myNum] = xcb_generate_id(xnestUpstreamInfo.conn); + xcb_create_window(xnestUpstreamInfo.conn, xnestUpstreamInfo.screenInfo->root_depth, - InputOutput, DefaultVisual(xnestDisplay, - xnestUpstreamInfo.screenId), + xnestScreenSaverWindows[pScreen->myNum], + xnestDefaultWindows[pScreen->myNum], + 0, + 0, + xnestWidth, + xnestHeight, + 0, + XCB_WINDOW_CLASS_INPUT_OUTPUT, + xnestUpstreamInfo.screenInfo->root_visual, valuemask, - &attributes); + values); } if (!xnestCreateDefaultColormap(pScreen)) diff --git a/hw/xnest/Window.c b/hw/xnest/Window.c index ec65409a1..150fd7570 100644 --- a/hw/xnest/Window.c +++ b/hw/xnest/Window.c @@ -16,6 +16,8 @@ is" without express or implied warranty. #include #endif +#include + #include #include #include @@ -31,6 +33,7 @@ is" without express or implied warranty. #include "mi.h" #include "Xnest.h" +#include "xnest-xcb.h" #include "Display.h" #include "Screen.h" @@ -78,9 +81,10 @@ Bool xnestCreateWindow(WindowPtr pWin) { unsigned long mask; - XSetWindowAttributes attributes; + XnSetWindowAttr attributes = { 0 }; Visual *visual; ColormapPtr pCmap; + uint32_t params[32] = { 0 }; if (pWin->drawable.class == InputOnly) { mask = 0L; @@ -118,18 +122,22 @@ xnestCreateWindow(WindowPtr pWin) } } - xnestWindowPriv(pWin)->window = XCreateWindow(xnestDisplay, - xnestWindowParent(pWin), - pWin->origin.x - - wBorderWidth(pWin), - pWin->origin.y - - wBorderWidth(pWin), - pWin->drawable.width, - pWin->drawable.height, - pWin->borderWidth, - pWin->drawable.depth, - pWin->drawable.class, - visual, mask, &attributes); + xnestWindowPriv(pWin)->window = xcb_generate_id(xnestUpstreamInfo.conn); + xnest_encode_window_attr(attributes, mask, params); + xcb_create_window(xnestUpstreamInfo.conn, + pWin->drawable.depth, + xnestWindowPriv(pWin)->window, + xnestWindowParent(pWin), + pWin->origin.x - wBorderWidth(pWin), + pWin->origin.y - wBorderWidth(pWin), + pWin->drawable.width, + pWin->drawable.height, + pWin->borderWidth, + pWin->drawable.class, + (visual ? visual->visualid : 0), + mask, + ¶ms); + xnestWindowPriv(pWin)->parent = xnestWindowParent(pWin); xnestWindowPriv(pWin)->x = pWin->origin.x - wBorderWidth(pWin); xnestWindowPriv(pWin)->y = pWin->origin.y - wBorderWidth(pWin);