summaryrefslogtreecommitdiffstats
path: root/generic/tkCursor.c
diff options
context:
space:
mode:
authorhobbs <hobbs>2000-05-11 22:37:05 (GMT)
committerhobbs <hobbs>2000-05-11 22:37:05 (GMT)
commit019b002c433bcd9f30920845f750845b0c047ef8 (patch)
tree5186d3f9e79d9d2c7d3b683a557385c781412add /generic/tkCursor.c
parent5a144b535bc726066340b42e20955732a1ffabe3 (diff)
downloadtk-019b002c433bcd9f30920845f750845b0c047ef8.zip
tk-019b002c433bcd9f30920845f750845b0c047ef8.tar.gz
tk-019b002c433bcd9f30920845f750845b0c047ef8.tar.bz2
* tests/menu.test:
* generic/tk3d.c: * generic/tkColor.c: * generic/tkCursor.c: corrected handling of 3DBorder, Cursor and Color objects on multiple screens. [Bug: 5454]
Diffstat (limited to 'generic/tkCursor.c')
-rw-r--r--generic/tkCursor.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/generic/tkCursor.c b/generic/tkCursor.c
index c8e5588..eab40e8 100644
--- a/generic/tkCursor.c
+++ b/generic/tkCursor.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: tkCursor.c,v 1.4 1999/09/02 17:02:28 hobbs Exp $
+ * RCS: @(#) $Id: tkCursor.c,v 1.5 2000/05/11 22:37:06 hobbs Exp $
*/
#include "tkPort.h"
@@ -561,6 +561,7 @@ Tk_FreeCursorFromObj(tkwin, objPtr)
Tcl_Obj *objPtr; /* The Tcl_Obj * to be freed. */
{
FreeCursor(GetCursorFromObj(tkwin, objPtr));
+ FreeCursorObjProc(objPtr);
}
/*
@@ -696,28 +697,31 @@ GetCursorFromObj(tkwin, objPtr)
InitCursorObj(objPtr);
}
+ /*
+ * The internal representation is a cache of the last cursor used
+ * with the given name. But there can be lots different cursors
+ * for each cursor name; one cursor for each display. Check to
+ * see if the cursor we have cached is the one that is needed.
+ */
cursorPtr = (TkCursor *) objPtr->internalRep.twoPtrValue.ptr1;
- if (cursorPtr != NULL) {
- if (Tk_Display(tkwin) == cursorPtr->display) {
- return cursorPtr;
- }
- hashPtr = cursorPtr->hashPtr;
- } else {
- hashPtr = Tcl_FindHashEntry(&dispPtr->cursorNameTable,
- Tcl_GetString(objPtr));
- if (hashPtr == NULL) {
- goto error;
- }
+ if ((cursorPtr != NULL) && (Tk_Display(tkwin) == cursorPtr->display)) {
+ return cursorPtr;
}
/*
- * At this point we've got a hash table entry, off of which hang
- * one or more TkCursor structures. See if any of them will work.
+ * If we get to here, it means the cursor we need is not in the cache.
+ * Try to look up the cursor in the TkDisplay structure of the window.
*/
+ hashPtr = Tcl_FindHashEntry(&dispPtr->cursorNameTable,
+ Tcl_GetString(objPtr));
+ if (hashPtr == NULL) {
+ goto error;
+ }
for (cursorPtr = (TkCursor *) Tcl_GetHashValue(hashPtr);
cursorPtr != NULL; cursorPtr = cursorPtr->nextPtr) {
if (Tk_Display(tkwin) == cursorPtr->display) {
+ FreeCursorObjProc(objPtr);
objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) cursorPtr;
cursorPtr->objRefCount++;
return cursorPtr;