summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordas <das>2008-06-19 00:14:21 (GMT)
committerdas <das>2008-06-19 00:14:21 (GMT)
commit464172781e52535bbac74d9b55bf368892f00001 (patch)
treebd54b61cd2f359127fe9a6390de2dee7d4c5a780
parent0e3a8dd74e3e0c78529eac6cba419bfbb92e750e (diff)
downloadtk-464172781e52535bbac74d9b55bf368892f00001.zip
tk-464172781e52535bbac74d9b55bf368892f00001.tar.gz
tk-464172781e52535bbac74d9b55bf368892f00001.tar.bz2
* macosx/tkMacOSXEmbed.c (TkpMakeWindow): fix bug with missing
* macosx/tkMacOSXSubwindows.c (XMapWindow): focus on first map by only sending VisibilityNotify events once windows are mapped (rather than when they are created).
-rw-r--r--macosx/tkMacOSXEmbed.c19
-rw-r--r--macosx/tkMacOSXSubwindows.c59
2 files changed, 59 insertions, 19 deletions
diff --git a/macosx/tkMacOSXEmbed.c b/macosx/tkMacOSXEmbed.c
index eab7f29..0830d4a 100644
--- a/macosx/tkMacOSXEmbed.c
+++ b/macosx/tkMacOSXEmbed.c
@@ -9,12 +9,12 @@
*
* Copyright (c) 1996-1997 Sun Microsystems, Inc.
* Copyright 2001, Apple Computer, Inc.
- * Copyright (c) 2006-2007 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright (c) 2006-2008 Daniel A. Steffen <das@users.sourceforge.net>
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXEmbed.c,v 1.16.2.1 2008/05/03 21:09:16 das Exp $
+ * RCS: @(#) $Id: tkMacOSXEmbed.c,v 1.16.2.2 2008/06/19 00:14:21 das Exp $
*/
#include "tkMacOSXInt.h"
@@ -123,7 +123,6 @@ TkpMakeWindow(
Window parent)
{
MacDrawable *macWin;
- XEvent event;
/*
* If this window is marked as embedded then the window structure should
@@ -171,20 +170,6 @@ TkpMakeWindow(
}
macWin->toplevel->referenceCount++;
}
-
- /*
- * TODO: need general solution for visibility events.
- */
-
- event.xany.serial = Tk_Display(winPtr)->request;
- event.xany.send_event = False;
- event.xany.display = Tk_Display(winPtr);
-
- event.xvisibility.type = VisibilityNotify;
- event.xvisibility.window = (Window) macWin;
- event.xvisibility.state = VisibilityUnobscured;
- Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
-
return (Window) macWin;
}
diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c
index b7a02f8..b64caee 100644
--- a/macosx/tkMacOSXSubwindows.c
+++ b/macosx/tkMacOSXSubwindows.c
@@ -5,12 +5,12 @@
*
* Copyright (c) 1995-1997 Sun Microsystems, Inc.
* Copyright 2001, Apple Computer, Inc.
- * Copyright (c) 2006-2007 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright (c) 2006-2008 Daniel A. Steffen <das@users.sourceforge.net>
*
* 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.27 2007/12/13 15:27:10 dgp Exp $
+ * RCS: @(#) $Id: tkMacOSXSubwindows.c,v 1.27.2.1 2008/06/19 00:14:21 das Exp $
*/
#include "tkMacOSXPrivate.h"
@@ -30,6 +30,7 @@
static void MoveResizeWindow(MacDrawable *macWin);
static void GenerateConfigureNotify(TkWindow *winPtr, int includeWin);
static void UpdateOffsets(TkWindow *winPtr, int deltaX, int deltaY);
+static void NotifyVisibility(TkWindow *winPtr, XEvent *eventPtr);
/*
@@ -252,6 +253,7 @@ XMapWindow(
* We only need to send the MapNotify event
* for toplevel windows.
*/
+
event.xany.serial = display->request;
event.xany.send_event = False;
event.xany.display = display;
@@ -269,6 +271,50 @@ XMapWindow(
TkMacOSXInvalClipRgns((Tk_Window) macWin->winPtr->parentPtr);
TkMacOSXInvalidateWindow(macWin, TK_PARENT_WINDOW);
}
+
+ /*
+ * Generate VisibilityNotify events for window and all mapped children.
+ */
+
+ event.xany.send_event = False;
+ event.xany.display = display;
+ event.xvisibility.type = VisibilityNotify;
+ event.xvisibility.state = VisibilityUnobscured;
+ NotifyVisibility(macWin->winPtr, &event);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * NotifyVisibility --
+ *
+ * Recursively called helper proc for XMapWindow().
+
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * VisibilityNotify events are queued.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+NotifyVisibility(
+ TkWindow *winPtr,
+ XEvent *eventPtr)
+{
+ if (winPtr->atts.event_mask & VisibilityChangeMask) {
+ eventPtr->xany.serial = LastKnownRequestProcessed(winPtr->display);
+ eventPtr->xvisibility.window = winPtr->window;
+ Tk_QueueWindowEvent(eventPtr, TCL_QUEUE_TAIL);
+ }
+ for (winPtr = winPtr->childList; winPtr != NULL;
+ winPtr = winPtr->nextPtr) {
+ if (winPtr->flags & TK_MAPPED) {
+ NotifyVisibility(winPtr, eventPtr);
+ }
+ }
}
/*
@@ -1397,3 +1443,12 @@ Tk_FreePixmap(
}
ckfree((char *) macPix);
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 79
+ * coding: utf-8
+ * End:
+ */