[comp.windows.x] Pixmap cursor problems in X11R4 cfbpmax for DEC 3100?

tbray@watdragon.waterloo.edu (Tim Bray) (05/28/90)

We have fairly fancy cursors which are built by including bitmap(1)
output, making into a pixmap with CreateBitmapFromData, and then using
CreatePixmapCursor.

The following code fragment worked under many, many, many versions of
X11R3.  On my stock X11R4, up to patch 11 (I think) on a DEC 3100,
cfbpmax server, Ultrix 2.0, we have a cursor problem.  Namely, the
cursor only shows partially.  It looks like (more or less) the top left
hand of the cursor is showing.

This works fine on a stock Sun3 X server, and also works fine on the
DECWindows server on the pmax here.  Furthermore, R3 clients running on
another system do exhibit the problem on this server.  So, it really
looks server-specific.

Now I can think of several things that might cause this, but before I
start hacking my way through the undergrowth, is there anything self-
evidently wrong here?

#define mask_width (23)
#define mask_height (35)
#define mask_x_hot (11)
#define mask_y_hot (21)
static char mask_bits[] = {
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00,
   0x00, 0x1e, 0x00, 0xfc, 0xff, 0x1f, 0xfe, 0xff, 0x3f, 0xff, 0xff, 0x7f,
   0xff, 0xff, 0x7f, 0xff, 0xff, 0x7f, 0xff, 0xff, 0x7f, 0xff, 0xff, 0x7f,
   0xff, 0xff, 0x7f, 0xff, 0xff, 0x7f, 0xff, 0xff, 0x7f, 0xff, 0xff, 0x7f,
   0xff, 0xff, 0x7f, 0xff, 0xff, 0x7f, 0xff, 0xff, 0x7f, 0xff, 0xff, 0x7f,
   0xff, 0xff, 0x7f, 0xff, 0xff, 0x7f, 0xff, 0xff, 0x7f, 0xff, 0xff, 0x7f,
   0xff, 0xff, 0x7f, 0xff, 0xff, 0x7f, 0xff, 0xff, 0x7f, 0xff, 0xff, 0x7f,
   0xff, 0xff, 0x7f, 0xff, 0xff, 0x7f, 0xff, 0xff, 0x7f, 0xff, 0xff, 0x7f,
   0xff, 0xff, 0x7f, 0xfe, 0xff, 0x3f, 0xfc, 0xff, 0x1f};

#define top_width (23)
#define top_height (35)
#define top_x_hot (11)
#define top_y_hot (21)
static char top_bits[] = {
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0xf8, 0xff, 0x0f, 0x04, 0x00, 0x10,
   0x02, 0x00, 0x20, 0x72, 0x14, 0x27, 0x72, 0x00, 0x27, 0x72, 0x14, 0x27,
   0x72, 0x00, 0x27, 0x72, 0x14, 0x27, 0x72, 0x00, 0x27, 0x72, 0x14, 0x27,
   0x72, 0x00, 0x27, 0x72, 0x14, 0x27, 0x72, 0x00, 0x27, 0x72, 0x14, 0x27,
   0x02, 0x00, 0x20, 0x02, 0x00, 0x20, 0x22, 0x00, 0x27, 0x22, 0x80, 0x28,
   0x22, 0x80, 0x28, 0x22, 0x00, 0x24, 0x22, 0x00, 0x22, 0x22, 0x00, 0x21,
   0x22, 0x00, 0x25, 0xfa, 0x00, 0x22, 0x72, 0x00, 0x20, 0x22, 0x00, 0x22,
   0x04, 0x00, 0x10, 0xf8, 0xff, 0x0f, 0x00, 0x00, 0x00};

...
void
create_cursors()
{
  int    best_height;
  int    best_width;
  Pixmap cursor_pix;
  Pixmap mask_pix;

  /* determine maximum cursor size */
  XQueryBestCursor(W->display, W->window, partial_width, partial_height, 
    &best_width, &best_height);

  /* if we can't create standard cursors, use small ones */
  if ((best_width < partial_width) || (best_height < partial_height))
  {
    ....
    return;
  }

  /* otherwise, create standard cursors */
  mask_pix = XCreateBitmapFromData(W->display, W->window, mask_bits, 
               mask_width, mask_height);
  cursor_pix = XCreateBitmapFromData(W->display, W->window, top_bits, 
                 top_width, top_height);
  top_cursor = XCreatePixmapCursor(W->display, cursor_pix, mask_pix, 
                 &W->fore, &W->back, top_x_hot, top_y_hot);

  /* ... much later ... */

  /* if we are at the start of the entry, show the top cursor */
  XDefineCursor(display, window, top_cursor);
}

jg@zorch.crl.dec.com (Jim Gettys) (05/28/90)

The DECstation 3100 has only a 16x16 hardware cursor.  The cursor
you define is larger than that....

The DECstation 5000 has a 64x64 hardware cursor.
				- Jim

mouse@SHAMASH.MCRCIM.MCGILL.EDU (der Mouse) (06/04/90)

> The following code fragment worked under many, many, many versions of
> X11R3.  On my stock X11R4, up to patch 11 (I think) on a DEC 3100,
> cfbpmax server, Ultrix 2.0, we have a cursor problem.  Namely, the
> cursor only shows partially.  It looks like (more or less) the top
> left hand of the cursor is showing.

I had a similar problem when I tried to run my shogi program, which
uses huge cursors (96x96), on a GraphOn.  The cursors came out utterly
scrambled.  I was quite shocked to discover that X allows the server to
place a limit on cursor size instead of simply noting that excessively
large cursors may produce bad performance.  Your DECstation probably
has a limit on cursor size....

					der Mouse

			old: mcgill-vision!mouse
			new: mouse@larry.mcrcim.mcgill.edu