Commit f7cff021 authored by Mihai Moldovan's avatar Mihai Moldovan

nx-X11/programs/Xserver/{dix/{colormap.c,window.c},hw/nxagent/NXwindow.c,include…

nx-X11/programs/Xserver/{dix/{colormap.c,window.c},hw/nxagent/NXwindow.c,include/{colormap,window{,str}}.h}: backport features needed for Composite 0.4.
parent aba2a534
......@@ -2791,3 +2791,80 @@ IsMapInstalled(Colormap map, WindowPtr pWin)
DEALLOCATE_LOCAL(pmaps);
return (found);
}
struct colormap_lookup_data {
ScreenPtr pScreen;
VisualPtr visuals;
};
static void
_colormap_find_resource(void *value, XID id, void *cdata)
{
struct colormap_lookup_data *cmap_data = cdata;
VisualPtr visuals = cmap_data->visuals;
ScreenPtr pScreen = cmap_data->pScreen;
ColormapPtr cmap = value;
int j;
if (pScreen != cmap->pScreen)
return;
j = cmap->pVisual - pScreen->visuals;
cmap->pVisual = &visuals[j];
}
/* something has realloced the visuals, instead of breaking
ABI fix it up here - glx and compsite did this wrong */
Bool
ResizeVisualArray(ScreenPtr pScreen, int new_visual_count, DepthPtr depth)
{
struct colormap_lookup_data cdata;
int numVisuals;
VisualPtr visuals;
XID *vids, vid;
int first_new_vid, first_new_visual, i;
first_new_vid = depth->numVids;
first_new_visual = pScreen->numVisuals;
#if 0 /* !defined(NXAGENT_SERVER) */
vids = reallocarray(depth->vids, depth->numVids + new_visual_count,
sizeof(XID));
#else
vids = xrealloc(depth->vids, sizeof(XID) *
(depth->numVids + new_visual_count));
#endif
if (!vids)
return FALSE;
/* its realloced now no going back if we fail the next one */
depth->vids = vids;
numVisuals = pScreen->numVisuals + new_visual_count;
#if 0 /* !defined(NXAGENT_SERVER) */
visuals = reallocarray(pScreen->visuals, numVisuals, sizeof(VisualRec));
#else
visuals = xrealloc(pScreen->visuals, sizeof(VisualRec) * numVisuals);
#endif
if (!visuals) {
return FALSE;
}
cdata.visuals = visuals;
cdata.pScreen = pScreen;
FindClientResourcesByType(serverClient, RT_COLORMAP,
_colormap_find_resource, &cdata);
pScreen->visuals = visuals;
for (i = 0; i < new_visual_count; i++) {
vid = FakeClientID(0);
pScreen->visuals[first_new_visual + i].vid = vid;
vids[first_new_vid + i] = vid;
}
depth->numVids += new_visual_count;
pScreen->numVisuals += new_visual_count;
return TRUE;
}
......@@ -535,9 +535,21 @@ ClippedRegionFromBox(register WindowPtr pWin, RegionPtr Rgn,
RegionIntersect(Rgn, Rgn, &pWin->winSize);
}
static RealChildHeadProc realChildHeadProc = NULL;
void
RegisterRealChildHeadProc (RealChildHeadProc proc)
{
realChildHeadProc = proc;
}
WindowPtr
RealChildHead(register WindowPtr pWin)
{
if (realChildHeadProc) {
return realChildHeadProc (pWin);
}
if (!pWin->parent &&
(screenIsSaved == SCREEN_SAVER_ON) &&
(HasSaverWindow (pWin->drawable.pScreen->myNum)))
......
......@@ -717,6 +717,14 @@ ClippedRegionFromBox(register WindowPtr pWin, RegionPtr Rgn,
RegionIntersect(Rgn, Rgn, &pWin->winSize);
}
static RealChildHeadProc realChildHeadProc = NULL;
void
RegisterRealChildHeadProc (RealChildHeadProc proc)
{
realChildHeadProc = proc;
}
WindowPtr
RealChildHead(register WindowPtr pWin)
{
......
......@@ -181,4 +181,8 @@ extern int IsMapInstalled(
Colormap /*map*/,
WindowPtr /*pWin*/);
extern Bool ResizeVisualArray(ScreenPtr /* pScreen */ ,
int /* new_vis_count */ ,
DepthPtr /* depth */ );
#endif /* CMAP_H */
......@@ -102,6 +102,10 @@ extern void ClippedRegionFromBox(
int /*w*/,
int /*h*/);
typedef WindowPtr (* RealChildHeadProc) (WindowPtr pWin);
void RegisterRealChildHeadProc (RealChildHeadProc proc);
extern WindowPtr RealChildHead(
WindowPtr /*pWin*/);
......
......@@ -96,6 +96,33 @@ typedef struct _WindowOpt {
#define BackgroundPixel 2L
#define BackgroundPixmap 3L
/*
* The redirectDraw field can have one of three values:
*
* RedirectDrawNone
* A normal window; painted into the same pixmap as the parent
* and clipping parent and siblings to its geometry. These
* windows get a clip list equal to the intersection of their
* geometry with the parent geometry, minus the geometry
* of overlapping None and Clipped siblings.
* RedirectDrawAutomatic
* A redirected window which clips parent and sibling drawing.
* Contents for these windows are manage inside the server.
* These windows get an internal clip list equal to their
* geometry.
* RedirectDrawManual
* A redirected window which does not clip parent and sibling
* drawing; the window must be represented within the parent
* geometry by the client performing the redirection management.
* Contents for these windows are managed outside the server.
* These windows get an internal clip list equal to their
* geometry.
*/
#define RedirectDrawNone 0
#define RedirectDrawAutomatic 1
#define RedirectDrawManual 2
typedef struct _Window {
DrawableRec drawable;
WindowPtr parent; /* ancestor chain */
......@@ -138,7 +165,7 @@ typedef struct _Window {
unsigned srcBuffer:1; /* source buffer for rendering */
#endif
#ifdef COMPOSITE
unsigned redirectDraw:1; /* rendering is redirected from here */
unsigned redirectDraw:2; /* rendering is redirected from here */
#endif
DevUnion *devPrivates;
} WindowRec;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment