-}
-#endif
-
-int open_all(void)
-{
- char name[MAXNAME+2];
-#if 0
- void *dummyptr;
- int dummyint;
-#endif
- int i;
-
-#if 0
- display = XOpenDisplay(arg_display);
- if (display == 0)
- {
- fprintf(stderr, "%s: \"%s\": %s: %s\n", progname,
- XDisplayName(arg_display), "failed to open display",
- strerror(errno));
- return(1);
- }
-#endif
-
- defaultScreen = DefaultScreenOfDisplay(display);
- defaultVisual = DefaultVisualOfScreen(defaultScreen);
- defaultColourmap = DefaultColormapOfScreen(defaultScreen);
- defaultRootWindow = RootWindowOfScreen(defaultScreen);
- screenDepth = DefaultDepthOfScreen(defaultScreen);
- screenWidth = WidthOfScreen(defaultScreen);
- screenHeight = HeightOfScreen(defaultScreen);
- screenBlackPixel = BlackPixelOfScreen(defaultScreen);
- screenWhitePixel = WhitePixelOfScreen(defaultScreen);
-
-#if 0
- if (arg_install)
- {
- visualInfo.visualid = XVisualIDFromVisual(defaultVisual);
- dummyptr = XGetVisualInfo(display, VisualIDMask, &visualInfo, &dummyint);
- if (dummyptr == 0)
- {
- fprintf(stderr, "%s: \"%s\": %s: %s\n", progname,
- XDisplayName(arg_display), "failed to get visual info",
- strerror(errno));
- return(1);
- }
-
- memcpy(&visualInfo, dummyptr, sizeof(visualInfo));
- XFree(dummyptr);
-
- if (visualInfo.class != PseudoColor)
- {
- fprintf(stderr, "%s: \"%s\": %s\n", progname, XDisplayName(arg_display),
- "private colourmap only supported for pseudocolour display");
- return(1);
- }
-
- privateColourmap = XCreateColormap(display, defaultRootWindow,
- defaultVisual, AllocAll);
- if (privateColourmap == 0)
- {
- fprintf(stderr, "%s: \"%s\": %s: %s\n", progname,
- XDisplayName(arg_display), "failed to create colourmap",
- strerror(errno));
- return(1);
- }
-
- privateNumColours = visualInfo.colormap_size;
-
- privateColours = malloc(privateNumColours * sizeof(XColor));
- if (privateColours == 0)
- {
- fprintf(stderr, "%s: %s (%d): %s\n", progname, "malloc failed",
- privateNumColours * sizeof(XColor), strerror(errno));
- return(1);
- }
-
- for (dummyint = 0; dummyint < privateNumColours; dummyint++)
- privateColours[dummyint].pixel = dummyint;
-
- XQueryColors(display, defaultColourmap, privateColours, privateNumColours);
- XStoreColors(display, privateColourmap, privateColours, privateNumColours);
-
- privateFlags = malloc(privateNumColours);
- if (privateFlags == 0)
- {
- fprintf(stderr, "%s: %s (%d): %s\n", progname, "malloc failed",
- privateNumColours, strerror(errno));
- return(1);
- }
-
- memset(privateFlags, 0, privateNumColours);
-
- /* first two entries (black and white) are already allocated */
- privateFlags[0] = 1;
- privateFlags[1] = 1;
- }
-
- sizeHints.flags = PSize | PMinSize | PMaxSize;
- sizeHints.width = 20 * TILEX;
- sizeHints.height = 12 * TILEY + SCOREY;
- sizeHints.min_width = sizeHints.max_width = sizeHints.width;
- sizeHints.min_height = sizeHints.max_height = sizeHints.height;
-
- if (arg_geometry)
- {
- dummyint = XWMGeometry(display, XScreenNumberOfScreen(defaultScreen),
- arg_geometry, 0, 2, &sizeHints, &sizeHints.x,
- &sizeHints.y, &dummyint, &dummyint,
- &sizeHints.win_gravity);
- if (dummyint & (XValue | YValue))
- sizeHints.flags |= USPosition | PWinGravity;
- }
-
- xwindow = XCreateWindow(display, defaultRootWindow, sizeHints.x, sizeHints.y,
- sizeHints.width, sizeHints.height, 2, screenDepth,
- InputOutput, CopyFromParent, 0, 0);
- if (xwindow == 0)
- {
- fprintf(stderr, "%s: \"%s\": %s: %s\n", progname,
- XDisplayName(arg_display), "failed to open window",
- strerror(errno));
- return(1);
- }
-
- setWindowAttributes.background_pixel = screenBlackPixel;
- setWindowAttributes.border_pixel = screenWhitePixel;
- setWindowAttributes.backing_store = NotUseful;
- setWindowAttributes.override_redirect = False;
- setWindowAttributes.event_mask =
- KeyPressMask | EnterWindowMask | LeaveWindowMask | ExposureMask;
- setWindowAttributes.colormap =
- privateColourmap ? privateColourmap : defaultColourmap;
- XChangeWindowAttributes(display, xwindow,
- CWBackPixel | CWBorderPixel | CWBackingStore |
- CWOverrideRedirect | CWEventMask | CWColormap,
- &setWindowAttributes);
-
- XStoreName(display, xwindow, "Emerald Mine");
-
- wmHints.flags = InputHint | StateHint;
- wmHints.input = True;
- wmHints.initial_state = NormalState;
- XSetWMHints(display, xwindow, &wmHints);