dshr@SUN.COM (David Rosenthal) (12/09/88)
The X11R2 (and R3) Sun drivers don't do the right thing here, as evidenced by the XXX comments in server/ddx/sun/sunCursor.c. Cursors are allocated pixels in the default map, and these aren't changed when another map is installed. David.
edmond@oahu.cs.ucla.edu (12/09/88)
I am a bit confused on the proper management of cursors in client windows. Here is my scenario using a 8 bit plane SUN 3/260 X11 R2: 1) I create a new colormap, and allocate all of the cells to get 256 colors. 2) I create the window. 3) I create a cursor using XCreateFontCursor(dpy, XC_gumby). 4) I recolor the cursor with appropriate colors from my colormap. When the window and associated colormap gets mapped, the cursor is not visible in my window. What's the story? Can I have a colortable with 256 colors AND a cursor with its background/foreground set to colors from my colortable? Or must I just allocate 254 colors and "save" space for my cursor colors? How is the cursor handled from window to window? What transformations occur when the cursor leaves the root window and enters a client window? Any help will be greatly appreciated. thanks, Edmond Mesrobian email: edmond@cs.ucla.edu
bowbeer@apollo.COM (Joe Bowbeer) (12/12/88)
X11 and the portable server implementation seem to be targeted for displays with a hardware cursor having its own two-slot colormap (ala DEC GPX, right?). When the cursor colors must be shared with the user colormap, there are several ways to handle this. In the Apollo implementation, we make use of the fact that the map_entries field of the Visual doesn't have to be equal to 2**planes. We steal the high two slots for our cursor and make sure that map_entries is decremented accordingly. In this scheme, the answer to your question would be: "You can't necessarily allocate 256 slots, check map_entries for the real limit." BTW, I'm not sure where we got this idea from. We lifted the rest of our software cursor implemetation from Godzilla's guide (Thanks, Dave Rosenthal). As for you, I don't believe SUN's implementation adjusts map_entries. I believe their server attempts to allocate the cursor slots on the fly. Therefore, I expect either (1) the SUN cursor is drawn using the default colormap's BlackPixel and WhitePixel regardless of the current color map, or (2) sunGetPixel in sunCursor.c tried to allocate two slots in the new map for the cursor but failed. In the second case, you should see a warning message and BlackPixel would be used for both colors: ErrorF("sunGetPixel: Can't alloc pixel (%d,%d,%d) in map 0x%x\n", r, g, b, pScreen->defColormap); BTW, I believe it's the first case. [These opinions are my own and not necessarily those of my employer]
rws@EXPO.LCS.MIT.EDU (Bob Scheifler) (12/12/88)
In the Apollo implementation, we make use of the fact that the map_entries field of the Visual doesn't have to be equal to 2**planes. We steal the high two slots for our cursor and make sure that map_entries is decremented accordingly. A perfectly reasonable scheme.
rob@daisy.UUCP (Rob Posadas) (12/13/88)
This is what the Sun sample server does when you try to set the cursor color: Takes the RGB values you supplied and compares them to entries in the default colormap. If it finds a match, it uses the entry value as the pixel value for the cursor, otherwise it will allocate a new colormap entry in the default colormap for this RGB value and use the new entry number as the pixel value. The problem is that if you have not installed the default colormap, it is not the one the system is using. This means that the pixel value it is using to determine the cursor color is in no way related to the RGB values you handed it. Example: You hand it the RGB value for Brown. Typically the default colormap has only white and black in it, maybe a couple others. So, since there is no Brown, it will allocate one in the next available spot, cell number 5. So the cursor will be drawn with pixel value 5. The problem is that your installed colormap is in no way related to the default colormap. Pixel value 5 could be anything. Anyway, as David Rosenthal mentioned earlier the Sun sample server does not do cursor colors correctly. -- Rob Posadas -- Daisy Systems Corp 700 E. Middlefield Rd. Mt. View, CA 94039-7006 ucbvax!imagen!atari!daisy!rob