Xnest: use new lookup table for visuals and cmaps mappings
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
0913ee24d0
commit
143c1e0648
|
|
@ -26,13 +26,11 @@ is" without express or implied warranty.
|
|||
#include "colormapst.h"
|
||||
#include "resource.h"
|
||||
|
||||
#include "Xnest.h"
|
||||
#include "xnest-xcb.h"
|
||||
|
||||
#include "Display.h"
|
||||
#include "Screen.h"
|
||||
#include "Color.h"
|
||||
#include "Visual.h"
|
||||
#include "XNWindow.h"
|
||||
#include "Args.h"
|
||||
|
||||
|
|
@ -98,7 +96,7 @@ xnestCreateColormap(ColormapPtr pCmap)
|
|||
(pVisual->class & DynamicClass) ? XCB_COLORMAP_ALLOC_ALL : XCB_COLORMAP_ALLOC_NONE,
|
||||
cmap,
|
||||
xnestDefaultWindows[pCmap->pScreen->myNum],
|
||||
xnestVisual(pVisual)->visualid);
|
||||
xnest_visual_map_to_host(pVisual->vid));
|
||||
|
||||
switch (pVisual->class) {
|
||||
case StaticGray: /* read only */
|
||||
|
|
@ -250,13 +248,12 @@ xnestSetInstalledColormapWindows(ScreenPtr pScreen)
|
|||
*/
|
||||
if (icws.numWindows) {
|
||||
WindowPtr pWin;
|
||||
Visual *visual;
|
||||
ColormapPtr pCmap;
|
||||
|
||||
pWin = xnestWindowPtr(icws.windows[0]);
|
||||
visual = xnestVisualFromID(pScreen, wVisual(pWin));
|
||||
|
||||
if (visual == xnestDefaultVisual(pScreen))
|
||||
if (xnest_visual_map_to_host(wVisual(pWin)) ==
|
||||
xnest_visual_map_to_host(pScreen->rootVisual))
|
||||
dixLookupResourceByType((void **) &pCmap, wColormap(pWin),
|
||||
X11_RESTYPE_COLORMAP, serverClient,
|
||||
DixUseAccess);
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ is" without express or implied warranty.
|
|||
#include "Display.h"
|
||||
#include "Screen.h"
|
||||
#include "XNCursor.h"
|
||||
#include "Visual.h"
|
||||
#include "Keyboard.h"
|
||||
#include "Args.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ is" without express or implied warranty.
|
|||
#include "XNFont.h"
|
||||
#include "GCOps.h"
|
||||
#include "Drawable.h"
|
||||
#include "Visual.h"
|
||||
|
||||
void
|
||||
xnestFillSpans(DrawablePtr pDrawable, GCPtr pGC, int nSpans, xPoint * pPoints,
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@ is" without express or implied warranty.
|
|||
#include "XNFont.h"
|
||||
#include "Color.h"
|
||||
#include "XNCursor.h"
|
||||
#include "Visual.h"
|
||||
#include "Events.h"
|
||||
#include "Init.h"
|
||||
#include "mipointer.h"
|
||||
|
|
@ -411,7 +410,7 @@ breakout:
|
|||
XnSetWindowAttr attributes = {
|
||||
.background_pixel = xnestUpstreamInfo.screenInfo->white_pixel,
|
||||
.event_mask = xnestEventMask,
|
||||
.colormap = xnestDefaultVisualColormap(xnestDefaultVisual(pScreen)),
|
||||
.colormap = xnestVisualToHostCmap(pScreen->rootVisual),
|
||||
};
|
||||
|
||||
valuemask = XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK | XCB_CW_COLORMAP;
|
||||
|
|
@ -438,7 +437,7 @@ breakout:
|
|||
xnestGeometry.height,
|
||||
xnestBorderWidth,
|
||||
XCB_WINDOW_CLASS_INPUT_OUTPUT,
|
||||
xnestDefaultVisual(pScreen)->visualid,
|
||||
xnest_visual_map_to_host(pScreen->rootVisual),
|
||||
valuemask,
|
||||
values);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ Visual *xnestVisual(VisualPtr pVisual);
|
|||
Visual *xnestVisualFromID(ScreenPtr pScreen, VisualID visual);
|
||||
Colormap xnestDefaultVisualColormap(Visual * visual);
|
||||
|
||||
#define xnestDefaultVisual(pScreen) \
|
||||
xnestVisualFromID((pScreen), (pScreen)->rootVisual)
|
||||
VisualPtr ScreenGetVisual(ScreenPtr pScreen, VisualID visual);
|
||||
|
||||
#endif /* XNESTVISUAL_H */
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ is" without express or implied warranty.
|
|||
#include "XNGC.h"
|
||||
#include "Drawable.h"
|
||||
#include "Color.h"
|
||||
#include "Visual.h"
|
||||
#include "Events.h"
|
||||
#include "Args.h"
|
||||
|
||||
|
|
@ -83,7 +82,7 @@ xnestCreateWindow(WindowPtr pWin)
|
|||
{
|
||||
unsigned long mask;
|
||||
XnSetWindowAttr attributes = { 0 };
|
||||
Visual *visual;
|
||||
uint32_t visual = CopyFromParent; /* 0L */
|
||||
ColormapPtr pCmap;
|
||||
uint32_t params[32] = { 0 };
|
||||
|
||||
|
|
@ -99,8 +98,7 @@ xnestCreateWindow(WindowPtr pWin)
|
|||
if (pWin->parent) {
|
||||
if (pWin->optional &&
|
||||
pWin->optional->visual != wVisual(pWin->parent)) {
|
||||
visual =
|
||||
xnestVisualFromID(pWin->drawable.pScreen, wVisual(pWin));
|
||||
visual = xnest_visual_map_to_host(wVisual(pWin));
|
||||
mask |= XCB_CW_COLORMAP;
|
||||
if (pWin->optional->colormap) {
|
||||
dixLookupResourceByType((void **) &pCmap, wColormap(pWin),
|
||||
|
|
@ -109,13 +107,13 @@ xnestCreateWindow(WindowPtr pWin)
|
|||
attributes.colormap = xnestColormap(pCmap);
|
||||
}
|
||||
else
|
||||
attributes.colormap = xnestDefaultVisualColormap(visual);
|
||||
attributes.colormap = xnestHostVisualToHostCmap(visual);
|
||||
}
|
||||
else
|
||||
visual = CopyFromParent;
|
||||
}
|
||||
else { /* root windows have their own colormaps at creation time */
|
||||
visual = xnestVisualFromID(pWin->drawable.pScreen, wVisual(pWin));
|
||||
visual = xnest_visual_map_to_host(wVisual(pWin));
|
||||
dixLookupResourceByType((void **) &pCmap, wColormap(pWin),
|
||||
X11_RESTYPE_COLORMAP, serverClient, DixUseAccess);
|
||||
mask |= XCB_CW_COLORMAP;
|
||||
|
|
@ -135,7 +133,7 @@ xnestCreateWindow(WindowPtr pWin)
|
|||
pWin->drawable.height,
|
||||
pWin->borderWidth,
|
||||
pWin->drawable.class,
|
||||
(visual ? visual->visualid : 0),
|
||||
visual,
|
||||
mask,
|
||||
¶ms);
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@
|
|||
#include "xnest-xcb.h"
|
||||
#include "xnest-xkb.h"
|
||||
#include "XNGC.h"
|
||||
|
||||
#include "Display.h"
|
||||
|
||||
xnestUpstreamInfoRec xnestUpstreamInfo = { 0 };
|
||||
|
|
@ -517,3 +516,33 @@ int xnestParseGeometry(const char *string, xRectangle *geometry)
|
|||
|
||||
return mask;
|
||||
}
|
||||
|
||||
uint32_t xnest_visual_map_to_host(VisualID visual)
|
||||
{
|
||||
for (int i = 0; i < xnestNumVisualMap; i++) {
|
||||
if (xnestVisualMap[i].ourXID == visual) {
|
||||
return xnestVisualMap[i].upstreamVisual->visual_id;
|
||||
}
|
||||
}
|
||||
return XCB_NONE;
|
||||
}
|
||||
|
||||
uint32_t xnestHostVisualToHostCmap(uint32_t upstreamVisual)
|
||||
{
|
||||
for (int i = 0; i < xnestNumVisualMap; i++) {
|
||||
if (xnestVisualMap[i].upstreamVisual->visual_id == upstreamVisual) {
|
||||
return xnestVisualMap[i].upstreamCMap;
|
||||
}
|
||||
}
|
||||
return XCB_COLORMAP_NONE;
|
||||
}
|
||||
|
||||
uint32_t xnestVisualToHostCmap(uint32_t visual)
|
||||
{
|
||||
for (int i = 0; i < xnestNumVisualMap; i++) {
|
||||
if (xnestVisualMap[i].ourXID == visual) {
|
||||
return xnestVisualMap[i].upstreamCMap;
|
||||
}
|
||||
}
|
||||
return XCB_COLORMAP_NONE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -132,4 +132,8 @@ xRectangle xnestGetGeometry(xcb_connection_t *conn, uint32_t window);
|
|||
|
||||
int xnestParseGeometry(const char *string, xRectangle *geometry);
|
||||
|
||||
uint32_t xnest_visual_map_to_host(VisualID visual);
|
||||
uint32_t xnestHostVisualToHostCmap(uint32_t visual);
|
||||
uint32_t xnestVisualToHostCmap(uint32_t visual);
|
||||
|
||||
#endif /* __XNEST__XCB_H */
|
||||
|
|
|
|||
Loading…
Reference in New Issue