summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog12
-rw-r--r--generic/tkButton.c32
-rw-r--r--generic/tkButton.h19
-rw-r--r--generic/tkScrollbar.c17
-rw-r--r--generic/tkScrollbar.h18
-rw-r--r--macosx/tkMacOSXButton.c44
-rw-r--r--macosx/tkMacOSXScrlbr.c60
-rw-r--r--unix/tkUnixPort.h2
-rw-r--r--win/tkWinButton.c7
-rw-r--r--win/tkWinScrlbr.c20
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 <nijtmans@users.sf.net>
+
+ * 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 <andreask@activestate.com>
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);
}
/*