From 65721df535d2aea9213fc2c357a9c4c256b2cec6 Mon Sep 17 00:00:00 2001 From: georgeps Date: Tue, 19 Aug 2008 15:52:11 +0000 Subject: After some discussion with Joe English and subsequently the X.org developers (Keith Packard in particular), it was discovered that Tk is doing management of XIDs that it shouldn't need to do. The very common XC-MISC extension which has come with every version of X for the last 15 years is used with Xlib now, to retrieve the information about the used/unused XIDs. The public Tk_FreeXId is now a no-op. Joe English reviewed the patch, and said "please commit." The patch is associated with the bug tracker id: 2039720 generic/tkError.c: Remove the usage of TkpWindowWasRecentlyDeleted. generic/tkInt.decls: Update the declarations for the now unused internalstubs. generic/tkIntDecls.h: Regenerated based on tkInt.decls. generic/tkIntPlatDecls.h: Regenerated based on tkInt.decls. generic/tkStubInit.c generic/tkWindow.c: Remove the calls to TkInitXId, and TkFreeWindowId. macosx/tkMaxOSXPort.h: Remove TkFreeWindowId and TkInitXId macro definitions. macosx/tkMacOSXXStubs.c: Remove the no-op TkpWindowWasRecentlyDeleted. unix/tkUnixEvent.c: Remove call to TkFreeXId. unix/tkUnixXId.c: Remove a lot of unnecessary code (see above). win/tkWinPort.h: Remove TkFreeWindowId and TkInitXId. win/tkWinWindow.c: Remove TkpWindowWasRecentlyDeleted. --- generic/tkError.c | 5 ++--- generic/tkInt.decls | 14 +------------- generic/tkIntDecls.h | 16 ++++------------ generic/tkIntPlatDecls.h | 41 ++++++++++------------------------------- generic/tkStubInit.c | 10 +++++----- generic/tkWindow.c | 5 +---- macosx/tkMacOSXPort.h | 4 +--- macosx/tkMacOSXXStubs.c | 29 +---------------------------- unix/tkUnixEvent.c | 4 +--- win/tkWinPort.h | 4 +--- win/tkWinWindow.c | 28 +--------------------------- 11 files changed, 28 insertions(+), 132 deletions(-) diff --git a/generic/tkError.c b/generic/tkError.c index 518cfdb..6144093 100644 --- a/generic/tkError.c +++ b/generic/tkError.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: tkError.c,v 1.6 2007/12/13 15:24:14 dgp Exp $ + * RCS: @(#) $Id: tkError.c,v 1.7 2008/08/19 15:52:11 georgeps Exp $ */ #include "tkInt.h" @@ -271,8 +271,7 @@ ErrorProc( if (errEventPtr->error_code == BadWindow) { Window w = (Window) errEventPtr->resourceid; - if (Tk_IdToWindow(display, w) != NULL - || TkpWindowWasRecentlyDeleted(w, dispPtr)) { + if (Tk_IdToWindow(display, w) != NULL) { return 0; } } diff --git a/generic/tkInt.decls b/generic/tkInt.decls index 561b237..7f87450 100644 --- a/generic/tkInt.decls +++ b/generic/tkInt.decls @@ -10,7 +10,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: tkInt.decls,v 1.44 2007/12/13 15:24:14 dgp Exp $ +# RCS: @(#) $Id: tkInt.decls,v 1.45 2008/08/19 15:52:11 georgeps Exp $ library tk @@ -278,9 +278,6 @@ declare 74 generic { declare 75 generic { int TkpUseWindow(Tcl_Interp *interp, Tk_Window tkwin, CONST char *string) } -declare 76 generic { - int TkpWindowWasRecentlyDeleted(Window win, TkDisplay *dispPtr) -} declare 77 generic { void TkQueueEventForAllChildren(TkWindow *winPtr, XEvent *eventPtr) } @@ -531,12 +528,6 @@ interface tkIntPlat declare 0 x11 { void TkCreateXEventSource(void) } -declare 1 x11 { - void TkFreeWindowId(TkDisplay *dispPtr, Window w) -} -declare 2 x11 { - void TkInitXId(TkDisplay *dispPtr) -} declare 3 x11 { int TkpCmapStressed(Tk_Window tkwin, Colormap colormap) } @@ -561,9 +552,6 @@ declare 9 x11 { declare 10 x11 { void TkSendCleanup(TkDisplay *dispPtr) } -declare 11 x11 { - void TkFreeXId(TkDisplay *dispPtr) -} declare 12 x11 { int TkpWmSetState(TkWindow *winPtr, int state) } diff --git a/generic/tkIntDecls.h b/generic/tkIntDecls.h index d5f1266..8f749a8 100644 --- a/generic/tkIntDecls.h +++ b/generic/tkIntDecls.h @@ -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: tkIntDecls.h,v 1.34 2008/04/08 03:28:05 kennykb Exp $ + * RCS: @(#) $Id: tkIntDecls.h,v 1.35 2008/08/19 15:52:11 georgeps Exp $ */ #ifndef _TKINTDECLS @@ -477,12 +477,7 @@ EXTERN void TkpSetMainMenubar (Tcl_Interp * interp, EXTERN int TkpUseWindow (Tcl_Interp * interp, Tk_Window tkwin, CONST char * string); #endif -#ifndef TkpWindowWasRecentlyDeleted_TCL_DECLARED -#define TkpWindowWasRecentlyDeleted_TCL_DECLARED -/* 76 */ -EXTERN int TkpWindowWasRecentlyDeleted (Window win, - TkDisplay * dispPtr); -#endif +/* Slot 76 is reserved */ #ifndef TkQueueEventForAllChildren_TCL_DECLARED #define TkQueueEventForAllChildren_TCL_DECLARED /* 77 */ @@ -1039,7 +1034,7 @@ typedef struct TkIntStubs { void (*tkpRedirectKeyEvent) (TkWindow * winPtr, XEvent * eventPtr); /* 73 */ void (*tkpSetMainMenubar) (Tcl_Interp * interp, Tk_Window tkwin, char * menuName); /* 74 */ int (*tkpUseWindow) (Tcl_Interp * interp, Tk_Window tkwin, CONST char * string); /* 75 */ - int (*tkpWindowWasRecentlyDeleted) (Window win, TkDisplay * dispPtr); /* 76 */ + void *reserved76; void (*tkQueueEventForAllChildren) (TkWindow * winPtr, XEvent * eventPtr); /* 77 */ int (*tkReadBitmapFile) (Display * display, Drawable d, CONST char * filename, unsigned int * width_return, unsigned int * height_return, Pixmap * bitmap_return, int * x_hot_return, int * y_hot_return); /* 78 */ int (*tkScrollWindow) (Tk_Window tkwin, GC gc, int x, int y, int width, int height, int dx, int dy, TkRegion damageRgn); /* 79 */ @@ -1536,10 +1531,7 @@ extern CONST TkIntStubs *tkIntStubsPtr; #define TkpUseWindow \ (tkIntStubsPtr->tkpUseWindow) /* 75 */ #endif -#ifndef TkpWindowWasRecentlyDeleted -#define TkpWindowWasRecentlyDeleted \ - (tkIntStubsPtr->tkpWindowWasRecentlyDeleted) /* 76 */ -#endif +/* Slot 76 is reserved */ #ifndef TkQueueEventForAllChildren #define TkQueueEventForAllChildren \ (tkIntStubsPtr->tkQueueEventForAllChildren) /* 77 */ diff --git a/generic/tkIntPlatDecls.h b/generic/tkIntPlatDecls.h index 1d8c391..dabb233 100644 --- a/generic/tkIntPlatDecls.h +++ b/generic/tkIntPlatDecls.h @@ -9,7 +9,7 @@ * Copyright (c) 1998-1999 by Scriptics Corporation. * All rights reserved. * - * RCS: @(#) $Id: tkIntPlatDecls.h,v 1.32 2008/04/08 15:00:43 das Exp $ + * RCS: @(#) $Id: tkIntPlatDecls.h,v 1.33 2008/08/19 15:52:12 georgeps Exp $ */ #ifndef _TKINTPLATDECLS @@ -484,16 +484,8 @@ EXTERN unsigned long TkpGetMS (void); /* 0 */ EXTERN void TkCreateXEventSource (void); #endif -#ifndef TkFreeWindowId_TCL_DECLARED -#define TkFreeWindowId_TCL_DECLARED -/* 1 */ -EXTERN void TkFreeWindowId (TkDisplay * dispPtr, Window w); -#endif -#ifndef TkInitXId_TCL_DECLARED -#define TkInitXId_TCL_DECLARED -/* 2 */ -EXTERN void TkInitXId (TkDisplay * dispPtr); -#endif +/* Slot 1 is reserved */ +/* Slot 2 is reserved */ #ifndef TkpCmapStressed_TCL_DECLARED #define TkpCmapStressed_TCL_DECLARED /* 3 */ @@ -535,11 +527,7 @@ EXTERN void TkWmCleanup (TkDisplay * dispPtr); /* 10 */ EXTERN void TkSendCleanup (TkDisplay * dispPtr); #endif -#ifndef TkFreeXId_TCL_DECLARED -#define TkFreeXId_TCL_DECLARED -/* 11 */ -EXTERN void TkFreeXId (TkDisplay * dispPtr); -#endif +/* Slot 11 is reserved */ #ifndef TkpWmSetState_TCL_DECLARED #define TkpWmSetState_TCL_DECLARED /* 12 */ @@ -654,8 +642,8 @@ typedef struct TkIntPlatStubs { #endif /* AQUA */ #if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */ void (*tkCreateXEventSource) (void); /* 0 */ - void (*tkFreeWindowId) (TkDisplay * dispPtr, Window w); /* 1 */ - void (*tkInitXId) (TkDisplay * dispPtr); /* 2 */ + void *reserved1; + void *reserved2; int (*tkpCmapStressed) (Tk_Window tkwin, Colormap colormap); /* 3 */ void (*tkpSync) (Display * display); /* 4 */ Window (*tkUnixContainerId) (TkWindow * winPtr); /* 5 */ @@ -664,7 +652,7 @@ typedef struct TkIntPlatStubs { int (*tkpScanWindowId) (Tcl_Interp * interp, CONST char * string, Window * idPtr); /* 8 */ void (*tkWmCleanup) (TkDisplay * dispPtr); /* 9 */ void (*tkSendCleanup) (TkDisplay * dispPtr); /* 10 */ - void (*tkFreeXId) (TkDisplay * dispPtr); /* 11 */ + void *reserved11; int (*tkpWmSetState) (TkWindow * winPtr, int state); /* 12 */ int (*tkpTestsendCmd) (ClientData clientData, Tcl_Interp * interp, int argc, CONST char ** argv); /* 13 */ #endif /* X11 */ @@ -1022,14 +1010,8 @@ extern CONST TkIntPlatStubs *tkIntPlatStubsPtr; #define TkCreateXEventSource \ (tkIntPlatStubsPtr->tkCreateXEventSource) /* 0 */ #endif -#ifndef TkFreeWindowId -#define TkFreeWindowId \ - (tkIntPlatStubsPtr->tkFreeWindowId) /* 1 */ -#endif -#ifndef TkInitXId -#define TkInitXId \ - (tkIntPlatStubsPtr->tkInitXId) /* 2 */ -#endif +/* Slot 1 is reserved */ +/* Slot 2 is reserved */ #ifndef TkpCmapStressed #define TkpCmapStressed \ (tkIntPlatStubsPtr->tkpCmapStressed) /* 3 */ @@ -1062,10 +1044,7 @@ extern CONST TkIntPlatStubs *tkIntPlatStubsPtr; #define TkSendCleanup \ (tkIntPlatStubsPtr->tkSendCleanup) /* 10 */ #endif -#ifndef TkFreeXId -#define TkFreeXId \ - (tkIntPlatStubsPtr->tkFreeXId) /* 11 */ -#endif +/* Slot 11 is reserved */ #ifndef TkpWmSetState #define TkpWmSetState \ (tkIntPlatStubsPtr->tkpWmSetState) /* 12 */ diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c index 2372007..e9f9c7d 100644 --- a/generic/tkStubInit.c +++ b/generic/tkStubInit.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkStubInit.c,v 1.63 2008/04/27 22:38:58 dkf Exp $ + * RCS: @(#) $Id: tkStubInit.c,v 1.64 2008/08/19 15:52:12 georgeps Exp $ */ #include "tkInt.h" @@ -128,7 +128,7 @@ static const TkIntStubs tkIntStubs = { TkpRedirectKeyEvent, /* 73 */ TkpSetMainMenubar, /* 74 */ TkpUseWindow, /* 75 */ - TkpWindowWasRecentlyDeleted, /* 76 */ + NULL, /* 76 */ TkQueueEventForAllChildren, /* 77 */ TkReadBitmapFile, /* 78 */ TkScrollWindow, /* 79 */ @@ -410,8 +410,8 @@ static const TkIntPlatStubs tkIntPlatStubs = { #endif /* AQUA */ #if !(defined(__WIN32__) || defined(MAC_OSX_TK)) /* X11 */ TkCreateXEventSource, /* 0 */ - TkFreeWindowId, /* 1 */ - TkInitXId, /* 2 */ + NULL, /* 1 */ + NULL, /* 2 */ TkpCmapStressed, /* 3 */ TkpSync, /* 4 */ TkUnixContainerId, /* 5 */ @@ -420,7 +420,7 @@ static const TkIntPlatStubs tkIntPlatStubs = { TkpScanWindowId, /* 8 */ TkWmCleanup, /* 9 */ TkSendCleanup, /* 10 */ - TkFreeXId, /* 11 */ + NULL, /* 11 */ TkpWmSetState, /* 12 */ TkpTestsendCmd, /* 13 */ #endif /* X11 */ diff --git a/generic/tkWindow.c b/generic/tkWindow.c index 8820c73..7e947cf 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.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: tkWindow.c,v 1.95 2008/04/27 22:38:58 dkf Exp $ + * RCS: @(#) $Id: tkWindow.c,v 1.96 2008/08/19 15:52:12 georgeps Exp $ */ #include "tkInt.h" @@ -521,8 +521,6 @@ GetScreen( dispPtr->name = (char *) ckalloc((unsigned) (length+1)); strncpy(dispPtr->name, screenName, length); dispPtr->name[length] = '\0'; - - TkInitXId(dispPtr); break; } if ((strncmp(dispPtr->name, screenName, length) == 0) @@ -1461,7 +1459,6 @@ Tk_DestroyWindow( XDestroyWindow(winPtr->display, winPtr->window); } #endif - TkFreeWindowId(dispPtr, winPtr->window); Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->winTable, (char *) winPtr->window)); winPtr->window = None; diff --git a/macosx/tkMacOSXPort.h b/macosx/tkMacOSXPort.h index 81d9167..3e89e7e 100644 --- a/macosx/tkMacOSXPort.h +++ b/macosx/tkMacOSXPort.h @@ -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: tkMacOSXPort.h,v 1.13 2007/12/13 15:27:10 dgp Exp $ + * RCS: @(#) $Id: tkMacOSXPort.h,v 1.14 2008/08/19 15:52:13 georgeps Exp $ */ #ifndef _TKMACPORT @@ -140,8 +140,6 @@ * The following functions are not used on the Mac, so we stub them out. */ -#define TkFreeWindowId(dispPtr,w) -#define TkInitXId(dispPtr) #define TkpButtonSetDefaults(specPtr) {} #define TkpCmapStressed(tkwin,colormap) (0) #define TkpFreeColor(tkColPtr) diff --git a/macosx/tkMacOSXXStubs.c b/macosx/tkMacOSXXStubs.c index 706c175..0b0ab49 100644 --- a/macosx/tkMacOSXXStubs.c +++ b/macosx/tkMacOSXXStubs.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXXStubs.c,v 1.28 2008/06/12 06:32:11 das Exp $ + * RCS: @(#) $Id: tkMacOSXXStubs.c,v 1.29 2008/08/19 15:52:13 georgeps Exp $ */ #include "tkMacOSXPrivate.h" @@ -323,33 +323,6 @@ MacXIdAlloc( /* *---------------------------------------------------------------------- * - * TkpWindowWasRecentlyDeleted -- - * - * Tries to determine whether the given window was recently deleted. - * Called from the generic code error handler to attempt to deal with - * async BadWindow errors under some circumstances. - * - * Results: - * Always 0, we do not keep this information on the Mac, so we do not - * know whether the window was destroyed. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ - -int -TkpWindowWasRecentlyDeleted( - Window win, - TkDisplay *dispPtr) -{ - return 0; -} - -/* - *---------------------------------------------------------------------- - * * DefaultErrorHandler -- * * This procedure is the default X error handler. Tk uses it's own error diff --git a/unix/tkUnixEvent.c b/unix/tkUnixEvent.c index 8335b09..e4b6f09 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.28 2008/04/27 22:39:13 dkf Exp $ + * RCS: @(#) $Id: tkUnixEvent.c,v 1.29 2008/08/19 15:52:13 georgeps Exp $ */ #include "tkUnixInt.h" @@ -156,8 +156,6 @@ TkpCloseDisplay( { TkSendCleanup(dispPtr); - TkFreeXId(dispPtr); - TkWmCleanup(dispPtr); #ifdef TK_USE_INPUT_METHODS diff --git a/win/tkWinPort.h b/win/tkWinPort.h index cb8def1..282fa79 100644 --- a/win/tkWinPort.h +++ b/win/tkWinPort.h @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinPort.h,v 1.10 2005/09/28 18:31:57 dgp Exp $ + * RCS: @(#) $Id: tkWinPort.h,v 1.11 2008/08/19 15:52:14 georgeps Exp $ */ #ifndef _WINPORT @@ -85,8 +85,6 @@ * under Windows. */ -#define TkFreeWindowId(dispPtr,w) -#define TkInitXId(dispPtr) #define TkpCmapStressed(tkwin,colormap) (0) #define XFlush(display) #define XGrabServer(display) diff --git a/win/tkWinWindow.c b/win/tkWinWindow.c index 95e7a16..a934f62 100644 --- a/win/tkWinWindow.c +++ b/win/tkWinWindow.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: tkWinWindow.c,v 1.17 2008/07/26 11:17:25 patthoyts Exp $ + * RCS: @(#) $Id: tkWinWindow.c,v 1.18 2008/08/19 15:52:14 georgeps Exp $ */ #include "tkWinInt.h" @@ -784,32 +784,6 @@ TkWinSetWindowPos( } /* - *---------------------------------------------------------------------- - * - * TkpWindowWasRecentlyDeleted -- - * - * Determines whether we know if the window given as argument was - * recently deleted. Called by the generic code error handler to handle - * BadWindow events. - * - * Results: - * Always 0. We do not keep this information on Windows. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ - -int -TkpWindowWasRecentlyDeleted( - Window win, - TkDisplay *dispPtr) -{ - return 0; -} - -/* * Local Variables: * mode: c * c-basic-offset: 4 -- cgit v0.12