diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-12-03 18:00:10 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-12-03 18:00:10 (GMT) |
commit | cd026d544367512db80eed7ea948c68b2e0ff623 (patch) | |
tree | e83a4b7be6aa05516cf3c34cf25bf78fa4f2669e | |
parent | 7311d9315f8484ce3cc251cb652f3ec19eaedecb (diff) | |
parent | 5141d1a7d374a8bf342737ca4777891b499c0c64 (diff) | |
download | tk-cd026d544367512db80eed7ea948c68b2e0ff623.zip tk-cd026d544367512db80eed7ea948c68b2e0ff623.tar.gz tk-cd026d544367512db80eed7ea948c68b2e0ff623.tar.bz2 |
Merge 8.6
-rw-r--r-- | generic/tkWindow.c | 27 | ||||
-rw-r--r-- | macosx/tkMacOSXSubwindows.c | 2 | ||||
-rw-r--r-- | macosx/tkMacOSXWm.c | 24 | ||||
-rw-r--r-- | win/tkWinWindow.c | 16 |
4 files changed, 41 insertions, 28 deletions
diff --git a/generic/tkWindow.c b/generic/tkWindow.c index 37cda60..7a93351 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.c @@ -1762,16 +1762,18 @@ Tk_MapWindow( TkWmMapWindow(winPtr); return; } - winPtr->flags |= TK_MAPPED; - XMapWindow(winPtr->display, winPtr->window); - event.type = MapNotify; - event.xmap.serial = LastKnownRequestProcessed(winPtr->display); - 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; - Tk_HandleEvent(&event); + if ((winPtr->window != None) + && (XMapWindow(winPtr->display, winPtr->window) == Success)) { + winPtr->flags |= TK_MAPPED; + event.type = MapNotify; + event.xmap.serial = LastKnownRequestProcessed(winPtr->display); + 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; + Tk_HandleEvent(&event); + } } /* @@ -1922,8 +1924,9 @@ Tk_UnmapWindow( return; } winPtr->flags &= ~TK_MAPPED; - XUnmapWindow(winPtr->display, winPtr->window); - if (!(winPtr->flags & TK_TOP_HIERARCHY)) { + if ((winPtr->window != None) + && (XUnmapWindow(winPtr->display, winPtr->window) == Success) + && !(winPtr->flags & TK_TOP_HIERARCHY)) { XEvent event; event.type = UnmapNotify; diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c index ed44ef5..a420898 100644 --- a/macosx/tkMacOSXSubwindows.c +++ b/macosx/tkMacOSXSubwindows.c @@ -128,7 +128,7 @@ XDestroyWindow( * Tk_WmMapWindow. * * Results: - * Returns Success or BadWindow. + * Always returns Success or BadWindow. * * Side effects: * The subwindow or toplevel may appear on the screen. VisibilityNotify diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index 547657b..906973a 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -1077,18 +1077,20 @@ TkWmUnmapWindow( TkWindow *winPtr) /* Top-level window that's about to be * unmapped. */ { - XEvent event; - - event.xany.serial = LastKnownRequestProcessed(winPtr->display); - event.xany.send_event = False; - event.xany.display = winPtr->display; - event.xunmap.type = UnmapNotify; - event.xunmap.window = winPtr->window; - event.xunmap.event = winPtr->window; - event.xunmap.from_configure = false; winPtr->flags &= ~TK_MAPPED; - XUnmapWindow(winPtr->display, winPtr->window); - Tk_HandleEvent(&event); + if ((winPtr->window != None) + && (XUnmapWindow(winPtr->display, winPtr->window) == Success)) { + XEvent event; + + event.xany.serial = LastKnownRequestProcessed(winPtr->display); + event.xany.send_event = False; + event.xany.display = winPtr->display; + event.xunmap.type = UnmapNotify; + event.xunmap.window = winPtr->window; + event.xunmap.event = winPtr->window; + event.xunmap.from_configure = false; + Tk_HandleEvent(&event); + } } /* diff --git a/win/tkWinWindow.c b/win/tkWinWindow.c index 53432d7..d80c017 100644 --- a/win/tkWinWindow.c +++ b/win/tkWinWindow.c @@ -341,7 +341,7 @@ XDestroyWindow( * Cause the given window to become visible. * * Results: - * None + * Always returns Success or BadWindow. * * Side effects: * Causes the window state to change, and generates a MapNotify event. @@ -356,8 +356,12 @@ XMapWindow( { XEvent event; TkWindow *parentPtr; - TkWindow *winPtr = TkWinGetWinPtr(w); + TkWindow *winPtr; + if (!w) { + return BadWindow; + } + winPtr = TkWinGetWinPtr(w); LastKnownRequestProcessed(display)++; ShowWindow(Tk_GetHWND(w), SW_SHOWNORMAL); @@ -450,7 +454,7 @@ NotifyVisibility( * Cause the given window to become invisible. * * Results: - * None + * Always returns Success or BadWindow. * * Side effects: * Causes the window state to change, and generates an UnmapNotify event. @@ -464,8 +468,12 @@ XUnmapWindow( Window w) { XEvent event; - TkWindow *winPtr = TkWinGetWinPtr(w); + TkWindow *winPtr; + if (!w) { + return BadWindow; + } + winPtr = TkWinGetWinPtr(w); LastKnownRequestProcessed(display)++; /* |