pop@linus.mitre.org (Paul Perry) (07/31/90)
I'm working with the O'Reilly example of overlay planes (Vol.1 p.190) and I'm running into an unexpected problem. When I try to XStoreColors I get the following error: X Error of failed request: BadAccess (attempt to access private resource denied) Major opcode of failed request: 89 (X_StoreColors) Minor opcode of failed request: 0 Resource id in failed request: 0x180 Serial number of failed request: 17 Current serial number in output stream: 17 in the following call : /* this sets the color of the read/write cell */ XStoreColors (display, cmap, exact_defs, ncolors); Which is performed after opening the display and before creating the window. I looked for an explanation of when this would occur but I haven't found it yet. I'm working on a Sun 4/330, SunOS 4.0.3, and X11R4. Anyone know why ? Thanks, Paul. Paul O. Perry MITRE Corporation Phone: (617) 271-5641 Burlington Road ARPA: pop@mitre.org Bedford, MA 01730 -- Paul O. Perry MITRE Corporation Phone: (617) 271-5641 Burlington Road ARPA: pop@mitre.org Bedford, MA 01730
pop@linus.mitre.org (Paul Perry) (08/15/90)
I'm working with the O'Reilly example of overlay planes (Vol.1 p.190) and I'm running into an unexpected problem. When I try to XStoreColors I get the following error: set RGB values stored colors X Error of failed request: BadAccess (attempt to access private resource denied) Major opcode of failed request: 89 (X_StoreColors) Minor opcode of failed request: 0 Resource id in failed request: 0x180 Serial number of failed request: 17 Current serial number in output stream: 17 in the following call : /* this sets the color of the read/write cell */ XStoreColors (display, cmap, exact_defs, ncolors); Which is performed after opening the display and before creating the window. I looked for an explanation of why this would occur but I haven't found it yet. I'm working on a Sun 4/330, SunOS 4.0.3, and X11R4. Anyone know why ? Thanks, Paul. Paul O. Perry MITRE Corporation Phone: (617) 271-5641 Burlington Road ARPA: pop@mitre.org Bedford, MA 01730 ---code------------------------------------------------------------- int get_colors() { int depth; static char *name[] = {"Red", "Yellow", "Green", "Green"}; XColor exact_defs[MAX_COLORS]; Colormap cmap; int ncolors = 4; int plane_masks[MAX_PLANES]; int colors[MAX_COLORS]; int i; depth = DisplayPlanes(display, screen); cmap = DefaultColormap(display, screen); if (depth == 1) { /* one-plane monochrome */ /* use BlackPixel annd WhitePixel only */ background_pixel = WhitePixel(display, screen); foreground = BlackPixel(display, screen); printf("unsing black and white\n"); return (CANNOT_OVERLAY); } else { /* allocate color cells */ if (XAllocColorCells (display, cmap, False, plane_masks, 1, colors, 4) == 0) { /* Can't get enough read/write cells to overlay. * Trying at least ot get three colors. */ if (XAllocColorCells (display, cmap, False, plane_masks, 0, colors, 3) == 0) { /* Can't even get that. Give up and use black and white */ background_pixel = WhitePixel(display, screen); foreground = BlackPixel(display, screen); printf("using black and white\n"); } ncolors = 3; printf("got only three colors\n"); } /* Allocated colors succesfully. Now setting their colors: 3, and 4 are set to the same RGB value */ for (i = 0; i < ncolors; i++) { if (!XParseColor (display, cmap, name[i], &exact_defs[i])) { fprintf(stderr, "overlay: color name %s not in database", name[i]); exit(0); } /* set pixel value to the allocated one */ exact_defs[i].pixel = colors[i]; } printf("set RGB values\n"); /* this sets the color of the read/write cell */ XStoreColors (display, cmap, exact_defs, ncolors); printf ("stored colors\n"); background_pixel = colors[0]; foreground = colors[1]; if (ncolors == 4) { overlay_pixel_1 = colors[0] | plane_masks[0]; overlay_pixel_2 = colors[1] | plane_masks[0]; overlay_plane = plane_masks[0]; return(CAN_OVERLAY); } else { overlay_pixel_1 = colors[2]; return(CANNOT_OVERLAY); } } } ------------------------------------------------------------------------- -- Paul O. Perry MITRE Corporation Phone: (617) 271-5641 Burlington Road ARPA: pop@mitre.org Bedford, MA 01730