Xnest: replace XCreateColormap() / XFreeColormap() by xcb

Use xcb_create_colormap() and XFreeColormap() instead of XCreateColormap()
and XFreeColormap().

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2024-07-31 20:48:17 +02:00
parent edd0d03e0b
commit 911ef9c365
2 changed files with 19 additions and 12 deletions

View File

@ -25,6 +25,7 @@ is" without express or implied warranty.
#include "resource.h"
#include "Xnest.h"
#include "xnest-xcb.h"
#include "Display.h"
#include "Screen.h"
@ -54,11 +55,14 @@ xnestCreateColormap(ColormapPtr pCmap)
pVisual = pCmap->pVisual;
ncolors = pVisual->ColormapEntries;
xnestColormapPriv(pCmap)->colormap =
XCreateColormap(xnestDisplay,
uint32_t const cmap = xcb_generate_id(xnestUpstreamInfo.conn);
xnestColormapPriv(pCmap)->colormap = cmap;
xcb_create_colormap(xnestUpstreamInfo.conn,
(pVisual->class & DynamicClass) ? XCB_COLORMAP_ALLOC_ALL : XCB_COLORMAP_ALLOC_NONE,
cmap,
xnestDefaultWindows[pCmap->pScreen->myNum],
xnestVisual(pVisual),
(pVisual->class & DynamicClass) ? AllocAll : AllocNone);
xnestVisual(pVisual)->visualid);
switch (pVisual->class) {
case StaticGray: /* read only */
@ -133,7 +137,7 @@ xnestCreateColormap(ColormapPtr pCmap)
void
xnestDestroyColormap(ColormapPtr pCmap)
{
XFreeColormap(xnestDisplay, xnestColormap(pCmap));
xcb_free_colormap(xnestUpstreamInfo.conn, xnestColormap(pCmap));
}
#define SEARCH_PREDICATE \

View File

@ -117,13 +117,16 @@ xnestOpenDisplay(int argc, char *argv[])
}
xnestNumDefaultColormaps = xnestNumVisuals;
if (!(xnestDefaultColormaps = calloc(xnestNumDefaultColormaps, sizeof(Colormap))))
return;
for (i = 0; i < xnestNumDefaultColormaps; i++)
xnestDefaultColormaps[i] = XCreateColormap(xnestDisplay,
xnestUpstreamInfo.screenInfo->root,
xnestVisuals[i].visual,
AllocNone);
xnestDefaultColormaps = calloc(xnestNumDefaultColormaps,
sizeof(Colormap));
for (i = 0; i < xnestNumDefaultColormaps; i++) {
xnestDefaultColormaps[i] = xcb_generate_id(xnestUpstreamInfo.conn);
xcb_create_colormap(xnestUpstreamInfo.conn,
XCB_COLORMAP_ALLOC_NONE,
xnestDefaultColormaps[i],
xnestUpstreamInfo.screenInfo->root,
xnestVisuals[i].visual->visualid);
}
xnestDepths = XListDepths(xnestDisplay, xnestUpstreamInfo.screenId,
&xnestNumDepths);