summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXSubwindows.c
diff options
context:
space:
mode:
authorwolfsuit <wolfsuit>2005-03-12 00:49:27 (GMT)
committerwolfsuit <wolfsuit>2005-03-12 00:49:27 (GMT)
commit28ecea8b901c9ce27d2b68175b40c9d9cd6c193d (patch)
treea653deaea813d558fc1961f902ee8e7ff6518cfb /macosx/tkMacOSXSubwindows.c
parent5f9da15aea28a478562cbf215df3fbbd864413c6 (diff)
downloadtk-28ecea8b901c9ce27d2b68175b40c9d9cd6c193d.zip
tk-28ecea8b901c9ce27d2b68175b40c9d9cd6c193d.tar.gz
tk-28ecea8b901c9ce27d2b68175b40c9d9cd6c193d.tar.bz2
Fix for 1124237 and the mysterious "sometimes buttons don't draw" bug.
Diffstat (limited to 'macosx/tkMacOSXSubwindows.c')
-rw-r--r--macosx/tkMacOSXSubwindows.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c
index fda9ae5..e7025b7 100644
--- a/macosx/tkMacOSXSubwindows.c
+++ b/macosx/tkMacOSXSubwindows.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: tkMacOSXSubwindows.c,v 1.2.2.3 2004/11/11 01:26:43 das Exp $
+ * RCS: @(#) $Id: tkMacOSXSubwindows.c,v 1.2.2.4 2005/03/12 00:49:28 wolfsuit Exp $
*/
#include "tkInt.h"
@@ -68,6 +68,31 @@ XDestroyWindow(
if (Tk_IsTopLevel(macWin->winPtr)) {
+ WindowRef winRef;
+ /*
+ * We are relying on the Activate Mac OS event to pass the
+ * focus away from a window that is getting Destroyed to the
+ * Front non-floating window. BUT we don't get activate events
+ * when a floating window is destroyed - since the front non-floating
+ * window doesn't in fact get activated... So maybe we can check here
+ * and if we are destroying a floating window, we can pass the focus
+ * back to the front non-floating window...
+ */
+
+ if (macWin->grafPtr != NULL) {
+ TkWindow *focusPtr = TkGetFocusWin(macWin->winPtr);
+ if (focusPtr == NULL || (focusPtr->mainPtr->winPtr == macWin->winPtr)) {
+ winRef = GetWindowFromPort(macWin->grafPtr);
+ if (TkpIsWindowFloating (winRef)) {
+ Window window;
+
+ window = TkMacOSXGetXWindow(FrontNonFloatingWindow());
+ if (window != None) {
+ TkMacOSXGenerateFocusEvent(window, 1);
+ }
+ }
+ }
+ }
DisposeRgn(macWin->clipRgn);
DisposeRgn(macWin->aboveClipRgn);