(interp, tkwin, source, mask, width, height, xHot, yHot, fg, bg)
| 445 | * |
| 446 | *---------------------------------------------------------------------- |
| 447 | */ |
| 448 | |
| 449 | Cursor |
| 450 | Tk_GetCursorFromData(interp, tkwin, source, mask, width, height, |
| 451 | xHot, yHot, fg, bg) |
| 452 | Tcl_Interp *interp; /* Interpreter to use for error reporting. */ |
| 453 | Tk_Window tkwin; /* Window in which cursor will be used. */ |
| 454 | char *source; /* Bitmap data for cursor shape. */ |
| 455 | char *mask; /* Bitmap data for cursor mask. */ |
| 456 | unsigned int width, height; /* Dimensions of cursor. */ |
| 457 | int xHot, yHot; /* Location of hot-spot in cursor. */ |
| 458 | Tk_Uid fg; /* Foreground color for cursor. */ |
| 459 | Tk_Uid bg; /* Background color for cursor. */ |
| 460 | { |
| 461 | DataKey key; |
| 462 | Tcl_HashEntry *dataHashPtr, *idHashPtr; |
| 463 | register TkCursor *cursorPtr; |
| 464 | int new; |
| 465 | XColor fgColor, bgColor; |
| 466 | Pixmap sourcePixmap, maskPixmap; |
| 467 | |
| 468 | if (!initialized) { |
| 469 | CursorInit(); |
| 470 | } |
| 471 | |
| 472 | key.source = source; |
| 473 | key.mask = mask; |
| 474 | key.width = width; |
| 475 | key.height = height; |
| 476 | key.xHot = xHot; |
| 477 | key.yHot = yHot; |
| 478 | key.fg = fg; |
| 479 | key.bg = bg; |
| 480 | key.display = Tk_Display(tkwin); |
| 481 | dataHashPtr = Tcl_CreateHashEntry(&dataTable, (char *) &key, &new); |
| 482 | if (!new) { |
| 483 | cursorPtr = (TkCursor *) Tcl_GetHashValue(dataHashPtr); |
| 484 | cursorPtr->refCount++; |
| 485 | return cursorPtr->cursor; |
| 486 | } |
| 487 | |
| 488 | /* |
| 489 | * No suitable cursor exists yet. Make one using the data |
| 490 | * available and add it to the database. |
| 491 | */ |
| 492 | |
| 493 | if (XParseColor(key.display, Tk_DefaultColormap(Tk_Screen(tkwin)), |
| 494 | fg, &fgColor) == 0) { |
| 495 | Tcl_AppendResult(interp, "invalid color name \"", fg, "\"", |
| 496 | (char *) NULL); |
| 497 | goto error; |
| 498 | } |
| 499 | if (XParseColor(key.display, Tk_DefaultColormap(Tk_Screen(tkwin)), |
| 500 | bg, &bgColor) == 0) { |
| 501 | Tcl_AppendResult(interp, "invalid color name \"", bg, "\"", |
| 502 | (char *) NULL); |
| 503 | goto error; |
| 504 | } |
nothing calls this directly
no test coverage detected