From b92f65900a7952564834d1ec51c59f97a1df9dd2 Mon Sep 17 00:00:00 2001
From: das <das@noemail.net>
Date: Thu, 19 Jun 2008 00:16:29 +0000
Subject: 	* macosx/tkMacOSXCarbonEvents.c:	fix debug carbon event
 tracing; 	(InstallStandardApplicationEventHandler):	replace
 needless use of 	TkMacOSXInitNamedDebugSymbol() by standard
 TkMacOSXInitNamedSymbol().

FossilOrigin-Name: f0631055e667b14ef0418fa61e21db0de035b557
---
 ChangeLog                     | 18 ++++++++++
 macosx/tkMacOSXCarbonEvents.c | 81 ++++++++++++++++++++-----------------------
 2 files changed, 55 insertions(+), 44 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ab291e8..b3d0bc0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2008-06-18  Daniel Steffen  <das@users.sourceforge.net>
+
+	* macosx/tkMacOSXCarbonEvents.c:	fix debug carbon event tracing;
+	(InstallStandardApplicationEventHandler):	replace needless use of
+	TkMacOSXInitNamedDebugSymbol() by standard TkMacOSXInitNamedSymbol().
+
+	* macosx/tkMacOSXDebug.c:	revert 2007-11-09 commit making
+	* macosx/tkMacOSXDebug.h:	TkMacOSXInitNamedDebugSymbol()
+					available outside of debug builds.
+
+	* 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).
+
+	* macosx/tkMacOSXWindowEvent.c (TkMacOSXProcessWindowEvent): fix
+	return value.
+
 2008-06-12  Daniel Steffen  <das@users.sourceforge.net>
 
 	* generic/tkPointer.c (Tk_UpdatePointer): fix failure to restore a
diff --git a/macosx/tkMacOSXCarbonEvents.c b/macosx/tkMacOSXCarbonEvents.c
index 3f9ed7a..c9c237f 100644
--- a/macosx/tkMacOSXCarbonEvents.c
+++ b/macosx/tkMacOSXCarbonEvents.c
@@ -11,7 +11,7 @@
  *	application event target.
  *
  * Copyright 2001, Apple Computer, Inc.
- * Copyright (c) 2005-2007 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright (c) 2005-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.
@@ -60,7 +60,7 @@
  *	software in accordance with the terms specified in this
  *	license.
  *
