diff options
author | drh <drh@sqlite.org> | 2000-09-30 18:46:03 (GMT) |
---|---|---|
committer | drh <drh@sqlite.org> | 2000-09-30 18:46:03 (GMT) |
commit | 550ed6e220a4b17dd1059ff841b5f416b73f4195 (patch) | |
tree | 045db8b798a5b1731268d029d0215b8e98307778 | |
parent | 8db7bc8b95f4cd5d184dfb92a9750cb8dbf68928 (diff) | |
download | tk-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.
-rw-r--r-- | generic/tkBitmap.c | 19 | ||||
-rw-r--r-- | tests/menu.test | 4 |
2 files changed, 15 insertions, 8 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; diff --git a/tests/menu.test b/tests/menu.test index 4b346ac..fa3a049 100644 --- a/tests/menu.test +++ b/tests/menu.test @@ -5,7 +5,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: menu.test,v 1.4 2000/05/11 22:37:05 hobbs Exp $ +# RCS: @(#) $Id: menu.test,v 1.5 2000/09/30 18:46:04 drh Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { source [file join [pwd] [file dirname [info script]] defs.tcl] @@ -2449,6 +2449,8 @@ test menu-35.1 {menus on multiple screens - crashes tk8.3.1, Bug 5454} { menu .two.m destroy .one destroy .two + } else { + puts "skipping: Multi-screen tests requiring TK_ALT_DISPLAY..." } } {} |