* and it isn't currently in use. */
int width, height; /* Dimensions of bitmap. */
Display *display; /* Display for which bitmap is valid. */
+ int screenNum; /* Screen on which bitmap is valid */
int resourceRefCount; /* Number of active uses of this bitmap (each
* active use corresponds to a call to
* Tk_AllocBitmapFromObj or Tk_GetBitmap).
* (needed when deleting). */
struct TkBitmap *nextPtr; /* Points to the next TkBitmap structure with
* the same name. All bitmaps with the
- * same name (but different displays) are
- * chained together off a single entry in
- * nameTable. */
+ * same name (but different displays or
+ * screens) are chained together off a
+ * single entry in nameTable. */
} TkBitmap;
/*
*/
typedef struct {
- char *source; /* Bitmap bits. */
+ CONST char *source; /* Bitmap bits. */
int width, height; /* Dimensions of bitmap. */
} DataKey;
* ptr1 field of the Tcl_Obj points to a TkBitmap object.
*/
-static Tcl_ObjType bitmapObjType = {
+Tcl_ObjType tkBitmapObjType = {
"bitmap", /* name */
FreeBitmapObjProc, /* freeIntRepProc */
DupBitmapObjProc, /* dupIntRepProc */
{
TkBitmap *bitmapPtr;
- if (objPtr->typePtr != &bitmapObjType) {
+ if (objPtr->typePtr != &tkBitmapObjType) {
InitBitmapObj(objPtr);
}
bitmapPtr = (TkBitmap *) objPtr->internalRep.twoPtrValue.ptr1;
FreeBitmapObjProc(objPtr);
bitmapPtr = NULL;
- } else if (Tk_Display(tkwin) == bitmapPtr->display) {
+ } else if ( (Tk_Display(tkwin) == bitmapPtr->display)
+ && (Tk_ScreenNumber(tkwin) == bitmapPtr->screenNum) ) {
bitmapPtr->resourceRefCount++;
return bitmapPtr->bitmap;
}
FreeBitmapObjProc(objPtr);
for (bitmapPtr = firstBitmapPtr; bitmapPtr != NULL;
bitmapPtr = bitmapPtr->nextPtr) {
- if (Tk_Display(tkwin) == bitmapPtr->display) {
+ if ( (Tk_Display(tkwin) == bitmapPtr->display) &&
+ (Tk_ScreenNumber(tkwin) == bitmapPtr->screenNum) ) {
bitmapPtr->resourceRefCount++;
bitmapPtr->objRefCount++;
objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) bitmapPtr;
existingBitmapPtr = (TkBitmap *) Tcl_GetHashValue(nameHashPtr);
for (bitmapPtr = existingBitmapPtr; bitmapPtr != NULL;
bitmapPtr = bitmapPtr->nextPtr) {
- if (Tk_Display(tkwin) == bitmapPtr->display) {
+ if ( (Tk_Display(tkwin) == bitmapPtr->display) &&
+ (Tk_ScreenNumber(tkwin) == bitmapPtr->screenNum) ) {
bitmapPtr->resourceRefCount++;
return bitmapPtr;
}
bitmapPtr->width = width;
bitmapPtr->height = height;
bitmapPtr->display = Tk_Display(tkwin);
+ bitmapPtr->screenNum = Tk_ScreenNumber(tkwin);
bitmapPtr->resourceRefCount = 1;
bitmapPtr->objRefCount = 0;
bitmapPtr->nameHashPtr = nameHashPtr;
Tcl_Interp *interp; /* Interpreter to use for error reporting. */
CONST char *name; /* Name to use for bitmap. Must not already
* be defined as a bitmap. */
- char *source; /* Address of bits for bitmap. */
+ CONST char *source; /* Address of bits for bitmap. */
int width; /* Width of bitmap. */
int height; /* Height of bitmap. */
{
*--------------------------------------------------------------
*/
-char *
+CONST char *
Tk_NameOfBitmap(display, bitmap)
Display *display; /* Display for which bitmap was
* allocated. */
Tk_GetBitmapFromData(interp, tkwin, source, width, height)
Tcl_Interp *interp; /* Interpreter to use for error reporting. */
Tk_Window tkwin; /* Window in which bitmap will be used. */
- char *source; /* Bitmap data for bitmap shape. */
+ CONST char *source; /* Bitmap data for bitmap shape. */
int width, height; /* Dimensions of bitmap. */
{
DataKey nameKey;
Tcl_HashEntry *hashPtr;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
- if (objPtr->typePtr != &bitmapObjType) {
+ if (objPtr->typePtr != &tkBitmapObjType) {
InitBitmapObj(objPtr);
}
if ((typePtr != NULL) && (typePtr->freeIntRepProc != NULL)) {
(*typePtr->freeIntRepProc)(objPtr);
}
- objPtr->typePtr = &bitmapObjType;
+ objPtr->typePtr = &tkBitmapObjType;
objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) NULL;
}
\f
return &tsdPtr->predefBitmapTable;
}
-