diff --git a/hw/xnest/Screen.c b/hw/xnest/Screen.c index e912f0cda..9ff4830ee 100644 --- a/hw/xnest/Screen.c +++ b/hw/xnest/Screen.c @@ -16,6 +16,9 @@ is" without express or implied warranty. #include #endif +#include +#include + #include #include #include @@ -141,7 +144,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 +366,35 @@ xnestOpenScreen(ScreenPtr pScreen, int argc, char *argv[]) if (xnestDoFullGeneration) { + xcb_params_cw_t attributes = { + .back_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, - xnestUpstreamInfo.screenInfo->root, - xnestX + POSITION_OFFSET, - xnestY + POSITION_OFFSET, - xnestWidth, xnestHeight, - xnestBorderWidth, - pScreen->rootDepth, - InputOutput, - xnestDefaultVisual(pScreen), - valuemask, &attributes); + else { + xnestDefaultWindows[pScreen->myNum] = xcb_generate_id(xnestUpstreamInfo.conn); + xcb_aux_create_window(xnestUpstreamInfo.conn, + pScreen->rootDepth, + xnestDefaultWindows[pScreen->myNum], + xnestUpstreamInfo.screenInfo->root, + xnestX + POSITION_OFFSET, + xnestY + POSITION_OFFSET, + xnestWidth, + xnestHeight, + xnestBorderWidth, + XCB_WINDOW_CLASS_INPUT_OUTPUT, + xnestDefaultVisual(pScreen)->visualid, + valuemask, + &attributes); + } if (!xnestWindowName) xnestWindowName = argv[0]; @@ -409,17 +417,23 @@ xnestOpenScreen(ScreenPtr pScreen, int argc, char *argv[]) XMapWindow(xnestDisplay, xnestDefaultWindows[pScreen->myNum]); valuemask = XCB_CW_BACK_PIXMAP | XCB_CW_COLORMAP; - attributes.background_pixmap = xnestScreenSaverPixmap; + attributes.back_pixmap = xnestScreenSaverPixmap; attributes.colormap = xnestUpstreamInfo.screenInfo->default_colormap; - xnestScreenSaverWindows[pScreen->myNum] = - XCreateWindow(xnestDisplay, - xnestDefaultWindows[pScreen->myNum], - 0, 0, xnestWidth, xnestHeight, 0, - xnestUpstreamInfo.screenInfo->root_depth, - InputOutput, DefaultVisual(xnestDisplay, - xnestUpstreamInfo.screenId), - valuemask, - &attributes); + + xnestScreenSaverWindows[pScreen->myNum] = xcb_generate_id(xnestUpstreamInfo.conn); + xcb_aux_create_window(xnestUpstreamInfo.conn, + xnestUpstreamInfo.screenInfo->root_depth, + xnestScreenSaverWindows[pScreen->myNum], + xnestDefaultWindows[pScreen->myNum], + 0, + 0, + xnestWidth, + xnestHeight, + 0, + XCB_WINDOW_CLASS_INPUT_OUTPUT, + xnestUpstreamInfo.screenInfo->root_visual, + valuemask, + &attributes); } if (!xnestCreateDefaultColormap(pScreen)) diff --git a/hw/xnest/Window.c b/hw/xnest/Window.c index ec65409a1..5b275f42a 100644 --- a/hw/xnest/Window.c +++ b/hw/xnest/Window.c @@ -16,6 +16,9 @@ is" without express or implied warranty. #include #endif +#include +#include + #include #include #include @@ -31,6 +34,7 @@ is" without express or implied warranty. #include "mi.h" #include "Xnest.h" +#include "xnest-xcb.h" #include "Display.h" #include "Screen.h" @@ -78,7 +82,7 @@ Bool xnestCreateWindow(WindowPtr pWin) { unsigned long mask; - XSetWindowAttributes attributes; + xcb_params_cw_t attributes = { 0 }; Visual *visual; ColormapPtr pCmap; @@ -118,18 +122,21 @@ 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); + xcb_aux_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, + &attributes); + xnestWindowPriv(pWin)->parent = xnestWindowParent(pWin); xnestWindowPriv(pWin)->x = pWin->origin.x - wBorderWidth(pWin); xnestWindowPriv(pWin)->y = pWin->origin.y - wBorderWidth(pWin); diff --git a/hw/xnest/meson.build b/hw/xnest/meson.build index 4428e6851..ee5f2d30a 100644 --- a/hw/xnest/meson.build +++ b/hw/xnest/meson.build @@ -22,6 +22,7 @@ srcs = [ x11_xcb_dep = dependency('x11-xcb', required: true) xcb_dep = dependency('xcb', required: true) +xcb_aux_dep = dependency('xcb-aux', required: true) executable( 'Xnest', @@ -31,6 +32,7 @@ executable( common_dep, xnest_dep, xcb_dep, + xcb_aux_dep, x11_xcb_dep, ], link_with: [