(!1654) 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 fad7540c75
commit 389e3eca37
2 changed files with 17 additions and 10 deletions

View File

@ -29,6 +29,7 @@ is" without express or implied warranty.
#include "resource.h"
#include "Xnest.h"
#include "xnest-xcb.h"
#include "Display.h"
#include "Screen.h"
@ -58,11 +59,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 */
@ -134,7 +138,7 @@ xnestCreateColormap(ColormapPtr pCmap)
void
xnestDestroyColormap(ColormapPtr pCmap)
{
XFreeColormap(xnestDisplay, xnestColormap(pCmap));
xcb_free_colormap(xnestUpstreamInfo.conn, xnestColormap(pCmap));
}
#define SEARCH_PREDICATE \

View File

@ -121,11 +121,14 @@ xnestOpenDisplay(int argc, char *argv[])
xnestNumDefaultColormaps = xnestNumVisuals;
xnestDefaultColormaps = xallocarray(xnestNumDefaultColormaps,
sizeof(Colormap));
for (i = 0; i < xnestNumDefaultColormaps; i++)
xnestDefaultColormaps[i] = XCreateColormap(xnestDisplay,
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,
AllocNone);
xnestVisuals[i].visual->visualid);
}
xnestDepths = XListDepths(xnestDisplay, xnestUpstreamInfo.screenId,
&xnestNumDepths);