From c38626d1adc195c2d87e1d6c16fa61ab473683a5 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 23 Oct 2012 07:39:03 +0000 Subject: Backport of ::tk::mac::useCompatibilityMetrics handling and scrollbar metrics handling from trunk --- ChangeLog | 12 ++++++++++ generic/tkButton.c | 32 +++++++++++++++----------- generic/tkButton.h | 19 ++++++++-------- generic/tkScrollbar.c | 17 ++++++++------ generic/tkScrollbar.h | 18 +++------------ macosx/tkMacOSXButton.c | 44 +++++++++++++----------------------- macosx/tkMacOSXScrlbr.c | 60 ++++++++++++++++++++++++------------------------- unix/tkUnixPort.h | 2 +- win/tkWinButton.c | 7 ++---- win/tkWinScrlbr.c | 20 +++-------------- 10 files changed, 104 insertions(+), 127 deletions(-) diff --git a/ChangeLog b/ChangeLog index f4b349f..70988a7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2012-10-23 Jan Nijtmans + + * generic/tkButton.h: Backport of ::tk::mac::useCompatibilityMetrics + * generic/tkButton.c handling and scrollbar metrics handling from trunk. + * generic/tkScrollbar.h + * generic/tkScrollbar.c + * macosx/tkMacOSXButton.c + * macosx/tkMacOSXScrlbr.c + * unix/tkUnixPort.h + * win/tkWinButton.c + * win/tkWinScrlbr.c + 2012-10-09 Andreas Kupries Cherrypick Merge, Backport of [6223d9e067]. Restored from diff --git a/generic/tkButton.c b/generic/tkButton.c index 9e3a08d..70bba83 100644 --- a/generic/tkButton.c +++ b/generic/tkButton.c @@ -55,7 +55,13 @@ static const char *const compoundStrings[] = { "bottom", "center", "left", "none", "right", "top", NULL }; +char tkDefButtonHighlightWidth[TCL_INTEGER_SPACE] = DEF_BUTTON_HIGHLIGHT_WIDTH; +char tkDefButtonPadx[TCL_INTEGER_SPACE] = DEF_BUTTON_PADX; +char tkDefButtonPady[TCL_INTEGER_SPACE] = DEF_BUTTON_PADY; char tkDefButtonBorderWidth[TCL_INTEGER_SPACE] = DEF_BUTTON_BORDER_WIDTH; +char tkDefLabelHighlightWidth[TCL_INTEGER_SPACE] = DEF_LABEL_HIGHLIGHT_WIDTH; +char tkDefLabelPadx[TCL_INTEGER_SPACE] = DEF_LABCHKRAD_PADX; +char tkDefLabelPady[TCL_INTEGER_SPACE] = DEF_LABCHKRAD_PADY; /* * Information used for parsing configuration options. There is a @@ -110,7 +116,7 @@ static const Tk_OptionSpec labelOptionSpecs[] = { DEF_BUTTON_HIGHLIGHT, -1, Tk_Offset(TkButton, highlightColorPtr), 0, 0, 0}, {TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness", - "HighlightThickness", DEF_LABEL_HIGHLIGHT_WIDTH, + "HighlightThickness", tkDefLabelHighlightWidth, Tk_Offset(TkButton, highlightWidthPtr), Tk_Offset(TkButton, highlightWidth), 0, 0, 0}, {TK_OPTION_STRING, "-image", "image", "Image", @@ -119,10 +125,10 @@ static const Tk_OptionSpec labelOptionSpecs[] = { {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify", DEF_BUTTON_JUSTIFY, -1, Tk_Offset(TkButton, justify), 0, 0, 0}, {TK_OPTION_PIXELS, "-padx", "padX", "Pad", - DEF_LABCHKRAD_PADX, Tk_Offset(TkButton, padXPtr), + tkDefLabelPadx, Tk_Offset(TkButton, padXPtr), Tk_Offset(TkButton, padX), 0, 0, 0}, {TK_OPTION_PIXELS, "-pady", "padY", "Pad", - DEF_LABCHKRAD_PADY, Tk_Offset(TkButton, padYPtr), + tkDefLabelPady, Tk_Offset(TkButton, padYPtr), Tk_Offset(TkButton, padY), 0, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", DEF_LABCHKRAD_RELIEF, -1, Tk_Offset(TkButton, relief), 0, 0, 0}, @@ -201,7 +207,7 @@ static const Tk_OptionSpec buttonOptionSpecs[] = { DEF_BUTTON_HIGHLIGHT, -1, Tk_Offset(TkButton, highlightColorPtr), 0, 0, 0}, {TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness", - "HighlightThickness", DEF_BUTTON_HIGHLIGHT_WIDTH, + "HighlightThickness", tkDefButtonHighlightWidth, Tk_Offset(TkButton, highlightWidthPtr), Tk_Offset(TkButton, highlightWidth), 0, 0, 0}, {TK_OPTION_STRING, "-image", "image", "Image", @@ -213,10 +219,10 @@ static const Tk_OptionSpec buttonOptionSpecs[] = { DEF_BUTTON_OVER_RELIEF, -1, Tk_Offset(TkButton, overRelief), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-padx", "padX", "Pad", - DEF_BUTTON_PADX, Tk_Offset(TkButton, padXPtr), + tkDefButtonPadx, Tk_Offset(TkButton, padXPtr), Tk_Offset(TkButton, padX), 0, 0, 0}, {TK_OPTION_PIXELS, "-pady", "padY", "Pad", - DEF_BUTTON_PADY, Tk_Offset(TkButton, padYPtr), + tkDefButtonPady, Tk_Offset(TkButton, padYPtr), Tk_Offset(TkButton, padY), 0, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", DEF_BUTTON_RELIEF, -1, Tk_Offset(TkButton, relief), @@ -299,7 +305,7 @@ static const Tk_OptionSpec checkbuttonOptionSpecs[] = { DEF_BUTTON_HIGHLIGHT, -1, Tk_Offset(TkButton, highlightColorPtr), 0, 0, 0}, {TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness", - "HighlightThickness", DEF_BUTTON_HIGHLIGHT_WIDTH, + "HighlightThickness", tkDefButtonHighlightWidth, Tk_Offset(TkButton, highlightWidthPtr), Tk_Offset(TkButton, highlightWidth), 0, 0, 0}, {TK_OPTION_STRING, "-image", "image", "Image", @@ -319,10 +325,10 @@ static const Tk_OptionSpec checkbuttonOptionSpecs[] = { DEF_BUTTON_OVER_RELIEF, -1, Tk_Offset(TkButton, overRelief), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-padx", "padX", "Pad", - DEF_LABCHKRAD_PADX, Tk_Offset(TkButton, padXPtr), + tkDefLabelPadx, Tk_Offset(TkButton, padXPtr), Tk_Offset(TkButton, padX), 0, 0, 0}, {TK_OPTION_PIXELS, "-pady", "padY", "Pad", - DEF_LABCHKRAD_PADY, Tk_Offset(TkButton, padYPtr), + tkDefLabelPady, Tk_Offset(TkButton, padYPtr), Tk_Offset(TkButton, padY), 0, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", DEF_LABCHKRAD_RELIEF, -1, Tk_Offset(TkButton, relief), 0, 0, 0}, @@ -412,7 +418,7 @@ static const Tk_OptionSpec radiobuttonOptionSpecs[] = { DEF_BUTTON_HIGHLIGHT, -1, Tk_Offset(TkButton, highlightColorPtr), 0, 0, 0}, {TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness", - "HighlightThickness", DEF_BUTTON_HIGHLIGHT_WIDTH, + "HighlightThickness", tkDefButtonHighlightWidth, Tk_Offset(TkButton, highlightWidthPtr), Tk_Offset(TkButton, highlightWidth), 0, 0, 0}, {TK_OPTION_STRING, "-image", "image", "Image", @@ -429,10 +435,10 @@ static const Tk_OptionSpec radiobuttonOptionSpecs[] = { DEF_BUTTON_OVER_RELIEF, -1, Tk_Offset(TkButton, overRelief), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-padx", "padX", "Pad", - DEF_LABCHKRAD_PADX, Tk_Offset(TkButton, padXPtr), + tkDefLabelPadx, Tk_Offset(TkButton, padXPtr), Tk_Offset(TkButton, padX), 0, 0, 0}, {TK_OPTION_PIXELS, "-pady", "padY", "Pad", - DEF_LABCHKRAD_PADY, Tk_Offset(TkButton, padYPtr), + tkDefLabelPady, Tk_Offset(TkButton, padYPtr), Tk_Offset(TkButton, padY), 0, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", DEF_LABCHKRAD_RELIEF, -1, Tk_Offset(TkButton, relief), 0, 0, 0}, @@ -637,7 +643,7 @@ ButtonCreate( Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!tsdPtr->defaultsInitialized) { - TkpButtonSetDefaults(NULL); + TkpButtonSetDefaults(); tsdPtr->defaultsInitialized = 1; } diff --git a/generic/tkButton.h b/generic/tkButton.h index 4fde4c1..09aaee2 100644 --- a/generic/tkButton.h +++ b/generic/tkButton.h @@ -17,11 +17,6 @@ #include "tkInt.h" #endif -#ifdef BUILD_tk -# undef TCL_STORAGE_CLASS -# define TCL_STORAGE_CLASS DLLEXPORT -#endif - /* * Legal values for the "compound" field of TkButton records. */ @@ -293,18 +288,25 @@ typedef struct { #define TRISTATED (1 << 4) /* - * Declaration of variables shared between the files in the button module. + * Declaration of button class functions structure + * and button/label defaults, for use in optionSpecs. */ MODULE_SCOPE Tk_ClassProcs tkpButtonProcs; +MODULE_SCOPE char tkDefButtonHighlightWidth[TCL_INTEGER_SPACE]; +MODULE_SCOPE char tkDefButtonPadx[TCL_INTEGER_SPACE]; +MODULE_SCOPE char tkDefButtonPady[TCL_INTEGER_SPACE]; MODULE_SCOPE char tkDefButtonBorderWidth[TCL_INTEGER_SPACE]; +MODULE_SCOPE char tkDefLabelHighlightWidth[TCL_INTEGER_SPACE]; +MODULE_SCOPE char tkDefLabelPadx[TCL_INTEGER_SPACE]; +MODULE_SCOPE char tkDefLabelPady[TCL_INTEGER_SPACE]; /* * Declaration of functions used in the implementation of the button widget. */ #ifndef TkpButtonSetDefaults -MODULE_SCOPE void TkpButtonSetDefaults(Tk_OptionSpec *specPtr); +MODULE_SCOPE void TkpButtonSetDefaults(); #endif MODULE_SCOPE void TkButtonWorldChanged(ClientData instanceData); MODULE_SCOPE void TkpComputeButtonGeometry(TkButton *butPtr); @@ -317,7 +319,4 @@ MODULE_SCOPE void TkpDisplayButton(ClientData clientData); #endif MODULE_SCOPE int TkInvokeButton(TkButton *butPtr); -# undef TCL_STORAGE_CLASS -# define TCL_STORAGE_CLASS DLLIMPORT - #endif /* _TKBUTTON */ diff --git a/generic/tkScrollbar.c b/generic/tkScrollbar.c index f19671c..3fff58d 100644 --- a/generic/tkScrollbar.c +++ b/generic/tkScrollbar.c @@ -26,11 +26,14 @@ static Tk_CustomOption orientOption = { (ClientData) NULL }; +/* non-const space for "-width" default value for scrollbars */ +char tkDefScrollbarWidth[TCL_INTEGER_SPACE] = DEF_SCROLLBAR_WIDTH; + /* * Information used for argv parsing. */ -Tk_ConfigSpec tkpScrollbarConfigSpecs[] = { +static Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_BORDER, "-activebackground", "activeBackground", "Foreground", DEF_SCROLLBAR_ACTIVE_BG_COLOR, Tk_Offset(TkScrollbar, activeBorder), TK_CONFIG_COLOR_ONLY}, @@ -87,7 +90,7 @@ Tk_ConfigSpec tkpScrollbarConfigSpecs[] = { DEF_SCROLLBAR_TROUGH_MONO, Tk_Offset(TkScrollbar, troughColorPtr), TK_CONFIG_MONO_ONLY}, {TK_CONFIG_PIXELS, "-width", "width", "Width", - DEF_SCROLLBAR_WIDTH, Tk_Offset(TkScrollbar, width), 0}, + tkDefScrollbarWidth, Tk_Offset(TkScrollbar, width), 0}, {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0} }; @@ -281,15 +284,15 @@ ScrollbarWidgetCmd( goto error; } result = Tk_ConfigureValue(interp, scrollPtr->tkwin, - tkpScrollbarConfigSpecs, (char *) scrollPtr, argv[2], 0); + configSpecs, (char *) scrollPtr, argv[2], 0); } else if ((c == 'c') && (strncmp(argv[1], "configure", length) == 0) && (length >= 2)) { if (argc == 2) { result = Tk_ConfigureInfo(interp, scrollPtr->tkwin, - tkpScrollbarConfigSpecs, (char *) scrollPtr, NULL, 0); + configSpecs, (char *) scrollPtr, NULL, 0); } else if (argc == 3) { result = Tk_ConfigureInfo(interp, scrollPtr->tkwin, - tkpScrollbarConfigSpecs, (char *) scrollPtr, argv[2], 0); + configSpecs, (char *) scrollPtr, argv[2], 0); } else { result = ConfigureScrollbar(interp, scrollPtr, argc-2, argv+2, TK_CONFIG_ARGV_ONLY); @@ -529,7 +532,7 @@ ConfigureScrollbar( CONST char **argv, /* Arguments. */ int flags) /* Flags to pass to Tk_ConfigureWidget. */ { - if (Tk_ConfigureWidget(interp, scrollPtr->tkwin, tkpScrollbarConfigSpecs, + if (Tk_ConfigureWidget(interp, scrollPtr->tkwin, configSpecs, argc, argv, (char *) scrollPtr, flags) != TCL_OK) { return TCL_ERROR; } @@ -604,7 +607,7 @@ TkScrollbarEventProc( * Tk_FreeOptions handle all the standard option-related stuff. */ - Tk_FreeOptions(tkpScrollbarConfigSpecs, (char *) scrollPtr, + Tk_FreeOptions(configSpecs, (char *) scrollPtr, scrollPtr->display, 0); Tcl_EventuallyFree((ClientData) scrollPtr, TCL_DYNAMIC); } else if (eventPtr->type == ConfigureNotify) { diff --git a/generic/tkScrollbar.h b/generic/tkScrollbar.h index e2890f4..126d590 100644 --- a/generic/tkScrollbar.h +++ b/generic/tkScrollbar.h @@ -17,11 +17,6 @@ #include "tkInt.h" #endif -#ifdef BUILD_tk -# undef TCL_STORAGE_CLASS -# define TCL_STORAGE_CLASS DLLEXPORT -#endif - /* * A data structure of the following type is kept for each scrollbar widget. */ @@ -162,16 +157,12 @@ typedef struct TkScrollbar { #define GOT_FOCUS 4 /* - * Declaration of scrollbar class functions structure. + * Declaration of scrollbar class functions structure + * and default scrollbar width, for use in configSpec. */ MODULE_SCOPE Tk_ClassProcs tkpScrollbarProcs; - -/* - * Declaration of scrollbar configuration options. - */ - -MODULE_SCOPE Tk_ConfigSpec tkpScrollbarConfigSpecs[]; +MODULE_SCOPE char tkDefScrollbarWidth[TCL_INTEGER_SPACE]; /* * Declaration of functions used in the implementation of the scrollbar @@ -189,7 +180,4 @@ MODULE_SCOPE void TkpConfigureScrollbar(TkScrollbar *scrollPtr); MODULE_SCOPE int TkpScrollbarPosition(TkScrollbar *scrollPtr, int x, int y); -# undef TCL_STORAGE_CLASS -# define TCL_STORAGE_CLASS DLLIMPORT - #endif /* _TKSCROLLBAR */ diff --git a/macosx/tkMacOSXButton.c b/macosx/tkMacOSXButton.c index 61382c4..f912b81 100644 --- a/macosx/tkMacOSXButton.c +++ b/macosx/tkMacOSXButton.c @@ -10,8 +10,6 @@ * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - * RCS: @(#) $Id$ */ #include "tkMacOSXPrivate.h" @@ -81,6 +79,8 @@ static void ComputeUnixButtonGeometry(TkButton *butPtr); Tk_ClassProcs tkpButtonProcs = { sizeof(Tk_ClassProcs), /* size */ TkButtonWorldChanged, /* worldChangedProc */ + NULL, /* createProc */ + NULL /* modalProc */ }; @@ -245,27 +245,16 @@ TkpComputeButtonGeometry( */ void -TkpButtonSetDefaults( - Tk_OptionSpec *specPtr) /* Points to an array of option specs, - * terminated by one with type - * TK_OPTION_END. */ +TkpButtonSetDefaults() { #if TK_MAC_BUTTON_USE_COMPATIBILITY_METRICS if (!tkMacOSXUseCompatibilityMetrics) { - while (specPtr->type != TK_CONFIG_END) { - switch (specPtr->internalOffset) { - case Tk_Offset(TkButton, highlightWidth): - specPtr->defValue = DEF_BUTTON_HIGHLIGHT_WIDTH_NOCM; - break; - case Tk_Offset(TkButton, padX): - specPtr->defValue = DEF_BUTTON_PADX_NOCM; - break; - case Tk_Offset(TkButton, padY): - specPtr->defValue = DEF_BUTTON_PADY_NOCM; - break; - } - specPtr++; - } + strcpy(tkDefButtonHighlightWidth, DEF_BUTTON_HIGHLIGHT_WIDTH_NOCM); + strcpy(tkDefLabelHighlightWidth, DEF_BUTTON_HIGHLIGHT_WIDTH_NOCM); + strcpy(tkDefButtonPadx, DEF_BUTTON_PADX_NOCM); + strcpy(tkDefLabelPadx, DEF_BUTTON_PADX_NOCM); + strcpy(tkDefButtonPady, DEF_BUTTON_PADY_NOCM); + strcpy(tkDefLabelPady, DEF_BUTTON_PADY_NOCM); } #endif } @@ -588,12 +577,12 @@ ComputeNativeButtonGeometry( } // if font is too tall, we can't use the fixed-height rounded bezel - if (!haveImage && haveText && style == NSRoundedBezelStyle) { - Tk_FontMetrics fm; - Tk_GetFontMetrics(butPtr->tkfont, &fm); - if (fm.linespace > 18) { - [button setBezelStyle:(style = NSRegularSquareBezelStyle)]; - } + if (!haveImage && haveText && style == NSRoundedBezelStyle) { + Tk_FontMetrics fm; + Tk_GetFontMetrics(butPtr->tkfont, &fm); + if (fm.linespace > 18) { + [button setBezelStyle:(style = NSRegularSquareBezelStyle)]; + } } bounds.size = [cell cellSize]; @@ -673,7 +662,6 @@ ComputeNativeButtonGeometry( #endif } - #pragma mark - #pragma mark Unix Buttons: @@ -1183,7 +1171,7 @@ ComputeUnixButtonGeometry( /* * Local Variables: - * mode: c + * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 diff --git a/macosx/tkMacOSXScrlbr.c b/macosx/tkMacOSXScrlbr.c index af91564..ff91ffd 100644 --- a/macosx/tkMacOSXScrlbr.c +++ b/macosx/tkMacOSXScrlbr.c @@ -10,8 +10,6 @@ * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - * RCS: @(#) $Id$ */ #include "tkMacOSXPrivate.h" @@ -45,13 +43,6 @@ static ScrollbarMetrics metrics[2] = { }; /* - * This variable holds the default width for a scrollbar in string form for - * use in a Tk_ConfigSpec. - */ - -static char defWidth[TCL_INTEGER_SPACE]; - -/* * Declarations for functions defined in this file. */ @@ -64,15 +55,19 @@ static void ScrollbarEventProc(ClientData clientData, */ Tk_ClassProcs tkpScrollbarProcs = { - sizeof(Tk_ClassProcs) /* size */ + sizeof(Tk_ClassProcs), /* size */ + NULL, /* worldChangedProc */ + NULL, /* createProc */ + NULL /* modalProc */ }; - + #pragma mark TKApplication(TKScrlbr) #define NSAppleAquaScrollBarVariantChanged @"AppleAquaScrollBarVariantChanged" @implementation TKApplication(TKScrlbr) -- (void)tkScroller:(NSScroller *)scroller { +- (void) tkScroller: (NSScroller *) scroller +{ NSScrollerPart hitPart = [scroller hitPart]; TkScrollbar *scrollPtr = (TkScrollbar *)[scroller tag]; Tcl_DString cmdString; @@ -131,14 +126,19 @@ Tk_ClassProcs tkpScrollbarProcs = { [scroller knobProportion]); #endif } -- (void)scrollBarVariantChanged:(NSNotification *)notification { + +- (void) scrollBarVariantChanged: (NSNotification *) notification +{ #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); #endif UpdateScrollbarMetrics(); } -- (void)_setupScrollBarNotifications { + +- (void) _setupScrollBarNotifications +{ NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; + #define observe(n, s) [nc addObserver:self selector:@selector(s) name:(n) object:nil] observe(NSAppleAquaScrollBarVariantChanged, scrollBarVariantChanged:); #undef observe @@ -180,7 +180,6 @@ UpdateScrollbarMetrics(void) .trackInfo.scrollbar = {.viewsize = 1, .pressState = 0}, }; CGRect bounds; - Tk_ConfigSpec *specPtr; ChkErr(GetThemeMetric, kThemeMetricScrollBarWidth, &metrics[0].width); ChkErr(GetThemeMetric, kThemeMetricScrollBarMinThumbHeight, @@ -203,13 +202,7 @@ UpdateScrollbarMetrics(void) metrics[1].minHeight = metrics[1].minThumbHeight + metrics[1].topArrowHeight + metrics[1].bottomArrowHeight; - sprintf(defWidth, "%d", (int)(metrics[0].width)); - for (specPtr = tkpScrollbarConfigSpecs; specPtr->type != TK_CONFIG_END; - specPtr++) { - if (specPtr->offset == Tk_Offset(TkScrollbar, width)) { - specPtr->defValue = defWidth; - } - } + sprintf(tkDefScrollbarWidth, "%d", (int)(metrics[0].width)); } /* @@ -235,11 +228,8 @@ TkpCreateScrollbar( MacScrollbar *scrollPtr = (MacScrollbar *) ckalloc(sizeof(MacScrollbar)); scrollPtr->scroller = nil; - - Tk_CreateEventHandler(tkwin, ActivateMask|ExposureMask| - StructureNotifyMask|FocusChangeMask, - ScrollbarEventProc, (ClientData) scrollPtr); - + Tk_CreateEventHandler(tkwin, StructureNotifyMask|FocusChangeMask| + ActivateMask|ExposureMask, ScrollbarEventProc, (ClientData) scrollPtr); return (TkScrollbar *) scrollPtr; } @@ -274,8 +264,8 @@ TkpDestroyScrollbar( * TkpDisplayScrollbar -- * * This procedure redraws the contents of a scrollbar window. It is - * invoked as a do-when-idle handler, so it only runs when there's - * nothing else for the application to do. + * invoked as a do-when-idle handler, so it only runs when there's nothing + * else for the application to do. * * Results: * None. @@ -338,12 +328,16 @@ TkpDisplayScrollbar( Tk_Height(tkwin)); frame = NSInsetRect(frame, scrollPtr->inset, scrollPtr->inset); frame.origin.y = viewHeight - (frame.origin.y + frame.size.height); + NSWindow *w = [view window]; + if ([w showsResizeIndicator]) { NSRect growBox = [view convertRect:[w _growBoxRect] fromView:nil]; + if (NSIntersectsRect(growBox, frame)) { if (scrollPtr->vertical) { CGFloat y = frame.origin.y; + frame.origin.y = growBox.origin.y + growBox.size.height; frame.size.height -= frame.origin.y - y; } else { @@ -408,8 +402,12 @@ TkpComputeScrollbarGeometry( macScrollPtr->variant = variant; if (scroller) { NSSize size = [scroller frame].size; + if ((size.width > size.height) ^ !scrollPtr->vertical) { - /* Orientation changed, need new scroller */ + /* + * Orientation changed, need new scroller. + */ + if ([scroller superview]) { [scroller removeFromSuperviewWithoutNeedingDisplay]; } @@ -614,7 +612,7 @@ ScrollbarEventProc( /* * Local Variables: - * mode: c + * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 diff --git a/unix/tkUnixPort.h b/unix/tkUnixPort.h index 38a8513..6e7a701 100644 --- a/unix/tkUnixPort.h +++ b/unix/tkUnixPort.h @@ -184,7 +184,7 @@ * These functions do nothing under Unix, so we just eliminate calls to them. */ -#define TkpButtonSetDefaults(specPtr) {} +#define TkpButtonSetDefaults() {} #define TkpDestroyButton(butPtr) {} #define TkSelUpdateClipboard(a,b) {} #ifndef __CYGWIN__ diff --git a/win/tkWinButton.c b/win/tkWinButton.c index af1058d..f4d2d05 100644 --- a/win/tkWinButton.c +++ b/win/tkWinButton.c @@ -90,7 +90,7 @@ Tk_ClassProcs tkpButtonProcs = { sizeof(Tk_ClassProcs), /* size */ TkButtonWorldChanged, /* worldChangedProc */ CreateProc, /* createProc */ - NULL + NULL /* modalProc */ }; @@ -181,10 +181,7 @@ InitBoxes(void) */ void -TkpButtonSetDefaults( - Tk_OptionSpec *specPtr) /* Points to an array of option specs, - * terminated by one with type - * TK_OPTION_END. */ +TkpButtonSetDefaults() { int width = GetSystemMetrics(SM_CXEDGE); if (width > 0) { diff --git a/win/tkWinScrlbr.c b/win/tkWinScrlbr.c index 5032912..2ec6883 100644 --- a/win/tkWinScrlbr.c +++ b/win/tkWinScrlbr.c @@ -52,18 +52,11 @@ typedef struct WinScrollbar { static int initialized = 0; static int hArrowWidth, hThumb; /* Horizontal control metrics. */ -static int vArrowWidth, vArrowHeight, vThumb; /* Vertical control metrics. */ +static int vArrowHeight, vThumb; /* Vertical control metrics. */ TCL_DECLARE_MUTEX(winScrlbrMutex) /* - * This variable holds the default width for a scrollbar in string form for - * use in a Tk_ConfigSpec. - */ - -static char defWidth[TCL_INTEGER_SPACE]; - -/* * Declarations for functions defined in this file. */ @@ -361,21 +354,14 @@ TkpDestroyScrollbar( void UpdateScrollbarMetrics(void) { - Tk_ConfigSpec *specPtr; + int arrowWidth = GetSystemMetrics(SM_CXVSCROLL); hArrowWidth = GetSystemMetrics(SM_CXHSCROLL); hThumb = GetSystemMetrics(SM_CXHTHUMB); - vArrowWidth = GetSystemMetrics(SM_CXVSCROLL); vArrowHeight = GetSystemMetrics(SM_CYVSCROLL); vThumb = GetSystemMetrics(SM_CYVTHUMB); - sprintf(defWidth, "%d", vArrowWidth); - for (specPtr = tkpScrollbarConfigSpecs; specPtr->type != TK_CONFIG_END; - specPtr++) { - if (specPtr->offset == Tk_Offset(TkScrollbar, width)) { - specPtr->defValue = defWidth; - } - } + sprintf(tkDefScrollbarWidth, "%d", arrowWidth); } /* -- cgit v0.12 From 2da8c8ef3be8a1ac136a7fda7f4d53a21e36cc62 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 23 Oct 2012 08:52:05 +0000 Subject: remove RCS keywords, use mode: objc consistantly --- macosx/GNUmakefile | 2 -- macosx/README | 6 ++---- macosx/Tk-Info.plist.in | 2 -- macosx/Wish-Common.xcconfig | 2 -- macosx/Wish-Debug.xcconfig | 2 -- macosx/Wish-Info.plist.in | 2 -- macosx/Wish-Release.xcconfig | 2 -- macosx/Wish.sdef | 4 +--- macosx/Wish.xcode/project.pbxproj | 2 +- macosx/Wish.xcodeproj/project.pbxproj | 2 +- macosx/configure.ac | 4 +--- macosx/tkMacOSX.h | 2 -- macosx/tkMacOSXBitmap.c | 4 +--- macosx/tkMacOSXCarbonEvents.c | 2 +- macosx/tkMacOSXClipboard.c | 4 +--- macosx/tkMacOSXColor.c | 4 +--- macosx/tkMacOSXConfig.c | 6 ++---- macosx/tkMacOSXCursor.c | 6 ++---- macosx/tkMacOSXDebug.c | 4 +--- macosx/tkMacOSXDebug.h | 2 -- macosx/tkMacOSXDefault.h | 2 -- macosx/tkMacOSXDialog.c | 4 +--- macosx/tkMacOSXDraw.c | 4 +--- macosx/tkMacOSXEmbed.c | 4 +--- macosx/tkMacOSXEntry.c | 4 +--- macosx/tkMacOSXEvent.c | 4 +--- macosx/tkMacOSXEvent.h | 2 -- macosx/tkMacOSXFont.c | 4 +--- macosx/tkMacOSXFont.h | 2 -- macosx/tkMacOSXHLEvents.c | 4 +--- macosx/tkMacOSXInit.c | 6 ++---- macosx/tkMacOSXInt.h | 2 -- macosx/tkMacOSXMenu.c | 2 +- macosx/tkMacOSXMenubutton.c | 4 +--- macosx/tkMacOSXMenus.c | 4 +--- macosx/tkMacOSXMouseEvent.c | 4 +--- macosx/tkMacOSXNotify.c | 4 +--- macosx/tkMacOSXPort.h | 2 -- macosx/tkMacOSXPrivate.h | 2 -- macosx/tkMacOSXRegion.c | 4 +--- macosx/tkMacOSXScale.c | 4 +--- macosx/tkMacOSXSend.c | 4 +--- macosx/tkMacOSXSubwindows.c | 4 +--- macosx/tkMacOSXTest.c | 4 +--- macosx/tkMacOSXWindowEvent.c | 4 ++-- macosx/tkMacOSXWm.c | 24 ++++++++++++------------ macosx/tkMacOSXWm.h | 2 -- macosx/tkMacOSXXStubs.c | 4 +--- macosx/ttkMacOSXTheme.c | 8 +++----- 49 files changed, 52 insertions(+), 138 deletions(-) diff --git a/macosx/GNUmakefile b/macosx/GNUmakefile index bbcdca7..333961c 100644 --- a/macosx/GNUmakefile +++ b/macosx/GNUmakefile @@ -9,8 +9,6 @@ # See the file "license.terms" for information on usage and redistribution of # this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id$ -# ######################################################################################################## #------------------------------------------------------------------------------------------------------- diff --git a/macosx/README b/macosx/README index 59924bb..efcca73 100644 --- a/macosx/README +++ b/macosx/README @@ -1,8 +1,6 @@ Tcl/Tk Mac OS X README ---------------------- -RCS: @(#) $Id$ - This is the README file for the Mac OS X/Darwin version of Tcl/Tk. @@ -185,7 +183,7 @@ Window class names: verticalZoom, closeBox, collapseBox, toolbarButton, sideTitlebar, noTitleBar, unifiedTitleAndToolbar, metal, hud, noShadow, doesNotCycle, noActivates, hideOnSuspend, inWindowMenu, ignoreClicks, doesNotHide, - canJoinAllSpaces, moveToActiveSpace, nonActivating, black, dark, light, + canJoinAllSpaces, moveToActiveSpace, nonActivating, black, dark, light, gray, red, green, blue, cyan, yellow, magenta, orange, purple, brown, clear, opacity Note that not all attributes are valid for all window classes. @@ -200,7 +198,7 @@ tk::unsupported::MacWindowStyle style .f document {metal light opaque closeBox c pack [label .f.f -bg #ababab -text "This is a textured window\nwith opacity and a gray background\nsimilar to other Mac applications"] -fill both -expand yes -The color attributes correspond to system-defined NSColor constants (e.g., red is [NSColor redColor]. The "light" and "dark" attributes correspond to lightGrayColor and darkGrayColor, respectively (because of the way the attributes are parsed, using "lightgray" and "darkgray" would cause a conflict with the core "gray" attribute). +The color attributes correspond to system-defined NSColor constants (e.g., red is [NSColor redColor]. The "light" and "dark" attributes correspond to lightGrayColor and darkGrayColor, respectively (because of the way the attributes are parsed, using "lightgray" and "darkgray" would cause a conflict with the core "gray" attribute). Below are the corresponding hex and/or Tk-defined colors that can be used from Tk widgets to match the NSColor-based attributes: diff --git a/macosx/Tk-Info.plist.in b/macosx/Tk-Info.plist.in index 7cbe63d..50b9d24 100644 --- a/macosx/Tk-Info.plist.in +++ b/macosx/Tk-Info.plist.in @@ -6,8 +6,6 @@ See the file "license.terms" for information on usage and redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. - - RCS: @(#) $Id$ --> diff --git a/macosx/Wish-Common.xcconfig b/macosx/Wish-Common.xcconfig index cc1c8fc..7bef051 100644 --- a/macosx/Wish-Common.xcconfig +++ b/macosx/Wish-Common.xcconfig @@ -10,8 +10,6 @@ // See the file "license.terms" for information on usage and redistribution // of this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// RCS: @(#) $Id$ -// HEADER_SEARCH_PATHS = $(TK_SRCROOT)/generic $(TK_SRCROOT)/xlib "$(DERIVED_FILE_DIR)/tcl" "$(DERIVED_FILE_DIR)/tk" $(HEADER_SEARCH_PATHS) REZ_SEARCH_PATHS = $(TK_SRCROOT)/generic $(TCL_SRCROOT)/generic $(REZ_SEARCH_PATHS) diff --git a/macosx/Wish-Debug.xcconfig b/macosx/Wish-Debug.xcconfig index f489038..d577d96 100644 --- a/macosx/Wish-Debug.xcconfig +++ b/macosx/Wish-Debug.xcconfig @@ -9,8 +9,6 @@ // See the file "license.terms" for information on usage and redistribution // of this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// RCS: @(#) $Id$ -// #include "Wish-Common.xcconfig" diff --git a/macosx/Wish-Info.plist.in b/macosx/Wish-Info.plist.in index f0de87d..90e00a4 100644 --- a/macosx/Wish-Info.plist.in +++ b/macosx/Wish-Info.plist.in @@ -6,8 +6,6 @@ See the file "license.terms" for information on usage and redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. - - RCS: @(#) $Id$ --> diff --git a/macosx/Wish-Release.xcconfig b/macosx/Wish-Release.xcconfig index 2e83e55..a46aab5 100644 --- a/macosx/Wish-Release.xcconfig +++ b/macosx/Wish-Release.xcconfig @@ -9,8 +9,6 @@ // See the file "license.terms" for information on usage and redistribution // of this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// RCS: @(#) $Id$ -// #include "Wish-Common.xcconfig" diff --git a/macosx/Wish.sdef b/macosx/Wish.sdef index d9de8bd..8873e95 100644 --- a/macosx/Wish.sdef +++ b/macosx/Wish.sdef @@ -2,13 +2,11 @@ diff --git a/macosx/Wish.xcode/project.pbxproj b/macosx/Wish.xcode/project.pbxproj index d553ba0..ef0fc31 100644 --- a/macosx/Wish.xcode/project.pbxproj +++ b/macosx/Wish.xcode/project.pbxproj @@ -2097,7 +2097,7 @@ F966C06F08F281DC005CB29B /* Frameworks */, 1AB674ADFE9D54B511CA2CBB /* Products */, ); - comments = "Copyright (c) 2004-2009 Daniel A. Steffen \nCopyright 2008-2009, Apple Inc.\n\nSee the file \"license.terms\" for information on usage and redistribution of\nthis file, and for a DISCLAIMER OF ALL WARRANTIES.\n\nRCS: @(#) $Id$\n"; + comments = "Copyright (c) 2004-2009 Daniel A. Steffen \nCopyright 2008-2009, Apple Inc.\n\nSee the file \"license.terms\" for information on usage and redistribution of\nthis file, and for a DISCLAIMER OF ALL WARRANTIES.\n"; name = Wish; path = .; sourceTree = SOURCE_ROOT; diff --git a/macosx/Wish.xcodeproj/project.pbxproj b/macosx/Wish.xcodeproj/project.pbxproj index d38f46d..5c7f667 100644 --- a/macosx/Wish.xcodeproj/project.pbxproj +++ b/macosx/Wish.xcodeproj/project.pbxproj @@ -2097,7 +2097,7 @@ F966C06F08F281DC005CB29B /* Frameworks */, 1AB674ADFE9D54B511CA2CBB /* Products */, ); - comments = "Copyright (c) 2004-2009 Daniel A. Steffen \nCopyright 2008-2009, Apple Inc.\n\nSee the file \"license.terms\" for information on usage and redistribution of\nthis file, and for a DISCLAIMER OF ALL WARRANTIES.\n\nRCS: @(#) $Id$\n"; + comments = "Copyright (c) 2004-2009 Daniel A. Steffen \nCopyright 2008-2009, Apple Inc.\n\nSee the file \"license.terms\" for information on usage and redistribution of\nthis file, and for a DISCLAIMER OF ALL WARRANTIES.\n"; name = Wish; path = .; sourceTree = SOURCE_ROOT; diff --git a/macosx/configure.ac b/macosx/configure.ac index 8e4b251..69573c5 100644 --- a/macosx/configure.ac +++ b/macosx/configure.ac @@ -2,10 +2,8 @@ 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$ -dnl Ensure that the config (auto)headers support is used, then just +dnl Ensure that the config (auto)headers support is used, then just dnl include the configure sources from ../unix: m4_include(../unix/aclocal.m4) diff --git a/macosx/tkMacOSX.h b/macosx/tkMacOSX.h index 4ae9920..05ea6c2 100644 --- a/macosx/tkMacOSX.h +++ b/macosx/tkMacOSX.h @@ -9,8 +9,6 @@ * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - * RCS: @(#) $Id$ */ #ifndef _TKMAC diff --git a/macosx/tkMacOSXBitmap.c b/macosx/tkMacOSXBitmap.c index 55512be..f503460 100644 --- a/macosx/tkMacOSXBitmap.c +++ b/macosx/tkMacOSXBitmap.c @@ -9,8 +9,6 @@ * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - * RCS: @(#) $Id$ */ #include "tkMacOSXPrivate.h" @@ -449,7 +447,7 @@ end: /* * Local Variables: - * mode: c + * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 diff --git a/macosx/tkMacOSXCarbonEvents.c b/macosx/tkMacOSXCarbonEvents.c index 1a71cbb..e5803f5 100644 --- a/macosx/tkMacOSXCarbonEvents.c +++ b/macosx/tkMacOSXCarbonEvents.c @@ -682,7 +682,7 @@ TkMacOSXReceiveAndDispatchEvent(void) /* * Local Variables: - * mode: c + * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 diff --git a/macosx/tkMacOSXClipboard.c b/macosx/tkMacOSXClipboard.c index 639e82f..7cd9c30 100644 --- a/macosx/tkMacOSXClipboard.c +++ b/macosx/tkMacOSXClipboard.c @@ -9,8 +9,6 @@ * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - * RCS: @(#) $Id$ */ #include "tkMacOSXPrivate.h" @@ -302,7 +300,7 @@ TkSuspendClipboard(void) /* * Local Variables: - * mode: c + * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c index 69d3be8..6f34c74 100644 --- a/macosx/tkMacOSXColor.c +++ b/macosx/tkMacOSXColor.c @@ -12,8 +12,6 @@ * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - * RCS: @(#) $Id$ */ #include "tkMacOSXPrivate.h" @@ -727,7 +725,7 @@ XFreeColors( /* * Local Variables: - * mode: c + * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 diff --git a/macosx/tkMacOSXConfig.c b/macosx/tkMacOSXConfig.c index bd2ca44..bdfcb6e 100644 --- a/macosx/tkMacOSXConfig.c +++ b/macosx/tkMacOSXConfig.c @@ -9,8 +9,6 @@ * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - * RCS: @(#) $Id$ */ #include "tkInt.h" @@ -38,8 +36,8 @@ Tcl_Obj * TkpGetSystemDefault( Tk_Window tkwin, /* A window to use. */ - CONST char *dbName, /* The option database name. */ - CONST char *className) /* The name of the option class. */ + const char *dbName, /* The option database name. */ + const char *className) /* The name of the option class. */ { return NULL; } diff --git a/macosx/tkMacOSXCursor.c b/macosx/tkMacOSXCursor.c index aac8414..c9815c1 100644 --- a/macosx/tkMacOSXCursor.c +++ b/macosx/tkMacOSXCursor.c @@ -9,8 +9,6 @@ * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - * RCS: @(#) $Id$ */ #include "tkMacOSXPrivate.h" @@ -286,7 +284,7 @@ FindCursorByName( kCGRenderingIntentDefault); CFRelease(provider); } - provider = CGDataProviderCreateWithData(NULL, bitmap + + provider = CGDataProviderCreateWithData(NULL, bitmap + pix*pix/8, pix*pix/8, NULL); if (provider) { mask = CGImageMaskCreate(pix, pix, 1, 1, pix/8, provider, @@ -586,7 +584,7 @@ Tk_MacOSXTkOwnsCursor( /* * Local Variables: - * mode: c + * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 diff --git a/macosx/tkMacOSXDebug.c b/macosx/tkMacOSXDebug.c index 1004353..78008f0 100644 --- a/macosx/tkMacOSXDebug.c +++ b/macosx/tkMacOSXDebug.c @@ -9,8 +9,6 @@ * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - * RCS: @(#) $Id$ */ #include "tkMacOSXPrivate.h" @@ -160,7 +158,7 @@ TkMacOSXGetNamedDebugSymbol( /* * Local Variables: - * mode: c + * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 diff --git a/macosx/tkMacOSXDebug.h b/macosx/tkMacOSXDebug.h index b61ae1e..ab37187 100644 --- a/macosx/tkMacOSXDebug.h +++ b/macosx/tkMacOSXDebug.h @@ -9,8 +9,6 @@ * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - * RCS: @(#) $Id$ */ #ifndef _TKMACDEBUG diff --git a/macosx/tkMacOSXDefault.h b/macosx/tkMacOSXDefault.h index c1dce3b..868144d 100644 --- a/macosx/tkMacOSXDefault.h +++ b/macosx/tkMacOSXDefault.h @@ -11,8 +11,6 @@ * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - * RCS: @(#) $Id$ */ #ifndef _TKMACDEFAULT diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c index 7827f85..d9e824a 100644 --- a/macosx/tkMacOSXDialog.c +++ b/macosx/tkMacOSXDialog.c @@ -9,8 +9,6 @@ * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - * RCS: @(#) $Id$ */ #include "tkMacOSXPrivate.h" @@ -1060,7 +1058,7 @@ end: /* * Local Variables: - * mode: c + * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c index 8183d6e..4eb4a88 100644 --- a/macosx/tkMacOSXDraw.c +++ b/macosx/tkMacOSXDraw.c @@ -11,8 +11,6 @@ * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - * RCS: @(#) $Id$ */ #include "tkMacOSXPrivate.h" @@ -1997,7 +1995,7 @@ TkpDrawFrame( /* * Local Variables: - * mode: c + * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 diff --git a/macosx/tkMacOSXEmbed.c b/macosx/tkMacOSXEmbed.c index 3f195aa..6a366db 100644 --- a/macosx/tkMacOSXEmbed.c +++ b/macosx/tkMacOSXEmbed.c @@ -13,8 +13,6 @@ * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - * RCS: @(#) $Id$ */ #include "tkMacOSXPrivate.h" @@ -1122,7 +1120,7 @@ EmbedWindowDeleted( /* * Local Variables: - * mode: c + * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 diff --git a/macosx/tkMacOSXEntry.c b/macosx/tkMacOSXEntry.c index 61a3586..ab236c6 100644 --- a/macosx/tkMacOSXEntry.c +++ b/macosx/tkMacOSXEntry.c @@ -9,8 +9,6 @@ * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - * RCS: @(#) $Id$ */ #include "tkMacOSXPrivate.h" @@ -261,7 +259,7 @@ TkpDrawSpinboxButtons( /* * Local Variables: - * mode: c + * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 diff --git a/macosx/tkMacOSXEvent.c b/macosx/tkMacOSXEvent.c index 193d0fa..73a67ad 100644 --- a/macosx/tkMacOSXEvent.c +++ b/macosx/tkMacOSXEvent.c @@ -9,8 +9,6 @@ * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - * RCS: @(#) $Id$ */ #include "tkMacOSXPrivate.h" @@ -148,7 +146,7 @@ TkMacOSXFlushWindows(void) /* * Local Variables: - * mode: c + * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 diff --git a/macosx/tkMacOSXEvent.h b/macosx/tkMacOSXEvent.h index 440733f..46d1585 100644 --- a/macosx/tkMacOSXEvent.h +++ b/macosx/tkMacOSXEvent.h @@ -9,8 +9,6 @@ * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - * RCS: @(#) $Id$ */ #ifndef _TKMACEVENT diff --git a/macosx/tkMacOSXFont.c b/macosx/tkMacOSXFont.c index f5f93b4..ae3be92 100644 --- a/macosx/tkMacOSXFont.c +++ b/macosx/tkMacOSXFont.c @@ -10,8 +10,6 @@ * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - * RCS: @(#) $Id$ */ #include "tkMacOSXPrivate.h" @@ -1216,7 +1214,7 @@ TkMacOSXUseAntialiasedText( /* * Local Variables: - * mode: c + * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 diff --git a/macosx/tkMacOSXFont.h b/macosx/tkMacOSXFont.h index 3bb4557..c852e9c 100644 --- a/macosx/tkMacOSXFont.h +++ b/macosx/tkMacOSXFont.h @@ -11,8 +11,6 @@ * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - * RCS: @(#) $Id$ */ #ifndef TKMACOSXFONT_H diff --git a/macosx/tkMacOSXHLEvents.c b/macosx/tkMacOSXHLEvents.c index a886408..43117a1 100644 --- a/macosx/tkMacOSXHLEvents.c +++ b/macosx/tkMacOSXHLEvents.c @@ -10,8 +10,6 @@ * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - * RCS: @(#) $Id$ */ #include "tkMacOSXPrivate.h" @@ -702,7 +700,7 @@ FSRefToDString( /* * Local Variables: - * mode: c + * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c index 2290809..2bf1962 100644 --- a/macosx/tkMacOSXInit.c +++ b/macosx/tkMacOSXInit.c @@ -10,8 +10,6 @@ * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - * RCS: @(#) $Id$ */ #include "tkMacOSXPrivate.h" @@ -378,7 +376,7 @@ TkpInit( Tcl_SetVar(interp, "auto_path", scriptPath, TCL_GLOBAL_ONLY|TCL_LIST_ELEMENT|TCL_APPEND_VALUE); } - + Tcl_CreateObjCommand(interp, "::tk::mac::standardAboutPanel", TkMacOSXStandardAboutPanelObjCmd, NULL, NULL); Tcl_CreateObjCommand(interp, "::tk::mac::iconBitmap", @@ -579,7 +577,7 @@ TkMacOSXGetStringObjFromCFString( /* * Local Variables: - * mode: c + * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 diff --git a/macosx/tkMacOSXInt.h b/macosx/tkMacOSXInt.h index eb34c51..813acce 100644 --- a/macosx/tkMacOSXInt.h +++ b/macosx/tkMacOSXInt.h @@ -9,8 +9,6 @@ * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - * RCS: @(#) $Id$ */ #ifndef _TKMACINT diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c index ccf8626..2b4dbc8 100644 --- a/macosx/tkMacOSXMenu.c +++ b/macosx/tkMacOSXMenu.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. */ - + #include "tkMacOSXPrivate.h" #include "tkMenubutton.h" #include "tkMenu.h" diff --git a/macosx/tkMacOSXMenubutton.c b/macosx/tkMacOSXMenubutton.c index 3a1c80e..eaa444a 100644 --- a/macosx/tkMacOSXMenubutton.c +++ b/macosx/tkMacOSXMenubutton.c @@ -10,8 +10,6 @@ * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - * RCS: @(#) $Id$ */ #include "tkMacOSXPrivate.h" @@ -468,7 +466,7 @@ MenuButtonEventProc( /* * Local Variables: - * mode: c + * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 diff --git a/macosx/tkMacOSXMenus.c b/macosx/tkMacOSXMenus.c index e9f275e..8b0c013 100644 --- a/macosx/tkMacOSXMenus.c +++ b/macosx/tkMacOSXMenus.c @@ -9,8 +9,6 @@ * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - * RCS: @(#) $Id$ */ #include "tkMacOSXPrivate.h" @@ -465,7 +463,7 @@ GenerateEditEvent( /* * Local Variables: - * mode: c + * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 diff --git a/macosx/tkMacOSXMouseEvent.c b/macosx/tkMacOSXMouseEvent.c index f57c184..89f0642 100644 --- a/macosx/tkMacOSXMouseEvent.c +++ b/macosx/tkMacOSXMouseEvent.c @@ -9,8 +9,6 @@ * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - * RCS: @(#) $Id$ */ #include "tkMacOSXPrivate.h" @@ -537,7 +535,7 @@ GenerateButtonEvent( /* * Local Variables: - * mode: c + * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 diff --git a/macosx/tkMacOSXNotify.c b/macosx/tkMacOSXNotify.c index 2274a31..b400423 100644 --- a/macosx/tkMacOSXNotify.c +++ b/macosx/tkMacOSXNotify.c @@ -10,8 +10,6 @@ * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - * RCS: @(#) $Id$ */ #include "tkMacOSXPrivate.h" @@ -306,7 +304,7 @@ TkMacOSXEventsCheckProc( /* * Local Variables: - * mode: c + * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 diff --git a/macosx/tkMacOSXPort.h b/macosx/tkMacOSXPort.h index 6cd5698..0a60cf6 100644 --- a/macosx/tkMacOSXPort.h +++ b/macosx/tkMacOSXPort.h @@ -11,8 +11,6 @@ * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - * RCS: @(#) $Id$ */ #ifndef _TKMACPORT diff --git a/macosx/tkMacOSXPrivate.h b/macosx/tkMacOSXPrivate.h index 034c450..3ad0689 100644 --- a/macosx/tkMacOSXPrivate.h +++ b/macosx/tkMacOSXPrivate.h @@ -8,8 +8,6 @@ * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - * RCS: @(#) $Id$ */ #ifndef _TKMACPRIV diff --git a/macosx/tkMacOSXRegion.c b/macosx/tkMacOSXRegion.c index 1980b3a..8432299 100644 --- a/macosx/tkMacOSXRegion.c +++ b/macosx/tkMacOSXRegion.c @@ -9,8 +9,6 @@ * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - * RCS: @(#) $Id$ */ #include "tkMacOSXPrivate.h" @@ -553,7 +551,7 @@ TkMacOSHIShapeUnion( /* * Local Variables: - * mode: c + * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 diff --git a/macosx/tkMacOSXScale.c b/macosx/tkMacOSXScale.c index dc361b9..e94763d 100644 --- a/macosx/tkMacOSXScale.c +++ b/macosx/tkMacOSXScale.c @@ -11,8 +11,6 @@ * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - * RCS: @(#) $Id$ */ #include "tkMacOSXPrivate.h" @@ -487,7 +485,7 @@ ScaleActionProc( /* * Local Variables: - * mode: c + * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 diff --git a/macosx/tkMacOSXSend.c b/macosx/tkMacOSXSend.c index 6740c2e..603d70e 100644 --- a/macosx/tkMacOSXSend.c +++ b/macosx/tkMacOSXSend.c @@ -29,8 +29,6 @@ * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - * RCS: @(#) $Id$ */ #include "tkMacOSXInt.h" @@ -509,7 +507,7 @@ SendInit( /* * Local Variables: - * mode: c + * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c index 7d1a5eb..c235cbf 100644 --- a/macosx/tkMacOSXSubwindows.c +++ b/macosx/tkMacOSXSubwindows.c @@ -9,8 +9,6 @@ * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - * RCS: @(#) $Id$ */ #include "tkMacOSXPrivate.h" @@ -1351,7 +1349,7 @@ Tk_FreePixmap( /* * Local Variables: - * mode: c + * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 diff --git a/macosx/tkMacOSXTest.c b/macosx/tkMacOSXTest.c index 51ade40..0e43785 100644 --- a/macosx/tkMacOSXTest.c +++ b/macosx/tkMacOSXTest.c @@ -10,8 +10,6 @@ * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - * RCS: @(#) $Id$ */ #include "tkMacOSXPrivate.h" @@ -84,7 +82,7 @@ DebuggerCmd( /* * Local Variables: - * mode: c + * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c index ca6834b..6ced470 100644 --- a/macosx/tkMacOSXWindowEvent.c +++ b/macosx/tkMacOSXWindowEvent.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. */ - + #include "tkMacOSXPrivate.h" #include "tkMacOSXWm.h" #include "tkMacOSXEvent.h" @@ -343,7 +343,7 @@ GenerateUpdates( return 0; } HIShapeGetBounds(damageRgn, &damageBounds); - + CFRelease(damageRgn); CFRelease(boundsRgn); diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index 9967581..1f4e2e2 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -14,7 +14,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ - + #include "tkMacOSXPrivate.h" #include "tkScrollbar.h" #include "tkMacOSXWm.h" @@ -1651,20 +1651,20 @@ WmForgetCmd( macWin = (MacDrawable *) winPtr->window; - TkFocusJoin(winPtr); - Tk_UnmapWindow(frameWin); + TkFocusJoin(winPtr); + Tk_UnmapWindow(frameWin); macWin->toplevel = winPtr->parentPtr->privatePtr->toplevel; macWin->flags &= ~TK_HOST_EXISTS; TkWmDeadWindow(winPtr); RemapWindows(winPtr, (MacDrawable *) winPtr->parentPtr->window); - + winPtr->flags &=~(TK_TOP_HIERARCHY|TK_TOP_LEVEL|TK_HAS_WRAPPER|TK_WIN_MANAGED); /* - * Flags (above) must be cleared before calling TkMapTopFrame (below). - */ + * Flags (above) must be cleared before calling TkMapTopFrame (below). + */ TkMapTopFrame(frameWin); } else { @@ -5049,7 +5049,7 @@ TkUnsupported1ObjCmd( } } - + winPtr = (TkWindow *) Tk_NameToWindow(interp, Tcl_GetString(objv[2]), tkwin); if (winPtr == NULL) { @@ -5264,7 +5264,7 @@ WmWinStyle( ApplyWindowAttributeFlagChanges(winPtr, NULL, oldAttributes, oldFlags, 0, 1); - + return TCL_OK; badClassAttrs: @@ -5429,8 +5429,8 @@ TkMacOSXMakeRealWindowExist( */ [window setMovableByWindowBackground:NO]; } - - + + /* Set background color and opacity of window if those flags are set. */ if (colorName != NULL) { [window setBackgroundColor: colorName]; @@ -5439,7 +5439,7 @@ TkMacOSXMakeRealWindowExist( if (opaqueTag != NULL) { [window setOpaque: opaqueTag]; } - + [window setDocumentEdited:NO]; wmPtr->window = window; macWin->view = contentView; @@ -6331,7 +6331,7 @@ TkMacOSXMakeFullscreen( [NSApp setPresentationOptions: prevPres]; [window setStyleMask: prevMask]; } - + if (wasFullscreen && !(wmPtr->flags & WM_FULLSCREEN)) { UInt64 oldAttributes = wmPtr->attributes; NSRect bounds = NSMakeRect(wmPtr->configX, tkMacOSXZeroScreenHeight - diff --git a/macosx/tkMacOSXWm.h b/macosx/tkMacOSXWm.h index 2f7aaa5..bfc7fac 100644 --- a/macosx/tkMacOSXWm.h +++ b/macosx/tkMacOSXWm.h @@ -8,8 +8,6 @@ * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - * RCS: @(#) $Id$ */ #ifndef _TKMACWM diff --git a/macosx/tkMacOSXXStubs.c b/macosx/tkMacOSXXStubs.c index 761416a..9594cd3 100644 --- a/macosx/tkMacOSXXStubs.c +++ b/macosx/tkMacOSXXStubs.c @@ -12,8 +12,6 @@ * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - * RCS: @(#) $Id$ */ #include "tkMacOSXPrivate.h" @@ -1364,7 +1362,7 @@ Tk_ResetUserInactiveTime( /* * Local Variables: - * mode: c + * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c index 80f00f7..5752fb1 100644 --- a/macosx/ttkMacOSXTheme.c +++ b/macosx/ttkMacOSXTheme.c @@ -7,7 +7,7 @@ * Copyright (c) 2005 Neil Madden * Copyright (c) 2006-2009 Daniel A. Steffen * Copyright 2008-2009, Apple Inc. - * Copyright 2009 Kevin Walzer/WordTech Communications LLC. + * Copyright 2009 Kevin Walzer/WordTech Communications LLC. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -28,8 +28,6 @@ * The QuickDraw/Carbon coordinate system is relative to the * top-level window, not to the Tk_Window. BoxToRect() * accounts for this. - * - * RCS: @(#) $Id$ */ #include "tkMacOSXPrivate.h" @@ -318,7 +316,7 @@ static void TabElementDraw( .size = kHIThemeTabSizeNormal, .adornment = Ttk_StateTableLookup(TabAdornmentTable, state), .kind = kHIThemeTabKindNormal, - .position = Ttk_StateTableLookup(TabPositionTable, state), + .position = Ttk_StateTableLookup(TabPositionTable, state), }; bounds.size.height += TAB_OVERLAP; @@ -1196,7 +1194,7 @@ int Ttk_MacOSXPlatformInit(Tcl_Interp *interp) /* * Local Variables: - * mode: c + * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 -- cgit v0.12 From c5c29cc39d29340d28c498b3008ba0a9ca9f84bd Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 23 Oct 2012 09:01:01 +0000 Subject: remove tkMacOSXCarbonEvents.c --- macosx/tkMacOSXCarbonEvents.c | 690 ------------------------------------------ 1 file changed, 690 deletions(-) delete mode 100644 macosx/tkMacOSXCarbonEvents.c diff --git a/macosx/tkMacOSXCarbonEvents.c b/macosx/tkMacOSXCarbonEvents.c deleted file mode 100644 index e5803f5..0000000 --- a/macosx/tkMacOSXCarbonEvents.c +++ /dev/null @@ -1,690 +0,0 @@ -/* - * tkMacOSXCarbonEvents.c -- - * - * This file implements functions that register for and handle - * various Carbon Events and Timers. Most carbon events of interest - * to TkAqua are processed in a handler registered on the dispatcher - * event target so that we get first crack at them before HIToolbox - * dispatchers/processes them further. - * As some events are sent directly to the focus or app event target - * and not dispatched normally, we also register a handler on the - * application event target. - * - * Copyright 2001, Apple Computer, Inc. - * Copyright (c) 2005-2008 Daniel A. Steffen - * - * See the file "license.terms" for information on usage and redistribution of - * this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - * The following terms apply to all files originating from Apple - * Computer, Inc. ("Apple") and associated with the software - * unless explicitly disclaimed in individual files. - * - * - * Apple hereby grants permission to use, copy, modify, - * distribute, and license this software and its documentation - * for any purpose, provided that existing copyright notices are - * retained in all copies and that this notice is included - * verbatim in any distributions. No written agreement, license, - * or royalty fee is required for any of the authorized - * uses. Modifications to this software may be copyrighted by - * their authors and need not follow the licensing terms - * described here, provided that the new terms are clearly - * indicated on the first page of each file where they apply. - * - * - * IN NO EVENT SHALL APPLE, THE AUTHORS OR DISTRIBUTORS OF THE - * SOFTWARE BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, - * INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF - * THIS SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF, - * EVEN IF APPLE OR THE AUTHORS HAVE BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. APPLE, THE AUTHORS AND - * DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING, - * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS - * SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, AND APPLE,THE - * AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE - * MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - * - * GOVERNMENT USE: If you are acquiring this software on behalf - * of the U.S. government, the Government shall have only - * "Restricted Rights" in the software and related documentation - * as defined in the Federal Acquisition Regulations (FARs) in - * Clause 52.227.19 (c) (2). If you are acquiring the software - * on behalf of the Department of Defense, the software shall be - * classified as "Commercial Computer Software" and the - * Government shall have only "Restricted Rights" as defined in - * Clause 252.227-7013 (c) (1) of DFARs. Notwithstanding the - * foregoing, the authors grant the U.S. Government and others - * acting in its behalf permission to use and distribute the - * software in accordance with the terms specified in this - * license. - */ - -#include "tkMacOSXPrivate.h" -#include "tkMacOSXEvent.h" -#include "tkMacOSXDebug.h" - -/* -#ifdef TK_MAC_DEBUG -#define TK_MAC_DEBUG_CARBON_EVENTS -#endif -*/ - -/* - * Declarations of functions used only in this file: - */ - -static OSStatus CarbonEventHandlerProc(EventHandlerCallRef callRef, - EventRef event, void *userData); -static OSStatus InstallStandardApplicationEventHandler(void); -static void CarbonTimerProc(EventLoopTimerRef timer, void *userData); - -/* - * Static data used by several functions in this file: - */ - -static EventLoopTimerRef carbonTimer = NULL; -static int carbonTimerEnabled = 0; -static EventHandlerUPP carbonEventHandlerUPP = NULL; -static Tcl_Interp *carbonEventInterp = NULL; -static int inTrackingLoop = 0; - -#if MAC_OS_X_VERSION_MIN_REQUIRED < 1050 -/* - * For InstallStandardApplicationEventHandler(): - */ - -static jmp_buf exitRaelJmpBuf; -static void ExitRaelEventHandlerProc(EventHandlerCallRef callRef, - EventRef event, void *userData) __attribute__ ((__noreturn__)); -#endif - - -/* - *---------------------------------------------------------------------- - * - * CarbonEventHandlerProc -- - * - * This procedure is the handler for all registered CarbonEvents. - * - * Results: - * OS status code. - * - * Side effects: - * Dispatches CarbonEvents. - * - *---------------------------------------------------------------------- - */ - -static OSStatus -CarbonEventHandlerProc( - EventHandlerCallRef callRef, - EventRef event, - void *userData) -{ - OSStatus err = eventNotHandledErr; - TkMacOSXEvent macEvent; - MacEventStatus eventStatus; - - macEvent.eventRef = event; - macEvent.eClass = GetEventClass(event); - macEvent.eKind = GetEventKind(event); - macEvent.interp = (Tcl_Interp *) userData; - macEvent.callRef = callRef; - bzero(&eventStatus, sizeof(eventStatus)); - -#ifdef TK_MAC_DEBUG_CARBON_EVENTS - if (!(macEvent.eClass == kEventClassMouse && ( - macEvent.eKind == kEventMouseMoved || - macEvent.eKind == kEventMouseDragged))) { - TkMacOSXDbgMsg("Started handling %s", - TkMacOSXCarbonEventToAscii(event)); - TkMacOSXInitNamedDebugSymbol(HIToolbox, void, _DebugPrintEvent, - EventRef inEvent); - if (_DebugPrintEvent) { - /* - * Carbon-internal event debugging (c.f. Technote 2124) - */ - - _DebugPrintEvent(event); - } - } -#endif /* TK_MAC_DEBUG_CARBON_EVENTS */ - - TkMacOSXProcessEvent(&macEvent,&eventStatus); - if (eventStatus.stopProcessing) { - err = noErr; - } - -#ifdef TK_MAC_DEBUG_CARBON_EVENTS - if (macEvent.eKind != kEventMouseMoved && - macEvent.eKind != kEventMouseDragged) { - TkMacOSXDbgMsg("Finished handling %s: %s handled", - TkMacOSXCarbonEventToAscii(event), - eventStatus.stopProcessing ? " " : "not"); - } -#endif /* TK_MAC_DEBUG_CARBON_EVENTS */ - return err; -} - -/* - *---------------------------------------------------------------------- - * - * TkMacOSXInitCarbonEvents -- - * - * This procedure initializes all CarbonEvent handlers. - * - * Results: - * None. - * - * Side effects: - * Handlers for Carbon Events are registered. - * - *---------------------------------------------------------------------- - */ - -MODULE_SCOPE void -TkMacOSXInitCarbonEvents( - Tcl_Interp *interp) -{ - const EventTypeSpec dispatcherEventTypes[] = { - {kEventClassKeyboard, kEventRawKeyDown}, - {kEventClassKeyboard, kEventRawKeyRepeat}, - {kEventClassKeyboard, kEventRawKeyUp}, - {kEventClassKeyboard, kEventRawKeyModifiersChanged}, - {kEventClassKeyboard, kEventRawKeyRepeat}, - }; - const EventTypeSpec applicationEventTypes[] = { - {kEventClassMenu, kEventMenuBeginTracking}, - {kEventClassMenu, kEventMenuEndTracking}, - {kEventClassMenu, kEventMenuOpening}, - {kEventClassMenu, kEventMenuTargetItem}, - {kEventClassCommand, kEventCommandProcess}, - {kEventClassCommand, kEventCommandUpdateStatus}, - {kEventClassApplication, kEventAppActivated}, - {kEventClassApplication, kEventAppDeactivated}, - {kEventClassApplication, kEventAppQuit}, - {kEventClassApplication, kEventAppHidden}, - {kEventClassApplication, kEventAppShown}, - {kEventClassApplication, kEventAppAvailableWindowBoundsChanged}, - {kEventClassAppearance, kEventAppearanceScrollBarVariantChanged}, - }; - - carbonEventHandlerUPP = NewEventHandlerUPP(CarbonEventHandlerProc); - carbonEventInterp = interp; - ChkErr(InstallStandardApplicationEventHandler); - ChkErr(InstallEventHandler, GetEventDispatcherTarget(), - carbonEventHandlerUPP, GetEventTypeCount(dispatcherEventTypes), - dispatcherEventTypes, (void *) carbonEventInterp, NULL); - ChkErr(InstallEventHandler, GetApplicationEventTarget(), - carbonEventHandlerUPP, GetEventTypeCount(applicationEventTypes), - applicationEventTypes, (void *) 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 = 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 */ -} - -/* - *---------------------------------------------------------------------- - * - * TkMacOSXInstallWindowCarbonEventHandler -- - * - * This procedure installs our window CarbonEvent handler. - * - * Results: - * None. - * - * Side effects: - * Handler for Carbon Events is registered. - * - *---------------------------------------------------------------------- - */ - -MODULE_SCOPE void -TkMacOSXInstallWindowCarbonEventHandler( - Tcl_Interp *interp, WindowRef window) -{ - const EventTypeSpec windowEventTypes[] = { - {kEventClassMouse, kEventMouseDown}, - {kEventClassMouse, kEventMouseUp}, - {kEventClassMouse, kEventMouseMoved}, - {kEventClassMouse, kEventMouseDragged}, - {kEventClassMouse, kEventMouseWheelMoved}, - {kEventClassWindow, kEventWindowActivated}, - {kEventClassWindow, kEventWindowDeactivated}, - {kEventClassWindow, kEventWindowUpdate}, - {kEventClassWindow, kEventWindowExpanding}, - {kEventClassWindow, kEventWindowBoundsChanged}, - {kEventClassWindow, kEventWindowDragStarted}, - {kEventClassWindow, kEventWindowDragCompleted}, - {kEventClassWindow, kEventWindowConstrain}, - {kEventClassWindow, kEventWindowGetRegion}, - {kEventClassWindow, kEventWindowDrawContent}, - }; - - ChkErr(InstallEventHandler, GetWindowEventTarget(window), - 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 */ -} - -/* - *---------------------------------------------------------------------- - * - * InstallStandardApplicationEventHandler -- - * - * This procedure installs the carbon standard application event - * handler. - * - * Results: - * OS status code. - * - * Side effects: - * Standard handlers for application Carbon Events are registered. - * - *---------------------------------------------------------------------- - */ - -static OSStatus -InstallStandardApplicationEventHandler(void) -{ - OSStatus err = memFullErr; - - TK_IF_HI_TOOLBOX(5, - /* - * The approach below does not work correctly in Leopard, it leads to - * crashes in [NSView unlockFocus] whenever HIToolbox uses Cocoa (Help - * menu, Nav Services, Color Picker). While it is now possible to - * install the standard app handler with InstallStandardEventHandler(), - * to fully replicate RAEL the standard menubar event handler also needs - * 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 TkMacOSXInitNamedSymbol() from HIToolbox - * version 343, may not exist in later versions). - */ - err = ChkErr(InstallStandardEventHandler, GetApplicationEventTarget()); - TkMacOSXInitNamedSymbol(HIToolbox, EventTargetRef, - GetMenuBarEventTarget, void); - if (GetMenuBarEventTarget) { - ChkErr(InstallStandardEventHandler, GetMenuBarEventTarget()); - } else { - TkMacOSXDbgMsg("Unable to install standard menubar event handler"); - } - ) TK_ELSE_HI_TOOLBOX (5, - /* - * This is a hack to workaround missing Carbon API to install the - * standard application event handler (InstallStandardEventHandler() - * does not work on the application target). The only way to install the - * standard app handler is to call RunApplicationEventLoop(), but since - * we are running our own event loop, we'll immediately need to break - * out of RAEL again: we do this via longjmp out of the - * ExitRaelEventHandlerProc event handler called first off from RAEL by - * posting a high priority dummy event. This workaround is derived from - * a similar approach in Technical Q&A 1061. - */ - enum { - kExitRaelEvent = 'ExiT' - }; - const EventTypeSpec exitRaelEventType = { - kExitRaelEvent, kExitRaelEvent - }; - EventHandlerUPP exitRaelEventHandler; - EventHandlerRef exitRaelEventHandlerRef = NULL; - EventRef exitRaelEvent = NULL; - - exitRaelEventHandler = NewEventHandlerUPP( - (EventHandlerProcPtr) ExitRaelEventHandlerProc); - if (exitRaelEventHandler) { - err = ChkErr(InstallEventHandler, GetEventDispatcherTarget(), - exitRaelEventHandler, 1, &exitRaelEventType, NULL, - &exitRaelEventHandlerRef); - } - if (err == noErr) { - err = ChkErr(CreateEvent, NULL, kExitRaelEvent, kExitRaelEvent, - GetCurrentEventTime(), kEventAttributeNone, - &exitRaelEvent); - } - if (err == noErr) { - err = ChkErr(PostEventToQueue, GetMainEventQueue(), exitRaelEvent, - kEventPriorityHigh); - } - if (err == noErr) { - if (!setjmp(exitRaelJmpBuf)) { - RunApplicationEventLoop(); - - /* - * This point should never be reached! - */ - - Tcl_Panic("RunApplicationEventLoop exited !"); - } - } - if (exitRaelEvent) { - ReleaseEvent(exitRaelEvent); - } - if (exitRaelEventHandlerRef) { - RemoveEventHandler(exitRaelEventHandlerRef); - } - if (exitRaelEventHandler) { - DisposeEventHandlerUPP(exitRaelEventHandler); - } - ) TK_ENDIF - return err; -} - -#if MAC_OS_X_VERSION_MIN_REQUIRED < 1050 -/* - *---------------------------------------------------------------------- - * - * ExitRaelEventHandlerProc -- - * - * This procedure is the dummy event handler used to break out of - * RAEL via longjmp, it is called as the first ever event handler - * in RAEL by posting a high priority dummy event. - * - * Results: - * None. Never returns ! - * - * Side effects: - * longjmp back to InstallStandardApplicationEventHandler(). - * - *---------------------------------------------------------------------- - */ - -static void -ExitRaelEventHandlerProc( - EventHandlerCallRef callRef, - EventRef event, - void *userData) -{ - longjmp(exitRaelJmpBuf, 1); -} -#endif - -/* - *---------------------------------------------------------------------- - * - * TkMacOSXRunTclEventLoop -- - * - * Process a limited number of tcl events. - * - * Results: - * Returns 1 if events were handled and 0 otherwise. - * - * Side effects: - * Runs the Tcl event loop. - * - *---------------------------------------------------------------------- - */ - -MODULE_SCOPE int -TkMacOSXRunTclEventLoop(void) -{ - int i = 4, result = 0; - - /* Avoid starving main event loop: process at most 4 events. */ - while(--i && Tcl_ServiceAll()) { - result = 1; - } - return result; -} - -/* - *---------------------------------------------------------------------- - * - * CarbonTimerProc -- - * - * This procedure is the carbon timer handler that runs the tcl - * event loop periodically. - * - * Results: - * None. - * - * Side effects: - * Runs the Tcl event loop. - * - *---------------------------------------------------------------------- - */ - -static void -CarbonTimerProc( - EventLoopTimerRef timer, - void *userData) -{ - if(carbonTimerEnabled > 0 && TkMacOSXRunTclEventLoop()) { -#ifdef TK_MAC_DEBUG_CARBON_EVENTS - TkMacOSXDbgMsg("Processed tcl events from carbon timer"); -#endif /* TK_MAC_DEBUG_CARBON_EVENTS */ - } -} - -/* - *---------------------------------------------------------------------- - * - * TkMacOSXStartTclEventLoopCarbonTimer -- - * - * This procedure installs (if necessary) and starts a carbon - * event timer that runs the tcl event loop periodically. - * It should be called whenever a nested carbon event loop might - * run by HIToolbox (e.g. during mouse tracking) to ensure that - * tcl events continue to be processed. - * - * Results: - * OS status code. - * - * Side effects: - * Carbon event timer is installed and started. - * - *---------------------------------------------------------------------- - */ - -MODULE_SCOPE OSStatus -TkMacOSXStartTclEventLoopCarbonTimer(void) -{ - OSStatus err = noErr; - - if (++carbonTimerEnabled > 0) { - if(!carbonTimer) { - EventLoopTimerUPP timerUPP = NewEventLoopTimerUPP(CarbonTimerProc); - - err = ChkErr(InstallEventLoopTimer, GetMainEventLoop(), - 5 * kEventDurationMillisecond, - 5 * kEventDurationMillisecond, - timerUPP, NULL, &carbonTimer); - } else { - err = ChkErr(SetEventLoopTimerNextFireTime, carbonTimer, - 5 * kEventDurationMillisecond); - } - } - return err; -} - -/* - *---------------------------------------------------------------------- - * - * TkMacOSXStopTclEventLoopCarbonTimer -- - * - * This procedure stops the carbon event timer started by - * TkMacOSXStartTclEventLoopCarbonTimer(). - * - * Results: - * OS status code. - * - * Side effects: - * Carbon event timer is stopped. - * - *---------------------------------------------------------------------- - */ - -MODULE_SCOPE OSStatus -TkMacOSXStopTclEventLoopCarbonTimer(void) -{ - OSStatus err = noErr; - - if (--carbonTimerEnabled == 0) { - if(carbonTimer) { - err = ChkErr(SetEventLoopTimerNextFireTime, carbonTimer, - kEventDurationForever); - } - } - return err; -} - -/* - *---------------------------------------------------------------------- - * - * TkMacOSXTrackingLoop -- - * - * Call with 1 before entering a mouse tracking loop (e.g. window - * resizing or menu tracking) to enable tcl event processing but - * disable carbon event processing (except for update events) - * during the loop, and with 0 after exiting the loop to reset. - * - * Results: - * None. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ - -MODULE_SCOPE void -TkMacOSXTrackingLoop(int tracking) -{ - static int previousServiceMode = TCL_SERVICE_NONE; - - if (tracking) { - inTrackingLoop++; - previousServiceMode = Tcl_SetServiceMode(TCL_SERVICE_ALL); - TkMacOSXStartTclEventLoopCarbonTimer(); -#ifdef TK_MAC_DEBUG_CARBON_EVENTS - TkMacOSXDbgMsg("Entering tracking loop"); -#endif /* TK_MAC_DEBUG_CARBON_EVENTS */ - } else { - TkMacOSXStopTclEventLoopCarbonTimer(); - previousServiceMode = Tcl_SetServiceMode(previousServiceMode); - inTrackingLoop--; -#ifdef TK_MAC_DEBUG_CARBON_EVENTS - TkMacOSXDbgMsg("Exiting tracking loop"); -#endif /* TK_MAC_DEBUG_CARBON_EVENTS */ - } -} - -/* - *---------------------------------------------------------------------- - * - * TkMacOSXReceiveAndDispatchEvent -- - * - * This receives a carbon event and sends it to the carbon event - * dispatcher. - * - * Results: - * Mac OS status - * - * Side effects: - * This receives and dispatches the next Carbon event. - * - *---------------------------------------------------------------------- - */ -MODULE_SCOPE OSStatus -TkMacOSXReceiveAndDispatchEvent(void) -{ - static EventTargetRef targetRef = NULL; - int numEventTypes = 0; - const EventTypeSpec *eventTypes = NULL; - EventRef eventRef; - OSStatus err; - const EventTypeSpec trackingEventTypes[] = { - {'dniw', kEventWindowUpdate}, - {kEventClassWindow, kEventWindowUpdate}, - }; - - if (inTrackingLoop > 0) { - eventTypes = trackingEventTypes; - numEventTypes = GetEventTypeCount(trackingEventTypes); - } - - /* - * This is a poll, since we have already counted the events coming - * into this routine, and are guaranteed to have one waiting. - */ - - err = ReceiveNextEvent(numEventTypes, eventTypes, - kEventDurationNoWait, true, &eventRef); - if (err == noErr) { -#ifdef TK_MAC_DEBUG_CARBON_EVENTS - UInt32 kind = GetEventKind(eventRef); - - if (kind != kEventMouseMoved && kind != kEventMouseDragged) { - TkMacOSXDbgMsg("Dispatching %s", TkMacOSXCarbonEventToAscii(eventRef)); - TkMacOSXInitNamedDebugSymbol(HIToolbox, void, _DebugPrintEvent, - EventRef inEvent); - if (_DebugPrintEvent) { - /* Carbon-internal event debugging (c.f. Technote 2124) */ - _DebugPrintEvent(eventRef); - } - } -#endif /* TK_MAC_DEBUG_CARBON_EVENTS */ - if (!targetRef) { - targetRef = GetEventDispatcherTarget(); - } - TkMacOSXStartTclEventLoopCarbonTimer(); - err = SendEventToEventTarget(eventRef, targetRef); - TkMacOSXStopTclEventLoopCarbonTimer(); - if (err != noErr && err != eventLoopTimedOutErr - && err != eventNotHandledErr) { - TkMacOSXDbgMsg("SendEventToEventTarget(%s) failed: %ld", - TkMacOSXCarbonEventToAscii(eventRef), err); - } - ReleaseEvent(eventRef); - } else if (err != eventLoopTimedOutErr) { - TkMacOSXDbgMsg("ReceiveNextEvent failed: %ld", err); - } - return err; -} - -/* - * Local Variables: - * mode: objc - * c-basic-offset: 4 - * fill-column: 79 - * coding: utf-8 - * End: - */ -- cgit v0.12