xnest: add pixmap depths to global depth list
Right now, we're only registering the depths of our visuals, which are mirroring upstream's visuals. But forgotten to register the pixmap depths that don't have an assiocated visual. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
9ab29c305f
commit
c90974c00d
|
@ -137,29 +137,27 @@ static miPointerSpriteFuncRec xnestPointerSpriteFuncs = {
|
||||||
xnestDeviceCursorCleanup
|
xnestDeviceCursorCleanup
|
||||||
};
|
};
|
||||||
|
|
||||||
static int add_depth_visual(DepthPtr depths, int numDepths, int nplanes, VisualID vid)
|
static DepthPtr add_depth(DepthPtr depths, int *numDepths, int nplanes)
|
||||||
{
|
{
|
||||||
DepthPtr walk = NULL;
|
int num = *numDepths;
|
||||||
|
|
||||||
for (int j = 0; j < numDepths; j++)
|
for (int j = 0; j < num; j++)
|
||||||
if (depths[j].depth == nplanes) {
|
if (depths[j].depth == nplanes)
|
||||||
walk = &depths[j];
|
return &depths[j];
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!walk) {
|
depths[num].depth = nplanes;
|
||||||
walk = &depths[numDepths++];
|
if (!(depths[num].vids = calloc(MAXVISUALSPERDEPTH, sizeof(VisualID))))
|
||||||
walk->depth = nplanes;
|
FatalError("memory allocation failed");
|
||||||
walk->numVids = 0;
|
|
||||||
walk->vids = (VisualID *) malloc(MAXVISUALSPERDEPTH * sizeof(VisualID));
|
(*numDepths)++;
|
||||||
}
|
return &depths[num];
|
||||||
if (walk->numVids >= MAXVISUALSPERDEPTH) {
|
}
|
||||||
FatalError("Visual table overflow");
|
|
||||||
}
|
static void add_depth_visual(DepthPtr depths, int *numDepths, int nplanes, VisualID vid)
|
||||||
|
{
|
||||||
|
DepthPtr walk = add_depth(depths, numDepths, nplanes);
|
||||||
walk->vids[walk->numVids] = vid;
|
walk->vids[walk->numVids] = vid;
|
||||||
walk->numVids++;
|
walk->numVids++;
|
||||||
|
|
||||||
return numDepths;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
|
@ -192,7 +190,7 @@ xnestOpenScreen(ScreenPtr pScreen, int argc, char *argv[])
|
||||||
|
|
||||||
int numVisuals = 0;
|
int numVisuals = 0;
|
||||||
VisualPtr visuals = calloc(1, sizeof(VisualRec));
|
VisualPtr visuals = calloc(1, sizeof(VisualRec));
|
||||||
int numDepths = 1;
|
int numDepths = 0;
|
||||||
DepthPtr depths = calloc(MAXDEPTH, sizeof(DepthRec));
|
DepthPtr depths = calloc(MAXDEPTH, sizeof(DepthRec));
|
||||||
|
|
||||||
if (!visuals || !depths) {
|
if (!visuals || !depths) {
|
||||||
|
@ -206,9 +204,10 @@ xnestOpenScreen(ScreenPtr pScreen, int argc, char *argv[])
|
||||||
else
|
else
|
||||||
xnestVisualMap = reallocarray(xnestVisualMap, xnestNumVisualMap+1, sizeof(xnest_visual_t));
|
xnestVisualMap = reallocarray(xnestVisualMap, xnestNumVisualMap+1, sizeof(xnest_visual_t));
|
||||||
|
|
||||||
depths[0].depth = 1;
|
add_depth(depths, &numDepths, 1);
|
||||||
depths[0].numVids = 0;
|
|
||||||
depths[0].vids = calloc(MAXVISUALSPERDEPTH, sizeof(VisualID));
|
for (int i=0; i<screenInfo.numPixmapFormats; i++)
|
||||||
|
add_depth(depths, &numDepths, screenInfo.formats[i].depth);
|
||||||
|
|
||||||
int found_default_visual = 0;
|
int found_default_visual = 0;
|
||||||
xcb_depth_iterator_t depth_iter;
|
xcb_depth_iterator_t depth_iter;
|
||||||
|
@ -261,7 +260,7 @@ xnestOpenScreen(ScreenPtr pScreen, int argc, char *argv[])
|
||||||
xnestUpstreamInfo.screenInfo->root,
|
xnestUpstreamInfo.screenInfo->root,
|
||||||
xnestVisualMap[xnestNumVisualMap].upstreamVisual->visual_id);
|
xnestVisualMap[xnestNumVisualMap].upstreamVisual->visual_id);
|
||||||
|
|
||||||
numDepths = add_depth_visual(depths, numDepths, visuals[numVisuals].nplanes, visuals[numVisuals].vid);
|
add_depth_visual(depths, &numDepths, visuals[numVisuals].nplanes, visuals[numVisuals].vid);
|
||||||
|
|
||||||
if (xnestUserDefaultClass || xnestUserDefaultDepth) {
|
if (xnestUserDefaultClass || xnestUserDefaultDepth) {
|
||||||
if ((!xnestDefaultClass || visuals[numVisuals].class == xnestDefaultClass) &&
|
if ((!xnestDefaultClass || visuals[numVisuals].class == xnestDefaultClass) &&
|
||||||
|
|
Loading…
Reference in New Issue