Index: generic/tkWindow.c ================================================================== --- generic/tkWindow.c +++ generic/tkWindow.c @@ -1746,11 +1746,11 @@ event.xmap.send_event = False; event.xmap.display = winPtr->display; event.xmap.event = winPtr->window; event.xmap.window = winPtr->window; event.xmap.override_redirect = winPtr->atts.override_redirect; - TkpHandleMapOrUnmap((Tk_Window)winPtr, &event); + Tk_HandleEvent(&event); } /* *-------------------------------------------------------------- * @@ -1908,11 +1908,11 @@ event.xunmap.send_event = False; event.xunmap.display = winPtr->display; event.xunmap.event = winPtr->window; event.xunmap.window = winPtr->window; event.xunmap.from_configure = False; - TkpHandleMapOrUnmap((Tk_Window)winPtr, &event); + Tk_HandleEvent(&event); } } void Tk_ConfigureWindow( Index: generic/ttk/ttkInit.c ================================================================== --- generic/ttk/ttkInit.c +++ generic/ttk/ttkInit.c @@ -105,11 +105,11 @@ # undef SETFLAGS } /* TtkSendVirtualEvent -- * Send a virtual event notification to the specified target window. - * Equivalent to "event generate $tgtWindow <<$eventName>>" + * Equivalent to "event generate $tgtWindow <<$eventName>> -when tail" * * Note that we use Tk_QueueWindowEvent, not Tk_HandleEvent, * so this routine does not reenter the interpreter. */ void TtkSendVirtualEvent(Tk_Window tgtWin, const char *eventName) Index: generic/ttk/ttkNotebook.c ================================================================== --- generic/ttk/ttkNotebook.c +++ generic/ttk/ttkNotebook.c @@ -1038,14 +1038,14 @@ tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index); tab->state = TAB_STATE_HIDDEN; if (index == nb->notebook.currentIndex) { SelectNearestTab(nb); + } else { + TtkRedisplayWidget(&nb->core); } - TtkRedisplayWidget(&nb->core); - return TCL_OK; } /* $nb identify $x $y -- * Returns name of tab element at $x,$y; empty string if none. Index: macosx/tkMacOSXPort.h ================================================================== --- macosx/tkMacOSXPort.h +++ macosx/tkMacOSXPort.h @@ -190,18 +190,10 @@ MODULE_SCOPE unsigned long TkMacOSXRGBPixel(unsigned long red, unsigned long green, unsigned long blue); #define TkpGetPixel(p) (TkMacOSXRGBPixel(p->red >> 8, p->green >> 8, p->blue >> 8)) -/* - * Used by tkWindow.c - */ - -MODULE_SCOPE void TkMacOSXHandleMapOrUnmap(Tk_Window tkwin, XEvent *event); - -#define TkpHandleMapOrUnmap(tkwin, event) TkMacOSXHandleMapOrUnmap(tkwin, event) - /* * Used by tkAppInit */ #define USE_CUSTOM_EXIT_PROC Index: macosx/tkMacOSXWm.c ================================================================== --- macosx/tkMacOSXWm.c +++ macosx/tkMacOSXWm.c @@ -743,78 +743,10 @@ } /* *---------------------------------------------------------------------- * - * TkMacOSXHandleMapOrUnmap -- - * - * The mechanism used by a geometry manager to propogate the information - * about which of its content widgets are mapped is to call Tk_MapWindow - * or Tk_UnmapNotify. Those functions generate MapNotify or UnmapNotify - * events and then handle them immediately. Other platforms use - * Tk_HandleEvent to do this. But that does not work correctly on macOS - * due to the fact that the calls to Tk_MapNotify or Tk_UnmapNotify can - * occur in display procedures which are being run in the drawRect method - * of a TKContentView. The events will be processed after drawRect - * returns, but they need to be processed immediately in some cases. - - * This function operates as a macOS alternative to Tk_HandleEvent, for - * processing MapNotify or UnmapNotify events only. It is called by - * Tk_MapWindow, Tk_UnmapWindow, TkWmMapWindow and TkWmUnmapWindow. - * Rather than using Tk_HandleEvent it installs a filter which restricts - * to the MapNotify or UnmapNotify events, it queues the event and then - * processes window events with the filter installed. This allows the - * event to be handled immediately even from within the drawRect method. - * - * Results: - * None. - * - * Side effects: - * Handles a MapNotify or UnMapNotify event. - * - *---------------------------------------------------------------------- - */ -static Tk_RestrictAction -MapUnmapRestrictProc( - ClientData arg, - XEvent *eventPtr) -{ - return (eventPtr->type==MapNotify || eventPtr->type==UnmapNotify ? - TK_PROCESS_EVENT : TK_DEFER_EVENT); -} - -MODULE_SCOPE -void TkMacOSXHandleMapOrUnmap( - Tk_Window tkwin, - XEvent *event) -{ - ClientData oldArg; - Tk_RestrictProc *oldProc; - TkWindow *winPtr = (TkWindow *) tkwin; - const Tk_GeomMgr *geomMgrPtr = winPtr->geomMgrPtr; - - /* - * Sadly, this approach does not work with the "text" geometry manager. - * The mysterious unexplained crash elicited by textDisp-5.2 occurs. So we - * have to check for the "text" manager and revert to using Tk_HandleEvent - * in that case. Hopefully this can be removed when the revised text - * widget is in place. - */ - - if (geomMgrPtr && strcmp(geomMgrPtr->name, "text") == 0) { - Tk_HandleEvent(event); - return; - } - oldProc = Tk_RestrictEvents(MapUnmapRestrictProc, NULL, &oldArg); - Tk_QueueWindowEvent(event, TCL_QUEUE_TAIL); - while (Tcl_DoOneEvent(TCL_WINDOW_EVENTS|TCL_DONT_WAIT)) {} - Tk_RestrictEvents(oldProc, oldArg, &oldArg); -} - -/* - *---------------------------------------------------------------------- - * * TkWmMapWindow -- * * This procedure is invoked to map a top-level window. This module gets * a chance to update all window-manager-related information in * properties before the window manager sees the map event and checks the @@ -914,11 +846,11 @@ event.xany.display = winPtr->display; event.xmap.window = winPtr->window; event.xmap.type = MapNotify; event.xmap.event = winPtr->window; event.xmap.override_redirect = winPtr->atts.override_redirect; - TkpHandleMapOrUnmap((Tk_Window)winPtr, &event); + Tk_HandleEvent(&event); } /* *---------------------------------------------------------------------- * @@ -950,11 +882,11 @@ event.xunmap.window = winPtr->window; event.xunmap.event = winPtr->window; event.xunmap.from_configure = false; winPtr->flags &= ~TK_MAPPED; XUnmapWindow(winPtr->display, winPtr->window); - TkpHandleMapOrUnmap((Tk_Window)winPtr, &event); + Tk_HandleEvent(&event); } /* *---------------------------------------------------------------------- * Index: unix/tkUnixPort.h ================================================================== --- unix/tkUnixPort.h +++ unix/tkUnixPort.h @@ -192,12 +192,6 @@ #ifndef __CYGWIN__ #define TkpPrintWindowId(buf,w) \ sprintf((buf), "0x%08lx", (unsigned long) (w)) #endif -/* - * Used by tkWindow.c - */ - -#define TkpHandleMapOrUnmap(tkwin, event) Tk_HandleEvent(event) - #endif /* _UNIXPORT */ Index: win/tkWinPort.h ================================================================== --- win/tkWinPort.h +++ win/tkWinPort.h @@ -123,16 +123,10 @@ */ #define TkpGetPixel(p) (((((p)->red >> 8) & 0xff) \ | ((p)->green & 0xff00) | (((p)->blue << 8) & 0xff0000)) | 0x20000000) -/* - * Used by tkWindow.c - */ - -#define TkpHandleMapOrUnmap(tkwin, event) Tk_HandleEvent(event) - /* * These calls implement native bitmaps which are not currently * supported under Windows. The macros eliminate the calls. */