summaryrefslogtreecommitdiff
path: root/hw/xnest/Screen.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/xnest/Screen.c')
-rw-r--r--hw/xnest/Screen.c111
1 files changed, 70 insertions, 41 deletions
diff --git a/hw/xnest/Screen.c b/hw/xnest/Screen.c
index bef6a75dd..686884555 100644
--- a/hw/xnest/Screen.c
+++ b/hw/xnest/Screen.c
@@ -12,7 +12,7 @@ the suitability of this software for any purpose. It is provided "as
is" without express or implied warranty.
*/
-/* $XFree86: xc/programs/Xserver/hw/xnest/Screen.c,v 3.11 2003/01/10 13:29:40 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xnest/Screen.c,v 3.13 2003/11/16 05:05:20 dawes Exp $ */
#include "X.h"
#include "Xproto.h"
@@ -20,6 +20,7 @@ is" without express or implied warranty.
#include "dix.h"
#include "mi.h"
#include "mibstore.h"
+#include "micmap.h"
#include "colormapst.h"
#include "resource.h"
@@ -39,17 +40,19 @@ is" without express or implied warranty.
#include "mipointer.h"
#include "Args.h"
-extern Window xnestParentWindow;
-
Window xnestDefaultWindows[MAXSCREENS];
Window xnestScreenSaverWindows[MAXSCREENS];
+#ifdef GLXEXT
+extern void GlxWrapInitVisuals(miInitVisualsProcPtr *);
+#endif
+
#ifdef PIXPRIV
int xnestScreenGeneration = -1;
#endif
-ScreenPtr xnestScreen(window)
- Window window;
+ScreenPtr
+xnestScreen(Window window)
{
int i;
@@ -60,8 +63,8 @@ ScreenPtr xnestScreen(window)
return NULL;
}
-static int offset(mask)
- unsigned long mask;
+static int
+offset(unsigned long mask)
{
int count;
@@ -71,9 +74,8 @@ static int offset(mask)
return count;
}
-static Bool xnestSaveScreen(pScreen, what)
- ScreenPtr pScreen;
- int what;
+static Bool
+xnestSaveScreen(ScreenPtr pScreen, int what)
{
if (xnestSoftwareScreenSaver)
return False;
@@ -105,17 +107,13 @@ static Bool xnestSaveScreen(pScreen, what)
}
static Bool
-xnestCursorOffScreen (ppScreen, x, y)
- ScreenPtr *ppScreen;
- int *x, *y;
+xnestCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y)
{
return FALSE;
}
static void
-xnestCrossScreen (pScreen, entering)
- ScreenPtr pScreen;
- Bool entering;
+xnestCrossScreen(ScreenPtr pScreen, Bool entering)
{
}
@@ -126,11 +124,8 @@ static miPointerScreenFuncRec xnestPointerCursorFuncs =
miPointerWarpCursor
};
-Bool xnestOpenScreen(index, pScreen, argc, argv)
- int index;
- register ScreenPtr pScreen;
- int argc;
- char *argv[];
+Bool
+xnestOpenScreen(int index, ScreenPtr pScreen, int argc, char *argv[])
{
VisualPtr visuals;
DepthPtr depths;
@@ -140,6 +135,8 @@ Bool xnestOpenScreen(index, pScreen, argc, argv)
XSetWindowAttributes attributes;
XWindowAttributes gattributes;
XSizeHints sizeHints;
+ VisualID defaultVisual;
+ int rootDepth;
if (!(AllocateWindowPrivate(pScreen, xnestWindowPrivateIndex,
sizeof(xnestPrivWin)) &&
@@ -168,7 +165,6 @@ Bool xnestOpenScreen(index, pScreen, argc, argv)
numDepths = 1;
for (i = 0; i < xnestNumVisuals; i++) {
- visuals[numVisuals].vid = FakeClientID(0);
visuals[numVisuals].class = xnestVisuals[i].class;
visuals[numVisuals].bitsPerRGBValue = xnestVisuals[i].bits_per_rgb;
visuals[numVisuals].ColormapEntries = xnestVisuals[i].colormap_size;
@@ -179,7 +175,26 @@ Bool xnestOpenScreen(index, pScreen, argc, argv)
visuals[numVisuals].offsetRed = offset(xnestVisuals[i].red_mask);
visuals[numVisuals].offsetGreen = offset(xnestVisuals[i].green_mask);
visuals[numVisuals].offsetBlue = offset(xnestVisuals[i].blue_mask);
-
+
+ /* Check for and remove duplicates. */
+ for (j = 0; j < numVisuals; j++) {
+ if (visuals[numVisuals].class == visuals[j].class &&
+ visuals[numVisuals].bitsPerRGBValue == visuals[j].bitsPerRGBValue &&
+ visuals[numVisuals].ColormapEntries == visuals[j].ColormapEntries &&
+ visuals[numVisuals].nplanes == visuals[j].nplanes &&
+ visuals[numVisuals].redMask == visuals[j].redMask &&
+ visuals[numVisuals].greenMask == visuals[j].greenMask &&
+ visuals[numVisuals].blueMask == visuals[j].blueMask &&
+ visuals[numVisuals].offsetRed == visuals[j].offsetRed &&
+ visuals[numVisuals].offsetGreen == visuals[j].offsetGreen &&
+ visuals[numVisuals].offsetBlue == visuals[j].offsetBlue)
+ break;
+ }
+ if (j < numVisuals)
+ break;
+
+ visuals[numVisuals].vid = FakeClientID(0);
+
depthIndex = UNDEFINED;
for (j = 0; j < numDepths; j++)
if (depths[j].depth == xnestVisuals[i].depth) {
@@ -204,6 +219,21 @@ Bool xnestOpenScreen(index, pScreen, argc, argv)
numVisuals++;
}
+ visuals = (VisualPtr)xrealloc(visuals, numVisuals * sizeof(VisualRec));
+
+ defaultVisual = visuals[xnestDefaultVisualIndex].vid;
+ rootDepth = visuals[xnestDefaultVisualIndex].nplanes;
+
+#ifdef GLXEXT
+ {
+ miInitVisualsProcPtr proc = NULL;
+
+ GlxWrapInitVisuals(&proc);
+ /* GlxInitVisuals ignores the last three arguments. */
+ proc(&visuals, &depths, &numVisuals, &numDepths,
+ &rootDepth, &defaultVisual, 0, 0, 0);
+ }
+#endif
if (xnestParentWindow != 0) {
XGetWindowAttributes(xnestDisplay, xnestParentWindow, &gattributes);
@@ -214,9 +244,9 @@ Bool xnestOpenScreen(index, pScreen, argc, argv)
/* myNum */
/* id */
miScreenInit(pScreen, NULL, xnestWidth, xnestHeight, 1, 1, xnestWidth,
- visuals[xnestDefaultVisualIndex].nplanes, /* rootDepth */
+ rootDepth,
numDepths, depths,
- visuals[xnestDefaultVisualIndex].vid, /* root visual */
+ defaultVisual, /* root visual */
numVisuals, visuals);
miInitializeBackingStore(pScreen);
@@ -257,8 +287,8 @@ Bool xnestOpenScreen(index, pScreen, argc, argv)
pScreen->SaveScreen = xnestSaveScreen;
pScreen->GetImage = xnestGetImage;
pScreen->GetSpans = xnestGetSpans;
- pScreen->PointerNonInterestBox = (void (*)()) 0;
- pScreen->SourceValidate = (void (*)()) 0;
+ pScreen->PointerNonInterestBox = NULL;
+ pScreen->SourceValidate = NULL;
/* Window Procedures */
@@ -268,7 +298,7 @@ Bool xnestOpenScreen(index, pScreen, argc, argv)
pScreen->ChangeWindowAttributes = xnestChangeWindowAttributes;
pScreen->RealizeWindow = xnestRealizeWindow;
pScreen->UnrealizeWindow = xnestUnrealizeWindow;
- pScreen->PostValidateTree = (void (*)()) 0;
+ pScreen->PostValidateTree = NULL;
pScreen->WindowExposures = xnestWindowExposures;
pScreen->PaintWindowBackground = xnestPaintWindowBackground;
pScreen->PaintWindowBorder = xnestPaintWindowBorder;
@@ -282,12 +312,12 @@ Bool xnestOpenScreen(index, pScreen, argc, argv)
/* Backing store procedures */
- pScreen->SaveDoomedAreas = (void (*)()) 0;
- pScreen->RestoreAreas = (RegionPtr (*)()) 0;
- pScreen->ExposeCopy = (void (*)()) 0;
- pScreen->TranslateBackingStore = (RegionPtr (*)()) 0;
- pScreen->ClearBackingStore = (RegionPtr (*)()) 0;
- pScreen->DrawGuarantee = (void (*)()) 0;
+ pScreen->SaveDoomedAreas = NULL;
+ pScreen->RestoreAreas = NULL;
+ pScreen->ExposeCopy = NULL;
+ pScreen->TranslateBackingStore = NULL;
+ pScreen->ClearBackingStore = NULL;
+ pScreen->DrawGuarantee = NULL;
/* Font procedures */
@@ -322,10 +352,10 @@ Bool xnestOpenScreen(index, pScreen, argc, argv)
/* OS layer procedures */
- pScreen->BlockHandler = (void (*)())NoopDDA;
- pScreen->WakeupHandler = (void (*)())NoopDDA;
- pScreen->blockData = (pointer)0;
- pScreen->wakeupData = (pointer)0;
+ pScreen->BlockHandler = (ScreenBlockHandlerProcPtr)NoopDDA;
+ pScreen->WakeupHandler = (ScreenWakeupHandlerProcPtr)NoopDDA;
+ pScreen->blockData = NULL;
+ pScreen->wakeupData = NULL;
if (!miScreenDevPrivateInit(pScreen, xnestWidth, NULL))
return FALSE;
@@ -397,9 +427,8 @@ Bool xnestOpenScreen(index, pScreen, argc, argv)
return True;
}
-Bool xnestCloseScreen(index, pScreen)
- int index;
- ScreenPtr pScreen;
+Bool
+xnestCloseScreen(int index, ScreenPtr pScreen)
{
int i;