- * RCS: @(#) $Id: tkMacOSXCarbonEvents.c,v 1.3.2.18 2007/11/09 06:26:54 das Exp $
+ * RCS: @(#) $Id: tkMacOSXCarbonEvents.c,v 1.3.2.19 2008/06/19 00:16:30 das Exp $
  */
 
 #include "tkMacOSXPrivate.h"
@@ -224,46 +224,21 @@ TkMacOSXInitCarbonEvents(
 	    applicationEventTypes, (void *) carbonEventInterp, NULL);
 
 #ifdef TK_MAC_DEBUG_CARBON_EVENTS
-    TkMacOSXInitNamedDebugSymbol(HIToolbox, void, _TraceEventByName,
-	    CFStringRef);
-    if (_TraceEventByName) {
-	/* Carbon-internal event debugging (c.f. Technote 2124) */
-	_TraceEventByName(CFSTR("kEventRawKeyDown"));
-	_TraceEventByName(CFSTR("kEventRawKeyRepeat"));
-	_TraceEventByName(CFSTR("kEventRawKeyUp"));
-	_TraceEventByName(CFSTR("kEventRawKeyModifiersChanged"));
-	_TraceEventByName(CFSTR("kEventRawKeyRepeat"));
-	_TraceEventByName(CFSTR("kEventMenuBeginTracking"));
-	_TraceEventByName(CFSTR("kEventMenuEndTracking"));
-	_TraceEventByName(CFSTR("kEventMenuOpening"));
-	_TraceEventByName(CFSTR("kEventMenuTargetItem"));
-	_TraceEventByName(CFSTR("kEventCommandProcess"));
-	_TraceEventByName(CFSTR("kEventCommandUpdateStatus"));
-	_TraceEventByName(CFSTR("kEventAppActivated"));
-	_TraceEventByName(CFSTR("kEventAppDeactivated"));
-	_TraceEventByName(CFSTR("kEventAppQuit"));
-	_TraceEventByName(CFSTR("kEventAppHidden"));
-	_TraceEventByName(CFSTR("kEventAppShown"));
-	_TraceEventByName(CFSTR("kEventAppAvailableWindowBoundsChanged"));
-	_TraceEventByName(CFSTR("kEventAppearanceScrollBarVariantChanged"));
-	_TraceEventByName(CFSTR("kEventMouseDown"));
-	_TraceEventByName(CFSTR("kEventMouseUp"));
-#if 0
-	_TraceEventByName(CFSTR("kEventMouseMoved"));
-	_TraceEventByName(CFSTR("kEventMouseDragged"));
-#endif
-	_TraceEventByName(CFSTR("kEventMouseWheelMoved"));
-	_TraceEventByName(CFSTR("kEventMouseScroll"));
-	_TraceEventByName(CFSTR("kEventWindowActivated"));
-	_TraceEventByName(CFSTR("kEventWindowDeactivated"));
-	_TraceEventByName(CFSTR("kEventWindowUpdate"));
-	_TraceEventByName(CFSTR("kEventWindowExpanding"));
-	_TraceEventByName(CFSTR("kEventWindowBoundsChanged"));
-	_TraceEventByName(CFSTR("kEventWindowDragStarted"));
-	_TraceEventByName(CFSTR("kEventWindowDragCompleted"));
-	_TraceEventByName(CFSTR("kEventWindowConstrain"));
-	_TraceEventByName(CFSTR("kEventWindowGetRegion"));
-	_TraceEventByName(CFSTR("kEventWindowDrawContent"));
+    TkMacOSXInitNamedSymbol(HIToolbox, void, DebugTraceEvent, OSType, UInt32,
+	    Boolean);
+    if (DebugTraceEvent) {
+	unsigned int i;
+	const EventTypeSpec *e;
+
+	for (i = 0, e = dispatcherEventTypes;
+		i < GetEventTypeCount(dispatcherEventTypes); i++, e++) {
+	    DebugTraceEvent(e->eventClass, e->eventKind, 1);
+	}
+	for (i = 0, e = applicationEventTypes;
+		i < GetEventTypeCount(applicationEventTypes); i++, e++) {
+	    DebugTraceEvent(e->eventClass, e->eventKind, 1);
+	}
+	DebugTraceEvent = NULL; /* Only enable tracing once. */
     }
 #endif /* TK_MAC_DEBUG_CARBON_EVENTS */
 }
@@ -310,6 +285,24 @@ TkMacOSXInstallWindowCarbonEventHandler(
 	    carbonEventHandlerUPP, GetEventTypeCount(windowEventTypes),
 	    windowEventTypes, (void *) (interp ? interp : carbonEventInterp),
 	    NULL);
+
+#ifdef TK_MAC_DEBUG_CARBON_EVENTS
+    TkMacOSXInitNamedSymbol(HIToolbox, void, DebugTraceEvent, OSType, UInt32,
+	    Boolean);
+    if (DebugTraceEvent) {
+	unsigned int i;
+	const EventTypeSpec *e;
+
+	for (i = 0, e = windowEventTypes;
+		i < GetEventTypeCount(windowEventTypes); i++, e++) {
+	    if (!(e->eventClass == kEventClassMouse && (
+		    e->eventKind == kEventMouseMoved ||
+		    e->eventKind == kEventMouseDragged))) {
+		DebugTraceEvent(e->eventClass, e->eventKind, 1);
+	    }
+	}
+    }
+#endif /* TK_MAC_DEBUG_CARBON_EVENTS */
 }
 
 /*
@@ -344,11 +337,11 @@ InstallStandardApplicationEventHandler(void)
 	* to be installed. Unfortunately there appears to be no public API to
 	* obtain the menubar event target. As a workaround, for now we resort
 	* to calling the HIToolbox-internal GetMenuBarEventTarget() directly
-	* (symbol acquired via TkMacOSXInitNamedDebugSymbol() from HIToolbox
+	* (symbol acquired via TkMacOSXInitNamedSymbol() from HIToolbox
 	* version 343, may not exist in later versions).
 	*/
 	err = ChkErr(InstallStandardEventHandler, GetApplicationEventTarget());
-	TkMacOSXInitNamedDebugSymbol(HIToolbox, EventTargetRef,
+	TkMacOSXInitNamedSymbol(HIToolbox, EventTargetRef,
 		GetMenuBarEventTarget, void);
 	if (GetMenuBarEventTarget) {
 	    ChkErr(InstallStandardEventHandler, GetMenuBarEventTarget());
-- 
cgit v0.12