Xnest: screen: record visuals and cmaps in separate table
Record the associations between host's and our visuals as well their corresponding cmaps in a global table, which's used later for lookups. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
23d541fbba
commit
0913ee24d0
|
@ -181,6 +181,9 @@ xnestCloseDisplay(void)
|
||||||
If xnestDoFullGeneration all x resources will be destroyed upon closing
|
If xnestDoFullGeneration all x resources will be destroyed upon closing
|
||||||
the display connection. There is no need to generate extra protocol.
|
the display connection. There is no need to generate extra protocol.
|
||||||
*/
|
*/
|
||||||
|
free(xnestVisualMap);
|
||||||
|
xnestVisualMap = NULL;
|
||||||
|
xnestNumVisualMap = 0;
|
||||||
|
|
||||||
free(xnestDefaultColormaps);
|
free(xnestDefaultColormaps);
|
||||||
XFree(xnestVisuals);
|
XFree(xnestVisuals);
|
||||||
|
|
|
@ -200,6 +200,11 @@ xnestOpenScreen(ScreenPtr pScreen, int argc, char *argv[])
|
||||||
visuals = xallocarray(1, sizeof(VisualRec));
|
visuals = xallocarray(1, sizeof(VisualRec));
|
||||||
numVisuals = 0;
|
numVisuals = 0;
|
||||||
|
|
||||||
|
if (!xnestVisualMap)
|
||||||
|
xnestVisualMap = calloc(1, sizeof(XnestVisualRec));
|
||||||
|
else
|
||||||
|
xnestVisualMap = reallocarray(xnestVisualMap, xnestNumVisualMap+1, sizeof(XnestVisualRec));
|
||||||
|
|
||||||
depths = (DepthPtr) malloc(MAXDEPTH * sizeof(DepthRec));
|
depths = (DepthPtr) malloc(MAXDEPTH * sizeof(DepthRec));
|
||||||
depths[0].depth = 1;
|
depths[0].depth = 1;
|
||||||
depths[0].numVids = 0;
|
depths[0].numVids = 0;
|
||||||
|
@ -244,6 +249,20 @@ xnestOpenScreen(ScreenPtr pScreen, int argc, char *argv[])
|
||||||
.vid = FakeClientID(0),
|
.vid = FakeClientID(0),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
xnestVisualMap[xnestNumVisualMap] = (XnestVisualRec) {
|
||||||
|
.ourXID = visuals[numVisuals].vid,
|
||||||
|
.ourVisual = &visuals[numVisuals],
|
||||||
|
.upstreamDepth = depth_iter.data,
|
||||||
|
.upstreamVisual = &vts[x],
|
||||||
|
.upstreamCMap = xcb_generate_id(xnestUpstreamInfo.conn),
|
||||||
|
};
|
||||||
|
|
||||||
|
xcb_create_colormap(xnestUpstreamInfo.conn,
|
||||||
|
XCB_COLORMAP_ALLOC_NONE,
|
||||||
|
xnestVisualMap[xnestNumVisualMap].upstreamCMap,
|
||||||
|
xnestUpstreamInfo.screenInfo->root,
|
||||||
|
xnestVisualMap[xnestNumVisualMap].upstreamVisual->visual_id);
|
||||||
|
|
||||||
numDepths = addDepthVisual(depths, numDepths, visuals[numVisuals].nplanes, visuals[numVisuals].vid);
|
numDepths = addDepthVisual(depths, numDepths, visuals[numVisuals].nplanes, visuals[numVisuals].vid);
|
||||||
|
|
||||||
if (xnestUserDefaultClass || xnestUserDefaultDepth) {
|
if (xnestUserDefaultClass || xnestUserDefaultDepth) {
|
||||||
|
@ -266,11 +285,14 @@ xnestOpenScreen(ScreenPtr pScreen, int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
numVisuals++;
|
numVisuals++;
|
||||||
|
xnestNumVisualMap++;
|
||||||
visuals = reallocarray(visuals, numVisuals+1, sizeof(VisualRec));
|
visuals = reallocarray(visuals, numVisuals+1, sizeof(VisualRec));
|
||||||
|
xnestVisualMap = reallocarray(xnestVisualMap, xnestNumVisualMap+1, sizeof(XnestVisualRec));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
breakout:
|
breakout:
|
||||||
visuals = reallocarray(visuals, numVisuals, sizeof(VisualRec));
|
visuals = reallocarray(visuals, numVisuals, sizeof(VisualRec));
|
||||||
|
xnestVisualMap = reallocarray(xnestVisualMap, xnestNumVisualMap, sizeof(XnestVisualRec));
|
||||||
|
|
||||||
if (!found_default_visual) {
|
if (!found_default_visual) {
|
||||||
ErrorF("Xnest: can't find matching visual for user specified depth %d\n", xnestDefaultDepth);
|
ErrorF("Xnest: can't find matching visual for user specified depth %d\n", xnestDefaultDepth);
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
#include "Display.h"
|
#include "Display.h"
|
||||||
|
|
||||||
xnestUpstreamInfoRec xnestUpstreamInfo = { 0 };
|
xnestUpstreamInfoRec xnestUpstreamInfo = { 0 };
|
||||||
|
XnestVisualRec *xnestVisualMap;
|
||||||
|
int xnestNumVisualMap;
|
||||||
|
|
||||||
void xnest_upstream_setup(void) {
|
void xnest_upstream_setup(void) {
|
||||||
xnestUpstreamInfo.screenId = DefaultScreen(xnestDisplay);
|
xnestUpstreamInfo.screenId = DefaultScreen(xnestDisplay);
|
||||||
|
|
|
@ -63,6 +63,17 @@ typedef struct {
|
||||||
int auto_repeat_mode;
|
int auto_repeat_mode;
|
||||||
} XnKeyboardControl;
|
} XnKeyboardControl;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
xcb_visualtype_t *upstreamVisual;
|
||||||
|
xcb_depth_t *upstreamDepth;
|
||||||
|
xcb_colormap_t upstreamCMap;
|
||||||
|
uint32_t ourXID;
|
||||||
|
VisualPtr ourVisual;
|
||||||
|
} XnestVisualRec;
|
||||||
|
|
||||||
|
extern XnestVisualRec *xnestVisualMap;
|
||||||
|
extern int xnestNumVisualMap;
|
||||||
|
|
||||||
void xnestEncodeKeyboardControl(XnKeyboardControl ctrl, long mask, uint32_t *value);
|
void xnestEncodeKeyboardControl(XnKeyboardControl ctrl, long mask, uint32_t *value);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
Loading…
Reference in New Issue