summaryrefslogtreecommitdiffstats
path: root/generic/tkBitmap.c
diff options
context:
space:
mode:
authordrh <drh@sqlite.org>2000-09-30 18:46:03 (GMT)
committerdrh <drh@sqlite.org>2000-09-30 18:46:03 (GMT)
commit550ed6e220a4b17dd1059ff841b5f416b73f4195 (patch)
tree045db8b798a5b1731268d029d0215b8e98307778 /generic/tkBitmap.c
parent8db7bc8b95f4cd5d184dfb92a9750cb8dbf68928 (diff)
downloadtk-550ed6e220a4b17dd1059ff841b5f416b73f4195.zip
tk-550ed6e220a4b17dd1059ff841b5f416b73f4195.tar.gz
tk-550ed6e220a4b17dd1059ff841b5f416b73f4195.tar.bz2
Fix bitmaps so that the same bitmap will not be used
on two difference screens of the same display. Without this fix you get a BadMatch error from the X-server when you try to use a bitmap on two screens at once.
Diffstat (limited to 'generic/tkBitmap.c')
-rw-r--r--generic/tkBitmap.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/generic/tkBitmap.c b/generic/tkBitmap.c
index 6facc97..a47d10d 100644
--- a/generic/tkBitmap.c
+++ b/generic/tkBitmap.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkBitmap.c,v 1.7 1999/04/16 01:51:10 stanton Exp $
+ * RCS: @(#) $Id: tkBitmap.c,v 1.8 2000/09/30 18:46:03 drh Exp $
*/
#include "tkPort.h"
@@ -57,6 +57,7 @@ typedef struct TkBitmap {
* 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).
@@ -75,9 +76,9 @@ typedef struct TkBitmap {
* (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;
/*
@@ -186,7 +187,8 @@ Tk_AllocBitmapFromObj(interp, tkwin, objPtr)
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;
}
@@ -204,7 +206,8 @@ Tk_AllocBitmapFromObj(interp, tkwin, objPtr)
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;
@@ -321,7 +324,8 @@ GetBitmap(interp, tkwin, string)
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;
}
@@ -418,6 +422,7 @@ GetBitmap(interp, tkwin, string)
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;