summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlfb <lfb>1998-12-13 08:14:38 (GMT)
committerlfb <lfb>1998-12-13 08:14:38 (GMT)
commit2d3a35af140d791de362fc99fe6254312f6f53ed (patch)
tree26b503694504ccdeaea06b9db1bc9cf7d85994a5
parent6f5a087819db717a69be9d39a945037b901f81fb (diff)
downloadtk-2d3a35af140d791de362fc99fe6254312f6f53ed.zip
tk-2d3a35af140d791de362fc99fe6254312f6f53ed.tar.gz
tk-2d3a35af140d791de362fc99fe6254312f6f53ed.tar.bz2
Tk 8.1 Muti-threading changes.
Moved static and global data elements into thread-local storage, or introduced locks where not possible, as first stage of adding thread safety to Tk.
-rw-r--r--unix/configure.in25
-rw-r--r--unix/tkUnixEmbed.c59
-rw-r--r--unix/tkUnixEvent.c30
-rw-r--r--unix/tkUnixFocus.c3
-rw-r--r--unix/tkUnixFont.c63
-rw-r--r--unix/tkUnixSelect.c43
-rw-r--r--unix/tkUnixSend.c69
-rw-r--r--unix/tkUnixWm.c71
8 files changed, 225 insertions, 138 deletions
diff --git a/unix/configure.in b/unix/configure.in
index e5a6853..cce9f36 100644
--- a/unix/configure.in
+++ b/unix/configure.in
@@ -2,7 +2,7 @@ dnl This file is an input file used by the GNU "autoconf" program to
dnl generate the file "configure", which is run during Tk installation
dnl to configure the system for the local environment.
AC_INIT(../generic/tk.h)
-# RCS: @(#) $Id: configure.in,v 1.1.4.6 1998/12/10 03:43:55 stanton Exp $
+# RCS: @(#) $Id: configure.in,v 1.1.4.7 1998/12/13 08:14:38 lfb Exp $
TK_VERSION=8.1
TK_MAJOR_VERSION=8
@@ -34,6 +34,25 @@ fi
AC_C_CROSS
AC_HAVE_HEADERS(unistd.h limits.h)
+# Threads support
+AC_ARG_ENABLE(threads,[ --enable-threads enable Threads support],,enableval="no")
+
+if test "$enableval" = "yes"; then
+ AC_MSG_RESULT(Will compile with Threads support)
+ AC_DEFINE(TCL_THREADS)
+ AC_DEFINE(_REENTRANT)
+
+ AC_CHECK_LIB(pthread,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
+ if test "$tcl_ok" = "yes"; then
+ # The space is needed
+ THREADS_LIBS=" -lpthread"
+ else
+ AC_MSG_WARN("Don t know how to find pthread lib on your system - you must disable thread support or edit the LIBS in the Makefile...")
+ fi
+else
+ AC_MSG_RESULT(Will compile without Threads support (normal))
+fi
+
# set the warning flags depending on whether or not we are using gcc
if test "${GCC}" = "yes" ; then
# leave -Wimplicit-int out, the X libs generate so many of these warnings
@@ -295,6 +314,10 @@ if test "$tk_checkBoth" = 1; then
fi
AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, main, [LIBS="$LIBS -lnsl"]))
+# Add the threads support libraries
+
+LIBS="$LIBS$THREADS_LIBS"
+
#--------------------------------------------------------------------
# One more check related to the X libraries. The standard releases
# of Ultrix don't support the "xauth" mechanism, so send won't work
diff --git a/unix/tkUnixEmbed.c b/unix/tkUnixEmbed.c
index af90cfa..2149d68 100644
--- a/unix/tkUnixEmbed.c
+++ b/unix/tkUnixEmbed.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: tkUnixEmbed.c,v 1.1.4.2 1998/09/30 02:19:16 stanton Exp $
+ * RCS: @(#) $Id: tkUnixEmbed.c,v 1.1.4.3 1998/12/13 08:14:38 lfb Exp $
*/
#include "tkInt.h"
@@ -46,9 +46,11 @@ typedef struct Container {
* this process. */
} Container;
-static Container *firstContainerPtr = NULL;
- /* First in list of all containers
+typedef struct ThreadSpecificData {
+ Container *firstContainerPtr; /* First in list of all containers
* managed by this process. */
+} ThreadSpecificData;
+static Tcl_ThreadDataKey dataKey;
/*
* Prototypes for static procedures defined in this file:
@@ -108,6 +110,8 @@ TkpUseWindow(interp, tkwin, string)
Tk_ErrorHandler handler;
Container *containerPtr;
XWindowAttributes parentAtts;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (winPtr->window != None) {
panic("TkUseWindow: X window already assigned");
@@ -157,7 +161,7 @@ TkpUseWindow(interp, tkwin, string)
* app. are in the same process.
*/
- for (containerPtr = firstContainerPtr; containerPtr != NULL;
+ for (containerPtr = tsdPtr->firstContainerPtr; containerPtr != NULL;
containerPtr = containerPtr->nextPtr) {
if (containerPtr->parent == parent) {
winPtr->flags |= TK_BOTH_HALVES;
@@ -171,8 +175,8 @@ TkpUseWindow(interp, tkwin, string)
containerPtr->parentRoot = parentAtts.root;
containerPtr->parentPtr = NULL;
containerPtr->wrapper = None;
- containerPtr->nextPtr = firstContainerPtr;
- firstContainerPtr = containerPtr;
+ containerPtr->nextPtr = tsdPtr->firstContainerPtr;
+ tsdPtr->firstContainerPtr = containerPtr;
}
containerPtr->embeddedPtr = winPtr;
winPtr->flags |= TK_EMBEDDED;
@@ -204,6 +208,8 @@ TkpMakeWindow(winPtr, parent)
* which the window is to be created. */
{
Container *containerPtr;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (winPtr->flags & TK_EMBEDDED) {
/*
@@ -213,7 +219,7 @@ TkpMakeWindow(winPtr, parent)
* into a wrapper window later.
*/
- for (containerPtr = firstContainerPtr; ;
+ for (containerPtr = tsdPtr->firstContainerPtr; ;
containerPtr = containerPtr->nextPtr) {
if (containerPtr == NULL) {
panic("TkMakeWindow couldn't find container for window");
@@ -259,6 +265,8 @@ TkpMakeContainer(tkwin)
{
TkWindow *winPtr = (TkWindow *) tkwin;
Container *containerPtr;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
* Register the window as a container so that, for example, we can
@@ -272,8 +280,8 @@ TkpMakeContainer(tkwin)
containerPtr->parentPtr = winPtr;
containerPtr->wrapper = None;
containerPtr->embeddedPtr = NULL;
- containerPtr->nextPtr = firstContainerPtr;
- firstContainerPtr = containerPtr;
+ containerPtr->nextPtr = tsdPtr->firstContainerPtr;
+ tsdPtr->firstContainerPtr = containerPtr;
winPtr->flags |= TK_CONTAINER;
/*
@@ -383,6 +391,8 @@ ContainerEventProc(clientData, eventPtr)
TkWindow *winPtr = (TkWindow *) clientData;
Container *containerPtr;
Tk_ErrorHandler errHandler;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
* Ignore any X protocol errors that happen in this procedure
@@ -397,7 +407,7 @@ ContainerEventProc(clientData, eventPtr)
* Find the Container structure associated with the parent window.
*/
- for (containerPtr = firstContainerPtr;
+ for (containerPtr = tsdPtr->firstContainerPtr;
containerPtr->parent != eventPtr->xmaprequest.parent;
containerPtr = containerPtr->nextPtr) {
if (containerPtr == NULL) {
@@ -697,8 +707,11 @@ TkpGetOtherWindow(winPtr)
* embedded window. */
{
Container *containerPtr;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- for (containerPtr = firstContainerPtr; containerPtr != NULL;
+ for (containerPtr = tsdPtr->firstContainerPtr;
+ containerPtr != NULL;
containerPtr = containerPtr->nextPtr) {
if (containerPtr->embeddedPtr == winPtr) {
return containerPtr->parentPtr;
@@ -741,6 +754,8 @@ TkpRedirectKeyEvent(winPtr, eventPtr)
{
Container *containerPtr;
Window saved;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
* First, find the top-level window corresponding to winPtr.
@@ -769,7 +784,7 @@ TkpRedirectKeyEvent(winPtr, eventPtr)
* application. Send the event back to the container.
*/
- for (containerPtr = firstContainerPtr;
+ for (containerPtr = tsdPtr->firstContainerPtr;
containerPtr->embeddedPtr != winPtr;
containerPtr = containerPtr->nextPtr) {
/* Empty loop body. */
@@ -811,12 +826,14 @@ TkpClaimFocus(topLevelPtr, force)
{
XEvent event;
Container *containerPtr;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (!(topLevelPtr->flags & TK_EMBEDDED)) {
return;
}
- for (containerPtr = firstContainerPtr;
+ for (containerPtr = tsdPtr->firstContainerPtr;
containerPtr->embeddedPtr != topLevelPtr;
containerPtr = containerPtr->nextPtr) {
/* Empty loop body. */
@@ -861,6 +878,8 @@ TkpTestembedCmd(clientData, interp, argc, argv)
Container *containerPtr;
Tcl_DString dString;
char buffer[50];
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if ((argc > 1) && (strcmp(argv[1], "all") == 0)) {
all = 1;
@@ -868,7 +887,7 @@ TkpTestembedCmd(clientData, interp, argc, argv)
all = 0;
}
Tcl_DStringInit(&dString);
- for (containerPtr = firstContainerPtr; containerPtr != NULL;
+ for (containerPtr = tsdPtr->firstContainerPtr; containerPtr != NULL;
containerPtr = containerPtr->nextPtr) {
Tcl_DStringStartSublist(&dString);
if (containerPtr->parent == None) {
@@ -933,6 +952,8 @@ EmbedWindowDeleted(winPtr)
* was deleted. */
{
Container *containerPtr, *prevPtr;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
* Find the Container structure for this window work. Delete the
@@ -941,7 +962,7 @@ EmbedWindowDeleted(winPtr)
*/
prevPtr = NULL;
- containerPtr = firstContainerPtr;
+ containerPtr = tsdPtr->firstContainerPtr;
while (1) {
if (containerPtr->embeddedPtr == winPtr) {
containerPtr->wrapper = None;
@@ -958,7 +979,7 @@ EmbedWindowDeleted(winPtr)
if ((containerPtr->embeddedPtr == NULL)
&& (containerPtr->parentPtr == NULL)) {
if (prevPtr == NULL) {
- firstContainerPtr = containerPtr->nextPtr;
+ tsdPtr->firstContainerPtr = containerPtr->nextPtr;
} else {
prevPtr->nextPtr = containerPtr->nextPtr;
}
@@ -989,9 +1010,11 @@ TkUnixContainerId(winPtr)
TkWindow *winPtr; /* Tk's structure for an embedded window. */
{
Container *containerPtr;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- for (containerPtr = firstContainerPtr; containerPtr != NULL;
- containerPtr = containerPtr->nextPtr) {
+ for (containerPtr = tsdPtr->firstContainerPtr;
+ containerPtr != NULL; containerPtr = containerPtr->nextPtr) {
if (containerPtr->embeddedPtr == winPtr) {
return containerPtr->parent;
}
diff --git a/unix/tkUnixEvent.c b/unix/tkUnixEvent.c
index cf2e523..8c3ff93 100644
--- a/unix/tkUnixEvent.c
+++ b/unix/tkUnixEvent.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkUnixEvent.c,v 1.1.4.2 1998/09/30 02:19:17 stanton Exp $
+ * RCS: @(#) $Id: tkUnixEvent.c,v 1.1.4.3 1998/12/13 08:14:38 lfb Exp $
*/
#include "tkInt.h"
@@ -17,10 +17,14 @@
#include <signal.h>
/*
- * The following static indicates whether this module has been initialized.
+ * The following static indicates whether this module has been initialized
+ * in the current thread.
*/
-static int initialized = 0;
+typedef struct ThreadSpecificData {
+ int initialized;
+} ThreadSpecificData;
+static Tcl_ThreadDataKey dataKey;
/*
* Prototypes for procedures that are referenced only in this file:
@@ -57,8 +61,11 @@ static void TransferXEventsToTcl _ANSI_ARGS_((Display *display));
void
TkCreateXEventSource()
{
- if (!initialized) {
- initialized = 1;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+
+ if (!tsdPtr->initialized) {
+ tsdPtr->initialized = 1;
Tcl_CreateEventSource(DisplaySetupProc, DisplayCheckProc, NULL);
Tcl_CreateExitHandler(DisplayExitHandler, NULL);
}
@@ -85,8 +92,11 @@ static void
DisplayExitHandler(clientData)
ClientData clientData; /* Not used. */
{
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+
Tcl_DeleteEventSource(DisplaySetupProc, DisplayCheckProc, NULL);
- initialized = 0;
+ tsdPtr->initialized = 0;
}
/*
@@ -187,7 +197,7 @@ DisplaySetupProc(clientData, flags)
return;
}
- for (dispPtr = tkDisplayList; dispPtr != NULL;
+ for (dispPtr = TkGetDisplayList(); dispPtr != NULL;
dispPtr = dispPtr->nextPtr) {
/*
@@ -269,7 +279,7 @@ DisplayCheckProc(clientData, flags)
return;
}
- for (dispPtr = tkDisplayList; dispPtr != NULL;
+ for (dispPtr = TkGetDisplayList(); dispPtr != NULL;
dispPtr = dispPtr->nextPtr) {
XFlush(dispPtr->display);
TransferXEventsToTcl(dispPtr->display);
@@ -414,7 +424,7 @@ TkUnixDoOneXEvent(timePtr)
*/
memset((VOID *) readMask, 0, MASK_SIZE*sizeof(fd_mask));
- for (dispPtr = tkDisplayList; dispPtr != NULL;
+ for (dispPtr = TkGetDisplayList(); dispPtr != NULL;
dispPtr = dispPtr->nextPtr) {
XFlush(dispPtr->display);
if (QLength(dispPtr->display) > 0) {
@@ -445,7 +455,7 @@ TkUnixDoOneXEvent(timePtr)
* Process any new events on the display connections.
*/
- for (dispPtr = tkDisplayList; dispPtr != NULL;
+ for (dispPtr = TkGetDisplayList(); dispPtr != NULL;
dispPtr = dispPtr->nextPtr) {
fd = ConnectionNumber(dispPtr->display);
index = fd/(NBBY*sizeof(fd_mask));
diff --git a/unix/tkUnixFocus.c b/unix/tkUnixFocus.c
index 8a61d39..eb4940b 100644
--- a/unix/tkUnixFocus.c
+++ b/unix/tkUnixFocus.c
@@ -9,14 +9,13 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkUnixFocus.c,v 1.1.4.1 1998/09/30 02:19:17 stanton Exp $
+ * RCS: @(#) $Id: tkUnixFocus.c,v 1.1.4.2 1998/12/13 08:14:39 lfb Exp $
*/
#include "tkInt.h"
#include "tkPort.h"
#include "tkUnixInt.h"
-extern int tclFocusDebug;
/*
*----------------------------------------------------------------------
diff --git a/unix/tkUnixFont.c b/unix/tkUnixFont.c
index 0386af8..6c4afdf 100644
--- a/unix/tkUnixFont.c
+++ b/unix/tkUnixFont.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkUnixFont.c,v 1.1.4.5 1998/11/25 23:31:05 stanton Exp $
+ * RCS: @(#) $Id: tkUnixFont.c,v 1.1.4.6 1998/12/13 08:14:39 lfb Exp $
*/
#include "tkUnixInt.h"
@@ -154,20 +154,19 @@ typedef struct FontAttributes {
TkXLFDAttributes xa;
} FontAttributes;
-/*
- * The list of font families that are currently loaded. As screen fonts
- * are loaded, this list grows to hold information about what characters
- * exist in each font family.
- */
-
-static FontFamily *fontFamilyList = NULL;
-/*
- * FontFamily used to handle control character expansions. The encoding
- * of this FontFamily converts UTF-8 to backslashed escape sequences.
- */
-
-static FontFamily controlFamily;
+typedef struct ThreadSpecificData {
+ FontFamily *fontFamilyList; /* The list of font families that are
+ * currently loaded. As screen fonts
+ * are loaded, this list grows to hold
+ * information about what characters
+ * exist in each font family. */
+ FontFamily controlFamily; /* FontFamily used to handle control
+ * character expansions. The encoding
+ * of this FontFamily converts UTF-8 to
+ * backslashed escape sequences. */
+} ThreadSpecificData;
+static Tcl_ThreadDataKey dataKey;
/*
* The set of builtin encoding alises to convert the XLFD names for the
@@ -268,11 +267,13 @@ void
TkpFontPkgInit(mainPtr)
TkMainInfo *mainPtr; /* The application being created. */
{
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_EncodingType type;
SubFont dummy;
int i;
- if (controlFamily.encoding == NULL) {
+ if (tsdPtr->controlFamily.encoding == NULL) {
type.encodingName = "X11ControlChars";
type.toUtfProc = ControlUtfProc;
type.fromUtfProc = ControlUtfProc;
@@ -280,12 +281,12 @@ TkpFontPkgInit(mainPtr)
type.clientData = NULL;
type.nullSize = 0;
- controlFamily.refCount = 2;
- controlFamily.encoding = Tcl_CreateEncoding(&type);
- controlFamily.isTwoByteFont = 0;
+ tsdPtr->controlFamily.refCount = 2;
+ tsdPtr->controlFamily.encoding = Tcl_CreateEncoding(&type);
+ tsdPtr->controlFamily.isTwoByteFont = 0;
- dummy.familyPtr = &controlFamily;
- dummy.fontMap = controlFamily.fontMap;
+ dummy.familyPtr = &tsdPtr->controlFamily;
+ dummy.fontMap = tsdPtr->controlFamily.fontMap;
for (i = 0x00; i < 0x20; i++) {
FontMapInsert(&dummy, i);
FontMapInsert(&dummy, i + 0x80);
@@ -1166,6 +1167,8 @@ InitFont(tkwin, fontStructPtr, fontPtr)
UnixFont *fontPtr; /* Filled with information constructed from
* the above arguments. */
{
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
unsigned long value;
int minHi, maxHi, minLo, maxLo, fixed, width, limit, i, n;
FontAttributes fa;
@@ -1232,8 +1235,8 @@ InitFont(tkwin, fontStructPtr, fontPtr)
subFontPtr = FindSubFontForChar(fontPtr, '0');
controlPtr = &fontPtr->controlSubFont;
controlPtr->fontStructPtr = subFontPtr->fontStructPtr;
- controlPtr->familyPtr = &controlFamily;
- controlPtr->fontMap = controlFamily.fontMap;
+ controlPtr->familyPtr = &tsdPtr->controlFamily;
+ controlPtr->fontMap = tsdPtr->controlFamily.fontMap;
pageMap = fontPtr->subFontArray[0].fontMap[0];
for (i = 0; i < 256; i++) {
@@ -1421,11 +1424,13 @@ AllocFontFamily(display, fontStructPtr, base)
FontFamily *familyPtr;
FontAttributes fa;
Tcl_Encoding encoding;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
GetFontAttributes(display, fontStructPtr, &fa);
encoding = Tcl_GetEncoding(NULL, GetEncodingAlias(fa.xa.charset));
- familyPtr = fontFamilyList;
+ familyPtr = tsdPtr->fontFamilyList;
for (; familyPtr != NULL; familyPtr = familyPtr->nextPtr) {
if ((familyPtr->faceName == fa.fa.family)
&& (familyPtr->foundry == fa.xa.foundry)
@@ -1438,8 +1443,8 @@ AllocFontFamily(display, fontStructPtr, base)
familyPtr = (FontFamily *) ckalloc(sizeof(FontFamily));
memset(familyPtr, 0, sizeof(FontFamily));
- familyPtr->nextPtr = fontFamilyList;
- fontFamilyList = familyPtr;
+ familyPtr->nextPtr = tsdPtr->fontFamilyList;
+ tsdPtr->fontFamilyList = familyPtr;
/*
* Set key for this FontFamily.
@@ -1483,6 +1488,8 @@ FreeFontFamily(familyPtr)
FontFamily *familyPtr; /* The FontFamily to delete. */
{
FontFamily **familyPtrPtr;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
int i;
if (familyPtr == NULL) {
@@ -1503,7 +1510,7 @@ FreeFontFamily(familyPtr)
* Delete from list.
*/
- for (familyPtrPtr = &fontFamilyList; ; ) {
+ for (familyPtrPtr = &tsdPtr->fontFamilyList; ; ) {
if (*familyPtrPtr == familyPtr) {
*familyPtrPtr = familyPtr->nextPtr;
break;
@@ -1782,11 +1789,13 @@ FontMapLoadPage(subFontPtr, row)
Tcl_Encoding encoding;
XFontStruct *fontStructPtr;
XCharStruct *widths;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
subFontPtr->fontMap[row] = (char *) ckalloc(FONTMAP_BITSPERPAGE / 8);
memset(subFontPtr->fontMap[row], 0, FONTMAP_BITSPERPAGE / 8);
- if (subFontPtr->familyPtr == &controlFamily) {
+ if (subFontPtr->familyPtr == &tsdPtr->controlFamily) {
return;
}
diff --git a/unix/tkUnixSelect.c b/unix/tkUnixSelect.c
index dfeb0c3..5d4938d 100644
--- a/unix/tkUnixSelect.c
+++ b/unix/tkUnixSelect.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkUnixSelect.c,v 1.1.4.2 1998/09/30 02:19:22 stanton Exp $
+ * RCS: @(#) $Id: tkUnixSelect.c,v 1.1.4.3 1998/12/13 08:14:40 lfb Exp $
*/
#include "tkInt.h"
@@ -57,9 +57,12 @@ typedef struct IncrInfo {
* retrievals currently pending. */
} IncrInfo;
-static IncrInfo *pendingIncrs = NULL;
- /* List of all incr structures
+
+typedef struct ThreadSpecificData {
+ IncrInfo *pendingIncrs; /* List of all incr structures
* currently active. */
+} ThreadSpecificData;
+static Tcl_ThreadDataKey dataKey;
/*
* Largest property that we'll accept when sending or receiving the
@@ -230,6 +233,8 @@ TkSelPropProc(eventPtr)
int numItems;
char *propPtr;
Tk_ErrorHandler errorHandler;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
* See if this event announces the deletion of a property being
@@ -240,7 +245,7 @@ TkSelPropProc(eventPtr)
if (eventPtr->xproperty.state != PropertyDelete) {
return;
}
- for (incrPtr = pendingIncrs; incrPtr != NULL;
+ for (incrPtr = tsdPtr->pendingIncrs; incrPtr != NULL;
incrPtr = incrPtr->nextPtr) {
if (incrPtr->reqWindow != eventPtr->xproperty.window) {
continue;
@@ -269,12 +274,12 @@ TkSelPropProc(eventPtr)
} else {
TkSelInProgress ip;
ip.selPtr = selPtr;
- ip.nextPtr = pendingPtr;
- pendingPtr = &ip;
+ ip.nextPtr = TkSelGetInProgress();
+ TkSelSetInProgress(&ip);
numItems = (*selPtr->proc)(selPtr->clientData,
incrPtr->offsets[i], (char *) buffer,
TK_SEL_BYTES_AT_ONCE);
- pendingPtr = ip.nextPtr;
+ TkSelSetInProgress(ip.nextPtr);
if (ip.selPtr == NULL) {
/*
* The selection handler deleted itself.
@@ -586,6 +591,8 @@ ConvertSelection(winPtr, eventPtr)
Tk_ErrorHandler errorHandler;
TkSelectionInfo *infoPtr;
TkSelInProgress ip;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
errorHandler = Tk_CreateErrorHandler(eventPtr->display, -1, -1,-1,
(int (*)()) NULL, (ClientData) NULL);
@@ -700,12 +707,12 @@ ConvertSelection(winPtr, eventPtr)
}
} else {
ip.selPtr = selPtr;
- ip.nextPtr = pendingPtr;
- pendingPtr = &ip;
+ ip.nextPtr = TkSelGetInProgress();
+ TkSelSetInProgress(&ip);
type = selPtr->format;
numItems = (*selPtr->proc)(selPtr->clientData, 0,
(char *) buffer, TK_SEL_BYTES_AT_ONCE);
- pendingPtr = ip.nextPtr;
+ TkSelSetInProgress(ip.nextPtr);
if ((ip.selPtr == NULL) || (numItems < 0)) {
incr.multAtoms[2*i + 1] = None;
continue;
@@ -767,8 +774,8 @@ ConvertSelection(winPtr, eventPtr)
incr.idleTime = 0;
incr.reqWindow = reply.requestor;
incr.time = infoPtr->time;
- incr.nextPtr = pendingIncrs;
- pendingIncrs = &incr;
+ incr.nextPtr = tsdPtr->pendingIncrs;
+ tsdPtr->pendingIncrs = &incr;
}
if (multiple) {
XChangeProperty(reply.display, reply.requestor, reply.property,
@@ -804,10 +811,10 @@ ConvertSelection(winPtr, eventPtr)
-1, -1,-1, (int (*)()) NULL, (ClientData) NULL);
XSelectInput(reply.display, reply.requestor, 0L);
Tk_DeleteErrorHandler(errorHandler);
- if (pendingIncrs == &incr) {
- pendingIncrs = incr.nextPtr;
+ if (tsdPtr->pendingIncrs == &incr) {
+ tsdPtr->pendingIncrs = incr.nextPtr;
} else {
- for (incrPtr2 = pendingIncrs; incrPtr2 != NULL;
+ for (incrPtr2 = tsdPtr->pendingIncrs; incrPtr2 != NULL;
incrPtr2 = incrPtr2->nextPtr) {
if (incrPtr2->nextPtr == &incr) {
incrPtr2->nextPtr = incr.nextPtr;
@@ -974,8 +981,8 @@ SelectionSize(selPtr)
size = TK_SEL_BYTES_AT_ONCE;
ip.selPtr = selPtr;
- ip.nextPtr = pendingPtr;
- pendingPtr = &ip;
+ ip.nextPtr = TkSelGetInProgress();
+ TkSelSetInProgress(&ip);
do {
chunkSize = (*selPtr->proc)(selPtr->clientData, size,
(char *) buffer, TK_SEL_BYTES_AT_ONCE);
@@ -985,7 +992,7 @@ SelectionSize(selPtr)
}
size += chunkSize;
} while (chunkSize == TK_SEL_BYTES_AT_ONCE);
- pendingPtr = ip.nextPtr;
+ TkSelSetInProgress(ip.nextPtr);
return size;
}
diff --git a/unix/tkUnixSend.c b/unix/tkUnixSend.c
index 5f028e1..d189fe4 100644
--- a/unix/tkUnixSend.c
+++ b/unix/tkUnixSend.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: tkUnixSend.c,v 1.1.4.2 1998/09/30 02:19:22 stanton Exp $
+ * RCS: @(#) $Id: tkUnixSend.c,v 1.1.4.3 1998/12/13 08:14:40 lfb Exp $
*/
#include "tkPort.h"
@@ -39,10 +39,6 @@ typedef struct RegisteredInterp {
* NULL means end of list. */
} RegisteredInterp;
-static RegisteredInterp *registry = NULL;
- /* List of all interpreters
- * registered by this process. */
-
/*
* A registry of all interpreters for a display is kept in a
* property "InterpRegistry" on the root window of the display.
@@ -109,9 +105,15 @@ typedef struct PendingCommand {
* list. */
} PendingCommand;
-static PendingCommand *pendingCommands = NULL;
- /* List of all commands currently
+typedef struct ThreadSpecificData {
+ PendingCommand *pendingCommands;
+ /* List of all commands currently
* being waited for. */
+ RegisteredInterp *interpListPtr;
+ /* List of all interpreters registered
+ * in the current process. */
+} ThreadSpecificData;
+static Tcl_ThreadDataKey dataKey;
/*
* The information below is used for communication between processes
@@ -745,14 +747,15 @@ Tk_SetAppName(tkwin, name)
RegisteredInterp *riPtr, *riPtr2;
Window w;
TkWindow *winPtr = (TkWindow *) tkwin;
- TkDisplay *dispPtr;
+ TkDisplay *dispPtr = winPtr->dispPtr;
NameRegistry *regPtr;
Tcl_Interp *interp;
char *actualName;
Tcl_DString dString;
int offset, i;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- dispPtr = winPtr->dispPtr;
interp = winPtr->mainPtr->interp;
if (dispPtr->commTkwin == NULL) {
SendInit(interp, winPtr->dispPtr);
@@ -764,7 +767,7 @@ Tk_SetAppName(tkwin, name)
*/
regPtr = RegOpen(interp, winPtr->dispPtr, 1);
- for (riPtr = registry; ; riPtr = riPtr->nextPtr) {
+ for (riPtr = tsdPtr->interpListPtr; ; riPtr = riPtr->nextPtr) {
if (riPtr == NULL) {
/*
@@ -776,8 +779,8 @@ Tk_SetAppName(tkwin, name)
riPtr = (RegisteredInterp *) ckalloc(sizeof(RegisteredInterp));
riPtr->interp = interp;
riPtr->dispPtr = winPtr->dispPtr;
- riPtr->nextPtr = registry;
- registry = riPtr;
+ riPtr->nextPtr = tsdPtr->interpListPtr;
+ tsdPtr->interpListPtr = riPtr;
Tcl_CreateCommand(interp, "send", Tk_SendCmd, (ClientData) riPtr,
DeleteProc);
if (Tcl_IsSafe(interp)) {
@@ -831,7 +834,8 @@ Tk_SetAppName(tkwin, name)
*/
if (w == Tk_WindowId(dispPtr->commTkwin)) {
- for (riPtr2 = registry; riPtr2 != NULL; riPtr2 = riPtr2->nextPtr) {
+ for (riPtr2 = tsdPtr->interpListPtr; riPtr2 != NULL;
+ riPtr2 = riPtr2->nextPtr) {
if ((riPtr2->interp != interp) &&
(strcmp(riPtr2->name, actualName) == 0)) {
goto nextSuffix;
@@ -903,6 +907,8 @@ Tk_SendCmd(clientData, interp, argc, argv)
Tcl_Time timeout;
NameRegistry *regPtr;
Tcl_DString request;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_Interp *localInterp; /* Used when the interpreter to
* send the command to is within
* the same process. */
@@ -964,7 +970,8 @@ Tk_SendCmd(clientData, interp, argc, argv)
* could be the same!
*/
- for (riPtr = registry; riPtr != NULL; riPtr = riPtr->nextPtr) {
+ for (riPtr = tsdPtr->interpListPtr; riPtr != NULL;
+ riPtr = riPtr->nextPtr) {
if ((riPtr->dispPtr != dispPtr)
|| (strcmp(riPtr->name, destName) != 0)) {
continue;
@@ -1080,8 +1087,8 @@ Tk_SendCmd(clientData, interp, argc, argv)
pending.errorInfo = NULL;
pending.errorCode = NULL;
pending.gotResponse = 0;
- pending.nextPtr = pendingCommands;
- pendingCommands = &pending;
+ pending.nextPtr = tsdPtr->pendingCommands;
+ tsdPtr->pendingCommands = &pending;
/*
* Enter a loop processing X events until the result comes
@@ -1129,10 +1136,10 @@ Tk_SendCmd(clientData, interp, argc, argv)
* and return the result.
*/
- if (pendingCommands != &pending) {
+ if (tsdPtr->pendingCommands != &pending) {
panic("Tk_SendCmd: corrupted send stack");
}
- pendingCommands = pending.nextPtr;
+ tsdPtr->pendingCommands = pending.nextPtr;
if (pending.errorInfo != NULL) {
/*
* Special trick: must clear the interp's result before calling
@@ -1333,6 +1340,8 @@ SendEventProc(clientData, eventPtr)
unsigned long numItems, bytesAfter;
Atom actualType;
Tcl_Interp *remoteInterp; /* Interp in which to execute the command. */
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if ((eventPtr->xproperty.atom != dispPtr->commProperty)
|| (eventPtr->xproperty.state != PropertyNewValue)) {
@@ -1457,7 +1466,7 @@ SendEventProc(clientData, eventPtr)
* Locate the application, then execute the script.
*/
- for (riPtr = registry; ; riPtr = riPtr->nextPtr) {
+ for (riPtr = tsdPtr->interpListPtr; ; riPtr = riPtr->nextPtr) {
if (riPtr == NULL) {
if (commWindow != None) {
Tcl_DStringAppend(&reply,
@@ -1599,7 +1608,7 @@ SendEventProc(clientData, eventPtr)
* waiting for it.
*/
- for (pcPtr = pendingCommands; pcPtr != NULL;
+ for (pcPtr = tsdPtr->pendingCommands; pcPtr != NULL;
pcPtr = pcPtr->nextPtr) {
if ((serial != pcPtr->serial) || (pcPtr->result != NULL)) {
continue;
@@ -1697,6 +1706,8 @@ AppendErrorProc(clientData, errorPtr)
{
PendingCommand *pendingPtr = (PendingCommand *) clientData;
register PendingCommand *pcPtr;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (pendingPtr == NULL) {
return 0;
@@ -1706,7 +1717,7 @@ AppendErrorProc(clientData, errorPtr)
* Make sure this command is still pending.
*/
- for (pcPtr = pendingCommands; pcPtr != NULL;
+ for (pcPtr = tsdPtr->pendingCommands; pcPtr != NULL;
pcPtr = pcPtr->nextPtr) {
if ((pcPtr == pendingPtr) && (pcPtr->result == NULL)) {
pcPtr->result = (char *) ckalloc((unsigned)
@@ -1746,15 +1757,17 @@ DeleteProc(clientData)
RegisteredInterp *riPtr = (RegisteredInterp *) clientData;
register RegisteredInterp *riPtr2;
NameRegistry *regPtr;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
regPtr = RegOpen(riPtr->interp, riPtr->dispPtr, 1);
RegDeleteName(regPtr, riPtr->name);
RegClose(regPtr);
- if (registry == riPtr) {
- registry = riPtr->nextPtr;
+ if (tsdPtr->interpListPtr == riPtr) {
+ tsdPtr->interpListPtr = riPtr->nextPtr;
} else {
- for (riPtr2 = registry; riPtr2 != NULL;
+ for (riPtr2 = tsdPtr->interpListPtr; riPtr2 != NULL;
riPtr2 = riPtr2->nextPtr) {
if (riPtr2->nextPtr == riPtr) {
riPtr2->nextPtr = riPtr->nextPtr;
@@ -1798,7 +1811,8 @@ SendRestrictProc(clientData, eventPtr)
if (eventPtr->type != PropertyNotify) {
return TK_DEFER_EVENT;
}
- for (dispPtr = tkDisplayList; dispPtr != NULL; dispPtr = dispPtr->nextPtr) {
+ for (dispPtr = TkGetDisplayList(); dispPtr != NULL;
+ dispPtr = dispPtr->nextPtr) {
if ((eventPtr->xany.display == dispPtr->display)
&& (eventPtr->xproperty.window
== Tk_WindowId(dispPtr->commTkwin))) {
@@ -1833,9 +1847,12 @@ UpdateCommWindow(dispPtr)
{
Tcl_DString names;
RegisteredInterp *riPtr;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_DStringInit(&names);
- for (riPtr = registry; riPtr != NULL; riPtr = riPtr->nextPtr) {
+ for (riPtr = tsdPtr->interpListPtr; riPtr != NULL;
+ riPtr = riPtr->nextPtr) {
Tcl_DStringAppendElement(&names, riPtr->name);
}
XChangeProperty(dispPtr->display, Tk_WindowId(dispPtr->commTkwin),
diff --git a/unix/tkUnixWm.c b/unix/tkUnixWm.c
index aecdac5..82fb80e 100644
--- a/unix/tkUnixWm.c
+++ b/unix/tkUnixWm.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkUnixWm.c,v 1.1.4.2 1998/09/30 02:19:23 stanton Exp $
+ * RCS: @(#) $Id: tkUnixWm.c,v 1.1.4.3 1998/12/13 08:14:41 lfb Exp $
*/
#include "tkPort.h"
@@ -266,21 +266,10 @@ typedef struct TkWmInfo {
/*
* This module keeps a list of all top-level windows, primarily to
- * simplify the job of Tk_CoordsToWindow.
+ * simplify the job of Tk_CoordsToWindow. The list is called
+ * firstWmPtr and is stored in the TkDisplay structure.
*/
-static WmInfo *firstWmPtr = NULL; /* Points to first top-level window. */
-
-
-/*
- * The variable below is used to enable or disable tracing in this
- * module. If tracing is enabled, then information is printed on
- * standard output about interesting interactions with the window
- * manager.
- */
-
-static int wmTracing = 0;
-
/*
* The following structures are the official type records for geometry
* management of top-level and menubar windows.
@@ -378,6 +367,7 @@ TkWmNewWindow(winPtr)
TkWindow *winPtr; /* Newly-created top-level window. */
{
register WmInfo *wmPtr;
+ TkDisplay *dispPtr = winPtr->dispPtr;
wmPtr = (WmInfo *) ckalloc(sizeof(WmInfo));
wmPtr->winPtr = winPtr;
@@ -433,8 +423,8 @@ TkWmNewWindow(winPtr)
wmPtr->cmdArgv = NULL;
wmPtr->clientMachine = NULL;
wmPtr->flags = WM_NEVER_MAPPED;
- wmPtr->nextPtr = firstWmPtr;
- firstWmPtr = wmPtr;
+ wmPtr->nextPtr = (WmInfo *) dispPtr->firstWmPtr;
+ (WmInfo *) dispPtr->firstWmPtr = wmPtr;
winPtr->wmInfoPtr = wmPtr;
UpdateVRootGeometry(wmPtr);
@@ -639,12 +629,13 @@ TkWmDeadWindow(winPtr)
if (wmPtr == NULL) {
return;
}
- if (firstWmPtr == wmPtr) {
- firstWmPtr = wmPtr->nextPtr;
+ if ((WmInfo *) winPtr->dispPtr->firstWmPtr == wmPtr) {
+ (WmInfo *) winPtr->dispPtr->firstWmPtr = wmPtr->nextPtr;
} else {
register WmInfo *prevPtr;
- for (prevPtr = firstWmPtr; ; prevPtr = prevPtr->nextPtr) {
+ for (prevPtr = (WmInfo *) winPtr->dispPtr->firstWmPtr; ;
+ prevPtr = prevPtr->nextPtr) {
if (prevPtr == NULL) {
panic("couldn't unlink window in TkWmDeadWindow");
}
@@ -795,6 +786,7 @@ Tk_WmCmd(clientData, interp, argc, argv)
register WmInfo *wmPtr;
int c;
size_t length;
+ TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
if (argc < 2) {
wrongNumArgs:
@@ -812,10 +804,11 @@ Tk_WmCmd(clientData, interp, argc, argv)
return TCL_ERROR;
}
if (argc == 2) {
- Tcl_SetResult(interp, ((wmTracing) ? "on" : "off"), TCL_STATIC);
+ Tcl_SetResult(interp, ((dispPtr->wmTracing) ? "on" : "off"),
+ TCL_STATIC);
return TCL_OK;
}
- return Tcl_GetBoolean(interp, argv[2], &wmTracing);
+ return Tcl_GetBoolean(interp, argv[2], &dispPtr->wmTracing);
}
if (argc < 3) {
@@ -2080,6 +2073,7 @@ ConfigureEvent(wmPtr, configEventPtr)
{
TkWindow *wrapperPtr = wmPtr->wrapperPtr;
TkWindow *winPtr = wmPtr->winPtr;
+ TkDisplay *dispPtr = wmPtr->winPtr->dispPtr;
/*
* Update size information from the event. There are a couple of
@@ -2097,7 +2091,7 @@ ConfigureEvent(wmPtr, configEventPtr)
if (((wrapperPtr->changes.width != configEventPtr->width)
|| (wrapperPtr->changes.height != configEventPtr->height))
&& !(wmPtr->flags & WM_SYNC_PENDING)){
- if (wmTracing) {
+ if (dispPtr->wmTracing) {
printf("TopLevelEventProc: user changed %s size to %dx%d\n",
winPtr->pathName, configEventPtr->width,
configEventPtr->height);
@@ -2161,7 +2155,7 @@ ConfigureEvent(wmPtr, configEventPtr)
wmPtr->configHeight = configEventPtr->height;
}
- if (wmTracing) {
+ if (dispPtr->wmTracing) {
printf("ConfigureEvent: %s x = %d y = %d, width = %d, height = %d",
winPtr->pathName, configEventPtr->x, configEventPtr->y,
configEventPtr->width, configEventPtr->height);
@@ -2264,6 +2258,7 @@ ReparentEvent(wmPtr, reparentEventPtr)
unsigned long numItems, bytesAfter;
unsigned int dummy;
Tk_ErrorHandler handler;
+ TkDisplay *dispPtr = wmPtr->winPtr->dispPtr;
/*
* Identify the root window for wrapperPtr. This is tricky because of
@@ -2289,7 +2284,7 @@ ReparentEvent(wmPtr, reparentEventPtr)
&& (actualType == XA_WINDOW))) {
if ((actualFormat == 32) && (numItems == 1)) {
vRoot = wmPtr->vRoot = *virtualRootPtr;
- } else if (wmTracing) {
+ } else if (dispPtr->wmTracing) {
printf("%s format %d numItems %ld\n",
"ReparentEvent got bogus VROOT property:", actualFormat,
numItems);
@@ -2298,7 +2293,7 @@ ReparentEvent(wmPtr, reparentEventPtr)
}
Tk_DeleteErrorHandler(handler);
- if (wmTracing) {
+ if (dispPtr->wmTracing) {
printf("ReparentEvent: %s reparented to 0x%x, vRoot = 0x%x\n",
wmPtr->winPtr->pathName,
(unsigned int) reparentEventPtr->parent, (unsigned int) vRoot);
@@ -2395,6 +2390,7 @@ ComputeReparentGeometry(wmPtr)
Window dummy2;
Status status;
Tk_ErrorHandler handler;
+ TkDisplay *dispPtr = wmPtr->winPtr->dispPtr;
handler = Tk_CreateErrorHandler(wrapperPtr->display, -1, -1, -1,
(Tk_ErrorProc *) NULL, (ClientData) NULL);
@@ -2461,7 +2457,7 @@ ComputeReparentGeometry(wmPtr)
wmPtr->wrapperPtr->changes.x = x + wmPtr->xInParent;
wmPtr->wrapperPtr->changes.y = y + wmPtr->yInParent;
- if (wmTracing) {
+ if (dispPtr->wmTracing) {
printf("wrapperPtr coords %d,%d, wmPtr coords %d,%d, offsets %d %d\n",
wrapperPtr->changes.x, wrapperPtr->changes.y,
wmPtr->x, wmPtr->y, wmPtr->xInParent, wmPtr->yInParent);
@@ -2494,6 +2490,7 @@ WrapperEventProc(clientData, eventPtr)
{
WmInfo *wmPtr = (WmInfo *) clientData;
XEvent mapEvent;
+ TkDisplay *dispPtr = wmPtr->winPtr->dispPtr;
wmPtr->flags |= WM_VROOT_OFFSET_STALE;
if (eventPtr->type == DestroyNotify) {
@@ -2513,7 +2510,7 @@ WrapperEventProc(clientData, eventPtr)
Tk_DestroyWindow((Tk_Window) wmPtr->winPtr);
Tk_DeleteErrorHandler(handler);
}
- if (wmTracing) {
+ if (dispPtr->wmTracing) {
printf("TopLevelEventProc: %s deleted\n", wmPtr->winPtr->pathName);
}
} else if (eventPtr->type == ConfigureNotify) {
@@ -2776,7 +2773,7 @@ UpdateGeometryInfo(clientData)
}
wmPtr->configWidth = width;
wmPtr->configHeight = height;
- if (wmTracing) {
+ if (winPtr->dispPtr->wmTracing) {
printf("UpdateGeometryInfo moving to %d %d, resizing to %d x %d,\n",
x, y, width, height);
}
@@ -2797,7 +2794,7 @@ UpdateGeometryInfo(clientData)
}
wmPtr->configWidth = width;
wmPtr->configHeight = height;
- if (wmTracing) {
+ if (winPtr->dispPtr->wmTracing) {
printf("UpdateGeometryInfo resizing to %d x %d\n", width, height);
}
XResizeWindow(winPtr->display, wmPtr->wrapperPtr->window,
@@ -2998,7 +2995,7 @@ WaitForConfigureNotify(winPtr, serial)
ConfigureNotify, &event);
wmPtr->flags &= ~WM_SYNC_PENDING;
if (code != TCL_OK) {
- if (wmTracing) {
+ if (winPtr->dispPtr->wmTracing) {
printf("WaitForConfigureNotify giving up on %s\n",
winPtr->pathName);
}
@@ -3010,7 +3007,7 @@ WaitForConfigureNotify(winPtr, serial)
}
}
wmPtr->flags &= ~WM_MOVE_PENDING;
- if (wmTracing) {
+ if (winPtr->dispPtr->wmTracing) {
printf("WaitForConfigureNotify finished with %s, serial %ld\n",
winPtr->pathName, serial);
}
@@ -3186,14 +3183,14 @@ WaitForMapNotify(winPtr, mapped)
* just quit.
*/
- if (wmTracing) {
+ if (winPtr->dispPtr->wmTracing) {
printf("WaitForMapNotify giving up on %s\n", winPtr->pathName);
}
break;
}
}
wmPtr->flags &= ~WM_MOVE_PENDING;
- if (wmTracing) {
+ if (winPtr->dispPtr->wmTracing) {
printf("WaitForMapNotify finished with %s\n", winPtr->pathName);
}
}
@@ -3492,6 +3489,7 @@ Tk_CoordsToWindow(rootX, rootY, tkwin)
int x, y, childX, childY, tmpx, tmpy, bd;
WmInfo *wmPtr;
TkWindow *winPtr, *childPtr, *nextPtr;
+ TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
/*
* Step 1: scan the list of toplevel windows to see if there is a
@@ -3503,7 +3501,7 @@ Tk_CoordsToWindow(rootX, rootY, tkwin)
parent = window = RootWindowOfScreen(Tk_Screen(tkwin));
x = rootX;
y = rootY;
- for (wmPtr = firstWmPtr; wmPtr != NULL; wmPtr = wmPtr->nextPtr) {
+ for (wmPtr = (WmInfo *) dispPtr->firstWmPtr; wmPtr != NULL; wmPtr = wmPtr->nextPtr) {
if (Tk_Screen(wmPtr->winPtr) != Tk_Screen(tkwin)) {
continue;
}
@@ -3538,7 +3536,8 @@ Tk_CoordsToWindow(rootX, rootY, tkwin)
if (child == None) {
return NULL;
}
- for (wmPtr = firstWmPtr; wmPtr != NULL; wmPtr = wmPtr->nextPtr) {
+ for (wmPtr = (WmInfo *) dispPtr->firstWmPtr; wmPtr != NULL;
+ wmPtr = wmPtr->nextPtr) {
if (wmPtr->reparent == child) {
goto gotToplevel;
}
@@ -3695,7 +3694,7 @@ UpdateVRootGeometry(wmPtr)
(unsigned int *) &wmPtr->vRootWidth,
(unsigned int *) &wmPtr->vRootHeight, (unsigned int *) &bd,
&dummy);
- if (wmTracing) {
+ if (winPtr->dispPtr->wmTracing) {
printf("UpdateVRootGeometry: x = %d, y = %d, width = %d, ",
wmPtr->vRootX, wmPtr->vRootY, wmPtr->vRootWidth);
printf("height = %d, status = %d\n", wmPtr->vRootHeight, status);