From ac472c4e66bab4cd03d4602aad73f23f885220cc Mon Sep 17 00:00:00 2001 From: das Date: Sat, 10 Sep 2005 14:54:17 +0000 Subject: * macosx/tkMacOSXMouseEvent.c (TkMacOSXProcessMouseEvent): check if process is in front on MouseDown, otherwise request process activation from BringWindowForward() via new isFrontProcess param. * macosx/tkMacOSXCarbonEvents.c (TkMacOSXInitCarbonEvents): register our event handler on the dispatcher target for all carbon events of interest to TkAqua; this replaces event processing directly from the event queue and thus allows to capture events that are syntesized by Carbon and sent directly to the dispatcher and not to the event queue. * macosx/tkMacOSXEvent.c: remove TkMacOSXCountAndProcessMacEvents(), rename ReceiveAndProcessEvent() to TkMacOSXReceiveAndProcessEvent(). (TkMacOSXReceiveAndProcessEvent): remove tk event processing before sending events to the dispatcher, all events of interest are now processed in our dispatcher target event handler. * macosx/tkMacOSXNotify.c (CarbonEventsCheckProc): dispatch events directly via TkMacOSXReceiveAndProcessEvent(), but dispatch no more than four carbon events at one time to avoid starving other event sources. * macosx/tkMacOSXEvent.c: formatting cleanup, move XSync() to XStubs, * macosx/tkMacOSXEvent.h: removed obsolete kEventClassWish handling. * macosx/tkMacOSXXStubs.c * macosx/tkMacOSXButton.c: conditionalize all debug message printing to * macosx/tkMacOSXCursor.c: stderr via TK_MAC_DEBUG define. * macosx/tkMacOSXDebug.c: * macosx/tkMacOSXDebug.h: * macosx/tkMacOSXDialog.c: * macosx/tkMacOSXEvent.c: * macosx/tkMacOSXInit.c: * macosx/tkMacOSXKeyEvent.c: * macosx/tkMacOSXMenu.c: * macosx/tkMacOSXMenubutton.c: * macosx/tkMacOSXScale.c: * macosx/tkMacOSXWindowEvent.c: * macosx/tkMacOSXWm.c: * unix/configure.in: define TK_MAC_DEBUG on aqua when symbols enabled. * unix/configure: autoconf-2.13 * library/listbox.tcl: corrected comments. * library/text.tcl: * xlib/xcolors.c: fixed warning --- ChangeLog | 48 +++++++++++++++ library/listbox.tcl | 8 +-- library/text.tcl | 8 +-- macosx/tkMacOSXButton.c | 20 +++++- macosx/tkMacOSXCarbonEvents.c | 104 +++++++++++++++++++++++-------- macosx/tkMacOSXCursor.c | 6 +- macosx/tkMacOSXDebug.c | 6 +- macosx/tkMacOSXDebug.h | 14 ++++- macosx/tkMacOSXDialog.c | 54 ++++++++++------ macosx/tkMacOSXEvent.c | 140 ++++++++++-------------------------------- macosx/tkMacOSXEvent.h | 25 ++++---- macosx/tkMacOSXInit.c | 4 +- macosx/tkMacOSXKeyEvent.c | 19 +++++- macosx/tkMacOSXMenu.c | 16 ++++- macosx/tkMacOSXMenubutton.c | 22 ++++++- macosx/tkMacOSXMouseEvent.c | 65 ++++++++++---------- macosx/tkMacOSXNotify.c | 16 ++++- macosx/tkMacOSXScale.c | 16 ++++- macosx/tkMacOSXWindowEvent.c | 9 ++- macosx/tkMacOSXWm.c | 4 +- macosx/tkMacOSXXStubs.c | 10 ++- unix/configure | 98 +++++++++++++++-------------- unix/configure.in | 5 +- xlib/xcolors.c | 4 +- 24 files changed, 449 insertions(+), 272 deletions(-) diff --git a/ChangeLog b/ChangeLog index d2ae4d6..06e167e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,51 @@ +2005-09-11 Daniel Steffen + + * macosx/tkMacOSXMouseEvent.c (TkMacOSXProcessMouseEvent): check if + process is in front on MouseDown, otherwise request process activation + from BringWindowForward() via new isFrontProcess param. + + * macosx/tkMacOSXCarbonEvents.c (TkMacOSXInitCarbonEvents): register our + event handler on the dispatcher target for all carbon events of interest + to TkAqua; this replaces event processing directly from the event queue + and thus allows to capture events that are syntesized by Carbon and sent + directly to the dispatcher and not to the event queue. + + * macosx/tkMacOSXEvent.c: remove TkMacOSXCountAndProcessMacEvents(), + rename ReceiveAndProcessEvent() to TkMacOSXReceiveAndProcessEvent(). + (TkMacOSXReceiveAndProcessEvent): remove tk event processing before + sending events to the dispatcher, all events of interest are now + processed in our dispatcher target event handler. + + * macosx/tkMacOSXNotify.c (CarbonEventsCheckProc): dispatch events + directly via TkMacOSXReceiveAndProcessEvent(), but dispatch no more than + four carbon events at one time to avoid starving other event sources. + + * macosx/tkMacOSXEvent.c: formatting cleanup, move XSync() to XStubs, + * macosx/tkMacOSXEvent.h: removed obsolete kEventClassWish handling. + * macosx/tkMacOSXXStubs.c + + * macosx/tkMacOSXButton.c: conditionalize all debug message printing to + * macosx/tkMacOSXCursor.c: stderr via TK_MAC_DEBUG define. + * macosx/tkMacOSXDebug.c: + * macosx/tkMacOSXDebug.h: + * macosx/tkMacOSXDialog.c: + * macosx/tkMacOSXEvent.c: + * macosx/tkMacOSXInit.c: + * macosx/tkMacOSXKeyEvent.c: + * macosx/tkMacOSXMenu.c: + * macosx/tkMacOSXMenubutton.c: + * macosx/tkMacOSXScale.c: + * macosx/tkMacOSXWindowEvent.c: + * macosx/tkMacOSXWm.c: + + * unix/configure.in: define TK_MAC_DEBUG on aqua when symbols enabled. + * unix/configure: autoconf-2.13 + + * library/listbox.tcl: corrected comments. + * library/text.tcl: + + * xlib/xcolors.c: fixed warning + 2005-08-23 Jeff Hobbs * macosx/tkMacOSXDialog.c: make dialogs ignore -initialfile "" and diff --git a/library/listbox.tcl b/library/listbox.tcl index b2abe11..5cec546 100644 --- a/library/listbox.tcl +++ b/library/listbox.tcl @@ -3,7 +3,7 @@ # This file defines the default bindings for Tk listbox widgets # and provides procedures that help in implementing those bindings. # -# RCS: @(#) $Id: listbox.tcl,v 1.13.2.2 2004/02/17 07:17:17 das Exp $ +# RCS: @(#) $Id: listbox.tcl,v 1.13.2.3 2005/09/10 14:54:17 das Exp $ # # Copyright (c) 1994 The Regents of the University of California. # Copyright (c) 1994-1995 Sun Microsystems, Inc. @@ -175,9 +175,9 @@ bind Listbox { %W scan dragto %x %y } -# The MouseWheel will typically only fire on Windows. However, -# someone could use the "event generate" command to produce one -# on other platforms. +# The MouseWheel will typically only fire on Windows and Mac OS X. +# However, someone could use the "event generate" command to produce +# one on other platforms. if {[string equal [tk windowingsystem] "classic"] || [string equal [tk windowingsystem] "aqua"]} { diff --git a/library/text.tcl b/library/text.tcl index 3b2a5ab..8e77e98 100644 --- a/library/text.tcl +++ b/library/text.tcl @@ -3,7 +3,7 @@ # This file defines the default bindings for Tk text widgets and provides # procedures that help in implementing the bindings. # -# RCS: @(#) $Id: text.tcl,v 1.24.2.6 2005/05/13 13:48:21 vincentdarley Exp $ +# RCS: @(#) $Id: text.tcl,v 1.24.2.7 2005/09/10 14:54:17 das Exp $ # # Copyright (c) 1992-1994 The Regents of the University of California. # Copyright (c) 1994-1997 Sun Microsystems, Inc. @@ -454,9 +454,9 @@ bind Text { } set ::tk::Priv(prevPos) {} -# The MouseWheel will typically only fire on Windows. However, -# someone could use the "event generate" command to produce one -# on other platforms. +# The MouseWheel will typically only fire on Windows and MacOS X. +# However, someone could use the "event generate" command to produce +# one on other platforms. if {[string equal [tk windowingsystem] "classic"] || [string equal [tk windowingsystem] "aqua"]} { diff --git a/macosx/tkMacOSXButton.c b/macosx/tkMacOSXButton.c index b4cfc67..909e83e 100644 --- a/macosx/tkMacOSXButton.c +++ b/macosx/tkMacOSXButton.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXButton.c,v 1.2.2.10 2005/08/22 11:55:15 das Exp $ + * RCS: @(#) $Id: tkMacOSXButton.c,v 1.2.2.11 2005/09/10 14:54:17 das Exp $ */ #include "tkButton.h" @@ -833,12 +833,16 @@ TkMacOSXInitControl ( controlReference ); if (!mbPtr->userPane) { +#ifdef TK_MAC_DEBUG fprintf(stderr,"Failed to create user pane control\n"); +#endif return 1; } if ((status = EmbedControl(mbPtr->userPane,rootControl)) != noErr) { +#ifdef TK_MAC_DEBUG fprintf(stderr,"Failed to embed user pane control %d\n", status); +#endif return 1; } @@ -857,12 +861,16 @@ TkMacOSXInitControl ( controlReference ); if (!mbPtr->control) { +#ifdef TK_MAC_DEBUG fprintf(stderr,"failed to create control of type %d\n",procID); +#endif return 1; } if (EmbedControl(mbPtr->control,mbPtr->userPane) != noErr ) { +#ifdef TK_MAC_DEBUG fprintf(stderr,"failed to embed control of type %d\n",procID); +#endif return 1; } @@ -985,7 +993,9 @@ TkMacOSXDrawControl( TkMacOSXInitControlFontStyle(font, &fontStyle); if (bcmp(&mbPtr->fontStyle, &fontStyle, sizeof(fontStyle)) ) { if (SetControlFontStyle(mbPtr->control, &fontStyle) != noErr) { +#ifdef TK_MAC_DEBUG fprintf(stderr,"SetControlFontStyle failed\n"); +#endif } bcopy(&fontStyle, &mbPtr->fontStyle, sizeof(fontStyle)); @@ -1113,7 +1123,9 @@ SetupBevelButton( if (!(mbPtr->bevelButtonContent.u.picture = OpenCPicture(&mbPtr->picParams)) ) { +#ifdef TK_MAC_DEBUG fprintf(stderr,"OpenCPicture failed\n"); +#endif } tkPictureIsOpen = 1; @@ -1142,8 +1154,10 @@ SetupBevelButton( kControlBevelButtonContentTag, sizeof(ControlButtonContentInfo), (char *) &mbPtr->bevelButtonContent)) != noErr) { +#ifdef TK_MAC_DEBUG fprintf(stderr, "SetControlData BevelButtonContent failed, %d\n", err ); +#endif } if (butPtr->anchor == TK_ANCHOR_N) { @@ -1170,8 +1184,10 @@ SetupBevelButton( kControlBevelButtonGraphicAlignTag, sizeof(ControlButtonGraphicAlignment), (char *) &theAlignment)) != noErr) { +#ifdef TK_MAC_DEBUG fprintf(stderr, "SetControlData BevelButtonGraphicAlign failed, %d\n", err ); +#endif } if (butPtr->compound != COMPOUND_NONE) { @@ -1190,8 +1206,10 @@ SetupBevelButton( kControlBevelButtonTextPlaceTag, sizeof(ControlButtonTextPlacement), (char *) &thePlacement)) != noErr) { +#ifdef TK_MAC_DEBUG fprintf(stderr, "SetControlData BevelButtonTextPlace failed, %d\n", err ); +#endif } } } diff --git a/macosx/tkMacOSXCarbonEvents.c b/macosx/tkMacOSXCarbonEvents.c index c0539d2..ddeec64 100644 --- a/macosx/tkMacOSXCarbonEvents.c +++ b/macosx/tkMacOSXCarbonEvents.c @@ -53,30 +53,32 @@ * software in accordance with the terms specified in this * license. * - * RCS: @(#) $Id: tkMacOSXCarbonEvents.c,v 1.3.2.2 2005/08/09 07:39:54 das Exp $ + * RCS: @(#) $Id: tkMacOSXCarbonEvents.c,v 1.3.2.3 2005/09/10 14:54:17 das Exp $ */ #include "tkInt.h" #include "tkMacOSXInt.h" #include "tkMacOSXEvent.h" +#include "tkMacOSXDebug.h" -static EventHandlerRef ApplicationCarbonEventHandler; +/* +#ifdef TK_MAC_DEBUG +#define TK_MAC_DEBUG_CARBON_EVENTS +#endif +*/ -/* Definitions of functions used only in this file */ -static OSStatus AppEventHandlerProc ( +/* Declarations of functions used only in this file */ +static OSStatus CarbonEventHandlerProc ( EventHandlerCallRef callRef, EventRef inEvent, void *userData); - /* *---------------------------------------------------------------------- * - * AppEventHandlerProc -- + * CarbonEventHandlerProc -- * - * This procedure is the Application CarbonEvent - * handler. Currently, it handles the Hide & Show - * events. + * This procedure is the handler for all registered CarbonEvents. * * Results: * None. @@ -88,7 +90,7 @@ static OSStatus AppEventHandlerProc ( */ static OSStatus -AppEventHandlerProc ( +CarbonEventHandlerProc ( EventHandlerCallRef callRef, EventRef inEvent, void *inUserData) @@ -97,15 +99,27 @@ AppEventHandlerProc ( TkMacOSXEvent macEvent; MacEventStatus eventStatus; +#ifdef TK_MAC_DEBUG_CARBON_EVENTS + char buf [256]; + CarbonEventToAscii(inEvent, buf); + fprintf(stderr, "CarbonEventHandlerProc started handling %s\n", buf); + _DebugPrintEvent(inEvent); +#endif /* TK_MAC_DEBUG_CARBON_EVENTS */ + macEvent.eventRef = inEvent; macEvent.eClass = GetEventClass(macEvent.eventRef); macEvent.eKind = GetEventKind(macEvent.eventRef); macEvent.interp = (Tcl_Interp *) inUserData; bzero(&eventStatus, sizeof(eventStatus)); TkMacOSXProcessEvent(&macEvent,&eventStatus); - if (!eventStatus.stopProcessing) { + if (eventStatus.stopProcessing) { result = noErr; } + +#ifdef TK_MAC_DEBUG_CARBON_EVENTS + fprintf(stderr, "CarbonEventHandlerProc finished handling %s: %s handled\n", buf, + eventStatus.stopProcessing ? " " : "not"); +#endif /* TK_MAC_DEBUG_CARBON_EVENTS */ return result; } @@ -114,14 +128,13 @@ AppEventHandlerProc ( * * TkMacOSXInitCarbonEvents -- * - * This procedure initializes the Application CarbonEvent - * handler. + * This procedure initializes all CarbonEvent handlers. * * Results: * None. * * Side effects: - * A handler for Application targeted Carbon Events is registered. + * Handlers for Carbon Events are registered. * *---------------------------------------------------------------------- */ @@ -130,17 +143,60 @@ void TkMacOSXInitCarbonEvents ( Tcl_Interp *interp) { - const EventTypeSpec inAppEventTypes[] = { - {kEventClassApplication, kEventAppHidden}, - {kEventClassApplication, kEventAppShown}, - {kEventClassWindow, kEventWindowExpanded}, + const EventTypeSpec dispatcherEventTypes[] = { + {kEventClassMouse, kEventMouseDown}, + {kEventClassMouse, kEventMouseUp}, + {kEventClassMouse, kEventMouseMoved}, + {kEventClassMouse, kEventMouseDragged}, + {kEventClassMouse, kEventMouseWheelMoved}, + {kEventClassWindow, kEventWindowUpdate}, + {kEventClassWindow, kEventWindowActivated}, + {kEventClassWindow, kEventWindowDeactivated}, + {kEventClassKeyboard, kEventRawKeyDown}, + {kEventClassKeyboard, kEventRawKeyRepeat}, + {kEventClassKeyboard, kEventRawKeyUp}, + {kEventClassKeyboard, kEventRawKeyModifiersChanged}, + {kEventClassKeyboard, kEventRawKeyRepeat}, + {kEventClassApplication, kEventAppActivated}, + {kEventClassApplication, kEventAppDeactivated}, + {kEventClassApplication, kEventAppQuit}, + {kEventClassAppleEvent, kEventAppleEvent}, + }; + const EventTypeSpec applicationEventTypes[] = { + {kEventClassWindow, kEventWindowExpanded}, + {kEventClassApplication, kEventAppHidden}, + {kEventClassApplication, kEventAppShown}, }; + EventHandlerUPP handler = NewEventHandlerUPP(CarbonEventHandlerProc); + + InstallEventHandler(GetEventDispatcherTarget(), handler, + GetEventTypeCount(dispatcherEventTypes), dispatcherEventTypes, + (void *) interp, NULL); + InstallEventHandler(GetApplicationEventTarget(), handler, + GetEventTypeCount(applicationEventTypes), applicationEventTypes, + (void *) interp, NULL); - InstallEventHandler(GetApplicationEventTarget(), - NewEventHandlerUPP(AppEventHandlerProc), - GetEventTypeCount(inAppEventTypes), - inAppEventTypes, (void *) interp, - &ApplicationCarbonEventHandler); - +#ifdef TK_MAC_DEBUG_CARBON_EVENTS + _TraceEventByName(CFSTR("kEventMouseDown")); + _TraceEventByName(CFSTR("kEventMouseUp")); + _TraceEventByName(CFSTR("kEventMouseMoved")); + _TraceEventByName(CFSTR("kEventMouseDragged")); + _TraceEventByName(CFSTR("kEventMouseWheelMoved")); + _TraceEventByName(CFSTR("kEventWindowUpdate")); + _TraceEventByName(CFSTR("kEventWindowActivated")); + _TraceEventByName(CFSTR("kEventWindowDeactivated")); + _TraceEventByName(CFSTR("kEventRawKeyDown")); + _TraceEventByName(CFSTR("kEventRawKeyRepeat")); + _TraceEventByName(CFSTR("kEventRawKeyUp")); + _TraceEventByName(CFSTR("kEventRawKeyModifiersChanged")); + _TraceEventByName(CFSTR("kEventRawKeyRepeat")); + _TraceEventByName(CFSTR("kEventAppActivated")); + _TraceEventByName(CFSTR("kEventAppDeactivated")); + _TraceEventByName(CFSTR("kEventAppQuit")); + _TraceEventByName(CFSTR("kEventAppleEvent")); + _TraceEventByName(CFSTR("kEventWindowExpanded")); + _TraceEventByName(CFSTR("kEventAppHidden")); + _TraceEventByName(CFSTR("kEventAppShown")); +#endif /* TK_MAC_DEBUG_CARBON_EVENTS */ } diff --git a/macosx/tkMacOSXCursor.c b/macosx/tkMacOSXCursor.c index 1db2ff9..d023d4a 100644 --- a/macosx/tkMacOSXCursor.c +++ b/macosx/tkMacOSXCursor.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: tkMacOSXCursor.c,v 1.4.2.1 2004/07/15 05:24:39 wolfsuit Exp $ + * RCS: @(#) $Id: tkMacOSXCursor.c,v 1.4.2.2 2005/09/10 14:54:17 das Exp $ */ #include "tkPort.h" @@ -370,9 +370,9 @@ TkMacOSXInstallCursor( if (cursor) { SetCursor(*cursor); } else { - /* +#ifdef TK_MAC_DEBUG fprintf(stderr,"Resize cursor failed, %d\n", ResError()); - */ +#endif } } else if (macCursorPtr == NULL) { SetThemeCursor(kThemeArrowCursor); diff --git a/macosx/tkMacOSXDebug.c b/macosx/tkMacOSXDebug.c index 7dac4c8..8651bc9 100644 --- a/macosx/tkMacOSXDebug.c +++ b/macosx/tkMacOSXDebug.c @@ -50,11 +50,13 @@ * software in accordance with the terms specified in this * license. * - * RCS: @(#) $Id: tkMacOSXDebug.c,v 1.2.2.2 2005/08/09 07:39:54 das Exp $ + * RCS: @(#) $Id: tkMacOSXDebug.c,v 1.2.2.3 2005/09/10 14:54:17 das Exp $ */ #include "tkMacOSXDebug.h" +#ifdef TK_MAC_DEBUG + typedef struct { EventKind kind; char * name; @@ -439,3 +441,5 @@ char * MouseTrackingResultToAscii(MouseTrackingResult r, char * buf) sprintf(buf, "Unknown mouse tracking result : %d", r); return buf; } + +#endif /* TK_MAC_DEBUG */ diff --git a/macosx/tkMacOSXDebug.h b/macosx/tkMacOSXDebug.h index abcc62f..bb3aa32 100644 --- a/macosx/tkMacOSXDebug.h +++ b/macosx/tkMacOSXDebug.h @@ -50,13 +50,18 @@ * software in accordance with the terms specified in this * license. * - * RCS: @(#) $Id: tkMacOSXDebug.h,v 1.2.2.1 2005/08/09 07:39:54 das Exp $ + * RCS: @(#) $Id: tkMacOSXDebug.h,v 1.2.2.2 2005/09/10 14:54:17 das Exp $ */ #ifndef _TKMACDEBUG #define _TKMACDEBUG #include +/* The following define enables printing of debug messages to stderr: */ +/* #define TK_MAC_DEBUG 1 */ + +#ifdef TK_MAC_DEBUG + char * CarbonEventToAscii(EventRef eventRef, char * buf ); char * ClassicEventToAscii(EventRecord * eventPtr, char * buf ); @@ -68,4 +73,11 @@ void printWindowTitle(char * tag, WindowRef window ); char * TkMacOSXMenuMessageToAscii(int msg, char * s); char * MouseTrackingResultToAscii(MouseTrackingResult r, char * buf ); + +/* Declare Carbon-internal debugging routines (c.f. Technote 2124): */ +void _DebugPrintEvent(EventRef inEvent); +void _TraceEventByName(CFStringRef eventName); + +#endif + #endif diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c index bc7b3c8..37d07f6 100644 --- a/macosx/tkMacOSXDialog.c +++ b/macosx/tkMacOSXDialog.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: tkMacOSXDialog.c,v 1.4.2.7 2005/08/23 22:08:27 hobbs Exp $ + * RCS: @(#) $Id: tkMacOSXDialog.c,v 1.4.2.8 2005/09/10 14:54:17 das Exp $ */ #include @@ -19,10 +19,10 @@ #include "tkFileFilter.h" #ifndef StrLength -#define StrLength(s) (*((unsigned char *) (s))) +#define StrLength(s) (*((unsigned char *) (s))) #endif #ifndef StrBody -#define StrBody(s) ((char *) (s) + 1) +#define StrBody(s) ((char *) (s) + 1) #endif /* @@ -47,14 +47,12 @@ * information about the file dialog and the file filters. */ typedef struct _OpenFileData { - FileFilterList fl; /* List of file filters. */ - SInt16 curType; /* The filetype currently being - * listed. */ - short popupItem; /* Item number of the popup in the - * dialog. */ - int usePopup; /* True if we show the popup menu (this - * is an open operation and the - * -filetypes option is set). */ + FileFilterList fl; /* List of file filters. */ + SInt16 curType; /* The filetype currently being listed. */ + short popupItem; /* Item number of the popup in the dialog. */ + int usePopup; /* True if we show the popup menu (this is + * an open operation and the -filetypes + * option is set). */ } OpenFileData; @@ -755,24 +753,24 @@ NavServicesGetFile( diagOptions.optionFlags += kNavAllowMultipleFiles; } diagOptions.modality = kWindowModalityAppModal; - + if (ofdPtr != NULL && ofdPtr->usePopup) { FileFilter *filterPtr; - + filterPtr = ofdPtr->fl.filters; if (filterPtr == NULL) { ofdPtr->usePopup = 0; } } - - if (ofdPtr != NULL && ofdPtr->usePopup) { + + if (ofdPtr != NULL && ofdPtr->usePopup) { FileFilter *filterPtr; int index = 0; ofdPtr->curType = 0; - + menuItemNames = (CFStringRef *)ckalloc(ofdPtr->fl.numFilters * sizeof(CFStringRef)); - + for (filterPtr = ofdPtr->fl.filters; filterPtr != NULL; filterPtr = filterPtr->next, index++) { menuItemNames[index] = CFStringCreateWithCString(NULL, @@ -780,7 +778,7 @@ NavServicesGetFile( } diagOptions.popupExtension = CFArrayCreate(NULL, (const void **) menuItemNames, ofdPtr->fl.numFilters, NULL); - } else { + } else { diagOptions.optionFlags += kNavNoTypePopup; diagOptions.popupExtension = NULL; } @@ -820,21 +818,27 @@ NavServicesGetFile( ofdPtr, &dialogRef); if (err != noErr) { +#ifdef TK_MAC_DEBUG fprintf(stderr,"NavCreateGetFileDialog failed, %d\n", err ); +#endif dialogRef = NULL; } } else if (isOpen == SAVE_FILE) { err = NavCreatePutFileDialog(&diagOptions, 'TEXT', 'WIsH', openFileEventUPP, NULL, &dialogRef); if (err!=noErr){ +#ifdef TK_MAC_DEBUG fprintf(stderr,"NavCreatePutFileDialog failed, %d\n", err ); +#endif dialogRef = NULL; } } else if (isOpen == CHOOSE_FOLDER) { err = NavCreateChooseFolderDialog(&diagOptions, openFileEventUPP, openFileFilterUPP, NULL, &dialogRef); if (err!=noErr){ +#ifdef TK_MAC_DEBUG fprintf(stderr,"NavCreateChooseFolderDialog failed, %d\n", err ); +#endif dialogRef = NULL; } } @@ -849,10 +853,14 @@ NavServicesGetFile( } if ((err = NavDialogRun(dialogRef)) != noErr ){ +#ifdef TK_MAC_DEBUG fprintf(stderr,"NavDialogRun failed, %d\n", err ); +#endif } else { if ((err = NavDialogGetReply(dialogRef, &theReply)) != noErr) { +#ifdef TK_MAC_DEBUG fprintf(stderr,"NavGetReply failed, %d\n", err ); +#endif } } } @@ -887,10 +895,14 @@ NavServicesGetFile( if (err == noErr) { if ((err = AEGetDescData(&resultDesc, &fsRef, sizeof(fsRef))) != noErr ) { +#ifdef TK_MAC_DEBUG fprintf(stderr,"AEGetDescData failed %d\n", err ); +#endif } else { if ((err = FSRefMakePath(&fsRef, (unsigned char*) pathPtr, 1024))) { +#ifdef TK_MAC_DEBUG fprintf(stderr,"FSRefMakePath failed, %d\n", err ); +#endif } else { if (isOpen == SAVE_FILE) { CFStringRef saveNameRef; @@ -903,13 +915,19 @@ NavServicesGetFile( strcat(pathPtr, saveName); pathValid = 1; } else { +#ifdef TK_MAC_DEBUG fprintf(stderr, "Path name too long\n"); +#endif } } else { +#ifdef TK_MAC_DEBUG fprintf(stderr, "CFStringGetCString failed\n"); +#endif } } else { +#ifdef TK_MAC_DEBUG fprintf(stderr, "NavDialogGetSaveFileName failed\n"); +#endif } } else { pathValid = 1; diff --git a/macosx/tkMacOSXEvent.c b/macosx/tkMacOSXEvent.c index 46e563f..3315310 100644 --- a/macosx/tkMacOSXEvent.c +++ b/macosx/tkMacOSXEvent.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: tkMacOSXEvent.c,v 1.3.2.2 2005/08/09 07:39:55 das Exp $ + * RCS: @(#) $Id: tkMacOSXEvent.c,v 1.3.2.3 2005/09/10 14:54:17 das Exp $ */ #include @@ -18,32 +18,17 @@ #include "tkMacOSXEvent.h" #include "tkMacOSXDebug.h" -/* - * Enable this define to get debug printing for events not handled. - */ - - /*#define TK_MAC_DEBUG 1 */ - /* * Forward declarations of procedures used in this file. */ static int TkMacOSXProcessAppleEvent( TkMacOSXEvent * eventPtr, MacEventStatus * statusPtr); - -static int ReceiveAndProcessEvent (void); - -/* - * Global data used in this file. - */ - -static EventTargetRef targetRef; - /* *---------------------------------------------------------------------- * - * tkMacOSXFlushWindows -- + * TkMacOSXFlushWindows -- * * This routine flushes all the Carbon windows of the application. It * is called by the setup procedure for the Tcl/Carbon event source. @@ -58,7 +43,7 @@ static EventTargetRef targetRef; */ void -tkMacOSXFlushWindows () +TkMacOSXFlushWindows () { WindowRef wRef = GetWindowList(); @@ -70,53 +55,7 @@ tkMacOSXFlushWindows () wRef = GetNextWindow(wRef); } } - - - -int -XSync (Display *display, Bool flag) -{ - tkMacOSXFlushWindows(); - display->request++; - return 0; -} - -/* - *---------------------------------------------------------------------- - * - * TkMacOSXCountAndProcessMacEvents -- - * - * This routine receives any Carbon events that are in the queue and - * converts them to Tk events. It is called by the event set-up and - * check routines - * - * Results: - * The number of events in the queue. - * - * Side effects: - * Tells the Window Manager to deliver events to the event queue of the - * current thread. Receives any Carbon events on the queue and converts - * them to Tk events. - * - *---------------------------------------------------------------------- - */ - -int -TkMacOSXCountAndProcessMacEvents() -{ - EventQueueRef qPtr; - int eventCount; - qPtr = GetMainEventQueue(); - eventCount = GetNumEventsInQueue(qPtr); - if (eventCount) { - int n, err; - for (n = 0, err = 0;neventRef, buf1), ClassicEventToAscii(&eventRecord,buf2), err); +#endif statusPtr->err = 1; } } else { - statusPtr->err = 1; +#ifdef TK_MAC_DEBUG fprintf(stderr,"ConvertEventRefToEventRecord failed\n"); +#endif + statusPtr->err = 1; } return 0; } @@ -201,14 +144,10 @@ TkMacOSXProcessEvent(TkMacOSXEvent * eventPtr, MacEventStatus * statusPtr) case kEventClassAppleEvent: TkMacOSXProcessAppleEvent(eventPtr, statusPtr); break; - case kEventClassWish: - statusPtr->stopProcessing = 1; - break; default: #ifdef TK_MAC_DEBUG - if (0) { - char buf [ 256 ]; + char buf [256]; fprintf(stderr, "Unrecognised event : %s\n", CarbonEventToAscii(eventPtr->eventRef, buf)); @@ -222,7 +161,7 @@ TkMacOSXProcessEvent(TkMacOSXEvent * eventPtr, MacEventStatus * statusPtr) /* *---------------------------------------------------------------------- * - * ReceiveAndProcessEvent -- + * TkMacOSXReceiveAndProcessEvent -- * * This receives a carbon event and converts it to a Tk event * @@ -237,46 +176,35 @@ TkMacOSXProcessEvent(TkMacOSXEvent * eventPtr, MacEventStatus * statusPtr) *---------------------------------------------------------------------- */ -static int -ReceiveAndProcessEvent() +OSStatus +TkMacOSXReceiveAndProcessEvent() { - TkMacOSXEvent macEvent; - MacEventStatus eventStatus; - int err; - char buf [ 256 ]; + static EventTargetRef targetRef = NULL; + EventRef eventRef; + OSStatus err; /* * This is a poll, since we have already counted the events coming * into this routine, and are guaranteed to have one waiting. */ - err = ReceiveNextEvent(0, NULL, kEventDurationNoWait, - true, &macEvent.eventRef); - if (err != noErr) { - return err; - } else { - macEvent.eClass = GetEventClass(macEvent.eventRef); - macEvent.eKind = GetEventKind(macEvent.eventRef); - macEvent.interp = NULL; - bzero(&eventStatus, sizeof(eventStatus)); - TkMacOSXProcessEvent(&macEvent,&eventStatus); - if (!eventStatus.stopProcessing) { - if (!targetRef) { - targetRef = GetEventDispatcherTarget(); - } - - err = SendEventToEventTarget(macEvent.eventRef,targetRef); - if (err != noErr -#if !TK_MAC_DEBUG - && err != eventNotHandledErr + err = ReceiveNextEvent(0, NULL, kEventDurationNoWait, true, &eventRef); + if (err == noErr) { + if (!targetRef) { + targetRef = GetEventDispatcherTarget(); + } + err = SendEventToEventTarget(eventRef,targetRef); +#ifdef TK_MAC_DEBUG + if (err != noErr && err != eventLoopTimedOutErr + && err != eventNotHandledErr + ) { + char buf [256]; + fprintf(stderr, + "RCNE SendEventToEventTarget (%s) failed, %d\n", + CarbonEventToAscii(eventRef, buf), (int)err); + } #endif - ) { - fprintf(stderr, - "RCNE SendEventToEventTarget (%s) failed, %d\n", - CarbonEventToAscii(macEvent.eventRef, buf),err); - } - } - ReleaseEvent(macEvent.eventRef); - return 0; - } + ReleaseEvent(eventRef); + } + return err; } diff --git a/macosx/tkMacOSXEvent.h b/macosx/tkMacOSXEvent.h index 5764b92..1300e91 100644 --- a/macosx/tkMacOSXEvent.h +++ b/macosx/tkMacOSXEvent.h @@ -50,7 +50,7 @@ * software in accordance with the terms specified in this * license. * - * RCS: @(#) $Id: tkMacOSXEvent.h,v 1.3.2.1 2005/08/09 07:39:55 das Exp $ + * RCS: @(#) $Id: tkMacOSXEvent.h,v 1.3.2.2 2005/09/10 14:54:17 das Exp $ */ #ifndef _TKMACEVENT @@ -59,10 +59,6 @@ #include #include -enum { - kEventClassWish = 'WiSH' -}; - typedef struct { int stopProcessing; int err; @@ -79,13 +75,18 @@ typedef struct { Tcl_Interp *interp; /* Interp to handle events in */ } TkMacOSXEvent; -int TkMacOSXCountAndProcessMacEvents _ANSI_ARGS_(()); -void tkMacOSXFlushWindows _ANSI_ARGS_(()); -int TkMacOSXProcessEvent(TkMacOSXEvent * eventPtr, MacEventStatus * statusPtr); -int TkMacOSXProcessMouseEvent(TkMacOSXEvent * e, MacEventStatus * statusPtr); -int TkMacOSXProcessWindowEvent(TkMacOSXEvent * e, MacEventStatus * statusPtr); -int TkMacOSXProcessKeyboardEvent(TkMacOSXEvent * e, MacEventStatus * statusPtr); -int TkMacOSXProcessApplicationEvent(TkMacOSXEvent * e, MacEventStatus * statusPtr); +OSStatus TkMacOSXReceiveAndProcessEvent(); +void TkMacOSXFlushWindows(); +int TkMacOSXProcessEvent(TkMacOSXEvent *eventPtr, + MacEventStatus *statusPtr); +int TkMacOSXProcessMouseEvent(TkMacOSXEvent *e, + MacEventStatus *statusPtr); +int TkMacOSXProcessWindowEvent(TkMacOSXEvent *e, + MacEventStatus *statusPtr); +int TkMacOSXProcessKeyboardEvent(TkMacOSXEvent *e, + MacEventStatus *statusPtr); +int TkMacOSXProcessApplicationEvent(TkMacOSXEvent *e, + MacEventStatus *statusPtr); int TkMacOSXKeycodeToUnicode( UniChar * uniChars, int maxChars, diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c index 0902388..7498514 100644 --- a/macosx/tkMacOSXInit.c +++ b/macosx/tkMacOSXInit.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXInit.c,v 1.3.2.9 2005/08/09 07:40:00 das Exp $ + * RCS: @(#) $Id: tkMacOSXInit.c,v 1.3.2.10 2005/09/10 14:54:17 das Exp $ */ #include "tkInt.h" @@ -207,7 +207,9 @@ TkpInit(interp) err = FSPathMakeRef(fileName, &ref, NULL); if (err != noErr) break; err = FSOpenResourceFile(&ref, 0, NULL, fsRdPerm, &refNum); +#ifdef TK_MAC_DEBUG if (err != noErr) fprintf(stderr,"FSOpenResourceFile error %ld\n",err); +#endif break; } if (fd != -1) { diff --git a/macosx/tkMacOSXKeyEvent.c b/macosx/tkMacOSXKeyEvent.c index 0429cb2..10b430e 100644 --- a/macosx/tkMacOSXKeyEvent.c +++ b/macosx/tkMacOSXKeyEvent.c @@ -50,7 +50,7 @@ * software in accordance with the terms specified in this * license. * - * RCS: @(#) $Id: tkMacOSXKeyEvent.c,v 1.6.2.4 2005/08/09 07:40:00 das Exp $ + * RCS: @(#) $Id: tkMacOSXKeyEvent.c,v 1.6.2.5 2005/09/10 14:54:17 das Exp $ */ #include "tkMacOSXInt.h" @@ -135,7 +135,8 @@ static int KeycodeToUnicodeViaKCHRResource( *---------------------------------------------------------------------- */ -int TkMacOSXProcessKeyboardEvent( +int +TkMacOSXProcessKeyboardEvent( TkMacOSXEvent * eventPtr, MacEventStatus * statusPtr) { @@ -201,7 +202,9 @@ int TkMacOSXProcessKeyboardEvent( sizeof(keyEventData.ch), NULL, &keyEventData.ch); if (status != noErr) { +#ifdef TK_MAC_DEBUG fprintf (stderr, "Failed to retrieve KeyMacCharCodes\n"); +#endif statusPtr->err = 1; return false; } @@ -211,7 +214,9 @@ int TkMacOSXProcessKeyboardEvent( sizeof(keyEventData.keyCode), NULL, &keyEventData.keyCode); if (status != noErr) { +#ifdef TK_MAC_DEBUG fprintf (stderr, "Failed to retrieve KeyCode\n"); +#endif statusPtr->err = 1; return false; } @@ -221,7 +226,9 @@ int TkMacOSXProcessKeyboardEvent( sizeof(keyEventData.keyModifiers), NULL, &keyEventData.keyModifiers); if (status != noErr) { +#ifdef TK_MAC_DEBUG fprintf (stderr, "Failed to retrieve KeyModifiers\n"); +#endif statusPtr->err = 1; return false; } @@ -398,9 +405,11 @@ GenerateKeyEvent( Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL); break; default: +#ifdef TK_MAC_DEBUG fprintf (stderr, "GenerateKeyEvent(): Invalid parameter eKind %d\n", (int) eKind); +#endif return -1; } } @@ -950,10 +959,12 @@ KeycodeToUnicodeViaUnicodeResource( action = kUCKeyActionAutoKey; break; default: +#ifdef TK_MAC_DEBUG fprintf (stderr, "KeycodeToUnicodeViaUnicodeResource(): " "Invalid parameter eKind %d\n", (int) eKind); +#endif return 0; } @@ -978,7 +989,9 @@ KeycodeToUnicodeViaUnicodeResource( *deadKeyStatePtr = 0; if (noErr != status) { +#ifdef TK_MAC_DEBUG fprintf(stderr,"UCKeyTranslate failed: %d", (int) status); +#endif actuallength = 0; } @@ -1101,8 +1114,10 @@ KeycodeToUnicodeViaKCHRResource( cfString = CFStringCreateWithCStringNoCopy( NULL, macStr, encoding, kCFAllocatorNull); if (cfString == NULL) { +#ifdef TK_MAC_DEBUG fprintf(stderr, "CFString: Can't convert with encoding %d\n", (int) encoding); +#endif return 0; } diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c index f4ed585..2b4914e 100644 --- a/macosx/tkMacOSXMenu.c +++ b/macosx/tkMacOSXMenu.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: tkMacOSXMenu.c,v 1.6.2.9 2005/08/09 07:40:00 das Exp $ + * RCS: @(#) $Id: tkMacOSXMenu.c,v 1.6.2.10 2005/09/10 14:54:17 das Exp $ */ #include "tkMacOSXInt.h" #include "tkMenubutton.h" @@ -576,7 +576,9 @@ TkpNewMenu( menuDefSpec.defType = kMenuDefProcPtr; menuDefSpec.u.defProc = MenuDefProc; if ((err = SetMenuDefinition(macMenuHdl, &menuDefSpec)) != noErr) { +#ifdef TK_MAC_DEBUG fprintf(stderr, "SetMenuDefinition failed %d\n", err ); +#endif } } menuPtr->platformData = (TkMenuPlatformData) ckalloc(sizeof(MacMenu)); @@ -3458,7 +3460,9 @@ DrawMenuEntryLabel( GetThemeFont (kThemeMenuItemFont, smSystemScript, fontName, &fontSize, &fontStyle); if ((err = ATSUCreateStyle(&style)) != noErr) { +#ifdef TK_MAC_DEBUG fprintf(stderr,"ATSUCreateStyle failed, %d\n", err); +#endif return; } fixedSize = fontSize<<16; @@ -3467,7 +3471,9 @@ DrawMenuEntryLabel( valuePtr = &fixedSize; err = ATSUSetAttributes(style, 1, &tag, &valueSize, &valuePtr); if (err != noErr) { +#ifdef TK_MAC_DEBUG fprintf(stderr,"ATSUSetAttributes failed,%d\n", err ); +#endif } GetFNum(fontName, &iFONDNumber); @@ -3477,7 +3483,9 @@ DrawMenuEntryLabel( valuePtr = &fontID; err = ATSUSetAttributes(style, 1, &tag, &valueSize, &valuePtr); if (err != noErr) { +#ifdef TK_MAC_DEBUG fprintf(stderr,"ATSUSetAttributes failed,%d\n", err ); +#endif } #endif @@ -3489,13 +3497,17 @@ DrawMenuEntryLabel( stringRef = CFStringCreateWithCString(NULL, Tcl_DStringValue(&itemTextDString), kCFStringEncodingUTF8); if (!stringRef) { +#ifdef TK_MAC_DEBUG fprintf(stderr,"CFStringCreateWithCString failed\n"); +#endif } err = ATSUCreateTextLayoutWithTextPtr(CFStringGetCharactersPtr(stringRef), 0, length, length, 1, &runLengths, &style, &textLayout) if (err != noErr) { +#ifdef TK_MAC_DEBUG fprintf(stderr,"ATSUCreateTextLayoutWithTextPtr failed, %d\n", err); +#endif return; } #endif @@ -4050,7 +4062,9 @@ HandleMenuHiliteMsg (MenuRef menu, err = GetMenuTrackingData(menu, mtdPtr); if (err !=noErr) { +#ifdef TK_MAC_DEBUG fprintf(stderr,"GetMenuTrackingData failed : %d\n", err ); +#endif return; } diff --git a/macosx/tkMacOSXMenubutton.c b/macosx/tkMacOSXMenubutton.c index 4721b45..67d84ca 100644 --- a/macosx/tkMacOSXMenubutton.c +++ b/macosx/tkMacOSXMenubutton.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXMenubutton.c,v 1.2.2.2 2005/05/14 20:53:31 das Exp $ + * RCS: @(#) $Id: tkMacOSXMenubutton.c,v 1.2.2.3 2005/09/10 14:54:17 das Exp $ */ #include @@ -214,7 +214,9 @@ TkpDisplayMenuButton( } if (!mbPtr->userPane) { if (MenuButtonInitControl(mbPtr,&paneRect,&cntrRect ) ) { +#ifdef TK_MAC_DEBUG fprintf(stderr,"Init Control failed\n" ); +#endif return; } } @@ -248,7 +250,9 @@ TkpDisplayMenuButton( if (hasImageOrBitmap) { err = SetControlFontStyle(mbPtr->control,&titleParams.style); if (err !=noErr) { +#ifdef TK_MAC_DEBUG fprintf(stderr,"SetControlFontStyle failed %d\n", err); +#endif return; } } @@ -268,7 +272,9 @@ TkpDisplayMenuButton( /* Set the flag to circumvent clipping and bounds problems with OS 10.0.4 */ tkPictureIsOpen = 1; if (!(mbPtr->bevelButtonContent.u.picture = OpenCPicture(&mbPtr->picParams)) ) { +#ifdef TK_MAC_DEBUG fprintf(stderr,"OpenCPicture failed\n"); +#endif } /* * TO DO - There is one case where XCopyPlane calls CopyDeepMask, @@ -290,7 +296,9 @@ TkpDisplayMenuButton( sizeof(ControlButtonContentInfo), (char *) &mbPtr->bevelButtonContent); if (err != noErr) { +#ifdef TK_MAC_DEBUG fprintf(stderr,"SetControlData BevelButtonContent failed, %d\n", err ); +#endif } switch (butPtr->anchor) { case TK_ANCHOR_N: @@ -327,7 +335,9 @@ TkpDisplayMenuButton( sizeof(ControlButtonGraphicAlignment), (char *) &theAlignment); if (err != noErr ) { +#ifdef TK_MAC_DEBUG fprintf(stderr,"SetControlData BevelButtonGraphicAlign failed, %d\n", err ); +#endif } } if (butPtr->flags & GOT_FOCUS) { @@ -628,12 +638,16 @@ MenuButtonInitControl ( procID, controlReference ); if (!mbPtr->userPane) { +#ifdef TK_MAC_DEBUG fprintf(stderr,"Failed to create user pane control\n"); +#endif return 1; } status = EmbedControl(mbPtr->userPane,rootControl); if (status != noErr) { +#ifdef TK_MAC_DEBUG fprintf(stderr,"Failed to embed user pane control %d\n", status); +#endif return 1; } SetUserPaneSetUpSpecialBackgroundProc(mbPtr->userPane, @@ -652,12 +666,16 @@ MenuButtonInitControl ( mbPtr->params.procID, controlReference ); if (!mbPtr->control) { +#ifdef TK_MAC_DEBUG fprintf(stderr,"failed to create control of type %d : line %d\n",mbPtr->params.procID, __LINE__); +#endif return 1; } err = EmbedControl(mbPtr->control,mbPtr->userPane); if (err != noErr ) { +#ifdef TK_MAC_DEBUG fprintf(stderr,"failed to embed control of type %d,%d\n",procID, err); +#endif return 1; } if (mbPtr->params.isBevel) { @@ -669,7 +687,9 @@ MenuButtonInitControl ( if (mbPtr->titleParams.len) { err = SetControlFontStyle(mbPtr->control,&mbPtr->titleParams.style); if (err !=noErr) { +#ifdef TK_MAC_DEBUG fprintf(stderr,"SetControlFontStyle failed %d\n", err); +#endif return 1; } } diff --git a/macosx/tkMacOSXMouseEvent.c b/macosx/tkMacOSXMouseEvent.c index 3f911d7..1c63fdf 100644 --- a/macosx/tkMacOSXMouseEvent.c +++ b/macosx/tkMacOSXMouseEvent.c @@ -50,7 +50,7 @@ * software in accordance with the terms specified in this * license. * - * RCS: @(#) $Id: tkMacOSXMouseEvent.c,v 1.6.2.7 2005/08/09 07:40:01 das Exp $ + * RCS: @(#) $Id: tkMacOSXMouseEvent.c,v 1.6.2.8 2005/09/10 14:54:17 das Exp $ */ #include "tkInt.h" @@ -82,7 +82,7 @@ static int gEatButtonUp = 0; /* 1 if we need to eat the next * up event */ * Declarations of functions used only in this file. */ -static void BringWindowForward _ANSI_ARGS_((WindowRef wRef)); +static void BringWindowForward(WindowRef wRef, Boolean isFrontProcess); static int GeneratePollingEvents(MouseEventData * medPtr); static int GenerateMouseWheelEvent(MouseEventData * medPtr); static int GenerateButtonEvent(MouseEventData * medPtr); @@ -201,8 +201,10 @@ TkMacOSXProcessMouseEvent(TkMacOSXEvent *eventPtr, MacEventStatus * statusPtr) typeLongInteger, NULL, sizeof(long), NULL, &medPtr->delta); if (status != noErr ) { +#ifdef TK_MAC_DEBUG fprintf (stderr, - "Failed to retrieve mouse wheel delta, %d\n", (int)status); + "Failed to retrieve mouse wheel delta, %d\n", (int) status); +#endif statusPtr->err = 1; return false; } @@ -231,9 +233,18 @@ TkMacOSXProcessMouseEvent(TkMacOSXEvent *eventPtr, MacEventStatus * statusPtr) * the corresponding mouse-up to be reported to the application * or else it will mess up some Tk scripts. */ - + + ProcessSerialNumber frontPsn, ourPsn = {0, kCurrentProcess}; + Boolean isFrontProcess = true; + + status = GetFrontProcess(&frontPsn); + if (status == noErr) { + SameProcess(&frontPsn, &ourPsn, &isFrontProcess); + } + if (!(TkpIsWindowFloating(medPtr->whichWin)) - && (medPtr->whichWin != medPtr->activeNonFloating)) { + && (medPtr->whichWin != medPtr->activeNonFloating + || !isFrontProcess)) { Tk_Window grabWin = TkMacOSXGetCapture(); if ((grabWin == NULL)) { int grabState = TkGrabState((TkWindow*)tkwin); @@ -241,7 +252,9 @@ TkMacOSXProcessMouseEvent(TkMacOSXEvent *eventPtr, MacEventStatus * statusPtr) /* Now we want to set the focus to the local grabWin */ TkMacOSXSetEatButtonUp(true); grabWin = (Tk_Window) (((TkWindow*)tkwin)->dispPtr->grabWinPtr); - BringWindowForward(GetWindowFromPort(TkMacOSXGetDrawablePort(((TkWindow*)grabWin)->window))); + BringWindowForward(GetWindowFromPort( + TkMacOSXGetDrawablePort(((TkWindow*)grabWin)->window)), + isFrontProcess); statusPtr->stopProcessing = 1; return false; } @@ -252,7 +265,9 @@ TkMacOSXProcessMouseEvent(TkMacOSXEvent *eventPtr, MacEventStatus * statusPtr) grb = (TkWindow *)grabWin; /* Now we want to set the focus to the global grabWin */ TkMacOSXSetEatButtonUp(true); - BringWindowForward(GetWindowFromPort(TkMacOSXGetDrawablePort(((TkWindow*)grabWin)->window))); + BringWindowForward(GetWindowFromPort( + TkMacOSXGetDrawablePort(((TkWindow*)grabWin)->window)), + isFrontProcess); statusPtr->stopProcessing = 1; return false; } @@ -265,13 +280,12 @@ TkMacOSXProcessMouseEvent(TkMacOSXEvent *eventPtr, MacEventStatus * statusPtr) return result; } else { TkMacOSXSetEatButtonUp(true); - BringWindowForward(medPtr->whichWin); + BringWindowForward(medPtr->whichWin, isFrontProcess); return false; } } } - if ((result = HandleWindowTitlebarMouseDown(medPtr, tkwin)) != -1) { return result; } @@ -488,32 +502,17 @@ GeneratePollingEvents(MouseEventData * medPtr) */ static void -BringWindowForward(WindowRef wRef) +BringWindowForward(WindowRef wRef, Boolean isFrontProcess) { - do { - ProcessSerialNumber frontPsn, ourPsn = {0, kCurrentProcess}; - Boolean flag; - int err; - - err = GetFrontProcess(&frontPsn); - if (err != noErr) { - fprintf(stderr, "GetFrontProcess failed, %d\n", err); - break; + if (!isFrontProcess) { + ProcessSerialNumber ourPsn = {0, kCurrentProcess}; + OSStatus status = SetFrontProcess(&ourPsn); + if (status != noErr) { +#ifdef TK_MAC_DEBUG + fprintf(stderr,"SetFrontProcess failed, %d\n", (int) status); +#endif } - err = SameProcess(&frontPsn, &ourPsn, &flag); - if (err != noErr) { - fprintf(stderr, "SameProcess failed, %d\n", err); - break; - } else { - if (!flag) { - err = SetFrontProcess(&ourPsn); - if (err != noErr) { - fprintf(stderr,"SetFrontProcess failed,%d\n", err); - break; - } - } - } - } while (0); + } if (!TkpIsWindowFloating(wRef)) { if (IsValidWindowPtr(wRef)) diff --git a/macosx/tkMacOSXNotify.c b/macosx/tkMacOSXNotify.c index 0ecccd2..78f159b 100644 --- a/macosx/tkMacOSXNotify.c +++ b/macosx/tkMacOSXNotify.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXNotify.c,v 1.5.2.5 2005/05/29 07:00:47 das Exp $ + * RCS: @(#) $Id: tkMacOSXNotify.c,v 1.5.2.6 2005/09/10 14:54:18 das Exp $ */ #include "tclInt.h" @@ -170,11 +170,21 @@ CarbonEventsCheckProc(clientData, flags) ClientData clientData; int flags; { + int numFound; + OSStatus err = noErr; + if (!(flags & TCL_WINDOW_EVENTS)) { return; } - if (GetNumEventsInQueue((EventQueueRef)clientData)) { - TkMacOSXCountAndProcessMacEvents(); + numFound = GetNumEventsInQueue((EventQueueRef)clientData); + + /* Avoid starving other event sources: */ + if (numFound > 4) { + numFound = 4; + } + while (numFound > 0 && err == noErr) { + err = TkMacOSXReceiveAndProcessEvent(); + numFound--; } } diff --git a/macosx/tkMacOSXScale.c b/macosx/tkMacOSXScale.c index 709b3e4..7a5c4a2 100644 --- a/macosx/tkMacOSXScale.c +++ b/macosx/tkMacOSXScale.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXScale.c,v 1.2.2.2 2005/08/09 07:40:01 das Exp $ + * RCS: @(#) $Id: tkMacOSXScale.c,v 1.2.2.3 2005/09/10 14:54:18 das Exp $ */ #include "tkScale.h" @@ -153,7 +153,9 @@ TkpDisplayScale(clientData) UInt16 numTicks; +#ifdef TK_MAC_DEBUG fprintf(stderr,"TkpDisplayScale\n"); +#endif scalePtr->flags &= ~REDRAW_PENDING; if ((scalePtr->tkwin == NULL) || !Tk_IsMapped(scalePtr->tkwin)) { goto done; @@ -244,7 +246,9 @@ TkpDisplayScale(clientData) if (macScalePtr->scaleHandle == NULL) { +#ifdef TK_MAC_DEBUG fprintf(stderr,"Initialising scale\n"); +#endif initialValue = scalePtr->value; if (scalePtr->orient == ORIENT_HORIZONTAL) { @@ -323,7 +327,9 @@ TkpScaleElement(scalePtr, x, y) CGrafPtr saveWorld; GDHandle saveDevice; GWorldPtr destPort; +#ifdef TK_MAC_DEBUG fprintf(stderr,"TkpScaleElement\n"); +#endif destPort = TkMacOSXGetDrawablePort(Tk_WindowId(scalePtr->tkwin)); GetGWorld(&saveWorld, &saveDevice); @@ -341,7 +347,9 @@ TkpScaleElement(scalePtr, x, y) SetGWorld(saveWorld, saveDevice); +#ifdef TK_MAC_DEBUG fprintf (stderr,"ScalePart %d, pos ( %d %d )\n", part, where.h, where.v ); +#endif switch (part) { case inSlider: @@ -396,7 +404,9 @@ MacScaleEventProc(clientData, eventPtr) GWorldPtr destPort; Window dummyWin; +#ifdef TK_MAC_DEBUG fprintf(stderr,"MacScaleEventProc\n" ); +#endif /* * To call Macintosh control routines we must have the port * set to the window containing the control. We will then test @@ -410,7 +420,9 @@ MacScaleEventProc(clientData, eventPtr) TkMacOSXWinBounds((TkWindow *) macScalePtr->info.tkwin, &bounds); where.h = eventPtr->xbutton.x + bounds.left; where.v = eventPtr->xbutton.y + bounds.top; +#ifdef TK_MAC_DEBUG fprintf(stderr,"calling TestControl\n"); +#endif part = TestControl(macScalePtr->scaleHandle, where); if (part == 0) { return; @@ -461,7 +473,9 @@ ScaleActionProc( int value; TkScale *scalePtr = (TkScale *) GetControlReference(theControl); +#ifdef TK_MAC_DEBUG fprintf(stderr,"ScaleActionProc\n"); +#endif value = GetControlValue(theControl); TkScaleSetValue(scalePtr, value, 1, 1); Tcl_Preserve((ClientData) scalePtr); diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c index 366c1c8..c960f10 100644 --- a/macosx/tkMacOSXWindowEvent.c +++ b/macosx/tkMacOSXWindowEvent.c @@ -50,7 +50,7 @@ * software in accordance with the terms specified in this * license. * - * RCS: @(#) $Id: tkMacOSXWindowEvent.c,v 1.3.2.3 2005/08/09 07:40:01 das Exp $ + * RCS: @(#) $Id: tkMacOSXWindowEvent.c,v 1.3.2.4 2005/09/10 14:54:18 das Exp $ */ #include "tkMacOSXInt.h" @@ -122,10 +122,7 @@ TkMacOSXProcessApplicationEvent( HideFloatingWindows(); break; case kEventAppQuit: - case kEventAppLaunchNotification: - case kEventAppLaunched: - case kEventAppTerminated: - case kEventAppFrontSwitched: + statusPtr->stopProcessing = 1; break; case kEventAppHidden: /* @@ -202,7 +199,9 @@ TkMacOSXProcessWindowEvent( sizeof(whichWindow), NULL, &whichWindow); if (status != noErr) { +#ifdef TK_MAC_DEBUG fprintf ( stderr, "TkMacOSXHandleWindowEvent:Failed to retrieve window" ); +#endif return 0; } diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index f3087fb..9c1c6db 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXWm.c,v 1.7.2.12 2005/08/09 07:40:01 das Exp $ + * RCS: @(#) $Id: tkMacOSXWm.c,v 1.7.2.13 2005/09/10 14:54:18 das Exp $ */ #include @@ -5180,8 +5180,10 @@ TkMacOSXUnregisterMacWindow( } entryPtr = Tcl_FindHashEntry(&windowTable,(char *) macWinPtr); if (!entryPtr) { +#ifdef TK_MAC_DEBUG fprintf(stderr,"Unregister:failed to find window %08x\n", (int) macWinPtr ); +#endif } else { Tcl_DeleteHashEntry(entryPtr); diff --git a/macosx/tkMacOSXXStubs.c b/macosx/tkMacOSXXStubs.c index 8da13aa..7942c9e 100644 --- a/macosx/tkMacOSXXStubs.c +++ b/macosx/tkMacOSXXStubs.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXXStubs.c,v 1.2.2.7 2005/08/09 07:40:02 das Exp $ + * RCS: @(#) $Id: tkMacOSXXStubs.c,v 1.2.2.8 2005/09/10 14:54:18 das Exp $ */ #include "tkInt.h" @@ -707,6 +707,14 @@ Tk_FreeXId ( { /* no-op function needed for stubs implementation. */ } + +int +XSync (Display *display, Bool flag) +{ + TkMacOSXFlushWindows(); + display->request++; + return 0; +} /* *---------------------------------------------------------------------- diff --git a/unix/configure b/unix/configure index dca87ba..2764971 100755 --- a/unix/configure +++ b/unix/configure @@ -4676,6 +4676,12 @@ EOF LIBS="$LIBS -framework Carbon" CFLAGS="$CFLAGS -fpascal-strings" TK_WINDOWINGSYSTEM=AQUA + if test "${enable_symbols+set}" = set; then + cat >> confdefs.h <<\EOF +#define TK_MAC_DEBUG 1 +EOF + + fi else #-------------------------------------------------------------------- # Locate the X11 header files and the X11 library archive. Try @@ -4692,7 +4698,7 @@ else # Uses ac_ vars as temps to allow command line to override cache and checks. # --without-x overrides everything else, but does not touch the cache. echo $ac_n "checking for X""... $ac_c" 1>&6 -echo "configure:4696: checking for X" >&5 +echo "configure:4702: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then @@ -4754,12 +4760,12 @@ if test "$ac_x_includes" = NO; then # First, try using that file with no special directory specified. cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4763: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4769: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4828,14 +4834,14 @@ if test "$ac_x_libraries" = NO; then ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4845: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* LIBS="$ac_save_LIBS" # We can link X programs with no special library path. @@ -4925,12 +4931,12 @@ fi if test "$no_x" = ""; then if test "$x_includes" = ""; then cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4934: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4940: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -4950,15 +4956,15 @@ rm -f conftest* fi if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then echo $ac_n "checking for X11 header files""... $ac_c" 1>&6 -echo "configure:4954: checking for X11 header files" >&5 +echo "configure:4960: checking for X11 header files" >&5 found_xincludes="no" cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4962: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4968: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4994,7 +5000,7 @@ rm -f conftest* if test "$no_x" = yes; then echo $ac_n "checking for X11 libraries""... $ac_c" 1>&6 -echo "configure:4998: checking for X11 libraries" >&5 +echo "configure:5004: checking for X11 libraries" >&5 XLIBSW=nope dirs="/usr/unsupported/lib /usr/local/lib /usr/X386/lib /usr/X11R6/lib /usr/X11R5/lib /usr/lib/X11R5 /usr/lib/X11R4 /usr/openwin/lib /usr/X11/lib /usr/sww/X11/lib" for i in $dirs ; do @@ -5014,7 +5020,7 @@ echo "configure:4998: checking for X11 libraries" >&5 fi if test "$XLIBSW" = nope ; then echo $ac_n "checking for XCreateWindow in -lXwindow""... $ac_c" 1>&6 -echo "configure:5018: checking for XCreateWindow in -lXwindow" >&5 +echo "configure:5024: checking for XCreateWindow in -lXwindow" >&5 ac_lib_var=`echo Xwindow'_'XCreateWindow | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5022,7 +5028,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lXwindow $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5043: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5110,7 +5116,7 @@ eval "LD_SEARCH_FLAGS=\"$TCL_LD_SEARCH_FLAGS\"" if test $tk_aqua = no; then echo $ac_n "checking for main in -lXbsd""... $ac_c" 1>&6 -echo "configure:5114: checking for main in -lXbsd" >&5 +echo "configure:5120: checking for main in -lXbsd" >&5 ac_lib_var=`echo Xbsd'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5118,14 +5124,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lXbsd $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5135: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5149,12 +5155,12 @@ fi tk_checkBoth=0 echo $ac_n "checking for connect""... $ac_c" 1>&6 -echo "configure:5153: checking for connect" >&5 +echo "configure:5159: checking for connect" >&5 if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5187: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_connect=yes" else @@ -5199,7 +5205,7 @@ fi if test "$tk_checkSocket" = 1; then echo $ac_n "checking for main in -lsocket""... $ac_c" 1>&6 -echo "configure:5203: checking for main in -lsocket" >&5 +echo "configure:5209: checking for main in -lsocket" >&5 ac_lib_var=`echo socket'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5207,14 +5213,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5224: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5240,12 +5246,12 @@ if test "$tk_checkBoth" = 1; then tk_oldLibs=$LIBS LIBS="$LIBS -lsocket -lnsl" echo $ac_n "checking for accept""... $ac_c" 1>&6 -echo "configure:5244: checking for accept" >&5 +echo "configure:5250: checking for accept" >&5 if eval "test \"`echo '$''{'ac_cv_func_accept'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5278: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_accept=yes" else @@ -5290,12 +5296,12 @@ fi fi echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 -echo "configure:5294: checking for gethostbyname" >&5 +echo "configure:5300: checking for gethostbyname" >&5 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5328: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_gethostbyname=yes" else @@ -5336,7 +5342,7 @@ if eval "test \"`echo '$ac_cv_func_'gethostbyname`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for main in -lnsl""... $ac_c" 1>&6 -echo "configure:5340: checking for main in -lnsl" >&5 +echo "configure:5346: checking for main in -lnsl" >&5 ac_lib_var=`echo nsl'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5344,14 +5350,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5361: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5387,13 +5393,13 @@ fi if test -d /usr/include/mit -a $tk_aqua = no; then echo $ac_n "checking MIT X libraries""... $ac_c" 1>&6 -echo "configure:5391: checking MIT X libraries" >&5 +echo "configure:5397: checking MIT X libraries" >&5 tk_oldCFlags=$CFLAGS CFLAGS="$CFLAGS -I/usr/include/mit" tk_oldLibs=$LIBS LIBS="$LIBS -lX11-mit" cat > conftest.$ac_ext < @@ -5404,7 +5410,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:5408: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5414: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "$ac_t""yes" 1>&6 @@ -5428,14 +5434,14 @@ fi #-------------------------------------------------------------------- echo $ac_n "checking whether char is unsigned""... $ac_c" 1>&6 -echo "configure:5432: checking whether char is unsigned" >&5 +echo "configure:5438: checking whether char is unsigned" >&5 if eval "test \"`echo '$''{'ac_cv_c_char_unsigned'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$GCC" = yes; then # GCC predefines this symbol on systems where it applies. cat > conftest.$ac_ext <&2; exit 1; } else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5477: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_char_unsigned=yes else @@ -5500,12 +5506,12 @@ fi echo $ac_n "checking for strtod""... $ac_c" 1>&6 -echo "configure:5504: checking for strtod" >&5 +echo "configure:5510: checking for strtod" >&5 if eval "test \"`echo '$''{'ac_cv_func_strtod'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5538: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_strtod=yes" else @@ -5550,7 +5556,7 @@ fi if test "$tcl_strtod" = 1; then echo $ac_n "checking for Solaris2.4/Tru64 strtod bugs""... $ac_c" 1>&6 -echo "configure:5554: checking for Solaris2.4/Tru64 strtod bugs" >&5 +echo "configure:5560: checking for Solaris2.4/Tru64 strtod bugs" >&5 if eval "test \"`echo '$''{'tcl_cv_strtod_buggy'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5559,7 +5565,7 @@ else tcl_cv_strtod_buggy=0 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5592: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then tcl_cv_strtod_buggy=1 else @@ -5645,7 +5651,7 @@ WISH_RSRC_FILE='wish$(VERSION).rsrc' if test "`uname -s`" = "Darwin" ; then echo $ac_n "checking how to package libraries""... $ac_c" 1>&6 -echo "configure:5649: checking how to package libraries" >&5 +echo "configure:5655: checking how to package libraries" >&5 # Check whether --enable-framework or --disable-framework was given. if test "${enable_framework+set}" = set; then enableval="$enable_framework" diff --git a/unix/configure.in b/unix/configure.in index 7116dfb..a154b18 100644 --- a/unix/configure.in +++ b/unix/configure.in @@ -3,7 +3,7 @@ dnl This file is an input file used by the GNU "autoconf" program to dnl generate the file "configure", which is run during Tk installation dnl to configure the system for the local environment. # -# RCS: @(#) $Id: configure.in,v 1.83.2.21 2005/07/25 01:33:54 mdejong Exp $ +# RCS: @(#) $Id: configure.in,v 1.83.2.22 2005/09/10 14:54:18 das Exp $ AC_INIT(../generic/tk.h) AC_PREREQ(2.13) @@ -253,6 +253,9 @@ if test $tk_aqua = yes; then LIBS="$LIBS -framework Carbon" CFLAGS="$CFLAGS -fpascal-strings" TK_WINDOWINGSYSTEM=AQUA + if test "${enable_symbols+set}" = set; then + AC_DEFINE(TK_MAC_DEBUG, 1, [Are TkAqua debug messages enabled?]) + fi else #-------------------------------------------------------------------- # Locate the X11 header files and the X11 library archive. Try diff --git a/xlib/xcolors.c b/xlib/xcolors.c index cc88e53..ad4a069 100644 --- a/xlib/xcolors.c +++ b/xlib/xcolors.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: xcolors.c,v 1.5 2002/08/31 06:12:31 das Exp $ + * RCS: @(#) $Id: xcolors.c,v 1.5.2.1 2005/09/10 14:54:18 das Exp $ */ #include @@ -820,7 +820,7 @@ FindColor(name, colorPtr) const char *name; XColor *colorPtr; { - int l, u, r, i; + int l, u, r, i = 0; /* * Count the number of elements in the color array if we haven't -- cgit v0.12