diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-06-15 20:56:00 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-06-15 20:56:00 (GMT) |
commit | 0df448d72dc5f494bf12f7b51263f5564caf044b (patch) | |
tree | 5a393326af3dc0ccaaf6e659939b88a6fb5a7c13 | |
parent | 8f72212fd698ae61734ebcaff08e59a3781f31f4 (diff) | |
parent | a780a7ac0367c7321e60e836e3694b0b8052e4a2 (diff) | |
download | tk-0df448d72dc5f494bf12f7b51263f5564caf044b.zip tk-0df448d72dc5f494bf12f7b51263f5564caf044b.tar.gz tk-0df448d72dc5f494bf12f7b51263f5564caf044b.tar.bz2 |
Merge trunk
80 files changed, 1780 insertions, 1311 deletions
diff --git a/doc/ConfigWidg.3 b/doc/ConfigWidg.3 index 92be073..927925c 100644 --- a/doc/ConfigWidg.3 +++ b/doc/ConfigWidg.3 @@ -107,7 +107,7 @@ typedef struct { const char *\fIdbName\fR; const char *\fIdbClass\fR; const char *\fIdefValue\fR; - int \fIoffset\fR; + size_t \fIoffset\fR; int \fIspecFlags\fR; const Tk_CustomOption *\fIcustomPtr\fR; } \fBTk_ConfigSpec\fR; @@ -161,9 +161,8 @@ contain information relevant to the manager of the widget; its exact type is unknown to \fBTk_ConfigureWidget\fR. The \fIoffset\fR field of each \fIspecs\fR entry indicates where in \fIwidgRec\fR to store the information about this configuration option. You should use the -\fBTk_Offset\fR macro to generate \fIoffset\fR values (see below for -a description of \fBTk_Offset\fR). The location indicated by -\fIwidgRec\fR and \fIoffset\fR will be referred to as the +\fBoffsetof\fR macro to generate \fIoffset\fR values. The location +indicated by \fIwidgRec\fR and \fIoffset\fR will be referred to as the .QW target in the descriptions below. .PP @@ -469,13 +468,6 @@ for which this entry is valid. When calling \fBTk_ConfigureWidget\fR, \fIflags\fR will have a single one of these bits set to select the entries for the desired widget type. For a working example of this feature, see the code in tkButton.c. -.SH TK_OFFSET -.PP -The \fBTk_Offset\fR macro is provided as a safe way of generating -the \fIoffset\fR values for entries in Tk_ConfigSpec structures. -It takes two arguments: the name of a type of record, and the -name of a field in that record. It returns the byte offset of -the named field in records of the given type. .SH TK_CONFIGUREINFO .PP The \fBTk_ConfigureInfo\fR procedure may be used to obtain diff --git a/doc/CrtItemType.3 b/doc/CrtItemType.3 index 1bfb20f..cd270f4 100644 --- a/doc/CrtItemType.3 +++ b/doc/CrtItemType.3 @@ -64,7 +64,7 @@ the standard procedures implemented by the type manager: .CS typedef struct Tk_ItemType { const char *\fIname\fR; - int \fIitemSize\fR; + size_t \fIitemSize\fR; Tk_ItemCreateProc *\fIcreateProc\fR; const Tk_ConfigSpec *\fIconfigSpecs\fR; Tk_ItemConfigureProc *\fIconfigProc\fR; diff --git a/doc/ParseArgv.3 b/doc/ParseArgv.3 index 4d85d15..727dcfa 100644 --- a/doc/ParseArgv.3 +++ b/doc/ParseArgv.3 @@ -72,8 +72,8 @@ expected; each of its entries has the following structure: typedef struct { const char *\fIkey\fR; int \fItype\fR; - char *\fIsrc\fR; - char *\fIdst\fR; + void *\fIsrc\fR; + void *\fIdst\fR; const char *\fIhelp\fR; } \fBTk_ArgvInfo\fR; .CE @@ -312,13 +312,13 @@ Boolean exec = FALSE; * Define option descriptions. */ Tk_ArgvInfo argTable[] = { - {"\-X", TK_ARGV_CONSTANT, (char *) 1, (char *) &debugFlag, + {"\-X", TK_ARGV_CONSTANT, (char *) 1, &debugFlag, "Turn on debugging printfs"}, - {"\-N", TK_ARGV_INT, NULL, (char *) &numReps, + {"\-N", TK_ARGV_INT, NULL, &numReps, "Number of repetitions"}, - {"\-of", TK_ARGV_STRING, NULL, (char *) &fileName, + {"\-of", TK_ARGV_STRING, NULL, &fileName, "Name of file for output"}, - {"x", TK_ARGV_REST, NULL, (char *) &exec, + {"x", TK_ARGV_REST, NULL, &exec, "File to exec, followed by any arguments (must be last argument)."}, {NULL, TK_ARGV_END, NULL, NULL, NULL} diff --git a/doc/SetClassProcs.3 b/doc/SetClassProcs.3 index a2af479..832b269 100644 --- a/doc/SetClassProcs.3 +++ b/doc/SetClassProcs.3 @@ -33,7 +33,7 @@ are used as callbacks in different places. The structure pointed to by \fIprocs\fR contains the following: .CS typedef struct Tk_ClassProcs { - unsigned int \fIsize\fR; + size_t \fIsize\fR; Tk_ClassWorldChangedProc *\fIworldChangedProc\fR; Tk_ClassCreateProc *\fIcreateProc\fR; Tk_ClassModalProc *\fImodalProc\fR; diff --git a/doc/SetOptions.3 b/doc/SetOptions.3 index 4323f95..f5966cb 100644 --- a/doc/SetOptions.3 +++ b/doc/SetOptions.3 @@ -8,7 +8,7 @@ .so man.macros .BS .SH NAME -Tk_CreateOptionTable, Tk_DeleteOptionTable, Tk_InitOptions, Tk_SetOptions, Tk_FreeSavedOptions, Tk_RestoreSavedOptions, Tk_GetOptionValue, Tk_GetOptionInfo, Tk_FreeConfigOptions, Tk_Offset \- process configuration options +Tk_CreateOptionTable, Tk_DeleteOptionTable, Tk_InitOptions, Tk_SetOptions, Tk_FreeSavedOptions, Tk_RestoreSavedOptions, Tk_GetOptionValue, Tk_GetOptionInfo, Tk_FreeConfigOptions \- process configuration options .SH SYNOPSIS .nf \fB#include <tk.h>\fR @@ -35,9 +35,6 @@ Tcl_Obj * \fBTk_GetOptionInfo(\fIinterp, recordPtr, optionTable, namePtr, tkwin\fB)\fR .sp \fBTk_FreeConfigOptions(\fIrecordPtr, optionTable, tkwin\fB)\fR -.sp -int -\fBTk_Offset(\fItype, field\fB)\fR .SH ARGUMENTS .AS Tk_SavedOptions "*const objv[]" in/out .AP Tcl_Interp *interp in @@ -239,12 +236,6 @@ is returned and an error message is left in \fIinterp\fR's result unless \fBTk_FreeConfigOptions\fR must be invoked when a widget is deleted. It frees all of the resources associated with any of the configuration options defined in \fIrecordPtr\fR by \fIoptionTable\fR. -.PP -The \fBTk_Offset\fR macro is provided as a safe way of generating the -\fIobjOffset\fR and \fIinternalOffset\fR values for entries in -Tk_OptionSpec structures. It takes two arguments: the name of a type -of record, and the name of a field in that record. It returns the byte -offset of the named field in records of the given type. .SH "TEMPLATES" .PP The array of Tk_OptionSpec structures passed to \fBTk_CreateOptionTable\fR @@ -258,8 +249,8 @@ typedef struct { const char *\fIdbName\fR; const char *\fIdbClass\fR; const char *\fIdefValue\fR; - int \fIobjOffset\fR; - int \fIinternalOffset\fR; + size_t \fIobjOffset\fR; + size_t \fIinternalOffset\fR; int \fIflags\fR; const void *\fIclientData\fR; int \fItypeMask\fR; @@ -281,7 +272,7 @@ value is specified in the option database. The \fIobjOffset\fR and \fIinternalOffset\fR fields indicate where to store the value of this option in widget records (more on this below); values for the \fIobjOffset\fR and \fIinternalOffset\fR fields should always be generated with the -\fBTk_Offset\fR macro. +\fBoffsetof\fR macro. The \fIflags\fR field contains additional information to control the processing of this configuration option (see below for details). diff --git a/doc/tk_mac.n b/doc/tk_mac.n index a1ad758..4f9e2b2 100644 --- a/doc/tk_mac.n +++ b/doc/tk_mac.n @@ -22,6 +22,9 @@ tk::mac \- Access Mac-Specific Functionality on OS X from Tk \fB::tk::mac::OnHide\fR \fB::tk::mac::OnShow\fR \fB::tk::mac::ShowHelp\fR +\fB::tk::mac::PerformService\fR +\fB::tk::mac::LaunchURL \fIURL...\fR +\fB::tk::mac::GetAppPath\fR \fB::tk::mac::standardAboutPanel\fR @@ -30,6 +33,7 @@ tk::mac \- Access Mac-Specific Functionality on OS X from Tk \fB::tk::mac::antialiasedtext \fInumber\fR \fB::tk::mac::useThemedToplevel \fIboolean\fR + \fB::tk::mac::iconBitmap \fIname width height \-kind value\fR .fi .BE @@ -110,9 +114,8 @@ proc ::tk::mac::OpenDocument {args} { If a proc of this name is defined it is the default Apple Event handler for kAEPrintDocuments, .QW pdoc , -the Apple Event sent when your application is asked to print one or more -documents (e.g., via the Print menu item in the Finder). It works the same -way as \fBtk::mac::OpenDocument\fR in terms of arguments. +the Apple Event sent when your application is asked to print a +document. It takes a single absolute file path as an argument. .TP \fB::tk::mac::Quit\fR . @@ -141,7 +144,57 @@ Customizes behavior of Apple Help menu; if this procedure is not defined, the platform-specific standard Help menu item .QW "YourApp Help" performs the default Cocoa action of showing the Help Book configured in the -application's Info.plist (or displaying an alert if no Help Book is set). +application's Info.plist (or displaying an alert if no Help Book is +set). +.TP +\fB::tk::mac::PerformService\fR +. +Executes a Tcl procedure called from the macOS +.QW Services +menu in the Application menu item. The +.QW Services +menu item allows for inter-application communication; data from one +application, such as selected text, can be sent to another application +for processing, for example to Safari as a search item for Google, or +to TextEdit to be appended to a file. An example of the proc is below, +and should be rewritten in an application script for customization: +.RS +.PP +.CS +proc ::tk::mac::PerformService {} { + set data [clipboard get] + $w insert end $data +} +.CE +.RE +Note that the mechanism for retrieving the data is from the clipboard; +there is no other supported way to obtain the data. If the Services +process is not desired, the NSServices keys can be deleted from +the application's Info.plist file. The underlying code supporting this +command also allows the text, entry and ttk::entry widgets to access +services from other applications via the Services menu. The NSPortName +key in Wish's Info.plist file is currently set as +.QW "Wish" +; if a developer changes the name of the Wish executable to something + else, this key should be modified with the same name. +.TP +\fB::tk::mac::LaunchURL \fIURL...\fR +. +If defined, launches a URL within Tk. This would be used if a Tk +application wants to handle a URL itself, such as displaying data from +an RSS feed, rather than launching a default application to handle the +URL, although it can defined as such. Wish includes a stub URL scheme +of +.QW foo:// +in the CFBundleURLSchemes key of its Info.plist file; this should be customized for the specific URL +scheme the developer wants to support. +.TP +\fB::tk::mac::GetAppPath\fR +. +Returns the current applications's file path. +.TP + + .SH "ADDITIONAL DIALOGS" .PP The Aqua/Mac OS X defines additional dialogs that applications should diff --git a/generic/tk.h b/generic/tk.h index 894d634..98cdd5f 100644 --- a/generic/tk.h +++ b/generic/tk.h @@ -191,14 +191,14 @@ typedef struct Tk_OptionSpec { size_t objOffset; /* Where in record to store a Tcl_Obj * that * holds the value of this option, specified * as an offset in bytes from the start of the - * record. Use the Tk_Offset macro to generate + * record. Use the offsetof macro to generate * values for this. -1 means don't store the * Tcl_Obj in the record. */ size_t internalOffset; /* Where in record to store the internal * representation of the value of this option, * such as an int or XColor *. This field is * specified as an offset in bytes from the - * start of the record. Use the Tk_Offset + * start of the record. Use the offsetof * macro to generate values for it. -1 means * don't store the internal representation in * the record. */ @@ -268,10 +268,12 @@ typedef struct Tk_ObjCustomOption { * Computes number of bytes from beginning of structure to a given field. */ -#ifdef offsetof -#define Tk_Offset(type, field) ((int) offsetof(type, field)) -#else -#define Tk_Offset(type, field) ((int) ((char *) &((type *) 0)->field)) +#ifndef TK_NO_DEPRECATED +# define Tk_Offset(type, field) ((int) offsetof(type, field)) +#endif +/* Workaround for platforms missing offsetof(), e.g. VC++ 6.0 */ +#ifndef offsetof +# define offsetof(type, field) ((size_t) ((char *) &((type *) 0)->field)) #endif /* @@ -376,7 +378,7 @@ typedef struct Tk_ConfigSpec { * in command line or database. */ #if TCL_MAJOR_VERSION > 8 size_t offset; /* Where in widget record to store value; use - * Tk_Offset macro to generate values for + * offsetof macro to generate values for * this. */ #else int offset; @@ -438,9 +440,9 @@ typedef struct { const char *key; /* The key string that flags the option in the * argv array. */ int type; /* Indicates option type; see below. */ - char *src; /* Value to be used in setting dst; usage + void *src; /* Value to be used in setting dst; usage * depends on type. */ - char *dst; /* Address of value to be modified; usage + void *dst; /* Address of value to be modified; usage * depends on type. */ const char *help; /* Documentation message describing this * option. */ @@ -616,12 +618,12 @@ typedef struct Tk_ClassProcs { * * #define Tk_GetField(name, who, which) \ * (((who) == NULL) ? NULL : - * (((who)->size <= Tk_Offset(name, which)) ? NULL :(name)->which)) + * (((who)->size <= offsetof(name, which)) ? NULL :(name)->which)) */ #define Tk_GetClassProc(procs, which) \ (((procs) == NULL) ? NULL : \ - (((procs)->size <= (size_t)Tk_Offset(Tk_ClassProcs, which)) ? NULL:(procs)->which)) + (((procs)->size <= offsetof(Tk_ClassProcs, which)) ? NULL:(procs)->which)) /* * Each geometry manager (the packer, the placer, etc.) is represented by a diff --git a/generic/tkArgv.c b/generic/tkArgv.c index 6c2c5c5..ca5ecc0 100644 --- a/generic/tkArgv.c +++ b/generic/tkArgv.c @@ -228,7 +228,7 @@ Tk_ParseArgv( break; case TK_ARGV_FUNC: { typedef int (ArgvFunc)(char *, const char *, const char *); - ArgvFunc *handlerProc = (ArgvFunc *) infoPtr->src; + ArgvFunc *handlerProc = infoPtr->src; if (handlerProc(infoPtr->dst, infoPtr->key, argv[srcIndex])) { srcIndex++; @@ -239,7 +239,7 @@ Tk_ParseArgv( case TK_ARGV_GENFUNC: { typedef int (ArgvGenFunc)(char *, Tcl_Interp *, const char *, int, const char **); - ArgvGenFunc *handlerProc = (ArgvGenFunc *) infoPtr->src; + ArgvGenFunc *handlerProc = infoPtr->src; argc = handlerProc(infoPtr->dst, interp, infoPtr->key, argc, argv+srcIndex); diff --git a/generic/tkBusy.c b/generic/tkBusy.c index 4dee047..1846a94 100644 --- a/generic/tkBusy.c +++ b/generic/tkBusy.c @@ -23,7 +23,7 @@ static const Tk_OptionSpec busyOptionSpecs[] = { {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", - DEF_BUSY_CURSOR, -1, Tk_Offset(Busy, cursor), + DEF_BUSY_CURSOR, -1, offsetof(Busy, cursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0} }; diff --git a/generic/tkButton.c b/generic/tkButton.c index 67a5510..a181056 100644 --- a/generic/tkButton.c +++ b/generic/tkButton.c @@ -70,412 +70,412 @@ char tkDefLabelPady[TCL_INTEGER_SPACE] = DEF_LABCHKRAD_PADY; static const Tk_OptionSpec labelOptionSpecs[] = { {TK_OPTION_BORDER, "-activebackground", "activeBackground", "Foreground", - DEF_BUTTON_ACTIVE_BG_COLOR, -1, Tk_Offset(TkButton, activeBorder), + DEF_BUTTON_ACTIVE_BG_COLOR, -1, offsetof(TkButton, activeBorder), 0, DEF_BUTTON_ACTIVE_BG_MONO, 0}, {TK_OPTION_COLOR, "-activeforeground", "activeForeground", "Background", - DEF_BUTTON_ACTIVE_FG_COLOR, -1, Tk_Offset(TkButton, activeFg), + DEF_BUTTON_ACTIVE_FG_COLOR, -1, offsetof(TkButton, activeFg), TK_OPTION_NULL_OK, DEF_BUTTON_ACTIVE_FG_MONO, 0}, {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", - DEF_BUTTON_ANCHOR, -1, Tk_Offset(TkButton, anchor), 0, 0, 0}, + DEF_BUTTON_ANCHOR, -1, offsetof(TkButton, anchor), 0, 0, 0}, {TK_OPTION_BORDER, "-background", "background", "Background", - DEF_BUTTON_BG_COLOR, -1, Tk_Offset(TkButton, normalBorder), + DEF_BUTTON_BG_COLOR, -1, offsetof(TkButton, normalBorder), 0, DEF_BUTTON_BG_MONO, 0}, {TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL, 0, -1, 0, "-borderwidth", 0}, {TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL, 0, -1, 0, "-background", 0}, {TK_OPTION_BITMAP, "-bitmap", "bitmap", "Bitmap", - DEF_BUTTON_BITMAP, -1, Tk_Offset(TkButton, bitmap), + DEF_BUTTON_BITMAP, -1, offsetof(TkButton, bitmap), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", - tkDefButtonBorderWidth, Tk_Offset(TkButton, borderWidthPtr), - Tk_Offset(TkButton, borderWidth), 0, 0, 0}, + tkDefButtonBorderWidth, offsetof(TkButton, borderWidthPtr), + offsetof(TkButton, borderWidth), 0, 0, 0}, {TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound", - DEF_BUTTON_COMPOUND, -1, Tk_Offset(TkButton, compound), 0, + DEF_BUTTON_COMPOUND, -1, offsetof(TkButton, compound), 0, compoundStrings, 0}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", - DEF_BUTTON_CURSOR, -1, Tk_Offset(TkButton, cursor), + DEF_BUTTON_CURSOR, -1, offsetof(TkButton, cursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_COLOR, "-disabledforeground", "disabledForeground", "DisabledForeground", DEF_BUTTON_DISABLED_FG_COLOR, - -1, Tk_Offset(TkButton, disabledFg), TK_OPTION_NULL_OK, + -1, offsetof(TkButton, disabledFg), TK_OPTION_NULL_OK, (ClientData) DEF_BUTTON_DISABLED_FG_MONO, 0}, {TK_OPTION_SYNONYM, "-fg", "foreground", NULL, NULL, 0, -1, 0, "-foreground", 0}, {TK_OPTION_FONT, "-font", "font", "Font", - DEF_BUTTON_FONT, -1, Tk_Offset(TkButton, tkfont), 0, 0, 0}, + DEF_BUTTON_FONT, -1, offsetof(TkButton, tkfont), 0, 0, 0}, {TK_OPTION_COLOR, "-foreground", "foreground", "Foreground", - DEF_BUTTON_FG, -1, Tk_Offset(TkButton, normalFg), 0, 0, 0}, + DEF_BUTTON_FG, -1, offsetof(TkButton, normalFg), 0, 0, 0}, {TK_OPTION_STRING, "-height", "height", "Height", - DEF_BUTTON_HEIGHT, Tk_Offset(TkButton, heightPtr), -1, 0, 0, 0}, + DEF_BUTTON_HEIGHT, offsetof(TkButton, heightPtr), -1, 0, 0, 0}, {TK_OPTION_BORDER, "-highlightbackground", "highlightBackground", "HighlightBackground", DEF_BUTTON_HIGHLIGHT_BG_COLOR, - -1, Tk_Offset(TkButton, highlightBorder), 0, + -1, offsetof(TkButton, highlightBorder), 0, (ClientData) DEF_BUTTON_HIGHLIGHT_BG_MONO, 0}, {TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor", - DEF_BUTTON_HIGHLIGHT, -1, Tk_Offset(TkButton, highlightColorPtr), + DEF_BUTTON_HIGHLIGHT, -1, offsetof(TkButton, highlightColorPtr), 0, 0, 0}, {TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness", "HighlightThickness", tkDefLabelHighlightWidth, - Tk_Offset(TkButton, highlightWidthPtr), - Tk_Offset(TkButton, highlightWidth), 0, 0, 0}, + offsetof(TkButton, highlightWidthPtr), + offsetof(TkButton, highlightWidth), 0, 0, 0}, {TK_OPTION_STRING, "-image", "image", "Image", - DEF_BUTTON_IMAGE, Tk_Offset(TkButton, imagePtr), -1, + DEF_BUTTON_IMAGE, offsetof(TkButton, imagePtr), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify", - DEF_BUTTON_JUSTIFY, -1, Tk_Offset(TkButton, justify), 0, 0, 0}, + DEF_BUTTON_JUSTIFY, -1, offsetof(TkButton, justify), 0, 0, 0}, {TK_OPTION_PIXELS, "-padx", "padX", "Pad", - tkDefLabelPadx, Tk_Offset(TkButton, padXPtr), - Tk_Offset(TkButton, padX), 0, 0, 0}, + tkDefLabelPadx, offsetof(TkButton, padXPtr), + offsetof(TkButton, padX), 0, 0, 0}, {TK_OPTION_PIXELS, "-pady", "padY", "Pad", - tkDefLabelPady, Tk_Offset(TkButton, padYPtr), - Tk_Offset(TkButton, padY), 0, 0, 0}, + tkDefLabelPady, offsetof(TkButton, padYPtr), + offsetof(TkButton, padY), 0, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", - DEF_LABCHKRAD_RELIEF, -1, Tk_Offset(TkButton, relief), 0, 0, 0}, + DEF_LABCHKRAD_RELIEF, -1, offsetof(TkButton, relief), 0, 0, 0}, {TK_OPTION_STRING_TABLE, "-state", "state", "State", - DEF_BUTTON_STATE, -1, Tk_Offset(TkButton, state), + DEF_BUTTON_STATE, -1, offsetof(TkButton, state), 0, stateStrings, 0}, {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", - DEF_LABEL_TAKE_FOCUS, Tk_Offset(TkButton, takeFocusPtr), -1, + DEF_LABEL_TAKE_FOCUS, offsetof(TkButton, takeFocusPtr), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-text", "text", "Text", - DEF_BUTTON_TEXT, Tk_Offset(TkButton, textPtr), -1, 0, 0, 0}, + DEF_BUTTON_TEXT, offsetof(TkButton, textPtr), -1, 0, 0, 0}, {TK_OPTION_STRING, "-textvariable", "textVariable", "Variable", - DEF_BUTTON_TEXT_VARIABLE, Tk_Offset(TkButton, textVarNamePtr), -1, + DEF_BUTTON_TEXT_VARIABLE, offsetof(TkButton, textVarNamePtr), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_INT, "-underline", "underline", "Underline", - DEF_BUTTON_UNDERLINE, -1, Tk_Offset(TkButton, underline), 0, 0, 0}, + DEF_BUTTON_UNDERLINE, -1, offsetof(TkButton, underline), 0, 0, 0}, {TK_OPTION_STRING, "-width", "width", "Width", - DEF_BUTTON_WIDTH, Tk_Offset(TkButton, widthPtr), -1, 0, 0, 0}, + DEF_BUTTON_WIDTH, offsetof(TkButton, widthPtr), -1, 0, 0, 0}, {TK_OPTION_PIXELS, "-wraplength", "wrapLength", "WrapLength", - DEF_BUTTON_WRAP_LENGTH, Tk_Offset(TkButton, wrapLengthPtr), - Tk_Offset(TkButton, wrapLength), 0, 0, 0}, + DEF_BUTTON_WRAP_LENGTH, offsetof(TkButton, wrapLengthPtr), + offsetof(TkButton, wrapLength), 0, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0} }; static const Tk_OptionSpec buttonOptionSpecs[] = { {TK_OPTION_BORDER, "-activebackground", "activeBackground", "Foreground", - DEF_BUTTON_ACTIVE_BG_COLOR, -1, Tk_Offset(TkButton, activeBorder), + DEF_BUTTON_ACTIVE_BG_COLOR, -1, offsetof(TkButton, activeBorder), 0, DEF_BUTTON_ACTIVE_BG_MONO, 0}, {TK_OPTION_COLOR, "-activeforeground", "activeForeground", "Background", - DEF_BUTTON_ACTIVE_FG_COLOR, -1, Tk_Offset(TkButton, activeFg), + DEF_BUTTON_ACTIVE_FG_COLOR, -1, offsetof(TkButton, activeFg), TK_OPTION_NULL_OK, DEF_BUTTON_ACTIVE_FG_MONO, 0}, {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", - DEF_BUTTON_ANCHOR, -1, Tk_Offset(TkButton, anchor), 0, 0, 0}, + DEF_BUTTON_ANCHOR, -1, offsetof(TkButton, anchor), 0, 0, 0}, {TK_OPTION_BORDER, "-background", "background", "Background", - DEF_BUTTON_BG_COLOR, -1, Tk_Offset(TkButton, normalBorder), + DEF_BUTTON_BG_COLOR, -1, offsetof(TkButton, normalBorder), 0, DEF_BUTTON_BG_MONO, 0}, {TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL, 0, -1, 0, "-borderwidth", 0}, {TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL, 0, -1, 0, "-background", 0}, {TK_OPTION_BITMAP, "-bitmap", "bitmap", "Bitmap", - DEF_BUTTON_BITMAP, -1, Tk_Offset(TkButton, bitmap), + DEF_BUTTON_BITMAP, -1, offsetof(TkButton, bitmap), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", - tkDefButtonBorderWidth, Tk_Offset(TkButton, borderWidthPtr), - Tk_Offset(TkButton, borderWidth), 0, 0, 0}, + tkDefButtonBorderWidth, offsetof(TkButton, borderWidthPtr), + offsetof(TkButton, borderWidth), 0, 0, 0}, {TK_OPTION_STRING, "-command", "command", "Command", - DEF_BUTTON_COMMAND, Tk_Offset(TkButton, commandPtr), -1, + DEF_BUTTON_COMMAND, offsetof(TkButton, commandPtr), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound", - DEF_BUTTON_COMPOUND, -1, Tk_Offset(TkButton, compound), 0, + DEF_BUTTON_COMPOUND, -1, offsetof(TkButton, compound), 0, compoundStrings, 0}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", - DEF_BUTTON_CURSOR, -1, Tk_Offset(TkButton, cursor), + DEF_BUTTON_CURSOR, -1, offsetof(TkButton, cursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING_TABLE, "-default", "default", "Default", - DEF_BUTTON_DEFAULT, -1, Tk_Offset(TkButton, defaultState), + DEF_BUTTON_DEFAULT, -1, offsetof(TkButton, defaultState), 0, defaultStrings, 0}, {TK_OPTION_COLOR, "-disabledforeground", "disabledForeground", "DisabledForeground", DEF_BUTTON_DISABLED_FG_COLOR, - -1, Tk_Offset(TkButton, disabledFg), TK_OPTION_NULL_OK, + -1, offsetof(TkButton, disabledFg), TK_OPTION_NULL_OK, (ClientData) DEF_BUTTON_DISABLED_FG_MONO, 0}, {TK_OPTION_SYNONYM, "-fg", "foreground", NULL, NULL, 0, -1, 0, "-foreground", 0}, {TK_OPTION_FONT, "-font", "font", "Font", - DEF_BUTTON_FONT, -1, Tk_Offset(TkButton, tkfont), 0, 0, 0}, + DEF_BUTTON_FONT, -1, offsetof(TkButton, tkfont), 0, 0, 0}, {TK_OPTION_COLOR, "-foreground", "foreground", "Foreground", - DEF_BUTTON_FG, -1, Tk_Offset(TkButton, normalFg), 0, 0, 0}, + DEF_BUTTON_FG, -1, offsetof(TkButton, normalFg), 0, 0, 0}, {TK_OPTION_STRING, "-height", "height", "Height", - DEF_BUTTON_HEIGHT, Tk_Offset(TkButton, heightPtr), -1, 0, 0, 0}, + DEF_BUTTON_HEIGHT, offsetof(TkButton, heightPtr), -1, 0, 0, 0}, {TK_OPTION_BORDER, "-highlightbackground", "highlightBackground", "HighlightBackground", DEF_BUTTON_HIGHLIGHT_BG_COLOR, - -1, Tk_Offset(TkButton, highlightBorder), 0, + -1, offsetof(TkButton, highlightBorder), 0, (ClientData) DEF_BUTTON_HIGHLIGHT_BG_MONO, 0}, {TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor", - DEF_BUTTON_HIGHLIGHT, -1, Tk_Offset(TkButton, highlightColorPtr), + DEF_BUTTON_HIGHLIGHT, -1, offsetof(TkButton, highlightColorPtr), 0, 0, 0}, {TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness", "HighlightThickness", tkDefButtonHighlightWidth, - Tk_Offset(TkButton, highlightWidthPtr), - Tk_Offset(TkButton, highlightWidth), 0, 0, 0}, + offsetof(TkButton, highlightWidthPtr), + offsetof(TkButton, highlightWidth), 0, 0, 0}, {TK_OPTION_STRING, "-image", "image", "Image", - DEF_BUTTON_IMAGE, Tk_Offset(TkButton, imagePtr), -1, + DEF_BUTTON_IMAGE, offsetof(TkButton, imagePtr), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify", - DEF_BUTTON_JUSTIFY, -1, Tk_Offset(TkButton, justify), 0, 0, 0}, + DEF_BUTTON_JUSTIFY, -1, offsetof(TkButton, justify), 0, 0, 0}, {TK_OPTION_RELIEF, "-overrelief", "overRelief", "OverRelief", - DEF_BUTTON_OVER_RELIEF, -1, Tk_Offset(TkButton, overRelief), + DEF_BUTTON_OVER_RELIEF, -1, offsetof(TkButton, overRelief), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-padx", "padX", "Pad", - tkDefButtonPadx, Tk_Offset(TkButton, padXPtr), - Tk_Offset(TkButton, padX), 0, 0, 0}, + tkDefButtonPadx, offsetof(TkButton, padXPtr), + offsetof(TkButton, padX), 0, 0, 0}, {TK_OPTION_PIXELS, "-pady", "padY", "Pad", - tkDefButtonPady, Tk_Offset(TkButton, padYPtr), - Tk_Offset(TkButton, padY), 0, 0, 0}, + tkDefButtonPady, offsetof(TkButton, padYPtr), + offsetof(TkButton, padY), 0, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", - DEF_BUTTON_RELIEF, -1, Tk_Offset(TkButton, relief), + DEF_BUTTON_RELIEF, -1, offsetof(TkButton, relief), 0, 0, 0}, {TK_OPTION_INT, "-repeatdelay", "repeatDelay", "RepeatDelay", - DEF_BUTTON_REPEAT_DELAY, -1, Tk_Offset(TkButton, repeatDelay), + DEF_BUTTON_REPEAT_DELAY, -1, offsetof(TkButton, repeatDelay), 0, 0, 0}, {TK_OPTION_INT, "-repeatinterval", "repeatInterval", "RepeatInterval", - DEF_BUTTON_REPEAT_INTERVAL, -1, Tk_Offset(TkButton, repeatInterval), + DEF_BUTTON_REPEAT_INTERVAL, -1, offsetof(TkButton, repeatInterval), 0, 0, 0}, {TK_OPTION_STRING_TABLE, "-state", "state", "State", - DEF_BUTTON_STATE, -1, Tk_Offset(TkButton, state), + DEF_BUTTON_STATE, -1, offsetof(TkButton, state), 0, stateStrings, 0}, {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", - DEF_BUTTON_TAKE_FOCUS, Tk_Offset(TkButton, takeFocusPtr), -1, + DEF_BUTTON_TAKE_FOCUS, offsetof(TkButton, takeFocusPtr), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-text", "text", "Text", - DEF_BUTTON_TEXT, Tk_Offset(TkButton, textPtr), -1, 0, 0, 0}, + DEF_BUTTON_TEXT, offsetof(TkButton, textPtr), -1, 0, 0, 0}, {TK_OPTION_STRING, "-textvariable", "textVariable", "Variable", - DEF_BUTTON_TEXT_VARIABLE, Tk_Offset(TkButton, textVarNamePtr), -1, + DEF_BUTTON_TEXT_VARIABLE, offsetof(TkButton, textVarNamePtr), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_INT, "-underline", "underline", "Underline", - DEF_BUTTON_UNDERLINE, -1, Tk_Offset(TkButton, underline), 0, 0, 0}, + DEF_BUTTON_UNDERLINE, -1, offsetof(TkButton, underline), 0, 0, 0}, {TK_OPTION_STRING, "-width", "width", "Width", - DEF_BUTTON_WIDTH, Tk_Offset(TkButton, widthPtr), -1, 0, 0, 0}, + DEF_BUTTON_WIDTH, offsetof(TkButton, widthPtr), -1, 0, 0, 0}, {TK_OPTION_PIXELS, "-wraplength", "wrapLength", "WrapLength", - DEF_BUTTON_WRAP_LENGTH, Tk_Offset(TkButton, wrapLengthPtr), - Tk_Offset(TkButton, wrapLength), 0, 0, 0}, + DEF_BUTTON_WRAP_LENGTH, offsetof(TkButton, wrapLengthPtr), + offsetof(TkButton, wrapLength), 0, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, 0, 0} }; static const Tk_OptionSpec checkbuttonOptionSpecs[] = { {TK_OPTION_BORDER, "-activebackground", "activeBackground", "Foreground", - DEF_BUTTON_ACTIVE_BG_COLOR, -1, Tk_Offset(TkButton, activeBorder), + DEF_BUTTON_ACTIVE_BG_COLOR, -1, offsetof(TkButton, activeBorder), 0, DEF_BUTTON_ACTIVE_BG_MONO, 0}, {TK_OPTION_COLOR, "-activeforeground", "activeForeground", "Background", - DEF_CHKRAD_ACTIVE_FG_COLOR, -1, Tk_Offset(TkButton, activeFg), + DEF_CHKRAD_ACTIVE_FG_COLOR, -1, offsetof(TkButton, activeFg), TK_OPTION_NULL_OK, DEF_BUTTON_ACTIVE_FG_MONO, 0}, {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", - DEF_BUTTON_ANCHOR, -1, Tk_Offset(TkButton, anchor), 0, 0, 0}, + DEF_BUTTON_ANCHOR, -1, offsetof(TkButton, anchor), 0, 0, 0}, {TK_OPTION_BORDER, "-background", "background", "Background", - DEF_BUTTON_BG_COLOR, -1, Tk_Offset(TkButton, normalBorder), + DEF_BUTTON_BG_COLOR, -1, offsetof(TkButton, normalBorder), 0, DEF_BUTTON_BG_MONO, 0}, {TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL, 0, -1, 0, "-borderwidth", 0}, {TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL, 0, -1, 0, "-background", 0}, {TK_OPTION_BITMAP, "-bitmap", "bitmap", "Bitmap", - DEF_BUTTON_BITMAP, -1, Tk_Offset(TkButton, bitmap), + DEF_BUTTON_BITMAP, -1, offsetof(TkButton, bitmap), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", - tkDefButtonBorderWidth, Tk_Offset(TkButton, borderWidthPtr), - Tk_Offset(TkButton, borderWidth), 0, 0, 0}, + tkDefButtonBorderWidth, offsetof(TkButton, borderWidthPtr), + offsetof(TkButton, borderWidth), 0, 0, 0}, {TK_OPTION_STRING, "-command", "command", "Command", - DEF_BUTTON_COMMAND, Tk_Offset(TkButton, commandPtr), -1, + DEF_BUTTON_COMMAND, offsetof(TkButton, commandPtr), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound", - DEF_BUTTON_COMPOUND, -1, Tk_Offset(TkButton, compound), 0, + DEF_BUTTON_COMPOUND, -1, offsetof(TkButton, compound), 0, compoundStrings, 0}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", - DEF_BUTTON_CURSOR, -1, Tk_Offset(TkButton, cursor), + DEF_BUTTON_CURSOR, -1, offsetof(TkButton, cursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_COLOR, "-disabledforeground", "disabledForeground", "DisabledForeground", DEF_BUTTON_DISABLED_FG_COLOR, - -1, Tk_Offset(TkButton, disabledFg), TK_OPTION_NULL_OK, + -1, offsetof(TkButton, disabledFg), TK_OPTION_NULL_OK, (ClientData) DEF_BUTTON_DISABLED_FG_MONO, 0}, {TK_OPTION_SYNONYM, "-fg", "foreground", NULL, NULL, 0, -1, 0, "-foreground", 0}, {TK_OPTION_FONT, "-font", "font", "Font", - DEF_BUTTON_FONT, -1, Tk_Offset(TkButton, tkfont), 0, 0, 0}, + DEF_BUTTON_FONT, -1, offsetof(TkButton, tkfont), 0, 0, 0}, {TK_OPTION_COLOR, "-foreground", "foreground", "Foreground", - DEF_CHKRAD_FG, -1, Tk_Offset(TkButton, normalFg), 0, 0, 0}, + DEF_CHKRAD_FG, -1, offsetof(TkButton, normalFg), 0, 0, 0}, {TK_OPTION_STRING, "-height", "height", "Height", - DEF_BUTTON_HEIGHT, Tk_Offset(TkButton, heightPtr), -1, 0, 0, 0}, + DEF_BUTTON_HEIGHT, offsetof(TkButton, heightPtr), -1, 0, 0, 0}, {TK_OPTION_BORDER, "-highlightbackground", "highlightBackground", "HighlightBackground", DEF_BUTTON_HIGHLIGHT_BG_COLOR, - -1, Tk_Offset(TkButton, highlightBorder), 0, + -1, offsetof(TkButton, highlightBorder), 0, (ClientData) DEF_BUTTON_HIGHLIGHT_BG_MONO, 0}, {TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor", - DEF_BUTTON_HIGHLIGHT, -1, Tk_Offset(TkButton, highlightColorPtr), + DEF_BUTTON_HIGHLIGHT, -1, offsetof(TkButton, highlightColorPtr), 0, 0, 0}, {TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness", "HighlightThickness", tkDefButtonHighlightWidth, - Tk_Offset(TkButton, highlightWidthPtr), - Tk_Offset(TkButton, highlightWidth), 0, 0, 0}, + offsetof(TkButton, highlightWidthPtr), + offsetof(TkButton, highlightWidth), 0, 0, 0}, {TK_OPTION_STRING, "-image", "image", "Image", - DEF_BUTTON_IMAGE, Tk_Offset(TkButton, imagePtr), -1, + DEF_BUTTON_IMAGE, offsetof(TkButton, imagePtr), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BOOLEAN, "-indicatoron", "indicatorOn", "IndicatorOn", - DEF_BUTTON_INDICATOR, -1, Tk_Offset(TkButton, indicatorOn), 0, 0, 0}, + DEF_BUTTON_INDICATOR, -1, offsetof(TkButton, indicatorOn), 0, 0, 0}, {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify", - DEF_BUTTON_JUSTIFY, -1, Tk_Offset(TkButton, justify), 0, 0, 0}, + DEF_BUTTON_JUSTIFY, -1, offsetof(TkButton, justify), 0, 0, 0}, {TK_OPTION_RELIEF, "-offrelief", "offRelief", "OffRelief", - DEF_BUTTON_RELIEF, -1, Tk_Offset(TkButton, offRelief), 0, 0, 0}, + DEF_BUTTON_RELIEF, -1, offsetof(TkButton, offRelief), 0, 0, 0}, {TK_OPTION_STRING, "-offvalue", "offValue", "Value", - DEF_BUTTON_OFF_VALUE, Tk_Offset(TkButton, offValuePtr), -1, 0, 0, 0}, + DEF_BUTTON_OFF_VALUE, offsetof(TkButton, offValuePtr), -1, 0, 0, 0}, {TK_OPTION_STRING, "-onvalue", "onValue", "Value", - DEF_BUTTON_ON_VALUE, Tk_Offset(TkButton, onValuePtr), -1, 0, 0, 0}, + DEF_BUTTON_ON_VALUE, offsetof(TkButton, onValuePtr), -1, 0, 0, 0}, {TK_OPTION_RELIEF, "-overrelief", "overRelief", "OverRelief", - DEF_BUTTON_OVER_RELIEF, -1, Tk_Offset(TkButton, overRelief), + DEF_BUTTON_OVER_RELIEF, -1, offsetof(TkButton, overRelief), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-padx", "padX", "Pad", - tkDefLabelPadx, Tk_Offset(TkButton, padXPtr), - Tk_Offset(TkButton, padX), 0, 0, 0}, + tkDefLabelPadx, offsetof(TkButton, padXPtr), + offsetof(TkButton, padX), 0, 0, 0}, {TK_OPTION_PIXELS, "-pady", "padY", "Pad", - tkDefLabelPady, Tk_Offset(TkButton, padYPtr), - Tk_Offset(TkButton, padY), 0, 0, 0}, + tkDefLabelPady, offsetof(TkButton, padYPtr), + offsetof(TkButton, padY), 0, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", - DEF_LABCHKRAD_RELIEF, -1, Tk_Offset(TkButton, relief), 0, 0, 0}, + DEF_LABCHKRAD_RELIEF, -1, offsetof(TkButton, relief), 0, 0, 0}, {TK_OPTION_BORDER, "-selectcolor", "selectColor", "Background", - DEF_BUTTON_SELECT_COLOR, -1, Tk_Offset(TkButton, selectBorder), + DEF_BUTTON_SELECT_COLOR, -1, offsetof(TkButton, selectBorder), TK_OPTION_NULL_OK, DEF_BUTTON_SELECT_MONO, 0}, {TK_OPTION_STRING, "-selectimage", "selectImage", "SelectImage", - DEF_BUTTON_SELECT_IMAGE, Tk_Offset(TkButton, selectImagePtr), -1, + DEF_BUTTON_SELECT_IMAGE, offsetof(TkButton, selectImagePtr), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING_TABLE, "-state", "state", "State", - DEF_BUTTON_STATE, -1, Tk_Offset(TkButton, state), + DEF_BUTTON_STATE, -1, offsetof(TkButton, state), 0, stateStrings, 0}, {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", - DEF_BUTTON_TAKE_FOCUS, Tk_Offset(TkButton, takeFocusPtr), -1, + DEF_BUTTON_TAKE_FOCUS, offsetof(TkButton, takeFocusPtr), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-text", "text", "Text", - DEF_BUTTON_TEXT, Tk_Offset(TkButton, textPtr), -1, 0, 0, 0}, + DEF_BUTTON_TEXT, offsetof(TkButton, textPtr), -1, 0, 0, 0}, {TK_OPTION_STRING, "-textvariable", "textVariable", "Variable", - DEF_BUTTON_TEXT_VARIABLE, Tk_Offset(TkButton, textVarNamePtr), -1, + DEF_BUTTON_TEXT_VARIABLE, offsetof(TkButton, textVarNamePtr), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-tristateimage", "tristateImage", "TristateImage", - DEF_BUTTON_IMAGE, Tk_Offset(TkButton, tristateImagePtr), -1, + DEF_BUTTON_IMAGE, offsetof(TkButton, tristateImagePtr), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-tristatevalue", "tristateValue", "TristateValue", - DEF_BUTTON_TRISTATE_VALUE, Tk_Offset(TkButton, tristateValuePtr), -1, 0, 0, 0}, + DEF_BUTTON_TRISTATE_VALUE, offsetof(TkButton, tristateValuePtr), -1, 0, 0, 0}, {TK_OPTION_INT, "-underline", "underline", "Underline", - DEF_BUTTON_UNDERLINE, -1, Tk_Offset(TkButton, underline), 0, 0, 0}, + DEF_BUTTON_UNDERLINE, -1, offsetof(TkButton, underline), 0, 0, 0}, {TK_OPTION_STRING, "-variable", "variable", "Variable", - DEF_CHECKBUTTON_VARIABLE, Tk_Offset(TkButton, selVarNamePtr), -1, + DEF_CHECKBUTTON_VARIABLE, offsetof(TkButton, selVarNamePtr), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-width", "width", "Width", - DEF_BUTTON_WIDTH, Tk_Offset(TkButton, widthPtr), -1, 0, 0, 0}, + DEF_BUTTON_WIDTH, offsetof(TkButton, widthPtr), -1, 0, 0, 0}, {TK_OPTION_PIXELS, "-wraplength", "wrapLength", "WrapLength", - DEF_BUTTON_WRAP_LENGTH, Tk_Offset(TkButton, wrapLengthPtr), - Tk_Offset(TkButton, wrapLength), 0, 0, 0}, + DEF_BUTTON_WRAP_LENGTH, offsetof(TkButton, wrapLengthPtr), + offsetof(TkButton, wrapLength), 0, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, 0, 0} }; static const Tk_OptionSpec radiobuttonOptionSpecs[] = { {TK_OPTION_BORDER, "-activebackground", "activeBackground", "Foreground", - DEF_BUTTON_ACTIVE_BG_COLOR, -1, Tk_Offset(TkButton, activeBorder), + DEF_BUTTON_ACTIVE_BG_COLOR, -1, offsetof(TkButton, activeBorder), 0, DEF_BUTTON_ACTIVE_BG_MONO, 0}, {TK_OPTION_COLOR, "-activeforeground", "activeForeground", "Background", - DEF_CHKRAD_ACTIVE_FG_COLOR, -1, Tk_Offset(TkButton, activeFg), + DEF_CHKRAD_ACTIVE_FG_COLOR, -1, offsetof(TkButton, activeFg), TK_OPTION_NULL_OK, DEF_BUTTON_ACTIVE_FG_MONO, 0}, {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", - DEF_BUTTON_ANCHOR, -1, Tk_Offset(TkButton, anchor), 0, 0, 0}, + DEF_BUTTON_ANCHOR, -1, offsetof(TkButton, anchor), 0, 0, 0}, {TK_OPTION_BORDER, "-background", "background", "Background", - DEF_BUTTON_BG_COLOR, -1, Tk_Offset(TkButton, normalBorder), + DEF_BUTTON_BG_COLOR, -1, offsetof(TkButton, normalBorder), 0, DEF_BUTTON_BG_MONO, 0}, {TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL, 0, -1, 0, "-borderwidth", 0}, {TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL, 0, -1, 0, "-background", 0}, {TK_OPTION_BITMAP, "-bitmap", "bitmap", "Bitmap", - DEF_BUTTON_BITMAP, -1, Tk_Offset(TkButton, bitmap), + DEF_BUTTON_BITMAP, -1, offsetof(TkButton, bitmap), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", - tkDefButtonBorderWidth, Tk_Offset(TkButton, borderWidthPtr), - Tk_Offset(TkButton, borderWidth), 0, 0, 0}, + tkDefButtonBorderWidth, offsetof(TkButton, borderWidthPtr), + offsetof(TkButton, borderWidth), 0, 0, 0}, {TK_OPTION_STRING, "-command", "command", "Command", - DEF_BUTTON_COMMAND, Tk_Offset(TkButton, commandPtr), -1, + DEF_BUTTON_COMMAND, offsetof(TkButton, commandPtr), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound", - DEF_BUTTON_COMPOUND, -1, Tk_Offset(TkButton, compound), 0, + DEF_BUTTON_COMPOUND, -1, offsetof(TkButton, compound), 0, compoundStrings, 0}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", - DEF_BUTTON_CURSOR, -1, Tk_Offset(TkButton, cursor), + DEF_BUTTON_CURSOR, -1, offsetof(TkButton, cursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_COLOR, "-disabledforeground", "disabledForeground", "DisabledForeground", DEF_BUTTON_DISABLED_FG_COLOR, - -1, Tk_Offset(TkButton, disabledFg), TK_OPTION_NULL_OK, + -1, offsetof(TkButton, disabledFg), TK_OPTION_NULL_OK, (ClientData) DEF_BUTTON_DISABLED_FG_MONO, 0}, {TK_OPTION_SYNONYM, "-fg", "foreground", NULL, NULL, 0, -1, 0, "-foreground", 0}, {TK_OPTION_FONT, "-font", "font", "Font", - DEF_BUTTON_FONT, -1, Tk_Offset(TkButton, tkfont), 0, 0, 0}, + DEF_BUTTON_FONT, -1, offsetof(TkButton, tkfont), 0, 0, 0}, {TK_OPTION_COLOR, "-foreground", "foreground", "Foreground", - DEF_CHKRAD_FG, -1, Tk_Offset(TkButton, normalFg), 0, 0, 0}, + DEF_CHKRAD_FG, -1, offsetof(TkButton, normalFg), 0, 0, 0}, {TK_OPTION_STRING, "-height", "height", "Height", - DEF_BUTTON_HEIGHT, Tk_Offset(TkButton, heightPtr), -1, 0, 0, 0}, + DEF_BUTTON_HEIGHT, offsetof(TkButton, heightPtr), -1, 0, 0, 0}, {TK_OPTION_BORDER, "-highlightbackground", "highlightBackground", "HighlightBackground", DEF_BUTTON_HIGHLIGHT_BG_COLOR, - -1, Tk_Offset(TkButton, highlightBorder), 0, + -1, offsetof(TkButton, highlightBorder), 0, (ClientData) DEF_BUTTON_HIGHLIGHT_BG_MONO, 0}, {TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor", - DEF_BUTTON_HIGHLIGHT, -1, Tk_Offset(TkButton, highlightColorPtr), + DEF_BUTTON_HIGHLIGHT, -1, offsetof(TkButton, highlightColorPtr), 0, 0, 0}, {TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness", "HighlightThickness", tkDefButtonHighlightWidth, - Tk_Offset(TkButton, highlightWidthPtr), - Tk_Offset(TkButton, highlightWidth), 0, 0, 0}, + offsetof(TkButton, highlightWidthPtr), + offsetof(TkButton, highlightWidth), 0, 0, 0}, {TK_OPTION_STRING, "-image", "image", "Image", - DEF_BUTTON_IMAGE, Tk_Offset(TkButton, imagePtr), -1, + DEF_BUTTON_IMAGE, offsetof(TkButton, imagePtr), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BOOLEAN, "-indicatoron", "indicatorOn", "IndicatorOn", - DEF_BUTTON_INDICATOR, -1, Tk_Offset(TkButton, indicatorOn), + DEF_BUTTON_INDICATOR, -1, offsetof(TkButton, indicatorOn), 0, 0, 0}, {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify", - DEF_BUTTON_JUSTIFY, -1, Tk_Offset(TkButton, justify), 0, 0, 0}, + DEF_BUTTON_JUSTIFY, -1, offsetof(TkButton, justify), 0, 0, 0}, {TK_OPTION_RELIEF, "-offrelief", "offRelief", "OffRelief", - DEF_BUTTON_RELIEF, -1, Tk_Offset(TkButton, offRelief), 0, 0, 0}, + DEF_BUTTON_RELIEF, -1, offsetof(TkButton, offRelief), 0, 0, 0}, {TK_OPTION_RELIEF, "-overrelief", "overRelief", "OverRelief", - DEF_BUTTON_OVER_RELIEF, -1, Tk_Offset(TkButton, overRelief), + DEF_BUTTON_OVER_RELIEF, -1, offsetof(TkButton, overRelief), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-padx", "padX", "Pad", - tkDefLabelPadx, Tk_Offset(TkButton, padXPtr), - Tk_Offset(TkButton, padX), 0, 0, 0}, + tkDefLabelPadx, offsetof(TkButton, padXPtr), + offsetof(TkButton, padX), 0, 0, 0}, {TK_OPTION_PIXELS, "-pady", "padY", "Pad", - tkDefLabelPady, Tk_Offset(TkButton, padYPtr), - Tk_Offset(TkButton, padY), 0, 0, 0}, + tkDefLabelPady, offsetof(TkButton, padYPtr), + offsetof(TkButton, padY), 0, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", - DEF_LABCHKRAD_RELIEF, -1, Tk_Offset(TkButton, relief), 0, 0, 0}, + DEF_LABCHKRAD_RELIEF, -1, offsetof(TkButton, relief), 0, 0, 0}, {TK_OPTION_BORDER, "-selectcolor", "selectColor", "Background", - DEF_BUTTON_SELECT_COLOR, -1, Tk_Offset(TkButton, selectBorder), + DEF_BUTTON_SELECT_COLOR, -1, offsetof(TkButton, selectBorder), TK_OPTION_NULL_OK, DEF_BUTTON_SELECT_MONO, 0}, {TK_OPTION_STRING, "-selectimage", "selectImage", "SelectImage", - DEF_BUTTON_SELECT_IMAGE, Tk_Offset(TkButton, selectImagePtr), -1, + DEF_BUTTON_SELECT_IMAGE, offsetof(TkButton, selectImagePtr), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING_TABLE, "-state", "state", "State", - DEF_BUTTON_STATE, -1, Tk_Offset(TkButton, state), + DEF_BUTTON_STATE, -1, offsetof(TkButton, state), 0, stateStrings, 0}, {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", - DEF_BUTTON_TAKE_FOCUS, Tk_Offset(TkButton, takeFocusPtr), -1, + DEF_BUTTON_TAKE_FOCUS, offsetof(TkButton, takeFocusPtr), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-text", "text", "Text", - DEF_BUTTON_TEXT, Tk_Offset(TkButton, textPtr), -1, 0, 0, 0}, + DEF_BUTTON_TEXT, offsetof(TkButton, textPtr), -1, 0, 0, 0}, {TK_OPTION_STRING, "-textvariable", "textVariable", "Variable", - DEF_BUTTON_TEXT_VARIABLE, Tk_Offset(TkButton, textVarNamePtr), -1, + DEF_BUTTON_TEXT_VARIABLE, offsetof(TkButton, textVarNamePtr), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-tristateimage", "tristateImage", "TristateImage", - DEF_BUTTON_IMAGE, Tk_Offset(TkButton, tristateImagePtr), -1, + DEF_BUTTON_IMAGE, offsetof(TkButton, tristateImagePtr), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-tristatevalue", "tristateValue", "TristateValue", - DEF_BUTTON_TRISTATE_VALUE, Tk_Offset(TkButton, tristateValuePtr), -1, 0, 0, 0}, + DEF_BUTTON_TRISTATE_VALUE, offsetof(TkButton, tristateValuePtr), -1, 0, 0, 0}, {TK_OPTION_INT, "-underline", "underline", "Underline", - DEF_BUTTON_UNDERLINE, -1, Tk_Offset(TkButton, underline), 0, 0, 0}, + DEF_BUTTON_UNDERLINE, -1, offsetof(TkButton, underline), 0, 0, 0}, {TK_OPTION_STRING, "-value", "value", "Value", - DEF_BUTTON_VALUE, Tk_Offset(TkButton, onValuePtr), -1, 0, 0, 0}, + DEF_BUTTON_VALUE, offsetof(TkButton, onValuePtr), -1, 0, 0, 0}, {TK_OPTION_STRING, "-variable", "variable", "Variable", - DEF_RADIOBUTTON_VARIABLE, Tk_Offset(TkButton, selVarNamePtr), -1, + DEF_RADIOBUTTON_VARIABLE, offsetof(TkButton, selVarNamePtr), -1, 0, 0, 0}, {TK_OPTION_STRING, "-width", "width", "Width", - DEF_BUTTON_WIDTH, Tk_Offset(TkButton, widthPtr), -1, 0, 0, 0}, + DEF_BUTTON_WIDTH, offsetof(TkButton, widthPtr), -1, 0, 0, 0}, {TK_OPTION_PIXELS, "-wraplength", "wrapLength", "WrapLength", - DEF_BUTTON_WRAP_LENGTH, Tk_Offset(TkButton, wrapLengthPtr), - Tk_Offset(TkButton, wrapLength), 0, 0, 0}, + DEF_BUTTON_WRAP_LENGTH, offsetof(TkButton, wrapLengthPtr), + offsetof(TkButton, wrapLength), 0, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, 0, 0} }; diff --git a/generic/tkCanvArc.c b/generic/tkCanvArc.c index 79593ef..cd7ce9d 100644 --- a/generic/tkCanvArc.c +++ b/generic/tkCanvArc.c @@ -112,67 +112,67 @@ static const Tk_CustomOption pixelOption = { static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_CUSTOM, "-activedash", NULL, NULL, - NULL, Tk_Offset(ArcItem, outline.activeDash), + NULL, offsetof(ArcItem, outline.activeDash), TK_CONFIG_NULL_OK, &dashOption}, {TK_CONFIG_COLOR, "-activefill", NULL, NULL, - NULL, Tk_Offset(ArcItem, activeFillColor), TK_CONFIG_NULL_OK, NULL}, + NULL, offsetof(ArcItem, activeFillColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_COLOR, "-activeoutline", NULL, NULL, - NULL, Tk_Offset(ArcItem, outline.activeColor), TK_CONFIG_NULL_OK, NULL}, + NULL, offsetof(ArcItem, outline.activeColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BITMAP, "-activeoutlinestipple", NULL, NULL, - NULL, Tk_Offset(ArcItem, outline.activeStipple), TK_CONFIG_NULL_OK, NULL}, + NULL, offsetof(ArcItem, outline.activeStipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BITMAP, "-activestipple", NULL, NULL, - NULL, Tk_Offset(ArcItem, activeFillStipple), TK_CONFIG_NULL_OK, NULL}, + NULL, offsetof(ArcItem, activeFillStipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_CUSTOM, "-activewidth", NULL, NULL, - "0.0", Tk_Offset(ArcItem, outline.activeWidth), + "0.0", offsetof(ArcItem, outline.activeWidth), TK_CONFIG_DONT_SET_DEFAULT, &pixelOption}, {TK_CONFIG_CUSTOM, "-dash", NULL, NULL, - NULL, Tk_Offset(ArcItem, outline.dash), + NULL, offsetof(ArcItem, outline.dash), TK_CONFIG_NULL_OK, &dashOption}, {TK_CONFIG_PIXELS, "-dashoffset", NULL, NULL, - "0", Tk_Offset(ArcItem, outline.offset), TK_CONFIG_DONT_SET_DEFAULT, NULL}, + "0", offsetof(ArcItem, outline.offset), TK_CONFIG_DONT_SET_DEFAULT, NULL}, {TK_CONFIG_CUSTOM, "-disableddash", NULL, NULL, - NULL, Tk_Offset(ArcItem, outline.disabledDash), + NULL, offsetof(ArcItem, outline.disabledDash), TK_CONFIG_NULL_OK, &dashOption}, {TK_CONFIG_COLOR, "-disabledfill", NULL, NULL, - NULL, Tk_Offset(ArcItem, disabledFillColor), TK_CONFIG_NULL_OK, NULL}, + NULL, offsetof(ArcItem, disabledFillColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_COLOR, "-disabledoutline", NULL, NULL, - NULL, Tk_Offset(ArcItem, outline.disabledColor), TK_CONFIG_NULL_OK, NULL}, + NULL, offsetof(ArcItem, outline.disabledColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BITMAP, "-disabledoutlinestipple", NULL, NULL, - NULL, Tk_Offset(ArcItem, outline.disabledStipple), TK_CONFIG_NULL_OK, NULL}, + NULL, offsetof(ArcItem, outline.disabledStipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BITMAP, "-disabledstipple", NULL, NULL, - NULL, Tk_Offset(ArcItem, disabledFillStipple), TK_CONFIG_NULL_OK, NULL}, + NULL, offsetof(ArcItem, disabledFillStipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_CUSTOM, "-disabledwidth", NULL, NULL, - "0.0", Tk_Offset(ArcItem, outline.disabledWidth), + "0.0", offsetof(ArcItem, outline.disabledWidth), TK_CONFIG_DONT_SET_DEFAULT, &pixelOption}, {TK_CONFIG_DOUBLE, "-extent", NULL, NULL, - "90", Tk_Offset(ArcItem, extent), TK_CONFIG_DONT_SET_DEFAULT, NULL}, + "90", offsetof(ArcItem, extent), TK_CONFIG_DONT_SET_DEFAULT, NULL}, {TK_CONFIG_COLOR, "-fill", NULL, NULL, - NULL, Tk_Offset(ArcItem, fillColor), TK_CONFIG_NULL_OK, NULL}, + NULL, offsetof(ArcItem, fillColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_DOUBLE, "-height", NULL, NULL, - 0, Tk_Offset(ArcItem, height), TK_CONFIG_DONT_SET_DEFAULT, NULL}, + 0, offsetof(ArcItem, height), TK_CONFIG_DONT_SET_DEFAULT, NULL}, {TK_CONFIG_CUSTOM, "-offset", NULL, NULL, - "0,0", Tk_Offset(ArcItem, tsoffset), + "0,0", offsetof(ArcItem, tsoffset), TK_CONFIG_DONT_SET_DEFAULT, &offsetOption}, {TK_CONFIG_COLOR, "-outline", NULL, NULL, - "black", Tk_Offset(ArcItem, outline.color), TK_CONFIG_NULL_OK, NULL}, + "black", offsetof(ArcItem, outline.color), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_CUSTOM, "-outlineoffset", NULL, NULL, - "0,0", Tk_Offset(ArcItem, outline.tsoffset), + "0,0", offsetof(ArcItem, outline.tsoffset), TK_CONFIG_DONT_SET_DEFAULT, &offsetOption}, {TK_CONFIG_BITMAP, "-outlinestipple", NULL, NULL, - NULL, Tk_Offset(ArcItem, outline.stipple), TK_CONFIG_NULL_OK, NULL}, + NULL, offsetof(ArcItem, outline.stipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_DOUBLE, "-start", NULL, NULL, - "0", Tk_Offset(ArcItem, start), TK_CONFIG_DONT_SET_DEFAULT, NULL}, + "0", offsetof(ArcItem, start), TK_CONFIG_DONT_SET_DEFAULT, NULL}, {TK_CONFIG_CUSTOM, "-state", NULL, NULL, - NULL, Tk_Offset(Tk_Item, state), TK_CONFIG_NULL_OK, &stateOption}, + NULL, offsetof(Tk_Item, state), TK_CONFIG_NULL_OK, &stateOption}, {TK_CONFIG_BITMAP, "-stipple", NULL, NULL, - NULL, Tk_Offset(ArcItem, fillStipple), TK_CONFIG_NULL_OK, NULL}, + NULL, offsetof(ArcItem, fillStipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_CUSTOM, "-style", NULL, NULL, - NULL, Tk_Offset(ArcItem, style), TK_CONFIG_DONT_SET_DEFAULT, + NULL, offsetof(ArcItem, style), TK_CONFIG_DONT_SET_DEFAULT, &styleOption}, {TK_CONFIG_CUSTOM, "-tags", NULL, NULL, NULL, 0, TK_CONFIG_NULL_OK, &tagsOption}, {TK_CONFIG_CUSTOM, "-width", NULL, NULL, - "1.0", Tk_Offset(ArcItem, outline.width), TK_CONFIG_DONT_SET_DEFAULT, + "1.0", offsetof(ArcItem, outline.width), TK_CONFIG_DONT_SET_DEFAULT, &pixelOption}, {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL} }; diff --git a/generic/tkCanvBmap.c b/generic/tkCanvBmap.c index 34c74f3..1fdfdf5 100644 --- a/generic/tkCanvBmap.c +++ b/generic/tkCanvBmap.c @@ -49,30 +49,30 @@ static const Tk_CustomOption tagsOption = { static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_COLOR, "-activebackground", NULL, NULL, - NULL, Tk_Offset(BitmapItem, activeBgColor), TK_CONFIG_NULL_OK, NULL}, + NULL, offsetof(BitmapItem, activeBgColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BITMAP, "-activebitmap", NULL, NULL, - NULL, Tk_Offset(BitmapItem, activeBitmap), TK_CONFIG_NULL_OK, NULL}, + NULL, offsetof(BitmapItem, activeBitmap), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_COLOR, "-activeforeground", NULL, NULL, - NULL, Tk_Offset(BitmapItem, activeFgColor), TK_CONFIG_NULL_OK, NULL}, + NULL, offsetof(BitmapItem, activeFgColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_ANCHOR, "-anchor", NULL, NULL, - "center", Tk_Offset(BitmapItem, anchor), TK_CONFIG_DONT_SET_DEFAULT, NULL}, + "center", offsetof(BitmapItem, anchor), TK_CONFIG_DONT_SET_DEFAULT, NULL}, {TK_CONFIG_COLOR, "-background", NULL, NULL, - NULL, Tk_Offset(BitmapItem, bgColor), TK_CONFIG_NULL_OK, NULL}, + NULL, offsetof(BitmapItem, bgColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BITMAP, "-bitmap", NULL, NULL, - NULL, Tk_Offset(BitmapItem, bitmap), TK_CONFIG_NULL_OK, NULL}, + NULL, offsetof(BitmapItem, bitmap), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_COLOR, "-disabledbackground", NULL, NULL, - NULL, Tk_Offset(BitmapItem, disabledBgColor), + NULL, offsetof(BitmapItem, disabledBgColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BITMAP, "-disabledbitmap", NULL, NULL, - NULL, Tk_Offset(BitmapItem, disabledBitmap), + NULL, offsetof(BitmapItem, disabledBitmap), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_COLOR, "-disabledforeground", NULL, NULL, - NULL, Tk_Offset(BitmapItem, disabledFgColor), + NULL, offsetof(BitmapItem, disabledFgColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_COLOR, "-foreground", NULL, NULL, - "black", Tk_Offset(BitmapItem, fgColor), 0, NULL}, + "black", offsetof(BitmapItem, fgColor), 0, NULL}, {TK_CONFIG_CUSTOM, "-state", NULL, NULL, - NULL, Tk_Offset(Tk_Item, state), TK_CONFIG_NULL_OK, + NULL, offsetof(Tk_Item, state), TK_CONFIG_NULL_OK, &stateOption}, {TK_CONFIG_CUSTOM, "-tags", NULL, NULL, NULL, 0, TK_CONFIG_NULL_OK, &tagsOption}, diff --git a/generic/tkCanvImg.c b/generic/tkCanvImg.c index f2b73a6..19e1c70 100644 --- a/generic/tkCanvImg.c +++ b/generic/tkCanvImg.c @@ -52,15 +52,15 @@ static const Tk_CustomOption tagsOption = { static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_STRING, "-activeimage", NULL, NULL, - NULL, Tk_Offset(ImageItem, activeImageString), TK_CONFIG_NULL_OK, NULL}, + NULL, offsetof(ImageItem, activeImageString), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_ANCHOR, "-anchor", NULL, NULL, - "center", Tk_Offset(ImageItem, anchor), TK_CONFIG_DONT_SET_DEFAULT, NULL}, + "center", offsetof(ImageItem, anchor), TK_CONFIG_DONT_SET_DEFAULT, NULL}, {TK_CONFIG_STRING, "-disabledimage", NULL, NULL, - NULL, Tk_Offset(ImageItem, disabledImageString), TK_CONFIG_NULL_OK, NULL}, + NULL, offsetof(ImageItem, disabledImageString), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_STRING, "-image", NULL, NULL, - NULL, Tk_Offset(ImageItem, imageString), TK_CONFIG_NULL_OK, NULL}, + NULL, offsetof(ImageItem, imageString), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_CUSTOM, "-state", NULL, NULL, - NULL, Tk_Offset(Tk_Item, state), TK_CONFIG_NULL_OK, &stateOption}, + NULL, offsetof(Tk_Item, state), TK_CONFIG_NULL_OK, &stateOption}, {TK_CONFIG_CUSTOM, "-tags", NULL, NULL, NULL, 0, TK_CONFIG_NULL_OK, &tagsOption}, {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL} diff --git a/generic/tkCanvLine.c b/generic/tkCanvLine.c index 3f8f5c1..62251fc 100644 --- a/generic/tkCanvLine.c +++ b/generic/tkCanvLine.c @@ -159,58 +159,58 @@ static const Tk_CustomOption pixelOption = { static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_CUSTOM, "-activedash", NULL, NULL, - NULL, Tk_Offset(LineItem, outline.activeDash), + NULL, offsetof(LineItem, outline.activeDash), TK_CONFIG_NULL_OK, &dashOption}, {TK_CONFIG_COLOR, "-activefill", NULL, NULL, - NULL, Tk_Offset(LineItem, outline.activeColor), TK_CONFIG_NULL_OK, NULL}, + NULL, offsetof(LineItem, outline.activeColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BITMAP, "-activestipple", NULL, NULL, - NULL, Tk_Offset(LineItem, outline.activeStipple), TK_CONFIG_NULL_OK, NULL}, + NULL, offsetof(LineItem, outline.activeStipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_CUSTOM, "-activewidth", NULL, NULL, - "0.0", Tk_Offset(LineItem, outline.activeWidth), + "0.0", offsetof(LineItem, outline.activeWidth), TK_CONFIG_DONT_SET_DEFAULT, &pixelOption}, {TK_CONFIG_CUSTOM, "-arrow", NULL, NULL, - "none", Tk_Offset(LineItem, arrow), + "none", offsetof(LineItem, arrow), TK_CONFIG_DONT_SET_DEFAULT, &arrowOption}, {TK_CONFIG_CUSTOM, "-arrowshape", NULL, NULL, - "8 10 3", Tk_Offset(LineItem, arrowShapeA), + "8 10 3", offsetof(LineItem, arrowShapeA), TK_CONFIG_DONT_SET_DEFAULT, &arrowShapeOption}, {TK_CONFIG_CAP_STYLE, "-capstyle", NULL, NULL, - "butt", Tk_Offset(LineItem, capStyle), TK_CONFIG_DONT_SET_DEFAULT, NULL}, + "butt", offsetof(LineItem, capStyle), TK_CONFIG_DONT_SET_DEFAULT, NULL}, {TK_CONFIG_COLOR, "-fill", NULL, NULL, - "black", Tk_Offset(LineItem, outline.color), TK_CONFIG_NULL_OK, NULL}, + "black", offsetof(LineItem, outline.color), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_CUSTOM, "-dash", NULL, NULL, - NULL, Tk_Offset(LineItem, outline.dash), + NULL, offsetof(LineItem, outline.dash), TK_CONFIG_NULL_OK, &dashOption}, {TK_CONFIG_PIXELS, "-dashoffset", NULL, NULL, - "0", Tk_Offset(LineItem, outline.offset), TK_CONFIG_DONT_SET_DEFAULT, NULL}, + "0", offsetof(LineItem, outline.offset), TK_CONFIG_DONT_SET_DEFAULT, NULL}, {TK_CONFIG_CUSTOM, "-disableddash", NULL, NULL, - NULL, Tk_Offset(LineItem, outline.disabledDash), + NULL, offsetof(LineItem, outline.disabledDash), TK_CONFIG_NULL_OK, &dashOption}, {TK_CONFIG_COLOR, "-disabledfill", NULL, NULL, - NULL, Tk_Offset(LineItem, outline.disabledColor), TK_CONFIG_NULL_OK, NULL}, + NULL, offsetof(LineItem, outline.disabledColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BITMAP, "-disabledstipple", NULL, NULL, - NULL, Tk_Offset(LineItem, outline.disabledStipple), TK_CONFIG_NULL_OK, NULL}, + NULL, offsetof(LineItem, outline.disabledStipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_CUSTOM, "-disabledwidth", NULL, NULL, - "0.0", Tk_Offset(LineItem, outline.disabledWidth), + "0.0", offsetof(LineItem, outline.disabledWidth), TK_CONFIG_DONT_SET_DEFAULT, &pixelOption}, {TK_CONFIG_JOIN_STYLE, "-joinstyle", NULL, NULL, - "round", Tk_Offset(LineItem, joinStyle), TK_CONFIG_DONT_SET_DEFAULT, NULL}, + "round", offsetof(LineItem, joinStyle), TK_CONFIG_DONT_SET_DEFAULT, NULL}, {TK_CONFIG_CUSTOM, "-offset", NULL, NULL, - "0,0", Tk_Offset(LineItem, outline.tsoffset), + "0,0", offsetof(LineItem, outline.tsoffset), TK_CONFIG_DONT_SET_DEFAULT, &offsetOption}, {TK_CONFIG_CUSTOM, "-smooth", NULL, NULL, - "0", Tk_Offset(LineItem, smooth), + "0", offsetof(LineItem, smooth), TK_CONFIG_DONT_SET_DEFAULT, &smoothOption}, {TK_CONFIG_INT, "-splinesteps", NULL, NULL, - "12", Tk_Offset(LineItem, splineSteps), TK_CONFIG_DONT_SET_DEFAULT, NULL}, + "12", offsetof(LineItem, splineSteps), TK_CONFIG_DONT_SET_DEFAULT, NULL}, {TK_CONFIG_CUSTOM, "-state", NULL, NULL, - NULL, Tk_Offset(Tk_Item, state), TK_CONFIG_NULL_OK, &stateOption}, + NULL, offsetof(Tk_Item, state), TK_CONFIG_NULL_OK, &stateOption}, {TK_CONFIG_BITMAP, "-stipple", NULL, NULL, - NULL, Tk_Offset(LineItem, outline.stipple), TK_CONFIG_NULL_OK, NULL}, + NULL, offsetof(LineItem, outline.stipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_CUSTOM, "-tags", NULL, NULL, NULL, 0, TK_CONFIG_NULL_OK, &tagsOption}, {TK_CONFIG_CUSTOM, "-width", NULL, NULL, - "1.0", Tk_Offset(LineItem, outline.width), + "1.0", offsetof(LineItem, outline.width), TK_CONFIG_DONT_SET_DEFAULT, &pixelOption}, {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL} }; @@ -1942,7 +1942,7 @@ ParseArrowShape( int argc; const char **argv = NULL; - if (offset != Tk_Offset(LineItem, arrowShapeA)) { + if ((size_t)offset != offsetof(LineItem, arrowShapeA)) { Tcl_Panic("ParseArrowShape received bogus offset"); } diff --git a/generic/tkCanvPoly.c b/generic/tkCanvPoly.c index 1677bbb..0b2d134 100644 --- a/generic/tkCanvPoly.c +++ b/generic/tkCanvPoly.c @@ -76,69 +76,69 @@ static const Tk_CustomOption pixelOption = { static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_CUSTOM, "-activedash", NULL, NULL, - NULL, Tk_Offset(PolygonItem, outline.activeDash), + NULL, offsetof(PolygonItem, outline.activeDash), TK_CONFIG_NULL_OK, &dashOption}, {TK_CONFIG_COLOR, "-activefill", NULL, NULL, - NULL, Tk_Offset(PolygonItem, activeFillColor), TK_CONFIG_NULL_OK, NULL}, + NULL, offsetof(PolygonItem, activeFillColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_COLOR, "-activeoutline", NULL, NULL, - NULL, Tk_Offset(PolygonItem, outline.activeColor), TK_CONFIG_NULL_OK, NULL}, + NULL, offsetof(PolygonItem, outline.activeColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BITMAP, "-activeoutlinestipple", NULL, NULL, - NULL, Tk_Offset(PolygonItem, outline.activeStipple), + NULL, offsetof(PolygonItem, outline.activeStipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BITMAP, "-activestipple", NULL, NULL, - NULL, Tk_Offset(PolygonItem, activeFillStipple), TK_CONFIG_NULL_OK, NULL}, + NULL, offsetof(PolygonItem, activeFillStipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_CUSTOM, "-activewidth", NULL, NULL, - "0.0", Tk_Offset(PolygonItem, outline.activeWidth), + "0.0", offsetof(PolygonItem, outline.activeWidth), TK_CONFIG_DONT_SET_DEFAULT, &pixelOption}, {TK_CONFIG_CUSTOM, "-dash", NULL, NULL, - NULL, Tk_Offset(PolygonItem, outline.dash), + NULL, offsetof(PolygonItem, outline.dash), TK_CONFIG_NULL_OK, &dashOption}, {TK_CONFIG_PIXELS, "-dashoffset", NULL, NULL, - "0", Tk_Offset(PolygonItem, outline.offset), + "0", offsetof(PolygonItem, outline.offset), TK_CONFIG_DONT_SET_DEFAULT, NULL}, {TK_CONFIG_CUSTOM, "-disableddash", NULL, NULL, - NULL, Tk_Offset(PolygonItem, outline.disabledDash), + NULL, offsetof(PolygonItem, outline.disabledDash), TK_CONFIG_NULL_OK, &dashOption}, {TK_CONFIG_COLOR, "-disabledfill", NULL, NULL, - NULL, Tk_Offset(PolygonItem, disabledFillColor), TK_CONFIG_NULL_OK, NULL}, + NULL, offsetof(PolygonItem, disabledFillColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_COLOR, "-disabledoutline", NULL, NULL, - NULL, Tk_Offset(PolygonItem, outline.disabledColor), + NULL, offsetof(PolygonItem, outline.disabledColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BITMAP, "-disabledoutlinestipple", NULL, NULL, - NULL, Tk_Offset(PolygonItem, outline.disabledStipple), + NULL, offsetof(PolygonItem, outline.disabledStipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BITMAP, "-disabledstipple", NULL, NULL, - NULL, Tk_Offset(PolygonItem, disabledFillStipple), TK_CONFIG_NULL_OK, NULL}, + NULL, offsetof(PolygonItem, disabledFillStipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_CUSTOM, "-disabledwidth", NULL, NULL, - "0.0", Tk_Offset(PolygonItem, outline.disabledWidth), + "0.0", offsetof(PolygonItem, outline.disabledWidth), TK_CONFIG_DONT_SET_DEFAULT, &pixelOption}, {TK_CONFIG_COLOR, "-fill", NULL, NULL, - "black", Tk_Offset(PolygonItem, fillColor), TK_CONFIG_NULL_OK, NULL}, + "black", offsetof(PolygonItem, fillColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_JOIN_STYLE, "-joinstyle", NULL, NULL, - "round", Tk_Offset(PolygonItem, joinStyle), TK_CONFIG_DONT_SET_DEFAULT, NULL}, + "round", offsetof(PolygonItem, joinStyle), TK_CONFIG_DONT_SET_DEFAULT, NULL}, {TK_CONFIG_CUSTOM, "-offset", NULL, NULL, - "0,0", Tk_Offset(PolygonItem, tsoffset), + "0,0", offsetof(PolygonItem, tsoffset), TK_CONFIG_NULL_OK, &offsetOption}, {TK_CONFIG_COLOR, "-outline", NULL, NULL, - NULL, Tk_Offset(PolygonItem, outline.color), TK_CONFIG_NULL_OK, NULL}, + NULL, offsetof(PolygonItem, outline.color), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_CUSTOM, "-outlineoffset", NULL, NULL, - "0,0", Tk_Offset(PolygonItem, outline.tsoffset), + "0,0", offsetof(PolygonItem, outline.tsoffset), TK_CONFIG_NULL_OK, &offsetOption}, {TK_CONFIG_BITMAP, "-outlinestipple", NULL, NULL, - NULL, Tk_Offset(PolygonItem, outline.stipple), TK_CONFIG_NULL_OK, NULL}, + NULL, offsetof(PolygonItem, outline.stipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_CUSTOM, "-smooth", NULL, NULL, - "0", Tk_Offset(PolygonItem, smooth), + "0", offsetof(PolygonItem, smooth), TK_CONFIG_DONT_SET_DEFAULT, &smoothOption}, {TK_CONFIG_INT, "-splinesteps", NULL, NULL, - "12", Tk_Offset(PolygonItem, splineSteps), TK_CONFIG_DONT_SET_DEFAULT, NULL}, + "12", offsetof(PolygonItem, splineSteps), TK_CONFIG_DONT_SET_DEFAULT, NULL}, {TK_CONFIG_CUSTOM, "-state", NULL, NULL, - NULL, Tk_Offset(Tk_Item, state), TK_CONFIG_NULL_OK, &stateOption}, + NULL, offsetof(Tk_Item, state), TK_CONFIG_NULL_OK, &stateOption}, {TK_CONFIG_BITMAP, "-stipple", NULL, NULL, - NULL, Tk_Offset(PolygonItem, fillStipple), TK_CONFIG_NULL_OK, NULL}, + NULL, offsetof(PolygonItem, fillStipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_CUSTOM, "-tags", NULL, NULL, NULL, 0, TK_CONFIG_NULL_OK, &tagsOption}, {TK_CONFIG_CUSTOM, "-width", NULL, NULL, - "1.0", Tk_Offset(PolygonItem, outline.width), + "1.0", offsetof(PolygonItem, outline.width), TK_CONFIG_DONT_SET_DEFAULT, &pixelOption}, {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL} }; diff --git a/generic/tkCanvPs.c b/generic/tkCanvPs.c index 609901b..083e018 100644 --- a/generic/tkCanvPs.c +++ b/generic/tkCanvPs.c @@ -94,37 +94,37 @@ typedef struct TkPostscriptInfo { static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_STRING, "-colormap", NULL, NULL, - "", Tk_Offset(TkPostscriptInfo, colorVar), 0, NULL}, + "", offsetof(TkPostscriptInfo, colorVar), 0, NULL}, {TK_CONFIG_STRING, "-colormode", NULL, NULL, - "", Tk_Offset(TkPostscriptInfo, colorMode), 0, NULL}, + "", offsetof(TkPostscriptInfo, colorMode), 0, NULL}, {TK_CONFIG_STRING, "-file", NULL, NULL, - "", Tk_Offset(TkPostscriptInfo, fileName), 0, NULL}, + "", offsetof(TkPostscriptInfo, fileName), 0, NULL}, {TK_CONFIG_STRING, "-channel", NULL, NULL, - "", Tk_Offset(TkPostscriptInfo, channelName), 0, NULL}, + "", offsetof(TkPostscriptInfo, channelName), 0, NULL}, {TK_CONFIG_STRING, "-fontmap", NULL, NULL, - "", Tk_Offset(TkPostscriptInfo, fontVar), 0, NULL}, + "", offsetof(TkPostscriptInfo, fontVar), 0, NULL}, {TK_CONFIG_PIXELS, "-height", NULL, NULL, - "", Tk_Offset(TkPostscriptInfo, height), 0, NULL}, + "", offsetof(TkPostscriptInfo, height), 0, NULL}, {TK_CONFIG_ANCHOR, "-pageanchor", NULL, NULL, - "", Tk_Offset(TkPostscriptInfo, pageAnchor), 0, NULL}, + "", offsetof(TkPostscriptInfo, pageAnchor), 0, NULL}, {TK_CONFIG_STRING, "-pageheight", NULL, NULL, - "", Tk_Offset(TkPostscriptInfo, pageHeightString), 0, NULL}, + "", offsetof(TkPostscriptInfo, pageHeightString), 0, NULL}, {TK_CONFIG_STRING, "-pagewidth", NULL, NULL, - "", Tk_Offset(TkPostscriptInfo, pageWidthString), 0, NULL}, + "", offsetof(TkPostscriptInfo, pageWidthString), 0, NULL}, {TK_CONFIG_STRING, "-pagex", NULL, NULL, - "", Tk_Offset(TkPostscriptInfo, pageXString), 0, NULL}, + "", offsetof(TkPostscriptInfo, pageXString), 0, NULL}, {TK_CONFIG_STRING, "-pagey", NULL, NULL, - "", Tk_Offset(TkPostscriptInfo, pageYString), 0, NULL}, + "", offsetof(TkPostscriptInfo, pageYString), 0, NULL}, {TK_CONFIG_BOOLEAN, "-prolog", NULL, NULL, - "", Tk_Offset(TkPostscriptInfo, prolog), 0, NULL}, + "", offsetof(TkPostscriptInfo, prolog), 0, NULL}, {TK_CONFIG_BOOLEAN, "-rotate", NULL, NULL, - "", Tk_Offset(TkPostscriptInfo, rotate), 0, NULL}, + "", offsetof(TkPostscriptInfo, rotate), 0, NULL}, {TK_CONFIG_PIXELS, "-width", NULL, NULL, - "", Tk_Offset(TkPostscriptInfo, width), 0, NULL}, + "", offsetof(TkPostscriptInfo, width), 0, NULL}, {TK_CONFIG_PIXELS, "-x", NULL, NULL, - "", Tk_Offset(TkPostscriptInfo, x), 0, NULL}, + "", offsetof(TkPostscriptInfo, x), 0, NULL}, {TK_CONFIG_PIXELS, "-y", NULL, NULL, - "", Tk_Offset(TkPostscriptInfo, y), 0, NULL}, + "", offsetof(TkPostscriptInfo, y), 0, NULL}, {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL} }; diff --git a/generic/tkCanvText.c b/generic/tkCanvText.c index b2211bd..b9607a5 100644 --- a/generic/tkCanvText.c +++ b/generic/tkCanvText.c @@ -95,38 +95,38 @@ static const Tk_CustomOption offsetOption = { static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_COLOR, "-activefill", NULL, NULL, - NULL, Tk_Offset(TextItem, activeColor), TK_CONFIG_NULL_OK, NULL}, + NULL, offsetof(TextItem, activeColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BITMAP, "-activestipple", NULL, NULL, - NULL, Tk_Offset(TextItem, activeStipple), TK_CONFIG_NULL_OK, NULL}, + NULL, offsetof(TextItem, activeStipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_ANCHOR, "-anchor", NULL, NULL, - "center", Tk_Offset(TextItem, anchor), TK_CONFIG_DONT_SET_DEFAULT, NULL}, + "center", offsetof(TextItem, anchor), TK_CONFIG_DONT_SET_DEFAULT, NULL}, {TK_CONFIG_DOUBLE, "-angle", NULL, NULL, - "0.0", Tk_Offset(TextItem, angle), TK_CONFIG_DONT_SET_DEFAULT, NULL}, + "0.0", offsetof(TextItem, angle), TK_CONFIG_DONT_SET_DEFAULT, NULL}, {TK_CONFIG_COLOR, "-disabledfill", NULL, NULL, - NULL, Tk_Offset(TextItem, disabledColor), TK_CONFIG_NULL_OK, NULL}, + NULL, offsetof(TextItem, disabledColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BITMAP, "-disabledstipple", NULL, NULL, - NULL, Tk_Offset(TextItem, disabledStipple), TK_CONFIG_NULL_OK, NULL}, + NULL, offsetof(TextItem, disabledStipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_COLOR, "-fill", NULL, NULL, - "black", Tk_Offset(TextItem, color), TK_CONFIG_NULL_OK, NULL}, + "black", offsetof(TextItem, color), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_FONT, "-font", NULL, NULL, - DEF_CANVTEXT_FONT, Tk_Offset(TextItem, tkfont), 0, NULL}, + DEF_CANVTEXT_FONT, offsetof(TextItem, tkfont), 0, NULL}, {TK_CONFIG_JUSTIFY, "-justify", NULL, NULL, - "left", Tk_Offset(TextItem, justify), TK_CONFIG_DONT_SET_DEFAULT, NULL}, + "left", offsetof(TextItem, justify), TK_CONFIG_DONT_SET_DEFAULT, NULL}, {TK_CONFIG_CUSTOM, "-offset", NULL, NULL, - "0,0", Tk_Offset(TextItem, tsoffset), + "0,0", offsetof(TextItem, tsoffset), TK_CONFIG_DONT_SET_DEFAULT, &offsetOption}, {TK_CONFIG_CUSTOM, "-state", NULL, NULL, - NULL, Tk_Offset(Tk_Item, state), TK_CONFIG_NULL_OK, &stateOption}, + NULL, offsetof(Tk_Item, state), TK_CONFIG_NULL_OK, &stateOption}, {TK_CONFIG_BITMAP, "-stipple", NULL, NULL, - NULL, Tk_Offset(TextItem, stipple), TK_CONFIG_NULL_OK, NULL}, + NULL, offsetof(TextItem, stipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_CUSTOM, "-tags", NULL, NULL, NULL, 0, TK_CONFIG_NULL_OK, &tagsOption}, {TK_CONFIG_STRING, "-text", NULL, NULL, - "", Tk_Offset(TextItem, text), 0, NULL}, + "", offsetof(TextItem, text), 0, NULL}, {TK_CONFIG_INT, "-underline", NULL, NULL, - "-1", Tk_Offset(TextItem, underline), 0, NULL}, + "-1", offsetof(TextItem, underline), 0, NULL}, {TK_CONFIG_PIXELS, "-width", NULL, NULL, - "0", Tk_Offset(TextItem, width), TK_CONFIG_DONT_SET_DEFAULT, NULL}, + "0", offsetof(TextItem, width), TK_CONFIG_DONT_SET_DEFAULT, NULL}, {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL} }; diff --git a/generic/tkCanvWind.c b/generic/tkCanvWind.c index 9f38932..59e81af 100644 --- a/generic/tkCanvWind.c +++ b/generic/tkCanvWind.c @@ -46,17 +46,17 @@ static const Tk_CustomOption tagsOption = { static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_ANCHOR, "-anchor", NULL, NULL, - "center", Tk_Offset(WindowItem, anchor), TK_CONFIG_DONT_SET_DEFAULT, NULL}, + "center", offsetof(WindowItem, anchor), TK_CONFIG_DONT_SET_DEFAULT, NULL}, {TK_CONFIG_PIXELS, "-height", NULL, NULL, - "0", Tk_Offset(WindowItem, height), TK_CONFIG_DONT_SET_DEFAULT, NULL}, + "0", offsetof(WindowItem, height), TK_CONFIG_DONT_SET_DEFAULT, NULL}, {TK_CONFIG_CUSTOM, "-state", NULL, NULL, - NULL, Tk_Offset(Tk_Item, state), TK_CONFIG_NULL_OK, &stateOption}, + NULL, offsetof(Tk_Item, state), TK_CONFIG_NULL_OK, &stateOption}, {TK_CONFIG_CUSTOM, "-tags", NULL, NULL, NULL, 0, TK_CONFIG_NULL_OK, &tagsOption}, {TK_CONFIG_PIXELS, "-width", NULL, NULL, - "0", Tk_Offset(WindowItem, width), TK_CONFIG_DONT_SET_DEFAULT, NULL}, + "0", offsetof(WindowItem, width), TK_CONFIG_DONT_SET_DEFAULT, NULL}, {TK_CONFIG_WINDOW, "-window", NULL, NULL, - NULL, Tk_Offset(WindowItem, tkwin), TK_CONFIG_NULL_OK, NULL}, + NULL, offsetof(WindowItem, tkwin), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL} }; diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c index cf6bce4..f8573fc 100644 --- a/generic/tkCanvas.c +++ b/generic/tkCanvas.c @@ -91,92 +91,92 @@ static const Tk_CustomOption offsetOption = { static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_BORDER, "-background", "background", "Background", - DEF_CANVAS_BG_COLOR, Tk_Offset(TkCanvas, bgBorder), + DEF_CANVAS_BG_COLOR, offsetof(TkCanvas, bgBorder), TK_CONFIG_COLOR_ONLY, NULL}, {TK_CONFIG_BORDER, "-background", "background", "Background", - DEF_CANVAS_BG_MONO, Tk_Offset(TkCanvas, bgBorder), + DEF_CANVAS_BG_MONO, offsetof(TkCanvas, bgBorder), TK_CONFIG_MONO_ONLY, NULL}, {TK_CONFIG_SYNONYM, "-bd", "borderWidth", NULL, NULL, 0, 0, NULL}, {TK_CONFIG_SYNONYM, "-bg", "background", NULL, NULL, 0, 0, NULL}, {TK_CONFIG_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", - DEF_CANVAS_BORDER_WIDTH, Tk_Offset(TkCanvas, borderWidth), 0, NULL}, + DEF_CANVAS_BORDER_WIDTH, offsetof(TkCanvas, borderWidth), 0, NULL}, {TK_CONFIG_DOUBLE, "-closeenough", "closeEnough", "CloseEnough", - DEF_CANVAS_CLOSE_ENOUGH, Tk_Offset(TkCanvas, closeEnough), 0, NULL}, + DEF_CANVAS_CLOSE_ENOUGH, offsetof(TkCanvas, closeEnough), 0, NULL}, {TK_CONFIG_BOOLEAN, "-confine", "confine", "Confine", - DEF_CANVAS_CONFINE, Tk_Offset(TkCanvas, confine), 0, NULL}, + DEF_CANVAS_CONFINE, offsetof(TkCanvas, confine), 0, NULL}, {TK_CONFIG_ACTIVE_CURSOR, "-cursor", "cursor", "Cursor", - DEF_CANVAS_CURSOR, Tk_Offset(TkCanvas, cursor), TK_CONFIG_NULL_OK, NULL}, + DEF_CANVAS_CURSOR, offsetof(TkCanvas, cursor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_PIXELS, "-height", "height", "Height", - DEF_CANVAS_HEIGHT, Tk_Offset(TkCanvas, height), 0, NULL}, + DEF_CANVAS_HEIGHT, offsetof(TkCanvas, height), 0, NULL}, {TK_CONFIG_COLOR, "-highlightbackground", "highlightBackground", "HighlightBackground", DEF_CANVAS_HIGHLIGHT_BG, - Tk_Offset(TkCanvas, highlightBgColorPtr), 0, NULL}, + offsetof(TkCanvas, highlightBgColorPtr), 0, NULL}, {TK_CONFIG_COLOR, "-highlightcolor", "highlightColor", "HighlightColor", - DEF_CANVAS_HIGHLIGHT, Tk_Offset(TkCanvas, highlightColorPtr), 0, NULL}, + DEF_CANVAS_HIGHLIGHT, offsetof(TkCanvas, highlightColorPtr), 0, NULL}, {TK_CONFIG_PIXELS, "-highlightthickness", "highlightThickness", "HighlightThickness", - DEF_CANVAS_HIGHLIGHT_WIDTH, Tk_Offset(TkCanvas, highlightWidth), 0, NULL}, + DEF_CANVAS_HIGHLIGHT_WIDTH, offsetof(TkCanvas, highlightWidth), 0, NULL}, {TK_CONFIG_BORDER, "-insertbackground", "insertBackground", "Foreground", - DEF_CANVAS_INSERT_BG, Tk_Offset(TkCanvas, textInfo.insertBorder), 0, NULL}, + DEF_CANVAS_INSERT_BG, offsetof(TkCanvas, textInfo.insertBorder), 0, NULL}, {TK_CONFIG_PIXELS, "-insertborderwidth", "insertBorderWidth", "BorderWidth", DEF_CANVAS_INSERT_BD_COLOR, - Tk_Offset(TkCanvas, textInfo.insertBorderWidth), TK_CONFIG_COLOR_ONLY, NULL}, + offsetof(TkCanvas, textInfo.insertBorderWidth), TK_CONFIG_COLOR_ONLY, NULL}, {TK_CONFIG_PIXELS, "-insertborderwidth", "insertBorderWidth", "BorderWidth", DEF_CANVAS_INSERT_BD_MONO, - Tk_Offset(TkCanvas, textInfo.insertBorderWidth), TK_CONFIG_MONO_ONLY, NULL}, + offsetof(TkCanvas, textInfo.insertBorderWidth), TK_CONFIG_MONO_ONLY, NULL}, {TK_CONFIG_INT, "-insertofftime", "insertOffTime", "OffTime", - DEF_CANVAS_INSERT_OFF_TIME, Tk_Offset(TkCanvas, insertOffTime), 0, NULL}, + DEF_CANVAS_INSERT_OFF_TIME, offsetof(TkCanvas, insertOffTime), 0, NULL}, {TK_CONFIG_INT, "-insertontime", "insertOnTime", "OnTime", - DEF_CANVAS_INSERT_ON_TIME, Tk_Offset(TkCanvas, insertOnTime), 0, NULL}, + DEF_CANVAS_INSERT_ON_TIME, offsetof(TkCanvas, insertOnTime), 0, NULL}, {TK_CONFIG_PIXELS, "-insertwidth", "insertWidth", "InsertWidth", - DEF_CANVAS_INSERT_WIDTH, Tk_Offset(TkCanvas, textInfo.insertWidth), 0, NULL}, + DEF_CANVAS_INSERT_WIDTH, offsetof(TkCanvas, textInfo.insertWidth), 0, NULL}, {TK_CONFIG_CUSTOM, "-offset", "offset", "Offset", "0,0", - Tk_Offset(TkCanvas, tsoffset),TK_CONFIG_DONT_SET_DEFAULT, + offsetof(TkCanvas, tsoffset),TK_CONFIG_DONT_SET_DEFAULT, &offsetOption}, {TK_CONFIG_RELIEF, "-relief", "relief", "Relief", - DEF_CANVAS_RELIEF, Tk_Offset(TkCanvas, relief), 0, NULL}, + DEF_CANVAS_RELIEF, offsetof(TkCanvas, relief), 0, NULL}, {TK_CONFIG_STRING, "-scrollregion", "scrollRegion", "ScrollRegion", - DEF_CANVAS_SCROLL_REGION, Tk_Offset(TkCanvas, regionString), + DEF_CANVAS_SCROLL_REGION, offsetof(TkCanvas, regionString), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BORDER, "-selectbackground", "selectBackground", "Foreground", - DEF_CANVAS_SELECT_COLOR, Tk_Offset(TkCanvas, textInfo.selBorder), + DEF_CANVAS_SELECT_COLOR, offsetof(TkCanvas, textInfo.selBorder), TK_CONFIG_COLOR_ONLY, NULL}, {TK_CONFIG_BORDER, "-selectbackground", "selectBackground", "Foreground", - DEF_CANVAS_SELECT_MONO, Tk_Offset(TkCanvas, textInfo.selBorder), + DEF_CANVAS_SELECT_MONO, offsetof(TkCanvas, textInfo.selBorder), TK_CONFIG_MONO_ONLY, NULL}, {TK_CONFIG_PIXELS, "-selectborderwidth", "selectBorderWidth", "BorderWidth", DEF_CANVAS_SELECT_BD_COLOR, - Tk_Offset(TkCanvas, textInfo.selBorderWidth), TK_CONFIG_COLOR_ONLY, NULL}, + offsetof(TkCanvas, textInfo.selBorderWidth), TK_CONFIG_COLOR_ONLY, NULL}, {TK_CONFIG_PIXELS, "-selectborderwidth", "selectBorderWidth", "BorderWidth", - DEF_CANVAS_SELECT_BD_MONO, Tk_Offset(TkCanvas, textInfo.selBorderWidth), + DEF_CANVAS_SELECT_BD_MONO, offsetof(TkCanvas, textInfo.selBorderWidth), TK_CONFIG_MONO_ONLY, NULL}, {TK_CONFIG_COLOR, "-selectforeground", "selectForeground", "Background", - DEF_CANVAS_SELECT_FG_COLOR, Tk_Offset(TkCanvas, textInfo.selFgColorPtr), + DEF_CANVAS_SELECT_FG_COLOR, offsetof(TkCanvas, textInfo.selFgColorPtr), TK_CONFIG_COLOR_ONLY|TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_COLOR, "-selectforeground", "selectForeground", "Background", - DEF_CANVAS_SELECT_FG_MONO, Tk_Offset(TkCanvas, textInfo.selFgColorPtr), + DEF_CANVAS_SELECT_FG_MONO, offsetof(TkCanvas, textInfo.selFgColorPtr), TK_CONFIG_MONO_ONLY|TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_CUSTOM, "-state", "state", "State", - "normal", Tk_Offset(TkCanvas, canvas_state), TK_CONFIG_DONT_SET_DEFAULT, + "normal", offsetof(TkCanvas, canvas_state), TK_CONFIG_DONT_SET_DEFAULT, &stateOption}, {TK_CONFIG_STRING, "-takefocus", "takeFocus", "TakeFocus", - DEF_CANVAS_TAKE_FOCUS, Tk_Offset(TkCanvas, takeFocus), + DEF_CANVAS_TAKE_FOCUS, offsetof(TkCanvas, takeFocus), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_PIXELS, "-width", "width", "Width", - DEF_CANVAS_WIDTH, Tk_Offset(TkCanvas, width), 0, NULL}, + DEF_CANVAS_WIDTH, offsetof(TkCanvas, width), 0, NULL}, {TK_CONFIG_STRING, "-xscrollcommand", "xScrollCommand", "ScrollCommand", - DEF_CANVAS_X_SCROLL_CMD, Tk_Offset(TkCanvas, xScrollCmd), + DEF_CANVAS_X_SCROLL_CMD, offsetof(TkCanvas, xScrollCmd), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_PIXELS, "-xscrollincrement", "xScrollIncrement", "ScrollIncrement", - DEF_CANVAS_X_SCROLL_INCREMENT, Tk_Offset(TkCanvas, xScrollIncrement), + DEF_CANVAS_X_SCROLL_INCREMENT, offsetof(TkCanvas, xScrollIncrement), 0, NULL}, {TK_CONFIG_STRING, "-yscrollcommand", "yScrollCommand", "ScrollCommand", - DEF_CANVAS_Y_SCROLL_CMD, Tk_Offset(TkCanvas, yScrollCmd), + DEF_CANVAS_Y_SCROLL_CMD, offsetof(TkCanvas, yScrollCmd), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_PIXELS, "-yscrollincrement", "yScrollIncrement", "ScrollIncrement", - DEF_CANVAS_Y_SCROLL_INCREMENT, Tk_Offset(TkCanvas, yScrollIncrement), + DEF_CANVAS_Y_SCROLL_INCREMENT, offsetof(TkCanvas, yScrollIncrement), 0, NULL}, {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL} }; diff --git a/generic/tkEntry.c b/generic/tkEntry.c index 89ce8d6..40409e2 100644 --- a/generic/tkEntry.c +++ b/generic/tkEntry.c @@ -63,106 +63,106 @@ enum validateType { static const Tk_OptionSpec entryOptSpec[] = { {TK_OPTION_BORDER, "-background", "background", "Background", - DEF_ENTRY_BG_COLOR, -1, Tk_Offset(Entry, normalBorder), + DEF_ENTRY_BG_COLOR, -1, offsetof(Entry, normalBorder), 0, DEF_ENTRY_BG_MONO, 0}, {TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL, 0, -1, 0, "-borderwidth", 0}, {TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL, 0, -1, 0, "-background", 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", - DEF_ENTRY_BORDER_WIDTH, -1, Tk_Offset(Entry, borderWidth), 0, 0, 0}, + DEF_ENTRY_BORDER_WIDTH, -1, offsetof(Entry, borderWidth), 0, 0, 0}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", - DEF_ENTRY_CURSOR, -1, Tk_Offset(Entry, cursor), + DEF_ENTRY_CURSOR, -1, offsetof(Entry, cursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BORDER, "-disabledbackground", "disabledBackground", "DisabledBackground", DEF_ENTRY_DISABLED_BG_COLOR, -1, - Tk_Offset(Entry, disabledBorder), TK_OPTION_NULL_OK, + offsetof(Entry, disabledBorder), TK_OPTION_NULL_OK, (ClientData) DEF_ENTRY_DISABLED_BG_MONO, 0}, {TK_OPTION_COLOR, "-disabledforeground", "disabledForeground", "DisabledForeground", DEF_ENTRY_DISABLED_FG, -1, - Tk_Offset(Entry, dfgColorPtr), TK_OPTION_NULL_OK, 0, 0}, + offsetof(Entry, dfgColorPtr), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BOOLEAN, "-exportselection", "exportSelection", "ExportSelection", DEF_ENTRY_EXPORT_SELECTION, -1, - Tk_Offset(Entry, exportSelection), 0, 0, 0}, + offsetof(Entry, exportSelection), 0, 0, 0}, {TK_OPTION_SYNONYM, "-fg", "foreground", NULL, NULL, 0, -1, 0, "-foreground", 0}, {TK_OPTION_FONT, "-font", "font", "Font", - DEF_ENTRY_FONT, -1, Tk_Offset(Entry, tkfont), 0, 0, 0}, + DEF_ENTRY_FONT, -1, offsetof(Entry, tkfont), 0, 0, 0}, {TK_OPTION_COLOR, "-foreground", "foreground", "Foreground", - DEF_ENTRY_FG, -1, Tk_Offset(Entry, fgColorPtr), 0, 0, 0}, + DEF_ENTRY_FG, -1, offsetof(Entry, fgColorPtr), 0, 0, 0}, {TK_OPTION_COLOR, "-highlightbackground", "highlightBackground", "HighlightBackground", DEF_ENTRY_HIGHLIGHT_BG, - -1, Tk_Offset(Entry, highlightBgColorPtr), 0, 0, 0}, + -1, offsetof(Entry, highlightBgColorPtr), 0, 0, 0}, {TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor", - DEF_ENTRY_HIGHLIGHT, -1, Tk_Offset(Entry, highlightColorPtr), 0, 0, 0}, + DEF_ENTRY_HIGHLIGHT, -1, offsetof(Entry, highlightColorPtr), 0, 0, 0}, {TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness", "HighlightThickness", DEF_ENTRY_HIGHLIGHT_WIDTH, -1, - Tk_Offset(Entry, highlightWidth), 0, 0, 0}, + offsetof(Entry, highlightWidth), 0, 0, 0}, {TK_OPTION_BORDER, "-insertbackground", "insertBackground", "Foreground", - DEF_ENTRY_INSERT_BG, -1, Tk_Offset(Entry, insertBorder), 0, 0, 0}, + DEF_ENTRY_INSERT_BG, -1, offsetof(Entry, insertBorder), 0, 0, 0}, {TK_OPTION_PIXELS, "-insertborderwidth", "insertBorderWidth", "BorderWidth", DEF_ENTRY_INSERT_BD_COLOR, -1, - Tk_Offset(Entry, insertBorderWidth), 0, + offsetof(Entry, insertBorderWidth), 0, (ClientData) DEF_ENTRY_INSERT_BD_MONO, 0}, {TK_OPTION_INT, "-insertofftime", "insertOffTime", "OffTime", - DEF_ENTRY_INSERT_OFF_TIME, -1, Tk_Offset(Entry, insertOffTime), + DEF_ENTRY_INSERT_OFF_TIME, -1, offsetof(Entry, insertOffTime), 0, 0, 0}, {TK_OPTION_INT, "-insertontime", "insertOnTime", "OnTime", - DEF_ENTRY_INSERT_ON_TIME, -1, Tk_Offset(Entry, insertOnTime), 0, 0, 0}, + DEF_ENTRY_INSERT_ON_TIME, -1, offsetof(Entry, insertOnTime), 0, 0, 0}, {TK_OPTION_PIXELS, "-insertwidth", "insertWidth", "InsertWidth", - DEF_ENTRY_INSERT_WIDTH, -1, Tk_Offset(Entry, insertWidth), 0, 0, 0}, + DEF_ENTRY_INSERT_WIDTH, -1, offsetof(Entry, insertWidth), 0, 0, 0}, {TK_OPTION_STRING, "-invalidcommand", "invalidCommand", "InvalidCommand", - DEF_ENTRY_INVALIDCMD, -1, Tk_Offset(Entry, invalidCmd), + DEF_ENTRY_INVALIDCMD, -1, offsetof(Entry, invalidCmd), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_SYNONYM, "-invcmd", NULL, NULL, NULL, 0, -1, 0, "-invalidcommand", 0}, {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify", - DEF_ENTRY_JUSTIFY, -1, Tk_Offset(Entry, justify), 0, 0, 0}, + DEF_ENTRY_JUSTIFY, -1, offsetof(Entry, justify), 0, 0, 0}, {TK_OPTION_STRING, "-placeholder", "placeHolder", "PlaceHolder", - DEF_ENTRY_PLACEHOLDER, -1, Tk_Offset(Entry, placeholderString), + DEF_ENTRY_PLACEHOLDER, -1, offsetof(Entry, placeholderString), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_COLOR, "-placeholderforeground", "placeholderForeground", "PlaceholderForeground", DEF_ENTRY_PLACEHOLDERFG, -1, - Tk_Offset(Entry, placeholderColorPtr), 0, 0, 0}, + offsetof(Entry, placeholderColorPtr), 0, 0, 0}, {TK_OPTION_BORDER, "-readonlybackground", "readonlyBackground", "ReadonlyBackground", DEF_ENTRY_READONLY_BG_COLOR, -1, - Tk_Offset(Entry, readonlyBorder), TK_OPTION_NULL_OK, + offsetof(Entry, readonlyBorder), TK_OPTION_NULL_OK, (ClientData) DEF_ENTRY_READONLY_BG_MONO, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", - DEF_ENTRY_RELIEF, -1, Tk_Offset(Entry, relief), 0, 0, 0}, + DEF_ENTRY_RELIEF, -1, offsetof(Entry, relief), 0, 0, 0}, {TK_OPTION_BORDER, "-selectbackground", "selectBackground", "Foreground", - DEF_ENTRY_SELECT_COLOR, -1, Tk_Offset(Entry, selBorder), + DEF_ENTRY_SELECT_COLOR, -1, offsetof(Entry, selBorder), 0, DEF_ENTRY_SELECT_MONO, 0}, {TK_OPTION_PIXELS, "-selectborderwidth", "selectBorderWidth", "BorderWidth", DEF_ENTRY_SELECT_BD_COLOR, -1, - Tk_Offset(Entry, selBorderWidth), + offsetof(Entry, selBorderWidth), 0, DEF_ENTRY_SELECT_BD_MONO, 0}, {TK_OPTION_COLOR, "-selectforeground", "selectForeground", "Background", - DEF_ENTRY_SELECT_FG_COLOR, -1, Tk_Offset(Entry, selFgColorPtr), + DEF_ENTRY_SELECT_FG_COLOR, -1, offsetof(Entry, selFgColorPtr), TK_OPTION_NULL_OK, DEF_ENTRY_SELECT_FG_MONO, 0}, {TK_OPTION_STRING, "-show", "show", "Show", - DEF_ENTRY_SHOW, -1, Tk_Offset(Entry, showChar), + DEF_ENTRY_SHOW, -1, offsetof(Entry, showChar), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING_TABLE, "-state", "state", "State", - DEF_ENTRY_STATE, -1, Tk_Offset(Entry, state), + DEF_ENTRY_STATE, -1, offsetof(Entry, state), 0, stateStrings, 0}, {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", - DEF_ENTRY_TAKE_FOCUS, -1, Tk_Offset(Entry, takeFocus), + DEF_ENTRY_TAKE_FOCUS, -1, offsetof(Entry, takeFocus), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-textvariable", "textVariable", "Variable", - DEF_ENTRY_TEXT_VARIABLE, -1, Tk_Offset(Entry, textVarName), + DEF_ENTRY_TEXT_VARIABLE, -1, offsetof(Entry, textVarName), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING_TABLE, "-validate", "validate", "Validate", - DEF_ENTRY_VALIDATE, -1, Tk_Offset(Entry, validate), + DEF_ENTRY_VALIDATE, -1, offsetof(Entry, validate), 0, validateStrings, 0}, {TK_OPTION_STRING, "-validatecommand", "validateCommand","ValidateCommand", - NULL, -1, Tk_Offset(Entry, validateCmd), TK_OPTION_NULL_OK, 0, 0}, + NULL, -1, offsetof(Entry, validateCmd), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_SYNONYM, "-vcmd", NULL, NULL, NULL, 0, -1, 0, "-validatecommand", 0}, {TK_OPTION_INT, "-width", "width", "Width", - DEF_ENTRY_WIDTH, -1, Tk_Offset(Entry, prefWidth), 0, 0, 0}, + DEF_ENTRY_WIDTH, -1, offsetof(Entry, prefWidth), 0, 0, 0}, {TK_OPTION_STRING, "-xscrollcommand", "xScrollCommand", "ScrollCommand", - DEF_ENTRY_SCROLL_COMMAND, -1, Tk_Offset(Entry, scrollCmd), + DEF_ENTRY_SCROLL_COMMAND, -1, offsetof(Entry, scrollCmd), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, 0, 0} }; @@ -186,139 +186,139 @@ static const Tk_OptionSpec entryOptSpec[] = { static const Tk_OptionSpec sbOptSpec[] = { {TK_OPTION_BORDER, "-activebackground", "activeBackground", "Background", - DEF_BUTTON_ACTIVE_BG_COLOR, -1, Tk_Offset(Spinbox, activeBorder), + DEF_BUTTON_ACTIVE_BG_COLOR, -1, offsetof(Spinbox, activeBorder), 0, DEF_BUTTON_ACTIVE_BG_MONO, 0}, {TK_OPTION_BORDER, "-background", "background", "Background", - DEF_ENTRY_BG_COLOR, -1, Tk_Offset(Entry, normalBorder), + DEF_ENTRY_BG_COLOR, -1, offsetof(Entry, normalBorder), 0, DEF_ENTRY_BG_MONO, 0}, {TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL, 0, -1, 0, "-borderwidth", 0}, {TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL, 0, -1, 0, "-background", 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", - DEF_ENTRY_BORDER_WIDTH, -1, Tk_Offset(Entry, borderWidth), 0, 0, 0}, + DEF_ENTRY_BORDER_WIDTH, -1, offsetof(Entry, borderWidth), 0, 0, 0}, {TK_OPTION_BORDER, "-buttonbackground", "Button.background", "Background", - DEF_BUTTON_BG_COLOR, -1, Tk_Offset(Spinbox, buttonBorder), + DEF_BUTTON_BG_COLOR, -1, offsetof(Spinbox, buttonBorder), 0, DEF_BUTTON_BG_MONO, 0}, {TK_OPTION_CURSOR, "-buttoncursor", "Button.cursor", "Cursor", - DEF_BUTTON_CURSOR, -1, Tk_Offset(Spinbox, bCursor), + DEF_BUTTON_CURSOR, -1, offsetof(Spinbox, bCursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_RELIEF, "-buttondownrelief", "Button.relief", "Relief", - DEF_BUTTON_RELIEF, -1, Tk_Offset(Spinbox, bdRelief), 0, 0, 0}, + DEF_BUTTON_RELIEF, -1, offsetof(Spinbox, bdRelief), 0, 0, 0}, {TK_OPTION_RELIEF, "-buttonuprelief", "Button.relief", "Relief", - DEF_BUTTON_RELIEF, -1, Tk_Offset(Spinbox, buRelief), 0, 0, 0}, + DEF_BUTTON_RELIEF, -1, offsetof(Spinbox, buRelief), 0, 0, 0}, {TK_OPTION_STRING, "-command", "command", "Command", - DEF_SPINBOX_CMD, -1, Tk_Offset(Spinbox, command), + DEF_SPINBOX_CMD, -1, offsetof(Spinbox, command), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", - DEF_ENTRY_CURSOR, -1, Tk_Offset(Entry, cursor), + DEF_ENTRY_CURSOR, -1, offsetof(Entry, cursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BORDER, "-disabledbackground", "disabledBackground", "DisabledBackground", DEF_ENTRY_DISABLED_BG_COLOR, -1, - Tk_Offset(Entry, disabledBorder), TK_OPTION_NULL_OK, + offsetof(Entry, disabledBorder), TK_OPTION_NULL_OK, (ClientData) DEF_ENTRY_DISABLED_BG_MONO, 0}, {TK_OPTION_COLOR, "-disabledforeground", "disabledForeground", "DisabledForeground", DEF_ENTRY_DISABLED_FG, -1, - Tk_Offset(Entry, dfgColorPtr), TK_OPTION_NULL_OK, 0, 0}, + offsetof(Entry, dfgColorPtr), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BOOLEAN, "-exportselection", "exportSelection", "ExportSelection", DEF_ENTRY_EXPORT_SELECTION, -1, - Tk_Offset(Entry, exportSelection), 0, 0, 0}, + offsetof(Entry, exportSelection), 0, 0, 0}, {TK_OPTION_SYNONYM, "-fg", "foreground", NULL, NULL, 0, -1, 0, "-foreground", 0}, {TK_OPTION_FONT, "-font", "font", "Font", - DEF_ENTRY_FONT, -1, Tk_Offset(Entry, tkfont), 0, 0, 0}, + DEF_ENTRY_FONT, -1, offsetof(Entry, tkfont), 0, 0, 0}, {TK_OPTION_COLOR, "-foreground", "foreground", "Foreground", - DEF_ENTRY_FG, -1, Tk_Offset(Entry, fgColorPtr), 0, 0, 0}, + DEF_ENTRY_FG, -1, offsetof(Entry, fgColorPtr), 0, 0, 0}, {TK_OPTION_STRING, "-format", "format", "Format", - DEF_SPINBOX_FORMAT, -1, Tk_Offset(Spinbox, reqFormat), + DEF_SPINBOX_FORMAT, -1, offsetof(Spinbox, reqFormat), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_DOUBLE, "-from", "from", "From", - DEF_SPINBOX_FROM, -1, Tk_Offset(Spinbox, fromValue), 0, 0, 0}, + DEF_SPINBOX_FROM, -1, offsetof(Spinbox, fromValue), 0, 0, 0}, {TK_OPTION_COLOR, "-highlightbackground", "highlightBackground", "HighlightBackground", DEF_ENTRY_HIGHLIGHT_BG, - -1, Tk_Offset(Entry, highlightBgColorPtr), 0, 0, 0}, + -1, offsetof(Entry, highlightBgColorPtr), 0, 0, 0}, {TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor", - DEF_ENTRY_HIGHLIGHT, -1, Tk_Offset(Entry, highlightColorPtr), 0, 0, 0}, + DEF_ENTRY_HIGHLIGHT, -1, offsetof(Entry, highlightColorPtr), 0, 0, 0}, {TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness", "HighlightThickness", DEF_ENTRY_HIGHLIGHT_WIDTH, -1, - Tk_Offset(Entry, highlightWidth), 0, 0, 0}, + offsetof(Entry, highlightWidth), 0, 0, 0}, {TK_OPTION_DOUBLE, "-increment", "increment", "Increment", - DEF_SPINBOX_INCREMENT, -1, Tk_Offset(Spinbox, increment), 0, 0, 0}, + DEF_SPINBOX_INCREMENT, -1, offsetof(Spinbox, increment), 0, 0, 0}, {TK_OPTION_BORDER, "-insertbackground", "insertBackground", "Foreground", - DEF_ENTRY_INSERT_BG, -1, Tk_Offset(Entry, insertBorder), 0, 0, 0}, + DEF_ENTRY_INSERT_BG, -1, offsetof(Entry, insertBorder), 0, 0, 0}, {TK_OPTION_PIXELS, "-insertborderwidth", "insertBorderWidth", "BorderWidth", DEF_ENTRY_INSERT_BD_COLOR, -1, - Tk_Offset(Entry, insertBorderWidth), 0, + offsetof(Entry, insertBorderWidth), 0, (ClientData) DEF_ENTRY_INSERT_BD_MONO, 0}, {TK_OPTION_INT, "-insertofftime", "insertOffTime", "OffTime", - DEF_ENTRY_INSERT_OFF_TIME, -1, Tk_Offset(Entry, insertOffTime), + DEF_ENTRY_INSERT_OFF_TIME, -1, offsetof(Entry, insertOffTime), 0, 0, 0}, {TK_OPTION_INT, "-insertontime", "insertOnTime", "OnTime", - DEF_ENTRY_INSERT_ON_TIME, -1, Tk_Offset(Entry, insertOnTime), 0, 0, 0}, + DEF_ENTRY_INSERT_ON_TIME, -1, offsetof(Entry, insertOnTime), 0, 0, 0}, {TK_OPTION_PIXELS, "-insertwidth", "insertWidth", "InsertWidth", - DEF_ENTRY_INSERT_WIDTH, -1, Tk_Offset(Entry, insertWidth), 0, 0, 0}, + DEF_ENTRY_INSERT_WIDTH, -1, offsetof(Entry, insertWidth), 0, 0, 0}, {TK_OPTION_STRING, "-invalidcommand", "invalidCommand", "InvalidCommand", - DEF_ENTRY_INVALIDCMD, -1, Tk_Offset(Entry, invalidCmd), + DEF_ENTRY_INVALIDCMD, -1, offsetof(Entry, invalidCmd), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_SYNONYM, "-invcmd", NULL, NULL, NULL, 0, -1, 0, "-invalidcommand", 0}, {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify", - DEF_ENTRY_JUSTIFY, -1, Tk_Offset(Entry, justify), 0, 0, 0}, + DEF_ENTRY_JUSTIFY, -1, offsetof(Entry, justify), 0, 0, 0}, {TK_OPTION_STRING, "-placeholder", "placeHolder", "PlaceHolder", - DEF_ENTRY_PLACEHOLDER, -1, Tk_Offset(Entry, placeholderString), + DEF_ENTRY_PLACEHOLDER, -1, offsetof(Entry, placeholderString), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_COLOR, "-placeholderforeground", "placeholderForeground", "PlaceholderForeground", DEF_ENTRY_PLACEHOLDERFG, -1, - Tk_Offset(Entry, placeholderColorPtr), 0, 0, 0}, + offsetof(Entry, placeholderColorPtr), 0, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", - DEF_ENTRY_RELIEF, -1, Tk_Offset(Entry, relief), 0, 0, 0}, + DEF_ENTRY_RELIEF, -1, offsetof(Entry, relief), 0, 0, 0}, {TK_OPTION_BORDER, "-readonlybackground", "readonlyBackground", "ReadonlyBackground", DEF_ENTRY_READONLY_BG_COLOR, -1, - Tk_Offset(Entry, readonlyBorder), TK_OPTION_NULL_OK, + offsetof(Entry, readonlyBorder), TK_OPTION_NULL_OK, (ClientData) DEF_ENTRY_READONLY_BG_MONO, 0}, {TK_OPTION_INT, "-repeatdelay", "repeatDelay", "RepeatDelay", - DEF_SPINBOX_REPEAT_DELAY, -1, Tk_Offset(Spinbox, repeatDelay), + DEF_SPINBOX_REPEAT_DELAY, -1, offsetof(Spinbox, repeatDelay), 0, 0, 0}, {TK_OPTION_INT, "-repeatinterval", "repeatInterval", "RepeatInterval", - DEF_SPINBOX_REPEAT_INTERVAL, -1, Tk_Offset(Spinbox, repeatInterval), + DEF_SPINBOX_REPEAT_INTERVAL, -1, offsetof(Spinbox, repeatInterval), 0, 0, 0}, {TK_OPTION_BORDER, "-selectbackground", "selectBackground", "Foreground", - DEF_ENTRY_SELECT_COLOR, -1, Tk_Offset(Entry, selBorder), + DEF_ENTRY_SELECT_COLOR, -1, offsetof(Entry, selBorder), 0, DEF_ENTRY_SELECT_MONO, 0}, {TK_OPTION_PIXELS, "-selectborderwidth", "selectBorderWidth", "BorderWidth", DEF_ENTRY_SELECT_BD_COLOR, -1, - Tk_Offset(Entry, selBorderWidth), + offsetof(Entry, selBorderWidth), 0, DEF_ENTRY_SELECT_BD_MONO, 0}, {TK_OPTION_COLOR, "-selectforeground", "selectForeground", "Background", - DEF_ENTRY_SELECT_FG_COLOR, -1, Tk_Offset(Entry, selFgColorPtr), + DEF_ENTRY_SELECT_FG_COLOR, -1, offsetof(Entry, selFgColorPtr), TK_OPTION_NULL_OK, DEF_ENTRY_SELECT_FG_MONO, 0}, {TK_OPTION_STRING_TABLE, "-state", "state", "State", - DEF_ENTRY_STATE, -1, Tk_Offset(Entry, state), + DEF_ENTRY_STATE, -1, offsetof(Entry, state), 0, stateStrings, 0}, {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", - DEF_ENTRY_TAKE_FOCUS, -1, Tk_Offset(Entry, takeFocus), + DEF_ENTRY_TAKE_FOCUS, -1, offsetof(Entry, takeFocus), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-textvariable", "textVariable", "Variable", - DEF_ENTRY_TEXT_VARIABLE, -1, Tk_Offset(Entry, textVarName), + DEF_ENTRY_TEXT_VARIABLE, -1, offsetof(Entry, textVarName), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_DOUBLE, "-to", "to", "To", - DEF_SPINBOX_TO, -1, Tk_Offset(Spinbox, toValue), 0, 0, 0}, + DEF_SPINBOX_TO, -1, offsetof(Spinbox, toValue), 0, 0, 0}, {TK_OPTION_STRING_TABLE, "-validate", "validate", "Validate", - DEF_ENTRY_VALIDATE, -1, Tk_Offset(Entry, validate), + DEF_ENTRY_VALIDATE, -1, offsetof(Entry, validate), 0, validateStrings, 0}, {TK_OPTION_STRING, "-validatecommand", "validateCommand","ValidateCommand", - NULL, -1, Tk_Offset(Entry, validateCmd), TK_OPTION_NULL_OK, 0, 0}, + NULL, -1, offsetof(Entry, validateCmd), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-values", "values", "Values", - DEF_SPINBOX_VALUES, -1, Tk_Offset(Spinbox, valueStr), + DEF_SPINBOX_VALUES, -1, offsetof(Spinbox, valueStr), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_SYNONYM, "-vcmd", NULL, NULL, NULL, 0, -1, 0, "-validatecommand", 0}, {TK_OPTION_INT, "-width", "width", "Width", - DEF_ENTRY_WIDTH, -1, Tk_Offset(Entry, prefWidth), 0, 0, 0}, + DEF_ENTRY_WIDTH, -1, offsetof(Entry, prefWidth), 0, 0, 0}, {TK_OPTION_BOOLEAN, "-wrap", "wrap", "Wrap", - DEF_SPINBOX_WRAP, -1, Tk_Offset(Spinbox, wrap), 0, 0, 0}, + DEF_SPINBOX_WRAP, -1, offsetof(Spinbox, wrap), 0, 0, 0}, {TK_OPTION_STRING, "-xscrollcommand", "xScrollCommand", "ScrollCommand", - DEF_ENTRY_SCROLL_COMMAND, -1, Tk_Offset(Entry, scrollCmd), + DEF_ENTRY_SCROLL_COMMAND, -1, offsetof(Entry, scrollCmd), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, 0, 0} }; diff --git a/generic/tkFrame.c b/generic/tkFrame.c index 9298655..0edd4c2 100644 --- a/generic/tkFrame.c +++ b/generic/tkFrame.c @@ -184,94 +184,94 @@ static const char *const labelAnchorStrings[] = { static const Tk_OptionSpec commonOptSpec[] = { {TK_OPTION_BORDER, "-background", "background", "Background", - DEF_FRAME_BG_COLOR, -1, Tk_Offset(Frame, border), + DEF_FRAME_BG_COLOR, -1, offsetof(Frame, border), TK_OPTION_NULL_OK, DEF_FRAME_BG_MONO, 0}, {TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL, 0, -1, 0, "-background", 0}, {TK_OPTION_STRING, "-colormap", "colormap", "Colormap", - DEF_FRAME_COLORMAP, -1, Tk_Offset(Frame, colormapName), + DEF_FRAME_COLORMAP, -1, offsetof(Frame, colormapName), TK_OPTION_NULL_OK, 0, 0}, /* * Having -container is useless in a labelframe since a container has * no border. It should be deprecated. */ {TK_OPTION_BOOLEAN, "-container", "container", "Container", - DEF_FRAME_CONTAINER, -1, Tk_Offset(Frame, isContainer), 0, 0, 0}, + DEF_FRAME_CONTAINER, -1, offsetof(Frame, isContainer), 0, 0, 0}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", - DEF_FRAME_CURSOR, -1, Tk_Offset(Frame, cursor), + DEF_FRAME_CURSOR, -1, offsetof(Frame, cursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-height", "height", "Height", - DEF_FRAME_HEIGHT, -1, Tk_Offset(Frame, height), 0, 0, 0}, + DEF_FRAME_HEIGHT, -1, offsetof(Frame, height), 0, 0, 0}, {TK_OPTION_COLOR, "-highlightbackground", "highlightBackground", "HighlightBackground", DEF_FRAME_HIGHLIGHT_BG, -1, - Tk_Offset(Frame, highlightBgColorPtr), 0, 0, 0}, + offsetof(Frame, highlightBgColorPtr), 0, 0, 0}, {TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor", - DEF_FRAME_HIGHLIGHT, -1, Tk_Offset(Frame, highlightColorPtr), + DEF_FRAME_HIGHLIGHT, -1, offsetof(Frame, highlightColorPtr), 0, 0, 0}, {TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness", "HighlightThickness", DEF_FRAME_HIGHLIGHT_WIDTH, -1, - Tk_Offset(Frame, highlightWidth), 0, 0, 0}, + offsetof(Frame, highlightWidth), 0, 0, 0}, {TK_OPTION_PIXELS, "-padx", "padX", "Pad", - DEF_FRAME_PADX, Tk_Offset(Frame, padXPtr), - Tk_Offset(Frame, padX), 0, 0, 0}, + DEF_FRAME_PADX, offsetof(Frame, padXPtr), + offsetof(Frame, padX), 0, 0, 0}, {TK_OPTION_PIXELS, "-pady", "padY", "Pad", - DEF_FRAME_PADY, Tk_Offset(Frame, padYPtr), - Tk_Offset(Frame, padY), 0, 0, 0}, + DEF_FRAME_PADY, offsetof(Frame, padYPtr), + offsetof(Frame, padY), 0, 0, 0}, {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", - DEF_FRAME_TAKE_FOCUS, -1, Tk_Offset(Frame, takeFocus), + DEF_FRAME_TAKE_FOCUS, -1, offsetof(Frame, takeFocus), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-visual", "visual", "Visual", - DEF_FRAME_VISUAL, -1, Tk_Offset(Frame, visualName), + DEF_FRAME_VISUAL, -1, offsetof(Frame, visualName), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-width", "width", "Width", - DEF_FRAME_WIDTH, -1, Tk_Offset(Frame, width), 0, 0, 0}, + DEF_FRAME_WIDTH, -1, offsetof(Frame, width), 0, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0} }; static const Tk_OptionSpec frameOptSpec[] = { {TK_OPTION_STRING, "-backgroundimage", "backgroundImage", "BackgroundImage", - DEF_FRAME_BG_IMAGE, Tk_Offset(Frame, bgimgPtr), -1, + DEF_FRAME_BG_IMAGE, offsetof(Frame, bgimgPtr), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL, 0, -1, 0, "-borderwidth", 0}, {TK_OPTION_SYNONYM, "-bgimg", NULL, NULL, NULL, 0, -1, 0, "-backgroundimage", 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", - DEF_FRAME_BORDER_WIDTH, -1, Tk_Offset(Frame, borderWidth), 0, 0, 0}, + DEF_FRAME_BORDER_WIDTH, -1, offsetof(Frame, borderWidth), 0, 0, 0}, {TK_OPTION_STRING, "-class", "class", "Class", - DEF_FRAME_CLASS, -1, Tk_Offset(Frame, className), 0, 0, 0}, + DEF_FRAME_CLASS, -1, offsetof(Frame, className), 0, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", - DEF_FRAME_RELIEF, -1, Tk_Offset(Frame, relief), 0, 0, 0}, + DEF_FRAME_RELIEF, -1, offsetof(Frame, relief), 0, 0, 0}, {TK_OPTION_BOOLEAN, "-tile", "tile", "Tile", - DEF_FRAME_BG_TILE, -1, Tk_Offset(Frame, tile), 0, 0, 0}, + DEF_FRAME_BG_TILE, -1, offsetof(Frame, tile), 0, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, commonOptSpec, 0} }; static const Tk_OptionSpec toplevelOptSpec[] = { {TK_OPTION_STRING, "-backgroundimage", "backgroundImage", "BackgroundImage", - DEF_FRAME_BG_IMAGE, Tk_Offset(Frame, bgimgPtr), -1, + DEF_FRAME_BG_IMAGE, offsetof(Frame, bgimgPtr), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL, 0, -1, 0, "-borderwidth", 0}, {TK_OPTION_SYNONYM, "-bgimg", NULL, NULL, NULL, 0, -1, 0, "-backgroundimage", 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", - DEF_FRAME_BORDER_WIDTH, -1, Tk_Offset(Frame, borderWidth), 0, 0, 0}, + DEF_FRAME_BORDER_WIDTH, -1, offsetof(Frame, borderWidth), 0, 0, 0}, {TK_OPTION_STRING, "-class", "class", "Class", - DEF_TOPLEVEL_CLASS, -1, Tk_Offset(Frame, className), 0, 0, 0}, + DEF_TOPLEVEL_CLASS, -1, offsetof(Frame, className), 0, 0, 0}, {TK_OPTION_STRING, "-menu", "menu", "Menu", - DEF_TOPLEVEL_MENU, -1, Tk_Offset(Frame, menuName), + DEF_TOPLEVEL_MENU, -1, offsetof(Frame, menuName), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", - DEF_FRAME_RELIEF, -1, Tk_Offset(Frame, relief), 0, 0, 0}, + DEF_FRAME_RELIEF, -1, offsetof(Frame, relief), 0, 0, 0}, {TK_OPTION_STRING, "-screen", "screen", "Screen", - DEF_TOPLEVEL_SCREEN, -1, Tk_Offset(Frame, screenName), + DEF_TOPLEVEL_SCREEN, -1, offsetof(Frame, screenName), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BOOLEAN, "-tile", "tile", "Tile", - DEF_FRAME_BG_TILE, -1, Tk_Offset(Frame, tile), 0, 0, 0}, + DEF_FRAME_BG_TILE, -1, offsetof(Frame, tile), 0, 0, 0}, {TK_OPTION_STRING, "-use", "use", "Use", - DEF_TOPLEVEL_USE, -1, Tk_Offset(Frame, useThis), + DEF_TOPLEVEL_USE, -1, offsetof(Frame, useThis), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, commonOptSpec, 0} @@ -281,25 +281,25 @@ static const Tk_OptionSpec labelframeOptSpec[] = { {TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL, 0, -1, 0, "-borderwidth", 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", - DEF_LABELFRAME_BORDER_WIDTH, -1, Tk_Offset(Frame, borderWidth), + DEF_LABELFRAME_BORDER_WIDTH, -1, offsetof(Frame, borderWidth), 0, 0, 0}, {TK_OPTION_STRING, "-class", "class", "Class", - DEF_LABELFRAME_CLASS, -1, Tk_Offset(Frame, className), 0, 0, 0}, + DEF_LABELFRAME_CLASS, -1, offsetof(Frame, className), 0, 0, 0}, {TK_OPTION_SYNONYM, "-fg", "foreground", NULL, NULL, 0, -1, 0, "-foreground", 0}, {TK_OPTION_FONT, "-font", "font", "Font", - DEF_LABELFRAME_FONT, -1, Tk_Offset(Labelframe, tkfont), 0, 0, 0}, + DEF_LABELFRAME_FONT, -1, offsetof(Labelframe, tkfont), 0, 0, 0}, {TK_OPTION_COLOR, "-foreground", "foreground", "Foreground", - DEF_LABELFRAME_FG, -1, Tk_Offset(Labelframe, textColorPtr), 0, 0, 0}, + DEF_LABELFRAME_FG, -1, offsetof(Labelframe, textColorPtr), 0, 0, 0}, {TK_OPTION_STRING_TABLE, "-labelanchor", "labelAnchor", "LabelAnchor", - DEF_LABELFRAME_LABELANCHOR, -1, Tk_Offset(Labelframe, labelAnchor), + DEF_LABELFRAME_LABELANCHOR, -1, offsetof(Labelframe, labelAnchor), 0, labelAnchorStrings, 0}, {TK_OPTION_WINDOW, "-labelwidget", "labelWidget", "LabelWidget", - NULL, -1, Tk_Offset(Labelframe, labelWin), TK_OPTION_NULL_OK, 0, 0}, + NULL, -1, offsetof(Labelframe, labelWin), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", - DEF_LABELFRAME_RELIEF, -1, Tk_Offset(Frame, relief), 0, 0, 0}, + DEF_LABELFRAME_RELIEF, -1, offsetof(Frame, relief), 0, 0, 0}, {TK_OPTION_STRING, "-text", "text", "Text", - DEF_LABELFRAME_TEXT, Tk_Offset(Labelframe, textPtr), -1, + DEF_LABELFRAME_TEXT, offsetof(Labelframe, textPtr), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, commonOptSpec, 0} diff --git a/generic/tkGrab.c b/generic/tkGrab.c index 0efddee..3881ac9 100644 --- a/generic/tkGrab.c +++ b/generic/tkGrab.c @@ -881,8 +881,9 @@ TkPointerEvent( return 1; } } else { - if ((eventPtr->xbutton.state & ALL_BUTTONS) - == buttonStates[eventPtr->xbutton.button - Button1]) { + if (eventPtr->xbutton.button != AnyButton && + ((eventPtr->xbutton.state & ALL_BUTTONS) + == buttonStates[eventPtr->xbutton.button - Button1])) { ReleaseButtonGrab(dispPtr); /* Note 4. */ } } diff --git a/generic/tkImgBmap.c b/generic/tkImgBmap.c index a3a94f9..f83f4cc 100644 --- a/generic/tkImgBmap.c +++ b/generic/tkImgBmap.c @@ -108,17 +108,17 @@ Tk_ImageType tkBitmapImageType = { static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_UID, "-background", NULL, NULL, - "", Tk_Offset(BitmapMaster, bgUid), 0, NULL}, + "", offsetof(BitmapMaster, bgUid), 0, NULL}, {TK_CONFIG_STRING, "-data", NULL, NULL, - NULL, Tk_Offset(BitmapMaster, dataString), TK_CONFIG_NULL_OK, NULL}, + NULL, offsetof(BitmapMaster, dataString), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_STRING, "-file", NULL, NULL, - NULL, Tk_Offset(BitmapMaster, fileString), TK_CONFIG_NULL_OK, NULL}, + NULL, offsetof(BitmapMaster, fileString), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_UID, "-foreground", NULL, NULL, - "#000000", Tk_Offset(BitmapMaster, fgUid), 0, NULL}, + "#000000", offsetof(BitmapMaster, fgUid), 0, NULL}, {TK_CONFIG_STRING, "-maskdata", NULL, NULL, - NULL, Tk_Offset(BitmapMaster, maskDataString), TK_CONFIG_NULL_OK, NULL}, + NULL, offsetof(BitmapMaster, maskDataString), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_STRING, "-maskfile", NULL, NULL, - NULL, Tk_Offset(BitmapMaster, maskFileString), TK_CONFIG_NULL_OK, NULL}, + NULL, offsetof(BitmapMaster, maskFileString), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL} }; diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c index ba3e234..95904b9 100644 --- a/generic/tkImgPhoto.c +++ b/generic/tkImgPhoto.c @@ -158,15 +158,15 @@ static Tcl_ThreadDataKey dataKey; static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_STRING, "-file", NULL, NULL, - NULL, Tk_Offset(PhotoMaster, fileString), TK_CONFIG_NULL_OK, NULL}, + NULL, offsetof(PhotoMaster, fileString), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_DOUBLE, "-gamma", NULL, NULL, - DEF_PHOTO_GAMMA, Tk_Offset(PhotoMaster, gamma), 0, NULL}, + DEF_PHOTO_GAMMA, offsetof(PhotoMaster, gamma), 0, NULL}, {TK_CONFIG_INT, "-height", NULL, NULL, - DEF_PHOTO_HEIGHT, Tk_Offset(PhotoMaster, userHeight), 0, NULL}, + DEF_PHOTO_HEIGHT, offsetof(PhotoMaster, userHeight), 0, NULL}, {TK_CONFIG_UID, "-palette", NULL, NULL, - DEF_PHOTO_PALETTE, Tk_Offset(PhotoMaster, palette), 0, NULL}, + DEF_PHOTO_PALETTE, offsetof(PhotoMaster, palette), 0, NULL}, {TK_CONFIG_INT, "-width", NULL, NULL, - DEF_PHOTO_WIDTH, Tk_Offset(PhotoMaster, userWidth), 0, NULL}, + DEF_PHOTO_WIDTH, offsetof(PhotoMaster, userWidth), 0, NULL}, {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL} }; diff --git a/generic/tkListbox.c b/generic/tkListbox.c index 2fabd9f..1264813 100644 --- a/generic/tkListbox.c +++ b/generic/tkListbox.c @@ -239,78 +239,78 @@ static const char *const activeStyleStrings[] = { static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_STRING_TABLE, "-activestyle", "activeStyle", "ActiveStyle", - DEF_LISTBOX_ACTIVE_STYLE, -1, Tk_Offset(Listbox, activeStyle), + DEF_LISTBOX_ACTIVE_STYLE, -1, offsetof(Listbox, activeStyle), 0, activeStyleStrings, 0}, {TK_OPTION_BORDER, "-background", "background", "Background", - DEF_LISTBOX_BG_COLOR, -1, Tk_Offset(Listbox, normalBorder), + DEF_LISTBOX_BG_COLOR, -1, offsetof(Listbox, normalBorder), 0, DEF_LISTBOX_BG_MONO, 0}, {TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL, 0, -1, 0, "-borderwidth", 0}, {TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL, 0, -1, 0, "-background", 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", - DEF_LISTBOX_BORDER_WIDTH, -1, Tk_Offset(Listbox, borderWidth), + DEF_LISTBOX_BORDER_WIDTH, -1, offsetof(Listbox, borderWidth), 0, 0, 0}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", - DEF_LISTBOX_CURSOR, -1, Tk_Offset(Listbox, cursor), + DEF_LISTBOX_CURSOR, -1, offsetof(Listbox, cursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_COLOR, "-disabledforeground", "disabledForeground", "DisabledForeground", DEF_LISTBOX_DISABLED_FG, -1, - Tk_Offset(Listbox, dfgColorPtr), TK_OPTION_NULL_OK, 0, 0}, + offsetof(Listbox, dfgColorPtr), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BOOLEAN, "-exportselection", "exportSelection", "ExportSelection", DEF_LISTBOX_EXPORT_SELECTION, -1, - Tk_Offset(Listbox, exportSelection), 0, 0, 0}, + offsetof(Listbox, exportSelection), 0, 0, 0}, {TK_OPTION_SYNONYM, "-fg", "foreground", NULL, NULL, 0, -1, 0, "-foreground", 0}, {TK_OPTION_FONT, "-font", "font", "Font", - DEF_LISTBOX_FONT, -1, Tk_Offset(Listbox, tkfont), 0, 0, 0}, + DEF_LISTBOX_FONT, -1, offsetof(Listbox, tkfont), 0, 0, 0}, {TK_OPTION_COLOR, "-foreground", "foreground", "Foreground", - DEF_LISTBOX_FG, -1, Tk_Offset(Listbox, fgColorPtr), 0, 0, 0}, + DEF_LISTBOX_FG, -1, offsetof(Listbox, fgColorPtr), 0, 0, 0}, {TK_OPTION_INT, "-height", "height", "Height", - DEF_LISTBOX_HEIGHT, -1, Tk_Offset(Listbox, height), 0, 0, 0}, + DEF_LISTBOX_HEIGHT, -1, offsetof(Listbox, height), 0, 0, 0}, {TK_OPTION_COLOR, "-highlightbackground", "highlightBackground", "HighlightBackground", DEF_LISTBOX_HIGHLIGHT_BG, -1, - Tk_Offset(Listbox, highlightBgColorPtr), 0, 0, 0}, + offsetof(Listbox, highlightBgColorPtr), 0, 0, 0}, {TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor", - DEF_LISTBOX_HIGHLIGHT, -1, Tk_Offset(Listbox, highlightColorPtr), + DEF_LISTBOX_HIGHLIGHT, -1, offsetof(Listbox, highlightColorPtr), 0, 0, 0}, {TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness", "HighlightThickness", DEF_LISTBOX_HIGHLIGHT_WIDTH, -1, - Tk_Offset(Listbox, highlightWidth), 0, 0, 0}, + offsetof(Listbox, highlightWidth), 0, 0, 0}, {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify", - DEF_LISTBOX_JUSTIFY, -1, Tk_Offset(Listbox, justify), 0, 0, 0}, + DEF_LISTBOX_JUSTIFY, -1, offsetof(Listbox, justify), 0, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", - DEF_LISTBOX_RELIEF, -1, Tk_Offset(Listbox, relief), 0, 0, 0}, + DEF_LISTBOX_RELIEF, -1, offsetof(Listbox, relief), 0, 0, 0}, {TK_OPTION_BORDER, "-selectbackground", "selectBackground", "Foreground", - DEF_LISTBOX_SELECT_COLOR, -1, Tk_Offset(Listbox, selBorder), + DEF_LISTBOX_SELECT_COLOR, -1, offsetof(Listbox, selBorder), 0, DEF_LISTBOX_SELECT_MONO, 0}, {TK_OPTION_PIXELS, "-selectborderwidth", "selectBorderWidth", "BorderWidth", DEF_LISTBOX_SELECT_BD, -1, - Tk_Offset(Listbox, selBorderWidth), 0, 0, 0}, + offsetof(Listbox, selBorderWidth), 0, 0, 0}, {TK_OPTION_COLOR, "-selectforeground", "selectForeground", "Background", - DEF_LISTBOX_SELECT_FG_COLOR, -1, Tk_Offset(Listbox, selFgColorPtr), + DEF_LISTBOX_SELECT_FG_COLOR, -1, offsetof(Listbox, selFgColorPtr), TK_OPTION_NULL_OK, DEF_LISTBOX_SELECT_FG_MONO, 0}, {TK_OPTION_STRING, "-selectmode", "selectMode", "SelectMode", - DEF_LISTBOX_SELECT_MODE, -1, Tk_Offset(Listbox, selectMode), + DEF_LISTBOX_SELECT_MODE, -1, offsetof(Listbox, selectMode), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BOOLEAN, "-setgrid", "setGrid", "SetGrid", - DEF_LISTBOX_SET_GRID, -1, Tk_Offset(Listbox, setGrid), 0, 0, 0}, + DEF_LISTBOX_SET_GRID, -1, offsetof(Listbox, setGrid), 0, 0, 0}, {TK_OPTION_STRING_TABLE, "-state", "state", "State", - DEF_LISTBOX_STATE, -1, Tk_Offset(Listbox, state), + DEF_LISTBOX_STATE, -1, offsetof(Listbox, state), 0, stateStrings, 0}, {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", - DEF_LISTBOX_TAKE_FOCUS, -1, Tk_Offset(Listbox, takeFocus), + DEF_LISTBOX_TAKE_FOCUS, -1, offsetof(Listbox, takeFocus), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_INT, "-width", "width", "Width", - DEF_LISTBOX_WIDTH, -1, Tk_Offset(Listbox, width), 0, 0, 0}, + DEF_LISTBOX_WIDTH, -1, offsetof(Listbox, width), 0, 0, 0}, {TK_OPTION_STRING, "-xscrollcommand", "xScrollCommand", "ScrollCommand", - DEF_LISTBOX_SCROLL_COMMAND, -1, Tk_Offset(Listbox, xScrollCmd), + DEF_LISTBOX_SCROLL_COMMAND, -1, offsetof(Listbox, xScrollCmd), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-yscrollcommand", "yScrollCommand", "ScrollCommand", - DEF_LISTBOX_SCROLL_COMMAND, -1, Tk_Offset(Listbox, yScrollCmd), + DEF_LISTBOX_SCROLL_COMMAND, -1, offsetof(Listbox, yScrollCmd), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-listvariable", "listVariable", "Variable", - DEF_LISTBOX_LIST_VARIABLE, -1, Tk_Offset(Listbox, listVarName), + DEF_LISTBOX_LIST_VARIABLE, -1, offsetof(Listbox, listVarName), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, 0, 0} }; @@ -322,7 +322,7 @@ static const Tk_OptionSpec optionSpecs[] = { static const Tk_OptionSpec itemAttrOptionSpecs[] = { {TK_OPTION_BORDER, "-background", "background", "Background", - NULL, -1, Tk_Offset(ItemAttr, border), + NULL, -1, offsetof(ItemAttr, border), TK_OPTION_NULL_OK|TK_OPTION_DONT_SET_DEFAULT, DEF_LISTBOX_BG_MONO, 0}, {TK_OPTION_SYNONYM, "-bg", NULL, NULL, @@ -330,14 +330,14 @@ static const Tk_OptionSpec itemAttrOptionSpecs[] = { {TK_OPTION_SYNONYM, "-fg", "foreground", NULL, NULL, 0, -1, 0, "-foreground", 0}, {TK_OPTION_COLOR, "-foreground", "foreground", "Foreground", - NULL, -1, Tk_Offset(ItemAttr, fgColor), + NULL, -1, offsetof(ItemAttr, fgColor), TK_OPTION_NULL_OK|TK_OPTION_DONT_SET_DEFAULT, 0, 0}, {TK_OPTION_BORDER, "-selectbackground", "selectBackground", "Foreground", - NULL, -1, Tk_Offset(ItemAttr, selBorder), + NULL, -1, offsetof(ItemAttr, selBorder), TK_OPTION_NULL_OK|TK_OPTION_DONT_SET_DEFAULT, DEF_LISTBOX_SELECT_MONO, 0}, {TK_OPTION_COLOR, "-selectforeground", "selectForeground", "Background", - NULL, -1, Tk_Offset(ItemAttr, selFgColor), + NULL, -1, offsetof(ItemAttr, selFgColor), TK_OPTION_NULL_OK|TK_OPTION_DONT_SET_DEFAULT, DEF_LISTBOX_SELECT_FG_MONO, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, 0, 0} diff --git a/generic/tkMenu.c b/generic/tkMenu.c index 05b8ecc..33b548d 100644 --- a/generic/tkMenu.c +++ b/generic/tkMenu.c @@ -118,79 +118,79 @@ static const char *const compoundStrings[] = { static const Tk_OptionSpec tkBasicMenuEntryConfigSpecs[] = { {TK_OPTION_BORDER, "-activebackground", NULL, NULL, - DEF_MENU_ENTRY_ACTIVE_BG, Tk_Offset(TkMenuEntry, activeBorderPtr), -1, + DEF_MENU_ENTRY_ACTIVE_BG, offsetof(TkMenuEntry, activeBorderPtr), -1, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_COLOR, "-activeforeground", NULL, NULL, DEF_MENU_ENTRY_ACTIVE_FG, - Tk_Offset(TkMenuEntry, activeFgPtr), -1, TK_OPTION_NULL_OK, NULL, 0}, + offsetof(TkMenuEntry, activeFgPtr), -1, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_STRING, "-accelerator", NULL, NULL, DEF_MENU_ENTRY_ACCELERATOR, - Tk_Offset(TkMenuEntry, accelPtr), -1, TK_OPTION_NULL_OK, NULL, 0}, + offsetof(TkMenuEntry, accelPtr), -1, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_BORDER, "-background", NULL, NULL, DEF_MENU_ENTRY_BG, - Tk_Offset(TkMenuEntry, borderPtr), -1, TK_OPTION_NULL_OK, NULL, 0}, + offsetof(TkMenuEntry, borderPtr), -1, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_BITMAP, "-bitmap", NULL, NULL, DEF_MENU_ENTRY_BITMAP, - Tk_Offset(TkMenuEntry, bitmapPtr), -1, TK_OPTION_NULL_OK, NULL, 0}, + offsetof(TkMenuEntry, bitmapPtr), -1, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_BOOLEAN, "-columnbreak", NULL, NULL, DEF_MENU_ENTRY_COLUMN_BREAK, - -1, Tk_Offset(TkMenuEntry, columnBreak), 0, NULL, 0}, + -1, offsetof(TkMenuEntry, columnBreak), 0, NULL, 0}, {TK_OPTION_STRING, "-command", NULL, NULL, DEF_MENU_ENTRY_COMMAND, - Tk_Offset(TkMenuEntry, commandPtr), -1, TK_OPTION_NULL_OK, NULL, 0}, + offsetof(TkMenuEntry, commandPtr), -1, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound", - DEF_MENU_ENTRY_COMPOUND, -1, Tk_Offset(TkMenuEntry, compound), 0, + DEF_MENU_ENTRY_COMPOUND, -1, offsetof(TkMenuEntry, compound), 0, (ClientData) compoundStrings, 0}, {TK_OPTION_FONT, "-font", NULL, NULL, DEF_MENU_ENTRY_FONT, - Tk_Offset(TkMenuEntry, fontPtr), -1, TK_OPTION_NULL_OK, NULL, 0}, + offsetof(TkMenuEntry, fontPtr), -1, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_COLOR, "-foreground", NULL, NULL, DEF_MENU_ENTRY_FG, - Tk_Offset(TkMenuEntry, fgPtr), -1, TK_OPTION_NULL_OK, NULL, 0}, + offsetof(TkMenuEntry, fgPtr), -1, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_BOOLEAN, "-hidemargin", NULL, NULL, DEF_MENU_ENTRY_HIDE_MARGIN, - -1, Tk_Offset(TkMenuEntry, hideMargin), 0, NULL, 0}, + -1, offsetof(TkMenuEntry, hideMargin), 0, NULL, 0}, {TK_OPTION_STRING, "-image", NULL, NULL, DEF_MENU_ENTRY_IMAGE, - Tk_Offset(TkMenuEntry, imagePtr), -1, TK_OPTION_NULL_OK, NULL, 0}, + offsetof(TkMenuEntry, imagePtr), -1, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_STRING, "-label", NULL, NULL, DEF_MENU_ENTRY_LABEL, - Tk_Offset(TkMenuEntry, labelPtr), -1, 0, NULL, 0}, + offsetof(TkMenuEntry, labelPtr), -1, 0, NULL, 0}, {TK_OPTION_STRING_TABLE, "-state", NULL, NULL, DEF_MENU_ENTRY_STATE, - -1, Tk_Offset(TkMenuEntry, state), 0, + -1, offsetof(TkMenuEntry, state), 0, (ClientData) menuStateStrings, 0}, {TK_OPTION_INT, "-underline", NULL, NULL, - DEF_MENU_ENTRY_UNDERLINE, -1, Tk_Offset(TkMenuEntry, underline), 0, NULL, 0}, + DEF_MENU_ENTRY_UNDERLINE, -1, offsetof(TkMenuEntry, underline), 0, NULL, 0}, {TK_OPTION_END, NULL, NULL, NULL, 0, 0, 0, 0, NULL, 0} }; static const Tk_OptionSpec tkSeparatorEntryConfigSpecs[] = { {TK_OPTION_BORDER, "-background", NULL, NULL, DEF_MENU_ENTRY_BG, - Tk_Offset(TkMenuEntry, borderPtr), -1, TK_OPTION_NULL_OK, NULL, 0}, + offsetof(TkMenuEntry, borderPtr), -1, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_END, NULL, NULL, NULL, 0, 0, 0, 0, NULL, 0} }; static const Tk_OptionSpec tkCheckButtonEntryConfigSpecs[] = { {TK_OPTION_BOOLEAN, "-indicatoron", NULL, NULL, DEF_MENU_ENTRY_INDICATOR, - -1, Tk_Offset(TkMenuEntry, indicatorOn), 0, NULL, 0}, + -1, offsetof(TkMenuEntry, indicatorOn), 0, NULL, 0}, {TK_OPTION_STRING, "-offvalue", NULL, NULL, DEF_MENU_ENTRY_OFF_VALUE, - Tk_Offset(TkMenuEntry, offValuePtr), -1, 0, NULL, 0}, + offsetof(TkMenuEntry, offValuePtr), -1, 0, NULL, 0}, {TK_OPTION_STRING, "-onvalue", NULL, NULL, DEF_MENU_ENTRY_ON_VALUE, - Tk_Offset(TkMenuEntry, onValuePtr), -1, 0, NULL, 0}, + offsetof(TkMenuEntry, onValuePtr), -1, 0, NULL, 0}, {TK_OPTION_COLOR, "-selectcolor", NULL, NULL, DEF_MENU_ENTRY_SELECT, - Tk_Offset(TkMenuEntry, indicatorFgPtr), -1, TK_OPTION_NULL_OK, NULL, 0}, + offsetof(TkMenuEntry, indicatorFgPtr), -1, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_STRING, "-selectimage", NULL, NULL, DEF_MENU_ENTRY_SELECT_IMAGE, - Tk_Offset(TkMenuEntry, selectImagePtr), -1, TK_OPTION_NULL_OK, NULL, 0}, + offsetof(TkMenuEntry, selectImagePtr), -1, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_STRING, "-variable", NULL, NULL, DEF_MENU_ENTRY_CHECK_VARIABLE, - Tk_Offset(TkMenuEntry, namePtr), -1, TK_OPTION_NULL_OK, NULL, 0}, + offsetof(TkMenuEntry, namePtr), -1, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, tkBasicMenuEntryConfigSpecs, 0} }; @@ -198,19 +198,19 @@ static const Tk_OptionSpec tkCheckButtonEntryConfigSpecs[] = { static const Tk_OptionSpec tkRadioButtonEntryConfigSpecs[] = { {TK_OPTION_BOOLEAN, "-indicatoron", NULL, NULL, DEF_MENU_ENTRY_INDICATOR, - -1, Tk_Offset(TkMenuEntry, indicatorOn), 0, NULL, 0}, + -1, offsetof(TkMenuEntry, indicatorOn), 0, NULL, 0}, {TK_OPTION_COLOR, "-selectcolor", NULL, NULL, DEF_MENU_ENTRY_SELECT, - Tk_Offset(TkMenuEntry, indicatorFgPtr), -1, TK_OPTION_NULL_OK, NULL, 0}, + offsetof(TkMenuEntry, indicatorFgPtr), -1, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_STRING, "-selectimage", NULL, NULL, DEF_MENU_ENTRY_SELECT_IMAGE, - Tk_Offset(TkMenuEntry, selectImagePtr), -1, TK_OPTION_NULL_OK, NULL, 0}, + offsetof(TkMenuEntry, selectImagePtr), -1, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_STRING, "-value", NULL, NULL, DEF_MENU_ENTRY_VALUE, - Tk_Offset(TkMenuEntry, onValuePtr), -1, TK_OPTION_NULL_OK, NULL, 0}, + offsetof(TkMenuEntry, onValuePtr), -1, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_STRING, "-variable", NULL, NULL, DEF_MENU_ENTRY_RADIO_VARIABLE, - Tk_Offset(TkMenuEntry, namePtr), -1, 0, NULL, 0}, + offsetof(TkMenuEntry, namePtr), -1, 0, NULL, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, tkBasicMenuEntryConfigSpecs, 0} }; @@ -218,7 +218,7 @@ static const Tk_OptionSpec tkRadioButtonEntryConfigSpecs[] = { static const Tk_OptionSpec tkCascadeEntryConfigSpecs[] = { {TK_OPTION_STRING, "-menu", NULL, NULL, DEF_MENU_ENTRY_MENU, - Tk_Offset(TkMenuEntry, namePtr), -1, TK_OPTION_NULL_OK, NULL, 0}, + offsetof(TkMenuEntry, namePtr), -1, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, tkBasicMenuEntryConfigSpecs, 0} }; @@ -226,9 +226,9 @@ static const Tk_OptionSpec tkCascadeEntryConfigSpecs[] = { static const Tk_OptionSpec tkTearoffEntryConfigSpecs[] = { {TK_OPTION_BORDER, "-background", NULL, NULL, DEF_MENU_ENTRY_BG, - Tk_Offset(TkMenuEntry, borderPtr), -1, TK_OPTION_NULL_OK, NULL, 0}, + offsetof(TkMenuEntry, borderPtr), -1, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_STRING_TABLE, "-state", NULL, NULL, - DEF_MENU_ENTRY_STATE, -1, Tk_Offset(TkMenuEntry, state), 0, + DEF_MENU_ENTRY_STATE, -1, offsetof(TkMenuEntry, state), 0, (ClientData) menuStateStrings, 0}, {TK_OPTION_END, NULL, NULL, NULL, 0, 0, 0, 0, NULL, 0} }; @@ -250,20 +250,20 @@ static const char *const menuTypeStrings[] = { static const Tk_OptionSpec tkMenuConfigSpecs[] = { {TK_OPTION_BORDER, "-activebackground", "activeBackground", "Foreground", DEF_MENU_ACTIVE_BG_COLOR, - Tk_Offset(TkMenu, activeBorderPtr), -1, 0, + offsetof(TkMenu, activeBorderPtr), -1, 0, (ClientData) DEF_MENU_ACTIVE_BG_MONO, 0}, {TK_OPTION_PIXELS, "-activeborderwidth", "activeBorderWidth", "BorderWidth", DEF_MENU_ACTIVE_BORDER_WIDTH, - Tk_Offset(TkMenu, activeBorderWidthPtr), -1, 0, NULL, 0}, + offsetof(TkMenu, activeBorderWidthPtr), -1, 0, NULL, 0}, {TK_OPTION_COLOR, "-activeforeground", "activeForeground", "Background", DEF_MENU_ACTIVE_FG_COLOR, - Tk_Offset(TkMenu, activeFgPtr), -1, 0, + offsetof(TkMenu, activeFgPtr), -1, 0, (ClientData) DEF_MENU_ACTIVE_FG_MONO, 0}, {TK_OPTION_RELIEF, "-activerelief", "activeRelief", "Relief", - DEF_MENU_ACTIVE_RELIEF, Tk_Offset(TkMenu, activeReliefPtr), + DEF_MENU_ACTIVE_RELIEF, offsetof(TkMenu, activeReliefPtr), -1, 0, NULL, 0}, {TK_OPTION_BORDER, "-background", "background", "Background", - DEF_MENU_BG_COLOR, Tk_Offset(TkMenu, borderPtr), -1, 0, + DEF_MENU_BG_COLOR, offsetof(TkMenu, borderPtr), -1, 0, (ClientData) DEF_MENU_BG_MONO, 0}, {TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL, 0, -1, 0, "-borderwidth", 0}, @@ -271,41 +271,41 @@ static const Tk_OptionSpec tkMenuConfigSpecs[] = { NULL, 0, -1, 0, "-background", 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", DEF_MENU_BORDER_WIDTH, - Tk_Offset(TkMenu, borderWidthPtr), -1, 0, NULL, 0}, + offsetof(TkMenu, borderWidthPtr), -1, 0, NULL, 0}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", DEF_MENU_CURSOR, - Tk_Offset(TkMenu, cursorPtr), -1, TK_OPTION_NULL_OK, NULL, 0}, + offsetof(TkMenu, cursorPtr), -1, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_COLOR, "-disabledforeground", "disabledForeground", "DisabledForeground", DEF_MENU_DISABLED_FG_COLOR, - Tk_Offset(TkMenu, disabledFgPtr), -1, TK_OPTION_NULL_OK, + offsetof(TkMenu, disabledFgPtr), -1, TK_OPTION_NULL_OK, (ClientData) DEF_MENU_DISABLED_FG_MONO, 0}, {TK_OPTION_SYNONYM, "-fg", NULL, NULL, NULL, 0, -1, 0, "-foreground", 0}, {TK_OPTION_FONT, "-font", "font", "Font", - DEF_MENU_FONT, Tk_Offset(TkMenu, fontPtr), -1, 0, NULL, 0}, + DEF_MENU_FONT, offsetof(TkMenu, fontPtr), -1, 0, NULL, 0}, {TK_OPTION_COLOR, "-foreground", "foreground", "Foreground", - DEF_MENU_FG, Tk_Offset(TkMenu, fgPtr), -1, 0, NULL, 0}, + DEF_MENU_FG, offsetof(TkMenu, fgPtr), -1, 0, NULL, 0}, {TK_OPTION_STRING, "-postcommand", "postCommand", "Command", DEF_MENU_POST_COMMAND, - Tk_Offset(TkMenu, postCommandPtr), -1, TK_OPTION_NULL_OK, NULL, 0}, + offsetof(TkMenu, postCommandPtr), -1, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", - DEF_MENU_RELIEF, Tk_Offset(TkMenu, reliefPtr), -1, 0, NULL, 0}, + DEF_MENU_RELIEF, offsetof(TkMenu, reliefPtr), -1, 0, NULL, 0}, {TK_OPTION_COLOR, "-selectcolor", "selectColor", "Background", - DEF_MENU_SELECT_COLOR, Tk_Offset(TkMenu, indicatorFgPtr), -1, 0, + DEF_MENU_SELECT_COLOR, offsetof(TkMenu, indicatorFgPtr), -1, 0, (ClientData) DEF_MENU_SELECT_MONO, 0}, {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", DEF_MENU_TAKE_FOCUS, - Tk_Offset(TkMenu, takeFocusPtr), -1, TK_OPTION_NULL_OK, NULL, 0}, + offsetof(TkMenu, takeFocusPtr), -1, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_BOOLEAN, "-tearoff", "tearOff", "TearOff", - DEF_MENU_TEAROFF, -1, Tk_Offset(TkMenu, tearoff), 0, NULL, 0}, + DEF_MENU_TEAROFF, -1, offsetof(TkMenu, tearoff), 0, NULL, 0}, {TK_OPTION_STRING, "-tearoffcommand", "tearOffCommand", "TearOffCommand", DEF_MENU_TEAROFF_CMD, - Tk_Offset(TkMenu, tearoffCommandPtr), -1, TK_OPTION_NULL_OK, NULL, 0}, + offsetof(TkMenu, tearoffCommandPtr), -1, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_STRING, "-title", "title", "Title", - DEF_MENU_TITLE, Tk_Offset(TkMenu, titlePtr), -1, + DEF_MENU_TITLE, offsetof(TkMenu, titlePtr), -1, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_STRING_TABLE, "-type", "type", "Type", - DEF_MENU_TYPE, Tk_Offset(TkMenu, menuTypePtr), -1, TK_OPTION_NULL_OK, + DEF_MENU_TYPE, offsetof(TkMenu, menuTypePtr), -1, TK_OPTION_NULL_OK, (ClientData) menuTypeStrings, 0}, {TK_OPTION_END, NULL, NULL, NULL, 0, 0, 0, 0, NULL, 0} }; diff --git a/generic/tkMenubutton.c b/generic/tkMenubutton.c index 25583be..4cf102f 100644 --- a/generic/tkMenubutton.c +++ b/generic/tkMenubutton.c @@ -61,98 +61,98 @@ static const char *const compoundStrings[] = { static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_BORDER, "-activebackground", "activeBackground", "Foreground", DEF_MENUBUTTON_ACTIVE_BG_COLOR, -1, - Tk_Offset(TkMenuButton, activeBorder), 0, + offsetof(TkMenuButton, activeBorder), 0, (ClientData) DEF_MENUBUTTON_ACTIVE_BG_MONO, 0}, {TK_OPTION_COLOR, "-activeforeground", "activeForeground", "Background", DEF_MENUBUTTON_ACTIVE_FG_COLOR, -1, - Tk_Offset(TkMenuButton, activeFg), + offsetof(TkMenuButton, activeFg), 0, DEF_MENUBUTTON_ACTIVE_FG_MONO, 0}, {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", DEF_MENUBUTTON_ANCHOR, -1, - Tk_Offset(TkMenuButton, anchor), 0, 0, 0}, + offsetof(TkMenuButton, anchor), 0, 0, 0}, {TK_OPTION_BORDER, "-background", "background", "Background", - DEF_MENUBUTTON_BG_COLOR, -1, Tk_Offset(TkMenuButton, normalBorder), + DEF_MENUBUTTON_BG_COLOR, -1, offsetof(TkMenuButton, normalBorder), 0, DEF_MENUBUTTON_BG_MONO, 0}, {TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL, 0, -1, 0, (ClientData) "-borderwidth", 0}, {TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL, 0, -1, 0, (ClientData) "-background", 0}, {TK_OPTION_BITMAP, "-bitmap", "bitmap", "Bitmap", - DEF_MENUBUTTON_BITMAP, -1, Tk_Offset(TkMenuButton, bitmap), + DEF_MENUBUTTON_BITMAP, -1, offsetof(TkMenuButton, bitmap), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", DEF_MENUBUTTON_BORDER_WIDTH, -1, - Tk_Offset(TkMenuButton, borderWidth), 0, 0, 0}, + offsetof(TkMenuButton, borderWidth), 0, 0, 0}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", - DEF_MENUBUTTON_CURSOR, -1, Tk_Offset(TkMenuButton, cursor), + DEF_MENUBUTTON_CURSOR, -1, offsetof(TkMenuButton, cursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING_TABLE, "-direction", "direction", "Direction", - DEF_MENUBUTTON_DIRECTION, -1, Tk_Offset(TkMenuButton, direction), + DEF_MENUBUTTON_DIRECTION, -1, offsetof(TkMenuButton, direction), 0, directionStrings, 0}, {TK_OPTION_COLOR, "-disabledforeground", "disabledForeground", "DisabledForeground", DEF_MENUBUTTON_DISABLED_FG_COLOR, - -1, Tk_Offset(TkMenuButton, disabledFg), TK_OPTION_NULL_OK, + -1, offsetof(TkMenuButton, disabledFg), TK_OPTION_NULL_OK, (ClientData) DEF_MENUBUTTON_DISABLED_FG_MONO, 0}, {TK_OPTION_SYNONYM, "-fg", "foreground", NULL, NULL, 0, -1, 0, (ClientData) "-foreground", 0}, {TK_OPTION_FONT, "-font", "font", "Font", - DEF_MENUBUTTON_FONT, -1, Tk_Offset(TkMenuButton, tkfont), 0, 0, 0}, + DEF_MENUBUTTON_FONT, -1, offsetof(TkMenuButton, tkfont), 0, 0, 0}, {TK_OPTION_COLOR, "-foreground", "foreground", "Foreground", - DEF_MENUBUTTON_FG, -1, Tk_Offset(TkMenuButton, normalFg), 0, 0, 0}, + DEF_MENUBUTTON_FG, -1, offsetof(TkMenuButton, normalFg), 0, 0, 0}, {TK_OPTION_STRING, "-height", "height", "Height", - DEF_MENUBUTTON_HEIGHT, -1, Tk_Offset(TkMenuButton, heightString), + DEF_MENUBUTTON_HEIGHT, -1, offsetof(TkMenuButton, heightString), 0, 0, 0}, {TK_OPTION_COLOR, "-highlightbackground", "highlightBackground", "HighlightBackground", DEF_MENUBUTTON_HIGHLIGHT_BG_COLOR, - -1, Tk_Offset(TkMenuButton, highlightBgColorPtr), 0, 0, 0}, + -1, offsetof(TkMenuButton, highlightBgColorPtr), 0, 0, 0}, {TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor", DEF_MENUBUTTON_HIGHLIGHT, -1, - Tk_Offset(TkMenuButton, highlightColorPtr), 0, 0, 0}, + offsetof(TkMenuButton, highlightColorPtr), 0, 0, 0}, {TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness", "HighlightThickness", DEF_MENUBUTTON_HIGHLIGHT_WIDTH, - -1, Tk_Offset(TkMenuButton, highlightWidth), 0, 0, 0}, + -1, offsetof(TkMenuButton, highlightWidth), 0, 0, 0}, {TK_OPTION_STRING, "-image", "image", "Image", - DEF_MENUBUTTON_IMAGE, -1, Tk_Offset(TkMenuButton, imageString), + DEF_MENUBUTTON_IMAGE, -1, offsetof(TkMenuButton, imageString), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BOOLEAN, "-indicatoron", "indicatorOn", "IndicatorOn", - DEF_MENUBUTTON_INDICATOR, -1, Tk_Offset(TkMenuButton, indicatorOn), + DEF_MENUBUTTON_INDICATOR, -1, offsetof(TkMenuButton, indicatorOn), 0, 0, 0}, {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify", - DEF_MENUBUTTON_JUSTIFY, -1, Tk_Offset(TkMenuButton, justify), 0, 0, 0}, + DEF_MENUBUTTON_JUSTIFY, -1, offsetof(TkMenuButton, justify), 0, 0, 0}, {TK_OPTION_STRING, "-menu", "menu", "Menu", - DEF_MENUBUTTON_MENU, -1, Tk_Offset(TkMenuButton, menuName), + DEF_MENUBUTTON_MENU, -1, offsetof(TkMenuButton, menuName), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-padx", "padX", "Pad", - DEF_MENUBUTTON_PADX, -1, Tk_Offset(TkMenuButton, padX), + DEF_MENUBUTTON_PADX, -1, offsetof(TkMenuButton, padX), 0, 0, 0}, {TK_OPTION_PIXELS, "-pady", "padY", "Pad", - DEF_MENUBUTTON_PADY, -1, Tk_Offset(TkMenuButton, padY), + DEF_MENUBUTTON_PADY, -1, offsetof(TkMenuButton, padY), 0, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", - DEF_MENUBUTTON_RELIEF, -1, Tk_Offset(TkMenuButton, relief), + DEF_MENUBUTTON_RELIEF, -1, offsetof(TkMenuButton, relief), 0, 0, 0}, {TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound", - DEF_BUTTON_COMPOUND, -1, Tk_Offset(TkMenuButton, compound), 0, + DEF_BUTTON_COMPOUND, -1, offsetof(TkMenuButton, compound), 0, compoundStrings, 0}, {TK_OPTION_STRING_TABLE, "-state", "state", "State", - DEF_MENUBUTTON_STATE, -1, Tk_Offset(TkMenuButton, state), + DEF_MENUBUTTON_STATE, -1, offsetof(TkMenuButton, state), 0, stateStrings, 0}, {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", DEF_MENUBUTTON_TAKE_FOCUS, -1, - Tk_Offset(TkMenuButton, takeFocus), TK_OPTION_NULL_OK, 0, 0}, + offsetof(TkMenuButton, takeFocus), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-text", "text", "Text", - DEF_MENUBUTTON_TEXT, -1, Tk_Offset(TkMenuButton, text), 0, 0, 0}, + DEF_MENUBUTTON_TEXT, -1, offsetof(TkMenuButton, text), 0, 0, 0}, {TK_OPTION_STRING, "-textvariable", "textVariable", "Variable", DEF_MENUBUTTON_TEXT_VARIABLE, -1, - Tk_Offset(TkMenuButton, textVarName), TK_OPTION_NULL_OK, 0, 0}, + offsetof(TkMenuButton, textVarName), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_INT, "-underline", "underline", "Underline", - DEF_MENUBUTTON_UNDERLINE, -1, Tk_Offset(TkMenuButton, underline), + DEF_MENUBUTTON_UNDERLINE, -1, offsetof(TkMenuButton, underline), 0, 0, 0}, {TK_OPTION_STRING, "-width", "width", "Width", - DEF_MENUBUTTON_WIDTH, -1, Tk_Offset(TkMenuButton, widthString), + DEF_MENUBUTTON_WIDTH, -1, offsetof(TkMenuButton, widthString), 0, 0, 0}, {TK_OPTION_PIXELS, "-wraplength", "wrapLength", "WrapLength", - DEF_MENUBUTTON_WRAP_LENGTH, -1, Tk_Offset(TkMenuButton, wrapLength), + DEF_MENUBUTTON_WRAP_LENGTH, -1, offsetof(TkMenuButton, wrapLength), 0, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0} }; diff --git a/generic/tkMessage.c b/generic/tkMessage.c index a46cce3..29daf3b 100644 --- a/generic/tkMessage.c +++ b/generic/tkMessage.c @@ -109,11 +109,11 @@ typedef struct { static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", DEF_MESSAGE_ANCHOR, - -1, Tk_Offset(Message, anchor), 0, 0, 0}, + -1, offsetof(Message, anchor), 0, 0, 0}, {TK_OPTION_INT, "-aspect", "aspect", "Aspect", DEF_MESSAGE_ASPECT, - -1, Tk_Offset(Message, aspect), 0, 0, 0}, + -1, offsetof(Message, aspect), 0, 0, 0}, {TK_OPTION_BORDER, "-background", "background", "Background", - DEF_MESSAGE_BG_COLOR, -1, Tk_Offset(Message, border), 0, + DEF_MESSAGE_BG_COLOR, -1, offsetof(Message, border), 0, DEF_MESSAGE_BG_MONO, 0}, {TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL, 0, -1, 0, "-borderwidth", 0}, @@ -121,45 +121,45 @@ static const Tk_OptionSpec optionSpecs[] = { 0, -1, 0, "-background", 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", DEF_MESSAGE_BORDER_WIDTH, -1, - Tk_Offset(Message, borderWidth), 0, 0, 0}, + offsetof(Message, borderWidth), 0, 0, 0}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", - DEF_MESSAGE_CURSOR, -1, Tk_Offset(Message, cursor), + DEF_MESSAGE_CURSOR, -1, offsetof(Message, cursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_SYNONYM, "-fg", NULL, NULL, NULL, 0, -1, 0, "-foreground", 0}, {TK_OPTION_FONT, "-font", "font", "Font", - DEF_MESSAGE_FONT, -1, Tk_Offset(Message, tkfont), 0, 0, 0}, + DEF_MESSAGE_FONT, -1, offsetof(Message, tkfont), 0, 0, 0}, {TK_OPTION_COLOR, "-foreground", "foreground", "Foreground", - DEF_MESSAGE_FG, -1, Tk_Offset(Message, fgColorPtr), 0, 0, 0}, + DEF_MESSAGE_FG, -1, offsetof(Message, fgColorPtr), 0, 0, 0}, {TK_OPTION_COLOR, "-highlightbackground", "highlightBackground", "HighlightBackground", DEF_MESSAGE_HIGHLIGHT_BG, -1, - Tk_Offset(Message, highlightBgColorPtr), 0, 0, 0}, + offsetof(Message, highlightBgColorPtr), 0, 0, 0}, {TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor", - DEF_MESSAGE_HIGHLIGHT, -1, Tk_Offset(Message, highlightColorPtr), + DEF_MESSAGE_HIGHLIGHT, -1, offsetof(Message, highlightColorPtr), 0, 0, 0}, {TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness", "HighlightThickness", DEF_MESSAGE_HIGHLIGHT_WIDTH, -1, - Tk_Offset(Message, highlightWidth), 0, 0, 0}, + offsetof(Message, highlightWidth), 0, 0, 0}, {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify", - DEF_MESSAGE_JUSTIFY, -1, Tk_Offset(Message, justify), 0, 0, 0}, + DEF_MESSAGE_JUSTIFY, -1, offsetof(Message, justify), 0, 0, 0}, {TK_OPTION_PIXELS, "-padx", "padX", "Pad", - DEF_MESSAGE_PADX, Tk_Offset(Message, padXPtr), - Tk_Offset(Message, padX), 0, 0, 0}, + DEF_MESSAGE_PADX, offsetof(Message, padXPtr), + offsetof(Message, padX), 0, 0, 0}, {TK_OPTION_PIXELS, "-pady", "padY", "Pad", - DEF_MESSAGE_PADY, Tk_Offset(Message, padYPtr), - Tk_Offset(Message, padY), 0, 0, 0}, + DEF_MESSAGE_PADY, offsetof(Message, padYPtr), + offsetof(Message, padY), 0, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", - DEF_MESSAGE_RELIEF, -1, Tk_Offset(Message, relief), 0, 0, 0}, + DEF_MESSAGE_RELIEF, -1, offsetof(Message, relief), 0, 0, 0}, {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", - DEF_MESSAGE_TAKE_FOCUS, -1, Tk_Offset(Message, takeFocus), + DEF_MESSAGE_TAKE_FOCUS, -1, offsetof(Message, takeFocus), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-text", "text", "Text", - DEF_MESSAGE_TEXT, -1, Tk_Offset(Message, string), 0, 0, 0}, + DEF_MESSAGE_TEXT, -1, offsetof(Message, string), 0, 0, 0}, {TK_OPTION_STRING, "-textvariable", "textVariable", "Variable", - DEF_MESSAGE_TEXT_VARIABLE, -1, Tk_Offset(Message, textVarName), + DEF_MESSAGE_TEXT_VARIABLE, -1, offsetof(Message, textVarName), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-width", "width", "Width", - DEF_MESSAGE_WIDTH, -1, Tk_Offset(Message, width), 0, 0 ,0}, + DEF_MESSAGE_WIDTH, -1, offsetof(Message, width), 0, 0 ,0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0} }; diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c index 6d17223..c605bf3 100644 --- a/generic/tkPanedWindow.c +++ b/generic/tkPanedWindow.c @@ -236,7 +236,7 @@ static void AdjustForSticky(int sticky, int cavityWidth, int *slaveWidthPtr, int *slaveHeightPtr); static void MoveSash(PanedWindow *pwPtr, int sash, int diff); static int ObjectIsEmpty(Tcl_Obj *objPtr); -static void * ComputeSlotAddress(void *recordPtr, int offset); +static void * ComputeSlotAddress(void *recordPtr, size_t offset); static int PanedWindowIdentifyCoords(PanedWindow *pwPtr, Tcl_Interp *interp, int x, int y); @@ -275,92 +275,92 @@ static const Tk_ObjCustomOption stickyOption = { static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_BORDER, "-background", "background", "Background", - DEF_PANEDWINDOW_BG_COLOR, -1, Tk_Offset(PanedWindow, background), 0, + DEF_PANEDWINDOW_BG_COLOR, -1, offsetof(PanedWindow, background), 0, DEF_PANEDWINDOW_BG_MONO, 0}, {TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL, 0, -1, 0, "-borderwidth", 0}, {TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL, 0, -1, 0, "-background", 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", - DEF_PANEDWINDOW_BORDERWIDTH, -1, Tk_Offset(PanedWindow, borderWidth), + DEF_PANEDWINDOW_BORDERWIDTH, -1, offsetof(PanedWindow, borderWidth), 0, 0, GEOMETRY}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", - DEF_PANEDWINDOW_CURSOR, -1, Tk_Offset(PanedWindow, cursor), + DEF_PANEDWINDOW_CURSOR, -1, offsetof(PanedWindow, cursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-handlepad", "handlePad", "HandlePad", - DEF_PANEDWINDOW_HANDLEPAD, -1, Tk_Offset(PanedWindow, handlePad), + DEF_PANEDWINDOW_HANDLEPAD, -1, offsetof(PanedWindow, handlePad), 0, 0, GEOMETRY}, {TK_OPTION_PIXELS, "-handlesize", "handleSize", "HandleSize", - DEF_PANEDWINDOW_HANDLESIZE, Tk_Offset(PanedWindow, handleSizePtr), - Tk_Offset(PanedWindow, handleSize), 0, 0, GEOMETRY}, + DEF_PANEDWINDOW_HANDLESIZE, offsetof(PanedWindow, handleSizePtr), + offsetof(PanedWindow, handleSize), 0, 0, GEOMETRY}, {TK_OPTION_PIXELS, "-height", "height", "Height", - DEF_PANEDWINDOW_HEIGHT, Tk_Offset(PanedWindow, heightPtr), - Tk_Offset(PanedWindow, height), TK_OPTION_NULL_OK, 0, GEOMETRY}, + DEF_PANEDWINDOW_HEIGHT, offsetof(PanedWindow, heightPtr), + offsetof(PanedWindow, height), TK_OPTION_NULL_OK, 0, GEOMETRY}, {TK_OPTION_BOOLEAN, "-opaqueresize", "opaqueResize", "OpaqueResize", DEF_PANEDWINDOW_OPAQUERESIZE, -1, - Tk_Offset(PanedWindow, resizeOpaque), 0, 0, 0}, + offsetof(PanedWindow, resizeOpaque), 0, 0, 0}, {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", - DEF_PANEDWINDOW_ORIENT, -1, Tk_Offset(PanedWindow, orient), + DEF_PANEDWINDOW_ORIENT, -1, offsetof(PanedWindow, orient), 0, orientStrings, GEOMETRY}, {TK_OPTION_BORDER, "-proxybackground", "proxyBackground", "ProxyBackground", - 0, -1, Tk_Offset(PanedWindow, proxyBackground), TK_OPTION_NULL_OK, + 0, -1, offsetof(PanedWindow, proxyBackground), TK_OPTION_NULL_OK, (ClientData) DEF_PANEDWINDOW_BG_MONO}, {TK_OPTION_PIXELS, "-proxyborderwidth", "proxyBorderWidth", "ProxyBorderWidth", - DEF_PANEDWINDOW_PROXYBORDER, Tk_Offset(PanedWindow, proxyBorderWidthPtr), - Tk_Offset(PanedWindow, proxyBorderWidth), 0, 0, GEOMETRY}, + DEF_PANEDWINDOW_PROXYBORDER, offsetof(PanedWindow, proxyBorderWidthPtr), + offsetof(PanedWindow, proxyBorderWidth), 0, 0, GEOMETRY}, {TK_OPTION_RELIEF, "-proxyrelief", "proxyRelief", "Relief", - 0, -1, Tk_Offset(PanedWindow, proxyRelief), + 0, -1, offsetof(PanedWindow, proxyRelief), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", - DEF_PANEDWINDOW_RELIEF, -1, Tk_Offset(PanedWindow, relief), 0, 0, 0}, + DEF_PANEDWINDOW_RELIEF, -1, offsetof(PanedWindow, relief), 0, 0, 0}, {TK_OPTION_CURSOR, "-sashcursor", "sashCursor", "Cursor", - DEF_PANEDWINDOW_SASHCURSOR, -1, Tk_Offset(PanedWindow, sashCursor), + DEF_PANEDWINDOW_SASHCURSOR, -1, offsetof(PanedWindow, sashCursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-sashpad", "sashPad", "SashPad", - DEF_PANEDWINDOW_SASHPAD, -1, Tk_Offset(PanedWindow, sashPad), + DEF_PANEDWINDOW_SASHPAD, -1, offsetof(PanedWindow, sashPad), 0, 0, GEOMETRY}, {TK_OPTION_RELIEF, "-sashrelief", "sashRelief", "Relief", - DEF_PANEDWINDOW_SASHRELIEF, -1, Tk_Offset(PanedWindow, sashRelief), + DEF_PANEDWINDOW_SASHRELIEF, -1, offsetof(PanedWindow, sashRelief), 0, 0, 0}, {TK_OPTION_PIXELS, "-sashwidth", "sashWidth", "Width", - DEF_PANEDWINDOW_SASHWIDTH, Tk_Offset(PanedWindow, sashWidthPtr), - Tk_Offset(PanedWindow, sashWidth), 0, 0, GEOMETRY}, + DEF_PANEDWINDOW_SASHWIDTH, offsetof(PanedWindow, sashWidthPtr), + offsetof(PanedWindow, sashWidth), 0, 0, GEOMETRY}, {TK_OPTION_BOOLEAN, "-showhandle", "showHandle", "ShowHandle", - DEF_PANEDWINDOW_SHOWHANDLE, -1, Tk_Offset(PanedWindow, showHandle), + DEF_PANEDWINDOW_SHOWHANDLE, -1, offsetof(PanedWindow, showHandle), 0, 0, GEOMETRY}, {TK_OPTION_PIXELS, "-width", "width", "Width", - DEF_PANEDWINDOW_WIDTH, Tk_Offset(PanedWindow, widthPtr), - Tk_Offset(PanedWindow, width), TK_OPTION_NULL_OK, 0, GEOMETRY}, + DEF_PANEDWINDOW_WIDTH, offsetof(PanedWindow, widthPtr), + offsetof(PanedWindow, width), TK_OPTION_NULL_OK, 0, GEOMETRY}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0} }; static const Tk_OptionSpec slaveOptionSpecs[] = { {TK_OPTION_WINDOW, "-after", NULL, NULL, - DEF_PANEDWINDOW_PANE_AFTER, -1, Tk_Offset(Slave, after), + DEF_PANEDWINDOW_PANE_AFTER, -1, offsetof(Slave, after), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_WINDOW, "-before", NULL, NULL, - DEF_PANEDWINDOW_PANE_BEFORE, -1, Tk_Offset(Slave, before), + DEF_PANEDWINDOW_PANE_BEFORE, -1, offsetof(Slave, before), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-height", NULL, NULL, - DEF_PANEDWINDOW_PANE_HEIGHT, Tk_Offset(Slave, heightPtr), - Tk_Offset(Slave, height), TK_OPTION_NULL_OK, 0, 0}, + DEF_PANEDWINDOW_PANE_HEIGHT, offsetof(Slave, heightPtr), + offsetof(Slave, height), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BOOLEAN, "-hide", "hide", "Hide", - DEF_PANEDWINDOW_PANE_HIDE, -1, Tk_Offset(Slave, hide), 0,0,GEOMETRY}, + DEF_PANEDWINDOW_PANE_HIDE, -1, offsetof(Slave, hide), 0,0,GEOMETRY}, {TK_OPTION_PIXELS, "-minsize", NULL, NULL, - DEF_PANEDWINDOW_PANE_MINSIZE, -1, Tk_Offset(Slave, minSize), 0, 0, 0}, + DEF_PANEDWINDOW_PANE_MINSIZE, -1, offsetof(Slave, minSize), 0, 0, 0}, {TK_OPTION_PIXELS, "-padx", NULL, NULL, - DEF_PANEDWINDOW_PANE_PADX, -1, Tk_Offset(Slave, padx), 0, 0, 0}, + DEF_PANEDWINDOW_PANE_PADX, -1, offsetof(Slave, padx), 0, 0, 0}, {TK_OPTION_PIXELS, "-pady", NULL, NULL, - DEF_PANEDWINDOW_PANE_PADY, -1, Tk_Offset(Slave, pady), 0, 0, 0}, + DEF_PANEDWINDOW_PANE_PADY, -1, offsetof(Slave, pady), 0, 0, 0}, {TK_OPTION_CUSTOM, "-sticky", NULL, NULL, - DEF_PANEDWINDOW_PANE_STICKY, -1, Tk_Offset(Slave, sticky), 0, + DEF_PANEDWINDOW_PANE_STICKY, -1, offsetof(Slave, sticky), 0, &stickyOption, 0}, {TK_OPTION_STRING_TABLE, "-stretch", "stretch", "Stretch", - DEF_PANEDWINDOW_PANE_STRETCH, -1, Tk_Offset(Slave, stretch), 0, + DEF_PANEDWINDOW_PANE_STRETCH, -1, offsetof(Slave, stretch), 0, (ClientData) stretchStrings, 0}, {TK_OPTION_PIXELS, "-width", NULL, NULL, - DEF_PANEDWINDOW_PANE_WIDTH, Tk_Offset(Slave, widthPtr), - Tk_Offset(Slave, width), TK_OPTION_NULL_OK, 0, 0}, + DEF_PANEDWINDOW_PANE_WIDTH, offsetof(Slave, widthPtr), + offsetof(Slave, width), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0} }; @@ -3023,9 +3023,9 @@ ObjectIsEmpty( static void * ComputeSlotAddress( void *recordPtr, /* Pointer to the start of a record. */ - int offset) /* Offset of a slot within that record; may be < 0. */ + size_t offset) /* Offset of a slot within that record; may be -1. */ { - if (offset >= 0) { + if (offset != (size_t)-1) { return (char *)recordPtr + offset; } else { return NULL; diff --git a/generic/tkPlace.c b/generic/tkPlace.c index 690f788..f6be0e5 100644 --- a/generic/tkPlace.c +++ b/generic/tkPlace.c @@ -82,29 +82,29 @@ typedef struct Slave { static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_ANCHOR, "-anchor", NULL, NULL, "nw", -1, - Tk_Offset(Slave, anchor), 0, 0, 0}, + offsetof(Slave, anchor), 0, 0, 0}, {TK_OPTION_STRING_TABLE, "-bordermode", NULL, NULL, "inside", -1, - Tk_Offset(Slave, borderMode), 0, borderModeStrings, 0}, - {TK_OPTION_PIXELS, "-height", NULL, NULL, "", Tk_Offset(Slave, heightPtr), - Tk_Offset(Slave, height), TK_OPTION_NULL_OK, 0, 0}, - {TK_OPTION_WINDOW, "-in", NULL, NULL, "", -1, Tk_Offset(Slave, inTkwin), + offsetof(Slave, borderMode), 0, borderModeStrings, 0}, + {TK_OPTION_PIXELS, "-height", NULL, NULL, "", offsetof(Slave, heightPtr), + offsetof(Slave, height), TK_OPTION_NULL_OK, 0, 0}, + {TK_OPTION_WINDOW, "-in", NULL, NULL, "", -1, offsetof(Slave, inTkwin), 0, 0, IN_MASK}, {TK_OPTION_DOUBLE, "-relheight", NULL, NULL, "", - Tk_Offset(Slave, relHeightPtr), Tk_Offset(Slave, relHeight), + offsetof(Slave, relHeightPtr), offsetof(Slave, relHeight), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_DOUBLE, "-relwidth", NULL, NULL, "", - Tk_Offset(Slave, relWidthPtr), Tk_Offset(Slave, relWidth), + offsetof(Slave, relWidthPtr), offsetof(Slave, relWidth), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_DOUBLE, "-relx", NULL, NULL, "0", -1, - Tk_Offset(Slave, relX), 0, 0, 0}, + offsetof(Slave, relX), 0, 0, 0}, {TK_OPTION_DOUBLE, "-rely", NULL, NULL, "0", -1, - Tk_Offset(Slave, relY), 0, 0, 0}, - {TK_OPTION_PIXELS, "-width", NULL, NULL, "", Tk_Offset(Slave, widthPtr), - Tk_Offset(Slave, width), TK_OPTION_NULL_OK, 0, 0}, - {TK_OPTION_PIXELS, "-x", NULL, NULL, "0", Tk_Offset(Slave, xPtr), - Tk_Offset(Slave, x), TK_OPTION_NULL_OK, 0, 0}, - {TK_OPTION_PIXELS, "-y", NULL, NULL, "0", Tk_Offset(Slave, yPtr), - Tk_Offset(Slave, y), TK_OPTION_NULL_OK, 0, 0}, + offsetof(Slave, relY), 0, 0, 0}, + {TK_OPTION_PIXELS, "-width", NULL, NULL, "", offsetof(Slave, widthPtr), + offsetof(Slave, width), TK_OPTION_NULL_OK, 0, 0}, + {TK_OPTION_PIXELS, "-x", NULL, NULL, "0", offsetof(Slave, xPtr), + offsetof(Slave, x), TK_OPTION_NULL_OK, 0, 0}, + {TK_OPTION_PIXELS, "-y", NULL, NULL, "0", offsetof(Slave, yPtr), + offsetof(Slave, y), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, 0, 0} }; diff --git a/generic/tkRectOval.c b/generic/tkRectOval.c index b40814e..507f072 100644 --- a/generic/tkRectOval.c +++ b/generic/tkRectOval.c @@ -60,62 +60,62 @@ static const Tk_CustomOption pixelOption = { static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_CUSTOM, "-activedash", NULL, NULL, - NULL, Tk_Offset(RectOvalItem, outline.activeDash), + NULL, offsetof(RectOvalItem, outline.activeDash), TK_CONFIG_NULL_OK, &dashOption}, {TK_CONFIG_COLOR, "-activefill", NULL, NULL, - NULL, Tk_Offset(RectOvalItem, activeFillColor), TK_CONFIG_NULL_OK, NULL}, + NULL, offsetof(RectOvalItem, activeFillColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_COLOR, "-activeoutline", NULL, NULL, - NULL, Tk_Offset(RectOvalItem, outline.activeColor), TK_CONFIG_NULL_OK, NULL}, + NULL, offsetof(RectOvalItem, outline.activeColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BITMAP, "-activeoutlinestipple", NULL, NULL, - NULL, Tk_Offset(RectOvalItem, outline.activeStipple), + NULL, offsetof(RectOvalItem, outline.activeStipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BITMAP, "-activestipple", NULL, NULL, - NULL, Tk_Offset(RectOvalItem, activeFillStipple), TK_CONFIG_NULL_OK, NULL}, + NULL, offsetof(RectOvalItem, activeFillStipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_CUSTOM, "-activewidth", NULL, NULL, - "0.0", Tk_Offset(RectOvalItem, outline.activeWidth), + "0.0", offsetof(RectOvalItem, outline.activeWidth), TK_CONFIG_DONT_SET_DEFAULT, &pixelOption}, {TK_CONFIG_CUSTOM, "-dash", NULL, NULL, - NULL, Tk_Offset(RectOvalItem, outline.dash), + NULL, offsetof(RectOvalItem, outline.dash), TK_CONFIG_NULL_OK, &dashOption}, {TK_CONFIG_PIXELS, "-dashoffset", NULL, NULL, - "0", Tk_Offset(RectOvalItem, outline.offset), + "0", offsetof(RectOvalItem, outline.offset), TK_CONFIG_DONT_SET_DEFAULT, NULL}, {TK_CONFIG_CUSTOM, "-disableddash", NULL, NULL, - NULL, Tk_Offset(RectOvalItem, outline.disabledDash), + NULL, offsetof(RectOvalItem, outline.disabledDash), TK_CONFIG_NULL_OK, &dashOption}, {TK_CONFIG_COLOR, "-disabledfill", NULL, NULL, - NULL, Tk_Offset(RectOvalItem, disabledFillColor), TK_CONFIG_NULL_OK, NULL}, + NULL, offsetof(RectOvalItem, disabledFillColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_COLOR, "-disabledoutline", NULL, NULL, - NULL, Tk_Offset(RectOvalItem, outline.disabledColor), + NULL, offsetof(RectOvalItem, outline.disabledColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BITMAP, "-disabledoutlinestipple", NULL, NULL, - NULL, Tk_Offset(RectOvalItem, outline.disabledStipple), + NULL, offsetof(RectOvalItem, outline.disabledStipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BITMAP, "-disabledstipple", NULL, NULL, - NULL, Tk_Offset(RectOvalItem, disabledFillStipple), TK_CONFIG_NULL_OK, NULL}, + NULL, offsetof(RectOvalItem, disabledFillStipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_PIXELS, "-disabledwidth", NULL, NULL, - "0.0", Tk_Offset(RectOvalItem, outline.disabledWidth), + "0.0", offsetof(RectOvalItem, outline.disabledWidth), TK_CONFIG_DONT_SET_DEFAULT, &pixelOption}, {TK_CONFIG_COLOR, "-fill", NULL, NULL, - NULL, Tk_Offset(RectOvalItem, fillColor), TK_CONFIG_NULL_OK, NULL}, + NULL, offsetof(RectOvalItem, fillColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_CUSTOM, "-offset", NULL, NULL, - "0,0", Tk_Offset(RectOvalItem, tsoffset), + "0,0", offsetof(RectOvalItem, tsoffset), TK_CONFIG_DONT_SET_DEFAULT, &offsetOption}, {TK_CONFIG_COLOR, "-outline", NULL, NULL, - "black", Tk_Offset(RectOvalItem, outline.color), TK_CONFIG_NULL_OK, NULL}, + "black", offsetof(RectOvalItem, outline.color), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_CUSTOM, "-outlineoffset", NULL, NULL, - "0,0", Tk_Offset(RectOvalItem, outline.tsoffset), + "0,0", offsetof(RectOvalItem, outline.tsoffset), TK_CONFIG_DONT_SET_DEFAULT, &offsetOption}, {TK_CONFIG_BITMAP, "-outlinestipple", NULL, NULL, - NULL, Tk_Offset(RectOvalItem, outline.stipple), TK_CONFIG_NULL_OK, NULL}, + NULL, offsetof(RectOvalItem, outline.stipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_CUSTOM, "-state", NULL, NULL, - NULL, Tk_Offset(Tk_Item, state),TK_CONFIG_NULL_OK, &stateOption}, + NULL, offsetof(Tk_Item, state),TK_CONFIG_NULL_OK, &stateOption}, {TK_CONFIG_BITMAP, "-stipple", NULL, NULL, - NULL, Tk_Offset(RectOvalItem, fillStipple),TK_CONFIG_NULL_OK, NULL}, + NULL, offsetof(RectOvalItem, fillStipple),TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_CUSTOM, "-tags", NULL, NULL, NULL, 0, TK_CONFIG_NULL_OK, &tagsOption}, {TK_CONFIG_CUSTOM, "-width", NULL, NULL, - "1.0", Tk_Offset(RectOvalItem, outline.width), + "1.0", offsetof(RectOvalItem, outline.width), TK_CONFIG_DONT_SET_DEFAULT, &pixelOption}, {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL} }; diff --git a/generic/tkScale.c b/generic/tkScale.c index 96f4f72..616d321 100644 --- a/generic/tkScale.c +++ b/generic/tkScale.c @@ -45,96 +45,96 @@ static const char *const stateStrings[] = { static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_BORDER, "-activebackground", "activeBackground", "Foreground", - DEF_SCALE_ACTIVE_BG_COLOR, -1, Tk_Offset(TkScale, activeBorder), + DEF_SCALE_ACTIVE_BG_COLOR, -1, offsetof(TkScale, activeBorder), 0, DEF_SCALE_ACTIVE_BG_MONO, 0}, {TK_OPTION_BORDER, "-background", "background", "Background", - DEF_SCALE_BG_COLOR, -1, Tk_Offset(TkScale, bgBorder), + DEF_SCALE_BG_COLOR, -1, offsetof(TkScale, bgBorder), 0, DEF_SCALE_BG_MONO, 0}, {TK_OPTION_DOUBLE, "-bigincrement", "bigIncrement", "BigIncrement", - DEF_SCALE_BIG_INCREMENT, -1, Tk_Offset(TkScale, bigIncrement), + DEF_SCALE_BIG_INCREMENT, -1, offsetof(TkScale, bigIncrement), 0, 0, 0}, {TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL, 0, -1, 0, "-borderwidth", 0}, {TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL, 0, -1, 0, "-background", 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", - DEF_SCALE_BORDER_WIDTH, -1, Tk_Offset(TkScale, borderWidth), + DEF_SCALE_BORDER_WIDTH, -1, offsetof(TkScale, borderWidth), 0, 0, 0}, {TK_OPTION_STRING, "-command", "command", "Command", - DEF_SCALE_COMMAND, -1, Tk_Offset(TkScale, command), + DEF_SCALE_COMMAND, -1, offsetof(TkScale, command), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", - DEF_SCALE_CURSOR, -1, Tk_Offset(TkScale, cursor), + DEF_SCALE_CURSOR, -1, offsetof(TkScale, cursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_INT, "-digits", "digits", "Digits", - DEF_SCALE_DIGITS, -1, Tk_Offset(TkScale, digits), + DEF_SCALE_DIGITS, -1, offsetof(TkScale, digits), 0, 0, 0}, {TK_OPTION_SYNONYM, "-fg", "foreground", NULL, NULL, 0, -1, 0, "-foreground", 0}, {TK_OPTION_FONT, "-font", "font", "Font", - DEF_SCALE_FONT, -1, Tk_Offset(TkScale, tkfont), 0, 0, 0}, + DEF_SCALE_FONT, -1, offsetof(TkScale, tkfont), 0, 0, 0}, {TK_OPTION_COLOR, "-foreground", "foreground", "Foreground", - DEF_SCALE_FG_COLOR, -1, Tk_Offset(TkScale, textColorPtr), 0, + DEF_SCALE_FG_COLOR, -1, offsetof(TkScale, textColorPtr), 0, (ClientData) DEF_SCALE_FG_MONO, 0}, {TK_OPTION_DOUBLE, "-from", "from", "From", DEF_SCALE_FROM, -1, - Tk_Offset(TkScale, fromValue), 0, 0, 0}, + offsetof(TkScale, fromValue), 0, 0, 0}, {TK_OPTION_BORDER, "-highlightbackground", "highlightBackground", "HighlightBackground", DEF_SCALE_HIGHLIGHT_BG_COLOR, - -1, Tk_Offset(TkScale, highlightBorder), + -1, offsetof(TkScale, highlightBorder), 0, DEF_SCALE_HIGHLIGHT_BG_MONO, 0}, {TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor", - DEF_SCALE_HIGHLIGHT, -1, Tk_Offset(TkScale, highlightColorPtr), + DEF_SCALE_HIGHLIGHT, -1, offsetof(TkScale, highlightColorPtr), 0, 0, 0}, {TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness", "HighlightThickness", DEF_SCALE_HIGHLIGHT_WIDTH, -1, - Tk_Offset(TkScale, highlightWidth), 0, 0, 0}, + offsetof(TkScale, highlightWidth), 0, 0, 0}, {TK_OPTION_STRING, "-label", "label", "Label", - DEF_SCALE_LABEL, -1, Tk_Offset(TkScale, label), + DEF_SCALE_LABEL, -1, offsetof(TkScale, label), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-length", "length", "Length", - DEF_SCALE_LENGTH, -1, Tk_Offset(TkScale, length), 0, 0, 0}, + DEF_SCALE_LENGTH, -1, offsetof(TkScale, length), 0, 0, 0}, {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", - DEF_SCALE_ORIENT, -1, Tk_Offset(TkScale, orient), + DEF_SCALE_ORIENT, -1, offsetof(TkScale, orient), 0, orientStrings, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", - DEF_SCALE_RELIEF, -1, Tk_Offset(TkScale, relief), 0, 0, 0}, + DEF_SCALE_RELIEF, -1, offsetof(TkScale, relief), 0, 0, 0}, {TK_OPTION_INT, "-repeatdelay", "repeatDelay", "RepeatDelay", - DEF_SCALE_REPEAT_DELAY, -1, Tk_Offset(TkScale, repeatDelay), + DEF_SCALE_REPEAT_DELAY, -1, offsetof(TkScale, repeatDelay), 0, 0, 0}, {TK_OPTION_INT, "-repeatinterval", "repeatInterval", "RepeatInterval", - DEF_SCALE_REPEAT_INTERVAL, -1, Tk_Offset(TkScale, repeatInterval), + DEF_SCALE_REPEAT_INTERVAL, -1, offsetof(TkScale, repeatInterval), 0, 0, 0}, {TK_OPTION_DOUBLE, "-resolution", "resolution", "Resolution", - DEF_SCALE_RESOLUTION, -1, Tk_Offset(TkScale, resolution), + DEF_SCALE_RESOLUTION, -1, offsetof(TkScale, resolution), 0, 0, 0}, {TK_OPTION_BOOLEAN, "-showvalue", "showValue", "ShowValue", - DEF_SCALE_SHOW_VALUE, -1, Tk_Offset(TkScale, showValue), + DEF_SCALE_SHOW_VALUE, -1, offsetof(TkScale, showValue), 0, 0, 0}, {TK_OPTION_PIXELS, "-sliderlength", "sliderLength", "SliderLength", - DEF_SCALE_SLIDER_LENGTH, -1, Tk_Offset(TkScale, sliderLength), + DEF_SCALE_SLIDER_LENGTH, -1, offsetof(TkScale, sliderLength), 0, 0, 0}, {TK_OPTION_RELIEF, "-sliderrelief", "sliderRelief", "SliderRelief", - DEF_SCALE_SLIDER_RELIEF, -1, Tk_Offset(TkScale, sliderRelief), + DEF_SCALE_SLIDER_RELIEF, -1, offsetof(TkScale, sliderRelief), 0, 0, 0}, {TK_OPTION_STRING_TABLE, "-state", "state", "State", - DEF_SCALE_STATE, -1, Tk_Offset(TkScale, state), + DEF_SCALE_STATE, -1, offsetof(TkScale, state), 0, stateStrings, 0}, {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", - DEF_SCALE_TAKE_FOCUS, Tk_Offset(TkScale, takeFocusPtr), -1, + DEF_SCALE_TAKE_FOCUS, offsetof(TkScale, takeFocusPtr), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_DOUBLE, "-tickinterval", "tickInterval", "TickInterval", - DEF_SCALE_TICK_INTERVAL, -1, Tk_Offset(TkScale, tickInterval), + DEF_SCALE_TICK_INTERVAL, -1, offsetof(TkScale, tickInterval), 0, 0, 0}, {TK_OPTION_DOUBLE, "-to", "to", "To", - DEF_SCALE_TO, -1, Tk_Offset(TkScale, toValue), 0, 0, 0}, + DEF_SCALE_TO, -1, offsetof(TkScale, toValue), 0, 0, 0}, {TK_OPTION_COLOR, "-troughcolor", "troughColor", "Background", - DEF_SCALE_TROUGH_COLOR, -1, Tk_Offset(TkScale, troughColorPtr), + DEF_SCALE_TROUGH_COLOR, -1, offsetof(TkScale, troughColorPtr), 0, DEF_SCALE_TROUGH_MONO, 0}, {TK_OPTION_STRING, "-variable", "variable", "Variable", - DEF_SCALE_VARIABLE, Tk_Offset(TkScale, varNamePtr), -1, + DEF_SCALE_VARIABLE, offsetof(TkScale, varNamePtr), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-width", "width", "Width", - DEF_SCALE_WIDTH, -1, Tk_Offset(TkScale, width), 0, 0, 0}, + DEF_SCALE_WIDTH, -1, offsetof(TkScale, width), 0, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, 0, 0} }; diff --git a/generic/tkScrollbar.c b/generic/tkScrollbar.c index b1389a8..5b0f6af 100644 --- a/generic/tkScrollbar.c +++ b/generic/tkScrollbar.c @@ -33,62 +33,62 @@ char tkDefScrollbarWidth[TCL_INTEGER_SPACE] = DEF_SCROLLBAR_WIDTH; static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_BORDER, "-activebackground", "activeBackground", "Foreground", - DEF_SCROLLBAR_ACTIVE_BG_COLOR, Tk_Offset(TkScrollbar, activeBorder), + DEF_SCROLLBAR_ACTIVE_BG_COLOR, offsetof(TkScrollbar, activeBorder), TK_CONFIG_COLOR_ONLY, NULL}, {TK_CONFIG_BORDER, "-activebackground", "activeBackground", "Foreground", - DEF_SCROLLBAR_ACTIVE_BG_MONO, Tk_Offset(TkScrollbar, activeBorder), + DEF_SCROLLBAR_ACTIVE_BG_MONO, offsetof(TkScrollbar, activeBorder), TK_CONFIG_MONO_ONLY, NULL}, {TK_CONFIG_RELIEF, "-activerelief", "activeRelief", "Relief", - DEF_SCROLLBAR_ACTIVE_RELIEF, Tk_Offset(TkScrollbar, activeRelief), 0, NULL}, + DEF_SCROLLBAR_ACTIVE_RELIEF, offsetof(TkScrollbar, activeRelief), 0, NULL}, {TK_CONFIG_BORDER, "-background", "background", "Background", - DEF_SCROLLBAR_BG_COLOR, Tk_Offset(TkScrollbar, bgBorder), + DEF_SCROLLBAR_BG_COLOR, offsetof(TkScrollbar, bgBorder), TK_CONFIG_COLOR_ONLY, NULL}, {TK_CONFIG_BORDER, "-background", "background", "Background", - DEF_SCROLLBAR_BG_MONO, Tk_Offset(TkScrollbar, bgBorder), + DEF_SCROLLBAR_BG_MONO, offsetof(TkScrollbar, bgBorder), TK_CONFIG_MONO_ONLY, NULL}, {TK_CONFIG_SYNONYM, "-bd", "borderWidth", NULL, NULL, 0, 0, NULL}, {TK_CONFIG_SYNONYM, "-bg", "background", NULL, NULL, 0, 0, NULL}, {TK_CONFIG_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", - DEF_SCROLLBAR_BORDER_WIDTH, Tk_Offset(TkScrollbar, borderWidth), 0, NULL}, + DEF_SCROLLBAR_BORDER_WIDTH, offsetof(TkScrollbar, borderWidth), 0, NULL}, {TK_CONFIG_STRING, "-command", "command", "Command", - DEF_SCROLLBAR_COMMAND, Tk_Offset(TkScrollbar, command), + DEF_SCROLLBAR_COMMAND, offsetof(TkScrollbar, command), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_ACTIVE_CURSOR, "-cursor", "cursor", "Cursor", - DEF_SCROLLBAR_CURSOR, Tk_Offset(TkScrollbar, cursor), TK_CONFIG_NULL_OK, NULL}, + DEF_SCROLLBAR_CURSOR, offsetof(TkScrollbar, cursor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_PIXELS, "-elementborderwidth", "elementBorderWidth", "BorderWidth", DEF_SCROLLBAR_EL_BORDER_WIDTH, - Tk_Offset(TkScrollbar, elementBorderWidth), 0, NULL}, + offsetof(TkScrollbar, elementBorderWidth), 0, NULL}, {TK_CONFIG_COLOR, "-highlightbackground", "highlightBackground", "HighlightBackground", DEF_SCROLLBAR_HIGHLIGHT_BG, - Tk_Offset(TkScrollbar, highlightBgColorPtr), 0, NULL}, + offsetof(TkScrollbar, highlightBgColorPtr), 0, NULL}, {TK_CONFIG_COLOR, "-highlightcolor", "highlightColor", "HighlightColor", DEF_SCROLLBAR_HIGHLIGHT, - Tk_Offset(TkScrollbar, highlightColorPtr), 0, NULL}, + offsetof(TkScrollbar, highlightColorPtr), 0, NULL}, {TK_CONFIG_PIXELS, "-highlightthickness", "highlightThickness", "HighlightThickness", - DEF_SCROLLBAR_HIGHLIGHT_WIDTH, Tk_Offset(TkScrollbar, highlightWidth), 0, NULL}, + DEF_SCROLLBAR_HIGHLIGHT_WIDTH, offsetof(TkScrollbar, highlightWidth), 0, NULL}, {TK_CONFIG_BOOLEAN, "-jump", "jump", "Jump", - DEF_SCROLLBAR_JUMP, Tk_Offset(TkScrollbar, jump), 0, NULL}, + DEF_SCROLLBAR_JUMP, offsetof(TkScrollbar, jump), 0, NULL}, {TK_CONFIG_CUSTOM, "-orient", "orient", "Orient", - DEF_SCROLLBAR_ORIENT, Tk_Offset(TkScrollbar, vertical), 0, + DEF_SCROLLBAR_ORIENT, offsetof(TkScrollbar, vertical), 0, &orientOption}, {TK_CONFIG_RELIEF, "-relief", "relief", "Relief", - DEF_SCROLLBAR_RELIEF, Tk_Offset(TkScrollbar, relief), 0, NULL}, + DEF_SCROLLBAR_RELIEF, offsetof(TkScrollbar, relief), 0, NULL}, {TK_CONFIG_INT, "-repeatdelay", "repeatDelay", "RepeatDelay", - DEF_SCROLLBAR_REPEAT_DELAY, Tk_Offset(TkScrollbar, repeatDelay), 0, NULL}, + DEF_SCROLLBAR_REPEAT_DELAY, offsetof(TkScrollbar, repeatDelay), 0, NULL}, {TK_CONFIG_INT, "-repeatinterval", "repeatInterval", "RepeatInterval", - DEF_SCROLLBAR_REPEAT_INTERVAL, Tk_Offset(TkScrollbar, repeatInterval), 0, NULL}, + DEF_SCROLLBAR_REPEAT_INTERVAL, offsetof(TkScrollbar, repeatInterval), 0, NULL}, {TK_CONFIG_STRING, "-takefocus", "takeFocus", "TakeFocus", - DEF_SCROLLBAR_TAKE_FOCUS, Tk_Offset(TkScrollbar, takeFocus), + DEF_SCROLLBAR_TAKE_FOCUS, offsetof(TkScrollbar, takeFocus), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_COLOR, "-troughcolor", "troughColor", "Background", - DEF_SCROLLBAR_TROUGH_COLOR, Tk_Offset(TkScrollbar, troughColorPtr), + DEF_SCROLLBAR_TROUGH_COLOR, offsetof(TkScrollbar, troughColorPtr), TK_CONFIG_COLOR_ONLY, NULL}, {TK_CONFIG_COLOR, "-troughcolor", "troughColor", "Background", - DEF_SCROLLBAR_TROUGH_MONO, Tk_Offset(TkScrollbar, troughColorPtr), + DEF_SCROLLBAR_TROUGH_MONO, offsetof(TkScrollbar, troughColorPtr), TK_CONFIG_MONO_ONLY, NULL}, {TK_CONFIG_PIXELS, "-width", "width", "Width", - tkDefScrollbarWidth, Tk_Offset(TkScrollbar, width), 0, NULL}, + tkDefScrollbarWidth, offsetof(TkScrollbar, width), 0, NULL}, {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL} }; diff --git a/generic/tkSelect.c b/generic/tkSelect.c index 563a0c4..85865de 100644 --- a/generic/tkSelect.c +++ b/generic/tkSelect.c @@ -190,7 +190,7 @@ Tk_CreateSelHandler( * should make a copy for this selPtr. */ - size_t cmdInfoLen = Tk_Offset(CommandInfo, command) + 1 + + size_t cmdInfoLen = offsetof(CommandInfo, command) + 1 + ((CommandInfo *)clientData)->cmdLength; selPtr->clientData = ckalloc(cmdInfoLen); @@ -904,7 +904,7 @@ Tk_SelectionObjCmd( if (cmdLength == 0) { Tk_DeleteSelHandler(tkwin, selection, target); } else { - cmdInfoPtr = ckalloc(Tk_Offset(CommandInfo, command) + cmdInfoPtr = ckalloc(offsetof(CommandInfo, command) + 1 + cmdLength); cmdInfoPtr->interp = interp; cmdInfoPtr->charOffset = 0; diff --git a/generic/tkSquare.c b/generic/tkSquare.c index e40a684..8421988 100644 --- a/generic/tkSquare.c +++ b/generic/tkSquare.c @@ -66,29 +66,29 @@ typedef struct { static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_BORDER, "-background", "background", "Background", - "#d9d9d9", Tk_Offset(Square, bgBorderPtr), -1, 0, + "#d9d9d9", offsetof(Square, bgBorderPtr), -1, 0, "white", 0}, {TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL, 0, -1, 0, "-borderwidth", 0}, {TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL, 0, -1, 0, "-background", 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", - "2", Tk_Offset(Square, borderWidthPtr), -1, 0, NULL, 0}, + "2", offsetof(Square, borderWidthPtr), -1, 0, NULL, 0}, {TK_OPTION_BOOLEAN, "-dbl", "doubleBuffer", "DoubleBuffer", - "1", Tk_Offset(Square, doubleBufferPtr), -1, 0 , NULL, 0}, + "1", offsetof(Square, doubleBufferPtr), -1, 0 , NULL, 0}, {TK_OPTION_SYNONYM, "-fg", NULL, NULL, NULL, 0, -1, 0, "-foreground", 0}, {TK_OPTION_BORDER, "-foreground", "foreground", "Foreground", - "#b03060", Tk_Offset(Square, fgBorderPtr), -1, 0, + "#b03060", offsetof(Square, fgBorderPtr), -1, 0, "black", 0}, {TK_OPTION_PIXELS, "-posx", "posx", "PosX", "0", - Tk_Offset(Square, xPtr), -1, 0, NULL, 0}, + offsetof(Square, xPtr), -1, 0, NULL, 0}, {TK_OPTION_PIXELS, "-posy", "posy", "PosY", "0", - Tk_Offset(Square, yPtr), -1, 0, NULL, 0}, + offsetof(Square, yPtr), -1, 0, NULL, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", - "raised", Tk_Offset(Square, reliefPtr), -1, 0, NULL, 0}, + "raised", offsetof(Square, reliefPtr), -1, 0, NULL, 0}, {TK_OPTION_PIXELS, "-size", "size", "Size", "20", - Tk_Offset(Square, sizeObjPtr), -1, 0, NULL, 0}, + offsetof(Square, sizeObjPtr), -1, 0, NULL, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0} }; diff --git a/generic/tkTest.c b/generic/tkTest.c index a369776..18f248e 100644 --- a/generic/tkTest.c +++ b/generic/tkTest.c @@ -556,9 +556,9 @@ TestobjconfigObjCmd( } ExtensionWidgetRecord; static const Tk_OptionSpec baseSpecs[] = { {TK_OPTION_STRING, "-one", "one", "One", "one", - Tk_Offset(ExtensionWidgetRecord, base1ObjPtr), -1, 0, NULL, 0}, + offsetof(ExtensionWidgetRecord, base1ObjPtr), -1, 0, NULL, 0}, {TK_OPTION_STRING, "-two", "two", "Two", "two", - Tk_Offset(ExtensionWidgetRecord, base2ObjPtr), -1, 0, NULL, 0}, + offsetof(ExtensionWidgetRecord, base2ObjPtr), -1, 0, NULL, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0} }; @@ -600,47 +600,47 @@ TestobjconfigObjCmd( }; static const Tk_OptionSpec typesSpecs[] = { {TK_OPTION_BOOLEAN, "-boolean", "boolean", "Boolean", "1", - Tk_Offset(TypesRecord, booleanPtr), -1, 0, 0, 0x1}, + offsetof(TypesRecord, booleanPtr), -1, 0, 0, 0x1}, {TK_OPTION_INT, "-integer", "integer", "Integer", "7", - Tk_Offset(TypesRecord, integerPtr), -1, 0, 0, 0x2}, + offsetof(TypesRecord, integerPtr), -1, 0, 0, 0x2}, {TK_OPTION_DOUBLE, "-double", "double", "Double", "3.14159", - Tk_Offset(TypesRecord, doublePtr), -1, 0, 0, 0x4}, + offsetof(TypesRecord, doublePtr), -1, 0, 0, 0x4}, {TK_OPTION_STRING, "-string", "string", "String", - "foo", Tk_Offset(TypesRecord, stringPtr), -1, + "foo", offsetof(TypesRecord, stringPtr), -1, TK_CONFIG_NULL_OK, 0, 0x8}, {TK_OPTION_STRING_TABLE, "-stringtable", "StringTable", "stringTable", - "one", Tk_Offset(TypesRecord, stringTablePtr), -1, + "one", offsetof(TypesRecord, stringTablePtr), -1, TK_CONFIG_NULL_OK, stringTable, 0x10}, {TK_OPTION_COLOR, "-color", "color", "Color", - "red", Tk_Offset(TypesRecord, colorPtr), -1, + "red", offsetof(TypesRecord, colorPtr), -1, TK_CONFIG_NULL_OK, "black", 0x20}, {TK_OPTION_FONT, "-font", "font", "Font", "Helvetica 12", - Tk_Offset(TypesRecord, fontPtr), -1, + offsetof(TypesRecord, fontPtr), -1, TK_CONFIG_NULL_OK, 0, 0x40}, {TK_OPTION_BITMAP, "-bitmap", "bitmap", "Bitmap", "gray50", - Tk_Offset(TypesRecord, bitmapPtr), -1, + offsetof(TypesRecord, bitmapPtr), -1, TK_CONFIG_NULL_OK, 0, 0x80}, {TK_OPTION_BORDER, "-border", "border", "Border", - "blue", Tk_Offset(TypesRecord, borderPtr), -1, + "blue", offsetof(TypesRecord, borderPtr), -1, TK_CONFIG_NULL_OK, "white", 0x100}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", "raised", - Tk_Offset(TypesRecord, reliefPtr), -1, + offsetof(TypesRecord, reliefPtr), -1, TK_CONFIG_NULL_OK, 0, 0x200}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", "xterm", - Tk_Offset(TypesRecord, cursorPtr), -1, + offsetof(TypesRecord, cursorPtr), -1, TK_CONFIG_NULL_OK, 0, 0x400}, {TK_OPTION_JUSTIFY, "-justify", NULL, NULL, "left", - Tk_Offset(TypesRecord, justifyPtr), -1, + offsetof(TypesRecord, justifyPtr), -1, TK_CONFIG_NULL_OK, 0, 0x800}, {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", NULL, - Tk_Offset(TypesRecord, anchorPtr), -1, + offsetof(TypesRecord, anchorPtr), -1, TK_CONFIG_NULL_OK, 0, 0x1000}, {TK_OPTION_PIXELS, "-pixel", "pixel", "Pixel", - "1", Tk_Offset(TypesRecord, pixelPtr), -1, + "1", offsetof(TypesRecord, pixelPtr), -1, TK_CONFIG_NULL_OK, 0, 0x2000}, {TK_OPTION_CUSTOM, "-custom", NULL, NULL, - "", Tk_Offset(TypesRecord, customPtr), -1, + "", offsetof(TypesRecord, customPtr), -1, TK_CONFIG_NULL_OK, &CustomOption, 0x4000}, {TK_OPTION_SYNONYM, "-synonym", NULL, NULL, NULL, 0, -1, 0, "-color", 0x8000}, @@ -745,14 +745,14 @@ TestobjconfigObjCmd( ExtensionWidgetRecord *recordPtr; static const Tk_OptionSpec extensionSpecs[] = { {TK_OPTION_STRING, "-three", "three", "Three", "three", - Tk_Offset(ExtensionWidgetRecord, extension3ObjPtr), -1, 0, NULL, 0}, + offsetof(ExtensionWidgetRecord, extension3ObjPtr), -1, 0, NULL, 0}, {TK_OPTION_STRING, "-four", "four", "Four", "four", - Tk_Offset(ExtensionWidgetRecord, extension4ObjPtr), -1, 0, NULL, 0}, + offsetof(ExtensionWidgetRecord, extension4ObjPtr), -1, 0, NULL, 0}, {TK_OPTION_STRING, "-two", "two", "Two", "two and a half", - Tk_Offset(ExtensionWidgetRecord, base2ObjPtr), -1, 0, NULL, 0}, + offsetof(ExtensionWidgetRecord, base2ObjPtr), -1, 0, NULL, 0}, {TK_OPTION_STRING, "-oneAgain", "oneAgain", "OneAgain", "one again", - Tk_Offset(ExtensionWidgetRecord, extension5ObjPtr), -1, 0, NULL, 0}, + offsetof(ExtensionWidgetRecord, extension5ObjPtr), -1, 0, NULL, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, (ClientData) baseSpecs, 0} }; @@ -801,7 +801,7 @@ TestobjconfigObjCmd( ErrorWidgetRecord widgetRecord; static const Tk_OptionSpec errorSpecs[] = { {TK_OPTION_INT, "-int", "integer", "Integer", "bogus", - Tk_Offset(ErrorWidgetRecord, intPtr), 0, 0, NULL, 0}, + offsetof(ErrorWidgetRecord, intPtr), 0, 0, NULL, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0} }; Tk_OptionTable optionTable; @@ -875,50 +875,50 @@ TestobjconfigObjCmd( }; static const Tk_OptionSpec internalSpecs[] = { {TK_OPTION_BOOLEAN, "-boolean", "boolean", "Boolean", "1", - -1, Tk_Offset(InternalRecord, boolean), 0, 0, 0x1}, + -1, offsetof(InternalRecord, boolean), 0, 0, 0x1}, {TK_OPTION_INT, "-integer", "integer", "Integer", "148962237", - -1, Tk_Offset(InternalRecord, integer), 0, 0, 0x2}, + -1, offsetof(InternalRecord, integer), 0, 0, 0x2}, {TK_OPTION_DOUBLE, "-double", "double", "Double", "3.14159", - -1, Tk_Offset(InternalRecord, doubleValue), 0, 0, 0x4}, + -1, offsetof(InternalRecord, doubleValue), 0, 0, 0x4}, {TK_OPTION_STRING, "-string", "string", "String", "foo", - -1, Tk_Offset(InternalRecord, string), + -1, offsetof(InternalRecord, string), TK_CONFIG_NULL_OK, 0, 0x8}, {TK_OPTION_STRING_TABLE, "-stringtable", "StringTable", "stringTable", "one", - -1, Tk_Offset(InternalRecord, index), + -1, offsetof(InternalRecord, index), TK_CONFIG_NULL_OK, internalStringTable, 0x10}, {TK_OPTION_COLOR, "-color", "color", "Color", "red", - -1, Tk_Offset(InternalRecord, colorPtr), + -1, offsetof(InternalRecord, colorPtr), TK_CONFIG_NULL_OK, "black", 0x20}, {TK_OPTION_FONT, "-font", "font", "Font", "Helvetica 12", - -1, Tk_Offset(InternalRecord, tkfont), + -1, offsetof(InternalRecord, tkfont), TK_CONFIG_NULL_OK, 0, 0x40}, {TK_OPTION_BITMAP, "-bitmap", "bitmap", "Bitmap", "gray50", - -1, Tk_Offset(InternalRecord, bitmap), + -1, offsetof(InternalRecord, bitmap), TK_CONFIG_NULL_OK, 0, 0x80}, {TK_OPTION_BORDER, "-border", "border", "Border", "blue", - -1, Tk_Offset(InternalRecord, border), + -1, offsetof(InternalRecord, border), TK_CONFIG_NULL_OK, "white", 0x100}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", "raised", - -1, Tk_Offset(InternalRecord, relief), + -1, offsetof(InternalRecord, relief), TK_CONFIG_NULL_OK, 0, 0x200}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", "xterm", - -1, Tk_Offset(InternalRecord, cursor), + -1, offsetof(InternalRecord, cursor), TK_CONFIG_NULL_OK, 0, 0x400}, {TK_OPTION_JUSTIFY, "-justify", NULL, NULL, "left", - -1, Tk_Offset(InternalRecord, justify), + -1, offsetof(InternalRecord, justify), TK_CONFIG_NULL_OK, 0, 0x800}, {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", NULL, - -1, Tk_Offset(InternalRecord, anchor), + -1, offsetof(InternalRecord, anchor), TK_CONFIG_NULL_OK, 0, 0x1000}, {TK_OPTION_PIXELS, "-pixel", "pixel", "Pixel", "1", - -1, Tk_Offset(InternalRecord, pixels), + -1, offsetof(InternalRecord, pixels), TK_CONFIG_NULL_OK, 0, 0x2000}, {TK_OPTION_WINDOW, "-window", "window", "Window", NULL, - -1, Tk_Offset(InternalRecord, tkwin), + -1, offsetof(InternalRecord, tkwin), TK_CONFIG_NULL_OK, 0, 0}, {TK_OPTION_CUSTOM, "-custom", NULL, NULL, "", - -1, Tk_Offset(InternalRecord, custom), + -1, offsetof(InternalRecord, custom), TK_CONFIG_NULL_OK, &CustomOption, 0x4000}, {TK_OPTION_SYNONYM, "-synonym", NULL, NULL, NULL, -1, -1, 0, "-color", 0x8000}, @@ -992,15 +992,15 @@ TestobjconfigObjCmd( FiveRecord *recordPtr; static const Tk_OptionSpec smallSpecs[] = { {TK_OPTION_INT, "-one", "one", "One", "1", - Tk_Offset(FiveRecord, one), -1, 0, NULL, 0}, + offsetof(FiveRecord, one), -1, 0, NULL, 0}, {TK_OPTION_INT, "-two", "two", "Two", "2", - Tk_Offset(FiveRecord, two), -1, 0, NULL, 0}, + offsetof(FiveRecord, two), -1, 0, NULL, 0}, {TK_OPTION_INT, "-three", "three", "Three", "3", - Tk_Offset(FiveRecord, three), -1, 0, NULL, 0}, + offsetof(FiveRecord, three), -1, 0, NULL, 0}, {TK_OPTION_INT, "-four", "four", "Four", "4", - Tk_Offset(FiveRecord, four), -1, 0, NULL, 0}, + offsetof(FiveRecord, four), -1, 0, NULL, 0}, {TK_OPTION_STRING, "-five", NULL, NULL, NULL, - Tk_Offset(FiveRecord, five), -1, 0, NULL, 0}, + offsetof(FiveRecord, five), -1, 0, NULL, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0} }; @@ -1046,7 +1046,7 @@ TestobjconfigObjCmd( NotEnoughRecord record; static const Tk_OptionSpec errorSpecs[] = { {TK_OPTION_INT, "-foo", "foo", "Foo", "0", - Tk_Offset(NotEnoughRecord, fooObjPtr), 0, 0, NULL, 0}, + offsetof(NotEnoughRecord, fooObjPtr), 0, 0, NULL, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0} }; Tcl_Obj *newObjPtr = Tcl_NewStringObj("-foo", -1); @@ -1077,7 +1077,7 @@ TestobjconfigObjCmd( SlaveRecord *recordPtr; static const Tk_OptionSpec slaveSpecs[] = { {TK_OPTION_WINDOW, "-window", "window", "Window", ".bar", - Tk_Offset(SlaveRecord, windowPtr), -1, TK_CONFIG_NULL_OK, NULL, 0}, + offsetof(SlaveRecord, windowPtr), -1, TK_CONFIG_NULL_OK, NULL, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0} }; Tk_Window tkwin = Tk_CreateWindowFromPath(interp, diff --git a/generic/tkText.c b/generic/tkText.c index 551ef5e..7e09bfd 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -122,10 +122,10 @@ static const Tk_ObjCustomOption lineOption = { static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_BOOLEAN, "-autoseparators", "autoSeparators", "AutoSeparators", DEF_TEXT_AUTO_SEPARATORS, -1, - Tk_Offset(TkText, autoSeparators), + offsetof(TkText, autoSeparators), TK_OPTION_DONT_SET_DEFAULT, 0, 0}, {TK_OPTION_BORDER, "-background", "background", "Background", - DEF_TEXT_BG_COLOR, -1, Tk_Offset(TkText, border), + DEF_TEXT_BG_COLOR, -1, offsetof(TkText, border), 0, DEF_TEXT_BG_MONO, 0}, {TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL, 0, -1, 0, "-borderwidth", @@ -134,126 +134,126 @@ static const Tk_OptionSpec optionSpecs[] = { NULL, 0, -1, 0, "-background", 0}, {TK_OPTION_BOOLEAN, "-blockcursor", "blockCursor", "BlockCursor", DEF_TEXT_BLOCK_CURSOR, -1, - Tk_Offset(TkText, insertCursorType), 0, 0, 0}, + offsetof(TkText, insertCursorType), 0, 0, 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", - DEF_TEXT_BORDER_WIDTH, -1, Tk_Offset(TkText, borderWidth), + DEF_TEXT_BORDER_WIDTH, -1, offsetof(TkText, borderWidth), 0, 0, TK_TEXT_LINE_GEOMETRY}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", - DEF_TEXT_CURSOR, -1, Tk_Offset(TkText, cursor), + DEF_TEXT_CURSOR, -1, offsetof(TkText, cursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_CUSTOM, "-endline", NULL, NULL, - NULL, -1, Tk_Offset(TkText, end), TK_OPTION_NULL_OK, + NULL, -1, offsetof(TkText, end), TK_OPTION_NULL_OK, &lineOption, TK_TEXT_LINE_RANGE}, {TK_OPTION_BOOLEAN, "-exportselection", "exportSelection", "ExportSelection", DEF_TEXT_EXPORT_SELECTION, -1, - Tk_Offset(TkText, exportSelection), 0, 0, 0}, + offsetof(TkText, exportSelection), 0, 0, 0}, {TK_OPTION_SYNONYM, "-fg", "foreground", NULL, NULL, 0, -1, 0, "-foreground", 0}, {TK_OPTION_FONT, "-font", "font", "Font", - DEF_TEXT_FONT, -1, Tk_Offset(TkText, tkfont), 0, 0, + DEF_TEXT_FONT, -1, offsetof(TkText, tkfont), 0, 0, TK_TEXT_LINE_GEOMETRY}, {TK_OPTION_COLOR, "-foreground", "foreground", "Foreground", - DEF_TEXT_FG, -1, Tk_Offset(TkText, fgColor), 0, + DEF_TEXT_FG, -1, offsetof(TkText, fgColor), 0, 0, 0}, {TK_OPTION_PIXELS, "-height", "height", "Height", - DEF_TEXT_HEIGHT, -1, Tk_Offset(TkText, height), 0, 0, 0}, + DEF_TEXT_HEIGHT, -1, offsetof(TkText, height), 0, 0, 0}, {TK_OPTION_COLOR, "-highlightbackground", "highlightBackground", "HighlightBackground", DEF_TEXT_HIGHLIGHT_BG, - -1, Tk_Offset(TkText, highlightBgColorPtr), + -1, offsetof(TkText, highlightBgColorPtr), 0, 0, 0}, {TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor", - DEF_TEXT_HIGHLIGHT, -1, Tk_Offset(TkText, highlightColorPtr), + DEF_TEXT_HIGHLIGHT, -1, offsetof(TkText, highlightColorPtr), 0, 0, 0}, {TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness", "HighlightThickness", DEF_TEXT_HIGHLIGHT_WIDTH, -1, - Tk_Offset(TkText, highlightWidth), 0, 0, TK_TEXT_LINE_GEOMETRY}, + offsetof(TkText, highlightWidth), 0, 0, TK_TEXT_LINE_GEOMETRY}, {TK_OPTION_BORDER, "-inactiveselectbackground","inactiveSelectBackground", "Foreground", DEF_TEXT_INACTIVE_SELECT_COLOR, - -1, Tk_Offset(TkText, inactiveSelBorder), + -1, offsetof(TkText, inactiveSelBorder), TK_OPTION_NULL_OK, DEF_TEXT_SELECT_MONO, 0}, {TK_OPTION_BORDER, "-insertbackground", "insertBackground", "Foreground", DEF_TEXT_INSERT_BG, - -1, Tk_Offset(TkText, insertBorder), + -1, offsetof(TkText, insertBorder), 0, 0, 0}, {TK_OPTION_PIXELS, "-insertborderwidth", "insertBorderWidth", "BorderWidth", DEF_TEXT_INSERT_BD_COLOR, -1, - Tk_Offset(TkText, insertBorderWidth), 0, + offsetof(TkText, insertBorderWidth), 0, (ClientData) DEF_TEXT_INSERT_BD_MONO, 0}, {TK_OPTION_INT, "-insertofftime", "insertOffTime", "OffTime", - DEF_TEXT_INSERT_OFF_TIME, -1, Tk_Offset(TkText, insertOffTime), + DEF_TEXT_INSERT_OFF_TIME, -1, offsetof(TkText, insertOffTime), 0, 0, 0}, {TK_OPTION_INT, "-insertontime", "insertOnTime", "OnTime", - DEF_TEXT_INSERT_ON_TIME, -1, Tk_Offset(TkText, insertOnTime), + DEF_TEXT_INSERT_ON_TIME, -1, offsetof(TkText, insertOnTime), 0, 0, 0}, {TK_OPTION_STRING_TABLE, "-insertunfocussed", "insertUnfocussed", "InsertUnfocussed", - DEF_TEXT_INSERT_UNFOCUSSED, -1, Tk_Offset(TkText, insertUnfocussed), + DEF_TEXT_INSERT_UNFOCUSSED, -1, offsetof(TkText, insertUnfocussed), 0, insertUnfocussedStrings, 0}, {TK_OPTION_PIXELS, "-insertwidth", "insertWidth", "InsertWidth", - DEF_TEXT_INSERT_WIDTH, -1, Tk_Offset(TkText, insertWidth), + DEF_TEXT_INSERT_WIDTH, -1, offsetof(TkText, insertWidth), 0, 0, 0}, {TK_OPTION_INT, "-maxundo", "maxUndo", "MaxUndo", - DEF_TEXT_MAX_UNDO, -1, Tk_Offset(TkText, maxUndo), + DEF_TEXT_MAX_UNDO, -1, offsetof(TkText, maxUndo), TK_OPTION_DONT_SET_DEFAULT, 0, 0}, {TK_OPTION_PIXELS, "-padx", "padX", "Pad", - DEF_TEXT_PADX, -1, Tk_Offset(TkText, padX), 0, 0, + DEF_TEXT_PADX, -1, offsetof(TkText, padX), 0, 0, TK_TEXT_LINE_GEOMETRY}, {TK_OPTION_PIXELS, "-pady", "padY", "Pad", - DEF_TEXT_PADY, -1, Tk_Offset(TkText, padY), 0, 0, 0}, + DEF_TEXT_PADY, -1, offsetof(TkText, padY), 0, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", - DEF_TEXT_RELIEF, -1, Tk_Offset(TkText, relief), 0, 0, 0}, + DEF_TEXT_RELIEF, -1, offsetof(TkText, relief), 0, 0, 0}, {TK_OPTION_BORDER, "-selectbackground", "selectBackground", "Foreground", - DEF_TEXT_SELECT_COLOR, -1, Tk_Offset(TkText, selBorder), + DEF_TEXT_SELECT_COLOR, -1, offsetof(TkText, selBorder), 0, DEF_TEXT_SELECT_MONO, 0}, {TK_OPTION_PIXELS, "-selectborderwidth", "selectBorderWidth", "BorderWidth", DEF_TEXT_SELECT_BD_COLOR, - Tk_Offset(TkText, selBorderWidthPtr), - Tk_Offset(TkText, selBorderWidth), + offsetof(TkText, selBorderWidthPtr), + offsetof(TkText, selBorderWidth), TK_OPTION_NULL_OK, DEF_TEXT_SELECT_BD_MONO, 0}, {TK_OPTION_COLOR, "-selectforeground", "selectForeground", "Background", - DEF_TEXT_SELECT_FG_COLOR, -1, Tk_Offset(TkText, selFgColorPtr), + DEF_TEXT_SELECT_FG_COLOR, -1, offsetof(TkText, selFgColorPtr), TK_OPTION_NULL_OK, DEF_TEXT_SELECT_FG_MONO, 0}, {TK_OPTION_BOOLEAN, "-setgrid", "setGrid", "SetGrid", - DEF_TEXT_SET_GRID, -1, Tk_Offset(TkText, setGrid), 0, 0, 0}, + DEF_TEXT_SET_GRID, -1, offsetof(TkText, setGrid), 0, 0, 0}, {TK_OPTION_PIXELS, "-spacing1", "spacing1", "Spacing", - DEF_TEXT_SPACING1, -1, Tk_Offset(TkText, spacing1), + DEF_TEXT_SPACING1, -1, offsetof(TkText, spacing1), 0, 0 , TK_TEXT_LINE_GEOMETRY }, {TK_OPTION_PIXELS, "-spacing2", "spacing2", "Spacing", - DEF_TEXT_SPACING2, -1, Tk_Offset(TkText, spacing2), + DEF_TEXT_SPACING2, -1, offsetof(TkText, spacing2), 0, 0 , TK_TEXT_LINE_GEOMETRY }, {TK_OPTION_PIXELS, "-spacing3", "spacing3", "Spacing", - DEF_TEXT_SPACING3, -1, Tk_Offset(TkText, spacing3), + DEF_TEXT_SPACING3, -1, offsetof(TkText, spacing3), 0, 0 , TK_TEXT_LINE_GEOMETRY }, {TK_OPTION_CUSTOM, "-startline", NULL, NULL, - NULL, -1, Tk_Offset(TkText, start), TK_OPTION_NULL_OK, + NULL, -1, offsetof(TkText, start), TK_OPTION_NULL_OK, &lineOption, TK_TEXT_LINE_RANGE}, {TK_OPTION_STRING_TABLE, "-state", "state", "State", - DEF_TEXT_STATE, -1, Tk_Offset(TkText, state), + DEF_TEXT_STATE, -1, offsetof(TkText, state), 0, stateStrings, 0}, {TK_OPTION_STRING, "-tabs", "tabs", "Tabs", - DEF_TEXT_TABS, Tk_Offset(TkText, tabOptionPtr), -1, + DEF_TEXT_TABS, offsetof(TkText, tabOptionPtr), -1, TK_OPTION_NULL_OK, 0, TK_TEXT_LINE_GEOMETRY}, {TK_OPTION_STRING_TABLE, "-tabstyle", "tabStyle", "TabStyle", - DEF_TEXT_TABSTYLE, -1, Tk_Offset(TkText, tabStyle), + DEF_TEXT_TABSTYLE, -1, offsetof(TkText, tabStyle), 0, tabStyleStrings, TK_TEXT_LINE_GEOMETRY}, {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", - DEF_TEXT_TAKE_FOCUS, -1, Tk_Offset(TkText, takeFocus), + DEF_TEXT_TAKE_FOCUS, -1, offsetof(TkText, takeFocus), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BOOLEAN, "-undo", "undo", "Undo", - DEF_TEXT_UNDO, -1, Tk_Offset(TkText, undo), + DEF_TEXT_UNDO, -1, offsetof(TkText, undo), TK_OPTION_DONT_SET_DEFAULT, 0 , 0}, {TK_OPTION_INT, "-width", "width", "Width", - DEF_TEXT_WIDTH, -1, Tk_Offset(TkText, width), 0, 0, + DEF_TEXT_WIDTH, -1, offsetof(TkText, width), 0, 0, TK_TEXT_LINE_GEOMETRY}, {TK_OPTION_STRING_TABLE, "-wrap", "wrap", "Wrap", - DEF_TEXT_WRAP, -1, Tk_Offset(TkText, wrapMode), + DEF_TEXT_WRAP, -1, offsetof(TkText, wrapMode), 0, wrapStrings, TK_TEXT_LINE_GEOMETRY}, {TK_OPTION_STRING, "-xscrollcommand", "xScrollCommand", "ScrollCommand", - DEF_TEXT_XSCROLL_COMMAND, -1, Tk_Offset(TkText, xScrollCmd), + DEF_TEXT_XSCROLL_COMMAND, -1, offsetof(TkText, xScrollCmd), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-yscrollcommand", "yScrollCommand", "ScrollCommand", - DEF_TEXT_YSCROLL_COMMAND, -1, Tk_Offset(TkText, yScrollCmd), + DEF_TEXT_YSCROLL_COMMAND, -1, offsetof(TkText, yScrollCmd), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0} }; diff --git a/generic/tkTextBTree.c b/generic/tkTextBTree.c index 66fa140..07c3bbd 100644 --- a/generic/tkTextBTree.c +++ b/generic/tkTextBTree.c @@ -140,9 +140,9 @@ int tkBTreeDebug = 0; * Macros that determine how much space to allocate for new segments: */ -#define CSEG_SIZE(chars) (Tk_Offset(TkTextSegment, body) \ +#define CSEG_SIZE(chars) (offsetof(TkTextSegment, body) \ + 1 + (chars)) -#define TSEG_SIZE (Tk_Offset(TkTextSegment, body) \ +#define TSEG_SIZE (offsetof(TkTextSegment, body) \ + sizeof(TkTextToggle)) /* diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index bd1250f..d4f6b83 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -7757,7 +7757,7 @@ TkTextCharLayoutProc( chunkPtr->breakIndex = -1; #if !TK_LAYOUT_WITH_BASE_CHUNKS - ciPtr = ckalloc(Tk_Offset(CharInfo, chars) + 1 + bytesThatFit); + ciPtr = ckalloc(offsetof(CharInfo, chars) + 1 + bytesThatFit); chunkPtr->clientData = ciPtr; memcpy(ciPtr->chars, p, bytesThatFit); #endif /* TK_LAYOUT_WITH_BASE_CHUNKS */ diff --git a/generic/tkTextImage.c b/generic/tkTextImage.c index defda56..3384a1f 100644 --- a/generic/tkTextImage.c +++ b/generic/tkTextImage.c @@ -18,7 +18,7 @@ */ #define EI_SEG_SIZE \ - (Tk_Offset(TkTextSegment, body) + sizeof(TkTextEmbImage)) + (offsetof(TkTextSegment, body) + sizeof(TkTextEmbImage)) /* * Prototypes for functions defined in this file: @@ -83,17 +83,17 @@ typedef enum { static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_STRING_TABLE, "-align", NULL, NULL, - "center", -1, Tk_Offset(TkTextEmbImage, align), + "center", -1, offsetof(TkTextEmbImage, align), 0, alignStrings, 0}, {TK_OPTION_PIXELS, "-padx", NULL, NULL, - "0", -1, Tk_Offset(TkTextEmbImage, padX), 0, 0, 0}, + "0", -1, offsetof(TkTextEmbImage, padX), 0, 0, 0}, {TK_OPTION_PIXELS, "-pady", NULL, NULL, - "0", -1, Tk_Offset(TkTextEmbImage, padY), 0, 0, 0}, + "0", -1, offsetof(TkTextEmbImage, padY), 0, 0, 0}, {TK_OPTION_STRING, "-image", NULL, NULL, - NULL, -1, Tk_Offset(TkTextEmbImage, imageString), + NULL, -1, offsetof(TkTextEmbImage, imageString), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-name", NULL, NULL, - NULL, -1, Tk_Offset(TkTextEmbImage, imageName), + NULL, -1, offsetof(TkTextEmbImage, imageName), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0} }; diff --git a/generic/tkTextMark.c b/generic/tkTextMark.c index 958b84a..aca08fb 100644 --- a/generic/tkTextMark.c +++ b/generic/tkTextMark.c @@ -19,7 +19,7 @@ * Macro that determines the size of a mark segment: */ -#define MSEG_SIZE (Tk_Offset(TkTextSegment, body) \ +#define MSEG_SIZE (offsetof(TkTextSegment, body) \ + sizeof(TkTextMark)) /* diff --git a/generic/tkTextTag.c b/generic/tkTextTag.c index f1afe36..cb0993b 100644 --- a/generic/tkTextTag.c +++ b/generic/tkTextTag.c @@ -40,66 +40,66 @@ static const char *const tabStyleStrings[] = { static const Tk_OptionSpec tagOptionSpecs[] = { {TK_OPTION_BORDER, "-background", NULL, NULL, - NULL, -1, Tk_Offset(TkTextTag, border), TK_OPTION_NULL_OK, 0, 0}, + NULL, -1, offsetof(TkTextTag, border), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BITMAP, "-bgstipple", NULL, NULL, - NULL, -1, Tk_Offset(TkTextTag, bgStipple), TK_OPTION_NULL_OK, 0, 0}, + NULL, -1, offsetof(TkTextTag, bgStipple), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-borderwidth", NULL, NULL, - NULL, Tk_Offset(TkTextTag, borderWidthPtr), Tk_Offset(TkTextTag, borderWidth), + NULL, offsetof(TkTextTag, borderWidthPtr), offsetof(TkTextTag, borderWidth), TK_OPTION_NULL_OK|TK_OPTION_DONT_SET_DEFAULT, 0, 0}, {TK_OPTION_STRING, "-elide", NULL, NULL, - NULL, -1, Tk_Offset(TkTextTag, elideString), + NULL, -1, offsetof(TkTextTag, elideString), TK_OPTION_NULL_OK|TK_OPTION_DONT_SET_DEFAULT, 0, 0}, {TK_OPTION_BITMAP, "-fgstipple", NULL, NULL, - NULL, -1, Tk_Offset(TkTextTag, fgStipple), TK_OPTION_NULL_OK, 0, 0}, + NULL, -1, offsetof(TkTextTag, fgStipple), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_FONT, "-font", NULL, NULL, - NULL, -1, Tk_Offset(TkTextTag, tkfont), TK_OPTION_NULL_OK, 0, 0}, + NULL, -1, offsetof(TkTextTag, tkfont), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_COLOR, "-foreground", NULL, NULL, - NULL, -1, Tk_Offset(TkTextTag, fgColor), TK_OPTION_NULL_OK, 0, 0}, + NULL, -1, offsetof(TkTextTag, fgColor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-justify", NULL, NULL, - NULL, -1, Tk_Offset(TkTextTag, justifyString), TK_OPTION_NULL_OK, 0,0}, + NULL, -1, offsetof(TkTextTag, justifyString), TK_OPTION_NULL_OK, 0,0}, {TK_OPTION_STRING, "-lmargin1", NULL, NULL, - NULL, -1, Tk_Offset(TkTextTag, lMargin1String), TK_OPTION_NULL_OK,0,0}, + NULL, -1, offsetof(TkTextTag, lMargin1String), TK_OPTION_NULL_OK,0,0}, {TK_OPTION_STRING, "-lmargin2", NULL, NULL, - NULL, -1, Tk_Offset(TkTextTag, lMargin2String), TK_OPTION_NULL_OK,0,0}, + NULL, -1, offsetof(TkTextTag, lMargin2String), TK_OPTION_NULL_OK,0,0}, {TK_OPTION_BORDER, "-lmargincolor", NULL, NULL, - NULL, -1, Tk_Offset(TkTextTag, lMarginColor), TK_OPTION_NULL_OK, 0, 0}, + NULL, -1, offsetof(TkTextTag, lMarginColor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-offset", NULL, NULL, - NULL, -1, Tk_Offset(TkTextTag, offsetString), TK_OPTION_NULL_OK, 0, 0}, + NULL, -1, offsetof(TkTextTag, offsetString), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-overstrike", NULL, NULL, - NULL, -1, Tk_Offset(TkTextTag, overstrikeString), + NULL, -1, offsetof(TkTextTag, overstrikeString), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_COLOR, "-overstrikefg", NULL, NULL, - NULL, -1, Tk_Offset(TkTextTag, overstrikeColor), + NULL, -1, offsetof(TkTextTag, overstrikeColor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-relief", NULL, NULL, - NULL, -1, Tk_Offset(TkTextTag, reliefString), TK_OPTION_NULL_OK, 0, 0}, + NULL, -1, offsetof(TkTextTag, reliefString), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-rmargin", NULL, NULL, - NULL, -1, Tk_Offset(TkTextTag, rMarginString), TK_OPTION_NULL_OK, 0,0}, + NULL, -1, offsetof(TkTextTag, rMarginString), TK_OPTION_NULL_OK, 0,0}, {TK_OPTION_BORDER, "-rmargincolor", NULL, NULL, - NULL, -1, Tk_Offset(TkTextTag, rMarginColor), TK_OPTION_NULL_OK, 0, 0}, + NULL, -1, offsetof(TkTextTag, rMarginColor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BORDER, "-selectbackground", NULL, NULL, - NULL, -1, Tk_Offset(TkTextTag, selBorder), TK_OPTION_NULL_OK, 0, 0}, + NULL, -1, offsetof(TkTextTag, selBorder), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_COLOR, "-selectforeground", NULL, NULL, - NULL, -1, Tk_Offset(TkTextTag, selFgColor), TK_OPTION_NULL_OK, 0, 0}, + NULL, -1, offsetof(TkTextTag, selFgColor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-spacing1", NULL, NULL, - NULL, -1, Tk_Offset(TkTextTag, spacing1String), TK_OPTION_NULL_OK,0,0}, + NULL, -1, offsetof(TkTextTag, spacing1String), TK_OPTION_NULL_OK,0,0}, {TK_OPTION_STRING, "-spacing2", NULL, NULL, - NULL, -1, Tk_Offset(TkTextTag, spacing2String), TK_OPTION_NULL_OK,0,0}, + NULL, -1, offsetof(TkTextTag, spacing2String), TK_OPTION_NULL_OK,0,0}, {TK_OPTION_STRING, "-spacing3", NULL, NULL, - NULL, -1, Tk_Offset(TkTextTag, spacing3String), TK_OPTION_NULL_OK,0,0}, + NULL, -1, offsetof(TkTextTag, spacing3String), TK_OPTION_NULL_OK,0,0}, {TK_OPTION_STRING, "-tabs", NULL, NULL, - NULL, Tk_Offset(TkTextTag, tabStringPtr), -1, TK_OPTION_NULL_OK, 0, 0}, + NULL, offsetof(TkTextTag, tabStringPtr), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING_TABLE, "-tabstyle", NULL, NULL, - NULL, -1, Tk_Offset(TkTextTag, tabStyle), + NULL, -1, offsetof(TkTextTag, tabStyle), TK_OPTION_NULL_OK, tabStyleStrings, 0}, {TK_OPTION_STRING, "-underline", NULL, NULL, - NULL, -1, Tk_Offset(TkTextTag, underlineString), + NULL, -1, offsetof(TkTextTag, underlineString), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_COLOR, "-underlinefg", NULL, NULL, - NULL, -1, Tk_Offset(TkTextTag, underlineColor), + NULL, -1, offsetof(TkTextTag, underlineColor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING_TABLE, "-wrap", NULL, NULL, - NULL, -1, Tk_Offset(TkTextTag, wrapMode), + NULL, -1, offsetof(TkTextTag, wrapMode), TK_OPTION_NULL_OK, wrapStrings, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0} }; diff --git a/generic/tkTextWind.c b/generic/tkTextWind.c index 79ed1a1..191c86c 100644 --- a/generic/tkTextWind.c +++ b/generic/tkTextWind.c @@ -35,7 +35,7 @@ static const Tk_GeomMgr textGeomType = { * Macro that determines the size of an embedded window segment: */ -#define EW_SEG_SIZE (Tk_Offset(TkTextSegment, body) \ +#define EW_SEG_SIZE (offsetof(TkTextSegment, body) \ + sizeof(TkTextEmbWindow)) /* @@ -99,18 +99,18 @@ typedef enum { static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_STRING_TABLE, "-align", NULL, NULL, - "center", -1, Tk_Offset(TkTextEmbWindow, align), + "center", -1, offsetof(TkTextEmbWindow, align), 0, alignStrings, 0}, {TK_OPTION_STRING, "-create", NULL, NULL, - NULL, -1, Tk_Offset(TkTextEmbWindow, create), TK_OPTION_NULL_OK, 0, 0}, + NULL, -1, offsetof(TkTextEmbWindow, create), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-padx", NULL, NULL, - "0", -1, Tk_Offset(TkTextEmbWindow, padX), 0, 0, 0}, + "0", -1, offsetof(TkTextEmbWindow, padX), 0, 0, 0}, {TK_OPTION_PIXELS, "-pady", NULL, NULL, - "0", -1, Tk_Offset(TkTextEmbWindow, padY), 0, 0, 0}, + "0", -1, offsetof(TkTextEmbWindow, padY), 0, 0, 0}, {TK_OPTION_BOOLEAN, "-stretch", NULL, NULL, - "0", -1, Tk_Offset(TkTextEmbWindow, stretch), 0, 0, 0}, + "0", -1, offsetof(TkTextEmbWindow, stretch), 0, 0, 0}, {TK_OPTION_WINDOW, "-window", NULL, NULL, - NULL, -1, Tk_Offset(TkTextEmbWindow, tkwin), TK_OPTION_NULL_OK, 0, 0}, + NULL, -1, offsetof(TkTextEmbWindow, tkwin), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0} }; diff --git a/generic/ttk/ttkButton.c b/generic/ttk/ttkButton.c index 722e034..d05a514 100644 --- a/generic/ttk/ttkButton.c +++ b/generic/ttk/ttkButton.c @@ -57,44 +57,44 @@ typedef struct static Tk_OptionSpec BaseOptionSpecs[] = { {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify", - "left", Tk_Offset(Base,base.justifyObj), -1, + "left", offsetof(Base,base.justifyObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_STRING, "-text", "text", "Text", "", - Tk_Offset(Base,base.textObj), -1, + offsetof(Base,base.textObj), -1, 0,0,GEOMETRY_CHANGED }, {TK_OPTION_STRING, "-textvariable", "textVariable", "Variable", "", - Tk_Offset(Base,base.textVariableObj), -1, + offsetof(Base,base.textVariableObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_INT, "-underline", "underline", "Underline", - "-1", Tk_Offset(Base,base.underlineObj), -1, + "-1", offsetof(Base,base.underlineObj), -1, 0,0,0 }, /* SB: OPTION_INT, see <<NOTE-NULLOPTIONS>> */ {TK_OPTION_STRING, "-width", "width", "Width", - NULL, Tk_Offset(Base,base.widthObj), -1, + NULL, offsetof(Base,base.widthObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, /* * Image options */ {TK_OPTION_STRING, "-image", "image", "Image", NULL/*default*/, - Tk_Offset(Base,base.imageObj), -1, + offsetof(Base,base.imageObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, /* * Compound base/image options */ {TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound", - "none", Tk_Offset(Base,base.compoundObj), -1, + "none", offsetof(Base,base.compoundObj), -1, 0,(ClientData)ttkCompoundStrings,GEOMETRY_CHANGED }, {TK_OPTION_STRING, "-padding", "padding", "Pad", - NULL, Tk_Offset(Base,base.paddingObj), -1, + NULL, offsetof(Base,base.paddingObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED}, /* * Compatibility/legacy options */ {TK_OPTION_STRING, "-state", "state", "State", - "normal", Tk_Offset(Base,base.stateObj), -1, + "normal", offsetof(Base,base.stateObj), -1, 0,0,STATE_CHANGED }, WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) @@ -232,28 +232,28 @@ typedef struct static Tk_OptionSpec LabelOptionSpecs[] = { {TK_OPTION_BORDER, "-background", "frameColor", "FrameColor", - NULL, Tk_Offset(Label,label.backgroundObj), -1, + NULL, offsetof(Label,label.backgroundObj), -1, TK_OPTION_NULL_OK,0,0 }, {TK_OPTION_COLOR, "-foreground", "textColor", "TextColor", - NULL, Tk_Offset(Label,label.foregroundObj), -1, + NULL, offsetof(Label,label.foregroundObj), -1, TK_OPTION_NULL_OK,0,0 }, {TK_OPTION_FONT, "-font", "font", "Font", - NULL, Tk_Offset(Label,label.fontObj), -1, + NULL, offsetof(Label,label.fontObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", - NULL, Tk_Offset(Label,label.borderWidthObj), -1, + NULL, offsetof(Label,label.borderWidthObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", - NULL, Tk_Offset(Label,label.reliefObj), -1, + NULL, offsetof(Label,label.reliefObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", - NULL, Tk_Offset(Label,label.anchorObj), -1, + NULL, offsetof(Label,label.anchorObj), -1, TK_OPTION_NULL_OK, 0, GEOMETRY_CHANGED}, {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify", - NULL, Tk_Offset(Label, label.justifyObj), -1, + NULL, offsetof(Label, label.justifyObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_PIXELS, "-wraplength", "wrapLength", "WrapLength", - NULL, Tk_Offset(Label, label.wrapLengthObj), -1, + NULL, offsetof(Label, label.wrapLengthObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED /*SB: SIZE_CHANGED*/ }, WIDGET_TAKEFOCUS_FALSE, @@ -315,9 +315,9 @@ typedef struct static Tk_OptionSpec ButtonOptionSpecs[] = { {TK_OPTION_STRING, "-command", "command", "Command", - "", Tk_Offset(Button, button.commandObj), -1, 0,0,0}, + "", offsetof(Button, button.commandObj), -1, 0,0,0}, {TK_OPTION_STRING_TABLE, "-default", "default", "Default", - "normal", Tk_Offset(Button, button.defaultStateObj), -1, + "normal", offsetof(Button, button.defaultStateObj), -1, 0, (ClientData) ttkDefaultStrings, DEFAULTSTATE_CHANGED}, WIDGET_TAKEFOCUS_TRUE, @@ -425,16 +425,16 @@ typedef struct static Tk_OptionSpec CheckbuttonOptionSpecs[] = { {TK_OPTION_STRING, "-variable", "variable", "Variable", - NULL, Tk_Offset(Checkbutton, checkbutton.variableObj), -1, + NULL, offsetof(Checkbutton, checkbutton.variableObj), -1, TK_OPTION_NULL_OK,0,0}, {TK_OPTION_STRING, "-onvalue", "onValue", "OnValue", - "1", Tk_Offset(Checkbutton, checkbutton.onValueObj), -1, + "1", offsetof(Checkbutton, checkbutton.onValueObj), -1, 0,0,0}, {TK_OPTION_STRING, "-offvalue", "offValue", "OffValue", - "0", Tk_Offset(Checkbutton, checkbutton.offValueObj), -1, + "0", offsetof(Checkbutton, checkbutton.offValueObj), -1, 0,0,0}, {TK_OPTION_STRING, "-command", "command", "Command", - "", Tk_Offset(Checkbutton, checkbutton.commandObj), -1, + "", offsetof(Checkbutton, checkbutton.commandObj), -1, 0,0,0}, WIDGET_TAKEFOCUS_TRUE, @@ -633,13 +633,13 @@ typedef struct static Tk_OptionSpec RadiobuttonOptionSpecs[] = { {TK_OPTION_STRING, "-variable", "variable", "Variable", - "::selectedButton", Tk_Offset(Radiobutton, radiobutton.variableObj),-1, + "::selectedButton", offsetof(Radiobutton, radiobutton.variableObj),-1, 0,0,0}, {TK_OPTION_STRING, "-value", "Value", "Value", - "1", Tk_Offset(Radiobutton, radiobutton.valueObj), -1, + "1", offsetof(Radiobutton, radiobutton.valueObj), -1, 0,0,0}, {TK_OPTION_STRING, "-command", "command", "Command", - "", Tk_Offset(Radiobutton, radiobutton.commandObj), -1, + "", offsetof(Radiobutton, radiobutton.commandObj), -1, 0,0,0}, WIDGET_TAKEFOCUS_TRUE, @@ -808,9 +808,9 @@ static const char *const directionStrings[] = { static Tk_OptionSpec MenubuttonOptionSpecs[] = { {TK_OPTION_STRING, "-menu", "menu", "Menu", - "", Tk_Offset(Menubutton, menubutton.menuObj), -1, 0,0,0}, + "", offsetof(Menubutton, menubutton.menuObj), -1, 0,0,0}, {TK_OPTION_STRING_TABLE, "-direction", "direction", "Direction", - "below", Tk_Offset(Menubutton, menubutton.directionObj), -1, + "below", offsetof(Menubutton, menubutton.directionObj), -1, 0,(ClientData)directionStrings,GEOMETRY_CHANGED}, WIDGET_TAKEFOCUS_TRUE, diff --git a/generic/ttk/ttkClamTheme.c b/generic/ttk/ttkClamTheme.c index e9bc74a..8657fba 100644 --- a/generic/ttk/ttkClamTheme.c +++ b/generic/ttk/ttkClamTheme.c @@ -108,15 +108,15 @@ typedef struct { static Ttk_ElementOptionSpec BorderElementOptions[] = { { "-bordercolor", TK_OPTION_COLOR, - Tk_Offset(BorderElement,borderColorObj), DARKEST_COLOR }, + offsetof(BorderElement,borderColorObj), DARKEST_COLOR }, { "-lightcolor", TK_OPTION_COLOR, - Tk_Offset(BorderElement,lightColorObj), LIGHT_COLOR }, + offsetof(BorderElement,lightColorObj), LIGHT_COLOR }, { "-darkcolor", TK_OPTION_COLOR, - Tk_Offset(BorderElement,darkColorObj), DARK_COLOR }, + offsetof(BorderElement,darkColorObj), DARK_COLOR }, { "-relief", TK_OPTION_RELIEF, - Tk_Offset(BorderElement,reliefObj), "flat" }, + offsetof(BorderElement,reliefObj), "flat" }, { "-borderwidth", TK_OPTION_PIXELS, - Tk_Offset(BorderElement,borderWidthObj), "2" }, + offsetof(BorderElement,borderWidthObj), "2" }, { NULL, 0, 0, NULL } }; @@ -198,13 +198,13 @@ typedef struct { static Ttk_ElementOptionSpec FieldElementOptions[] = { { "-bordercolor", TK_OPTION_COLOR, - Tk_Offset(FieldElement,borderColorObj), DARKEST_COLOR }, + offsetof(FieldElement,borderColorObj), DARKEST_COLOR }, { "-lightcolor", TK_OPTION_COLOR, - Tk_Offset(FieldElement,lightColorObj), LIGHT_COLOR }, + offsetof(FieldElement,lightColorObj), LIGHT_COLOR }, { "-darkcolor", TK_OPTION_COLOR, - Tk_Offset(FieldElement,darkColorObj), DARK_COLOR }, + offsetof(FieldElement,darkColorObj), DARK_COLOR }, { "-fieldbackground", TK_OPTION_BORDER, - Tk_Offset(FieldElement,backgroundObj), "white" }, + offsetof(FieldElement,backgroundObj), "white" }, { NULL, 0, 0, NULL } }; @@ -280,17 +280,17 @@ typedef struct { static Ttk_ElementOptionSpec IndicatorElementOptions[] = { { "-indicatorsize", TK_OPTION_PIXELS, - Tk_Offset(IndicatorElement,sizeObj), "10" }, + offsetof(IndicatorElement,sizeObj), "10" }, { "-indicatormargin", TK_OPTION_STRING, - Tk_Offset(IndicatorElement,marginObj), "1" }, + offsetof(IndicatorElement,marginObj), "1" }, { "-indicatorbackground", TK_OPTION_COLOR, - Tk_Offset(IndicatorElement,backgroundObj), "white" }, + offsetof(IndicatorElement,backgroundObj), "white" }, { "-indicatorforeground", TK_OPTION_COLOR, - Tk_Offset(IndicatorElement,foregroundObj), "black" }, + offsetof(IndicatorElement,foregroundObj), "black" }, { "-upperbordercolor", TK_OPTION_COLOR, - Tk_Offset(IndicatorElement,upperColorObj), DARKEST_COLOR }, + offsetof(IndicatorElement,upperColorObj), DARKEST_COLOR }, { "-lowerbordercolor", TK_OPTION_COLOR, - Tk_Offset(IndicatorElement,lowerColorObj), DARK_COLOR }, + offsetof(IndicatorElement,lowerColorObj), DARK_COLOR }, { NULL, 0, 0, NULL } }; @@ -402,13 +402,13 @@ typedef struct { static Ttk_ElementOptionSpec MenuIndicatorElementOptions[] = { { "-arrowsize", TK_OPTION_PIXELS, - Tk_Offset(MenuIndicatorElement,sizeObj), + offsetof(MenuIndicatorElement,sizeObj), STR(MENUBUTTON_ARROW_SIZE)}, { "-arrowcolor",TK_OPTION_COLOR, - Tk_Offset(MenuIndicatorElement,colorObj), + offsetof(MenuIndicatorElement,colorObj), "black" }, { "-arrowpadding",TK_OPTION_STRING, - Tk_Offset(MenuIndicatorElement,paddingObj), + offsetof(MenuIndicatorElement,paddingObj), "3" }, { NULL, 0, 0, NULL } }; @@ -471,11 +471,11 @@ typedef struct { static Ttk_ElementOptionSpec GripElementOptions[] = { { "-lightcolor", TK_OPTION_COLOR, - Tk_Offset(GripElement,lightColorObj), LIGHT_COLOR }, + offsetof(GripElement,lightColorObj), LIGHT_COLOR }, { "-bordercolor", TK_OPTION_COLOR, - Tk_Offset(GripElement,borderColorObj), DARKEST_COLOR }, + offsetof(GripElement,borderColorObj), DARKEST_COLOR }, { "-gripcount", TK_OPTION_INT, - Tk_Offset(GripElement,gripCountObj), "5" }, + offsetof(GripElement,gripCountObj), "5" }, { NULL, 0, 0, NULL } }; @@ -556,25 +556,25 @@ typedef struct { /* Common element record for scrollbar elements */ static Ttk_ElementOptionSpec ScrollbarElementOptions[] = { { "-orient", TK_OPTION_ANY, - Tk_Offset(ScrollbarElement, orientObj), "horizontal" }, + offsetof(ScrollbarElement, orientObj), "horizontal" }, { "-background", TK_OPTION_BORDER, - Tk_Offset(ScrollbarElement,backgroundObj), FRAME_COLOR }, + offsetof(ScrollbarElement,backgroundObj), FRAME_COLOR }, { "-bordercolor", TK_OPTION_COLOR, - Tk_Offset(ScrollbarElement,borderColorObj), DARKEST_COLOR }, + offsetof(ScrollbarElement,borderColorObj), DARKEST_COLOR }, { "-troughcolor", TK_OPTION_COLOR, - Tk_Offset(ScrollbarElement,troughColorObj), DARKER_COLOR }, + offsetof(ScrollbarElement,troughColorObj), DARKER_COLOR }, { "-lightcolor", TK_OPTION_COLOR, - Tk_Offset(ScrollbarElement,lightColorObj), LIGHT_COLOR }, + offsetof(ScrollbarElement,lightColorObj), LIGHT_COLOR }, { "-darkcolor", TK_OPTION_COLOR, - Tk_Offset(ScrollbarElement,darkColorObj), DARK_COLOR }, + offsetof(ScrollbarElement,darkColorObj), DARK_COLOR }, { "-arrowcolor", TK_OPTION_COLOR, - Tk_Offset(ScrollbarElement,arrowColorObj), "#000000" }, + offsetof(ScrollbarElement,arrowColorObj), "#000000" }, { "-arrowsize", TK_OPTION_PIXELS, - Tk_Offset(ScrollbarElement,arrowSizeObj), STR(SCROLLBAR_THICKNESS) }, + offsetof(ScrollbarElement,arrowSizeObj), STR(SCROLLBAR_THICKNESS) }, { "-gripcount", TK_OPTION_INT, - Tk_Offset(ScrollbarElement,gripCountObj), "5" }, + offsetof(ScrollbarElement,gripCountObj), "5" }, { "-sliderlength", TK_OPTION_INT, - Tk_Offset(ScrollbarElement,sliderlengthObj), "30" }, + offsetof(ScrollbarElement,sliderlengthObj), "30" }, { NULL, 0, 0, NULL } }; @@ -794,13 +794,13 @@ typedef struct { static Ttk_ElementOptionSpec NotebookElementOptions[] = { { "-background", TK_OPTION_BORDER, - Tk_Offset(NotebookElement,backgroundObj), FRAME_COLOR }, + offsetof(NotebookElement,backgroundObj), FRAME_COLOR }, { "-bordercolor", TK_OPTION_COLOR, - Tk_Offset(NotebookElement,borderColorObj), DARKEST_COLOR }, + offsetof(NotebookElement,borderColorObj), DARKEST_COLOR }, { "-lightcolor", TK_OPTION_COLOR, - Tk_Offset(NotebookElement,lightColorObj), LIGHT_COLOR }, + offsetof(NotebookElement,lightColorObj), LIGHT_COLOR }, { "-darkcolor", TK_OPTION_COLOR, - Tk_Offset(NotebookElement,darkColorObj), DARK_COLOR }, + offsetof(NotebookElement,darkColorObj), DARK_COLOR }, { NULL, 0, 0, NULL } }; diff --git a/generic/ttk/ttkClassicTheme.c b/generic/ttk/ttkClassicTheme.c index 48e856e..b22e5d5 100644 --- a/generic/ttk/ttkClassicTheme.c +++ b/generic/ttk/ttkClassicTheme.c @@ -23,9 +23,9 @@ typedef struct { static Ttk_ElementOptionSpec HighlightElementOptions[] = { { "-highlightcolor",TK_OPTION_COLOR, - Tk_Offset(HighlightElement,highlightColorObj), DEFAULT_BACKGROUND }, + offsetof(HighlightElement,highlightColorObj), DEFAULT_BACKGROUND }, { "-highlightthickness",TK_OPTION_PIXELS, - Tk_Offset(HighlightElement,highlightThicknessObj), "0" }, + offsetof(HighlightElement,highlightThicknessObj), "0" }, { NULL, 0, 0, NULL } }; @@ -84,13 +84,13 @@ typedef struct { static Ttk_ElementOptionSpec ButtonBorderElementOptions[] = { { "-background", TK_OPTION_BORDER, - Tk_Offset(ButtonBorderElement,borderObj), DEFAULT_BACKGROUND }, + offsetof(ButtonBorderElement,borderObj), DEFAULT_BACKGROUND }, { "-borderwidth", TK_OPTION_PIXELS, - Tk_Offset(ButtonBorderElement,borderWidthObj), DEFAULT_BORDERWIDTH }, + offsetof(ButtonBorderElement,borderWidthObj), DEFAULT_BORDERWIDTH }, { "-relief", TK_OPTION_RELIEF, - Tk_Offset(ButtonBorderElement,reliefObj), "flat" }, + offsetof(ButtonBorderElement,reliefObj), "flat" }, { "-default", TK_OPTION_ANY, - Tk_Offset(ButtonBorderElement,defaultStateObj), "disabled" }, + offsetof(ButtonBorderElement,defaultStateObj), "disabled" }, { NULL, 0, 0, NULL } }; @@ -197,13 +197,13 @@ typedef struct static Ttk_ElementOptionSpec ArrowElementOptions[] = { - { "-arrowsize", TK_OPTION_PIXELS, Tk_Offset(ArrowElement,sizeObj), + { "-arrowsize", TK_OPTION_PIXELS, offsetof(ArrowElement,sizeObj), DEFAULT_ARROW_SIZE }, - { "-background", TK_OPTION_BORDER, Tk_Offset(ArrowElement,borderObj), + { "-background", TK_OPTION_BORDER, offsetof(ArrowElement,borderObj), DEFAULT_BACKGROUND }, - { "-borderwidth", TK_OPTION_PIXELS, Tk_Offset(ArrowElement,borderWidthObj), + { "-borderwidth", TK_OPTION_PIXELS, offsetof(ArrowElement,borderWidthObj), DEFAULT_BORDERWIDTH }, - { "-relief", TK_OPTION_RELIEF, Tk_Offset(ArrowElement,reliefObj),"raised" }, + { "-relief", TK_OPTION_RELIEF, offsetof(ArrowElement,reliefObj),"raised" }, { NULL, 0, 0, NULL } }; @@ -305,17 +305,17 @@ typedef struct { static Ttk_ElementOptionSpec SashOptions[] = { { "-background", TK_OPTION_BORDER, - Tk_Offset(SashElement,borderObj), DEFAULT_BACKGROUND }, + offsetof(SashElement,borderObj), DEFAULT_BACKGROUND }, { "-sashrelief", TK_OPTION_RELIEF, - Tk_Offset(SashElement,sashReliefObj), "sunken" }, + offsetof(SashElement,sashReliefObj), "sunken" }, { "-sashthickness", TK_OPTION_PIXELS, - Tk_Offset(SashElement,sashThicknessObj), "6" }, + offsetof(SashElement,sashThicknessObj), "6" }, { "-sashpad", TK_OPTION_PIXELS, - Tk_Offset(SashElement,sashPadObj), "2" }, + offsetof(SashElement,sashPadObj), "2" }, { "-handlesize", TK_OPTION_PIXELS, - Tk_Offset(SashElement,handleSizeObj), "8" }, + offsetof(SashElement,handleSizeObj), "8" }, { "-handlepad", TK_OPTION_PIXELS, - Tk_Offset(SashElement,handlePadObj), "8" }, + offsetof(SashElement,handlePadObj), "8" }, { NULL, 0, 0, NULL } }; diff --git a/generic/ttk/ttkDefaultTheme.c b/generic/ttk/ttkDefaultTheme.c index e4bfeca..002448b 100644 --- a/generic/ttk/ttkDefaultTheme.c +++ b/generic/ttk/ttkDefaultTheme.c @@ -245,15 +245,15 @@ typedef struct { } BorderElement; static Ttk_ElementOptionSpec BorderElementOptions[] = { - { "-background", TK_OPTION_BORDER, Tk_Offset(BorderElement,borderObj), + { "-background", TK_OPTION_BORDER, offsetof(BorderElement,borderObj), DEFAULT_BACKGROUND }, { "-bordercolor",TK_OPTION_COLOR, - Tk_Offset(BorderElement,borderColorObj), "black" }, - { "-default", TK_OPTION_ANY, Tk_Offset(BorderElement,defaultStateObj), + offsetof(BorderElement,borderColorObj), "black" }, + { "-default", TK_OPTION_ANY, offsetof(BorderElement,defaultStateObj), "disabled" }, - { "-borderwidth",TK_OPTION_PIXELS,Tk_Offset(BorderElement,borderWidthObj), + { "-borderwidth",TK_OPTION_PIXELS, offsetof(BorderElement,borderWidthObj), STRINGIFY(BORDERWIDTH) }, - { "-relief", TK_OPTION_RELIEF, Tk_Offset(BorderElement,reliefObj), + { "-relief", TK_OPTION_RELIEF, offsetof(BorderElement,reliefObj), "flat" }, { NULL, 0, 0, NULL } }; @@ -325,9 +325,9 @@ typedef struct { } FieldElement; static Ttk_ElementOptionSpec FieldElementOptions[] = { - { "-fieldbackground", TK_OPTION_BORDER, Tk_Offset(FieldElement,borderObj), + { "-fieldbackground", TK_OPTION_BORDER, offsetof(FieldElement,borderObj), "white" }, - { "-bordercolor",TK_OPTION_COLOR, Tk_Offset(FieldElement,borderColorObj), + { "-bordercolor",TK_OPTION_COLOR, offsetof(FieldElement,borderColorObj), "black" }, { NULL, 0, 0, NULL } }; @@ -467,19 +467,19 @@ typedef struct { static Ttk_ElementOptionSpec IndicatorElementOptions[] = { { "-background", TK_OPTION_COLOR, - Tk_Offset(IndicatorElement,backgroundObj), DEFAULT_BACKGROUND }, + offsetof(IndicatorElement,backgroundObj), DEFAULT_BACKGROUND }, { "-foreground", TK_OPTION_COLOR, - Tk_Offset(IndicatorElement,foregroundObj), DEFAULT_FOREGROUND }, + offsetof(IndicatorElement,foregroundObj), DEFAULT_FOREGROUND }, { "-indicatorcolor", TK_OPTION_COLOR, - Tk_Offset(IndicatorElement,colorObj), "#FFFFFF" }, + offsetof(IndicatorElement,colorObj), "#FFFFFF" }, { "-lightcolor", TK_OPTION_COLOR, - Tk_Offset(IndicatorElement,lightColorObj), "#DDDDDD" }, + offsetof(IndicatorElement,lightColorObj), "#DDDDDD" }, { "-shadecolor", TK_OPTION_COLOR, - Tk_Offset(IndicatorElement,shadeColorObj), "#888888" }, + offsetof(IndicatorElement,shadeColorObj), "#888888" }, { "-bordercolor", TK_OPTION_COLOR, - Tk_Offset(IndicatorElement,borderColorObj), "black" }, + offsetof(IndicatorElement,borderColorObj), "black" }, { "-indicatormargin", TK_OPTION_STRING, - Tk_Offset(IndicatorElement,marginObj), "0 2 4 2" }, + offsetof(IndicatorElement,marginObj), "0 2 4 2" }, { NULL, 0, 0, NULL } }; @@ -654,15 +654,15 @@ typedef struct { static Ttk_ElementOptionSpec ArrowElementOptions[] = { { "-arrowsize", TK_OPTION_PIXELS, - Tk_Offset(ArrowElement,sizeObj), STRINGIFY(SCROLLBAR_WIDTH) }, + offsetof(ArrowElement,sizeObj), STRINGIFY(SCROLLBAR_WIDTH) }, { "-background", TK_OPTION_BORDER, - Tk_Offset(ArrowElement,borderObj), DEFAULT_BACKGROUND }, + offsetof(ArrowElement,borderObj), DEFAULT_BACKGROUND }, { "-bordercolor", TK_OPTION_COLOR, - Tk_Offset(ArrowElement,borderColorObj), "black" }, + offsetof(ArrowElement,borderColorObj), "black" }, { "-relief", TK_OPTION_RELIEF, - Tk_Offset(ArrowElement,reliefObj),"raised"}, + offsetof(ArrowElement,reliefObj),"raised"}, { "-arrowcolor", TK_OPTION_COLOR, - Tk_Offset(ArrowElement,colorObj),"black"}, + offsetof(ArrowElement,colorObj),"black"}, { NULL, 0, 0, NULL } }; @@ -738,11 +738,11 @@ enum { POST_ABOVE, POST_BELOW, POST_LEFT, POST_RIGHT, POST_FLUSH }; static Ttk_ElementOptionSpec MenubuttonArrowElementOptions[] = { { "-direction", TK_OPTION_STRING, - Tk_Offset(MenubuttonArrowElement,directionObj), "below" }, + offsetof(MenubuttonArrowElement,directionObj), "below" }, { "-arrowsize", TK_OPTION_PIXELS, - Tk_Offset(MenubuttonArrowElement,sizeObj), STRINGIFY(MENUBUTTON_ARROW_SIZE)}, + offsetof(MenubuttonArrowElement,sizeObj), STRINGIFY(MENUBUTTON_ARROW_SIZE)}, { "-arrowcolor",TK_OPTION_COLOR, - Tk_Offset(MenubuttonArrowElement,colorObj), "black"}, + offsetof(MenubuttonArrowElement,colorObj), "black"}, { NULL, 0, 0, NULL } }; @@ -822,15 +822,15 @@ typedef struct { static Ttk_ElementOptionSpec TroughElementOptions[] = { { "-orient", TK_OPTION_ANY, - Tk_Offset(TroughElement, orientObj), "horizontal" }, + offsetof(TroughElement, orientObj), "horizontal" }, { "-troughborderwidth", TK_OPTION_PIXELS, - Tk_Offset(TroughElement,borderWidthObj), "1" }, + offsetof(TroughElement,borderWidthObj), "1" }, { "-troughcolor", TK_OPTION_BORDER, - Tk_Offset(TroughElement,colorObj), DEFAULT_BACKGROUND }, + offsetof(TroughElement,colorObj), DEFAULT_BACKGROUND }, { "-troughrelief",TK_OPTION_RELIEF, - Tk_Offset(TroughElement,reliefObj), "sunken" }, + offsetof(TroughElement,reliefObj), "sunken" }, { "-groovewidth", TK_OPTION_PIXELS, - Tk_Offset(TroughElement,grooveWidthObj), "-1" }, + offsetof(TroughElement,grooveWidthObj), "-1" }, { NULL, 0, 0, NULL } }; @@ -901,14 +901,14 @@ typedef struct { } ThumbElement; static Ttk_ElementOptionSpec ThumbElementOptions[] = { - { "-width", TK_OPTION_PIXELS, Tk_Offset(ThumbElement,sizeObj), + { "-width", TK_OPTION_PIXELS, offsetof(ThumbElement,sizeObj), STRINGIFY(SCROLLBAR_WIDTH) }, - { "-background", TK_OPTION_BORDER, Tk_Offset(ThumbElement,borderObj), + { "-background", TK_OPTION_BORDER, offsetof(ThumbElement,borderObj), DEFAULT_BACKGROUND }, - { "-bordercolor", TK_OPTION_COLOR, Tk_Offset(ThumbElement,borderColorObj), + { "-bordercolor", TK_OPTION_COLOR, offsetof(ThumbElement,borderColorObj), "black" }, - { "-relief", TK_OPTION_RELIEF,Tk_Offset(ThumbElement,reliefObj),"raised" }, - { "-orient", TK_OPTION_ANY,Tk_Offset(ThumbElement,orientObj),"horizontal"}, + { "-relief", TK_OPTION_RELIEF, offsetof(ThumbElement,reliefObj),"raised" }, + { "-orient", TK_OPTION_ANY, offsetof(ThumbElement,orientObj),"horizontal"}, { NULL, 0, 0, NULL } }; @@ -984,19 +984,19 @@ typedef struct { } SliderElement; static Ttk_ElementOptionSpec SliderElementOptions[] = { - { "-sliderlength", TK_OPTION_PIXELS, Tk_Offset(SliderElement,lengthObj), + { "-sliderlength", TK_OPTION_PIXELS, offsetof(SliderElement,lengthObj), "15" }, - { "-sliderthickness",TK_OPTION_PIXELS,Tk_Offset(SliderElement,thicknessObj), + { "-sliderthickness",TK_OPTION_PIXELS, offsetof(SliderElement,thicknessObj), "15" }, - { "-sliderrelief", TK_OPTION_RELIEF, Tk_Offset(SliderElement,reliefObj), + { "-sliderrelief", TK_OPTION_RELIEF, offsetof(SliderElement,reliefObj), "raised" }, - { "-borderwidth", TK_OPTION_PIXELS, Tk_Offset(SliderElement,borderWidthObj), + { "-borderwidth", TK_OPTION_PIXELS, offsetof(SliderElement,borderWidthObj), STRINGIFY(BORDERWIDTH) }, - { "-background", TK_OPTION_BORDER, Tk_Offset(SliderElement,borderObj), + { "-background", TK_OPTION_BORDER, offsetof(SliderElement,borderObj), DEFAULT_BACKGROUND }, - { "-bordercolor", TK_OPTION_COLOR, Tk_Offset(ThumbElement,borderColorObj), + { "-bordercolor", TK_OPTION_COLOR, offsetof(ThumbElement,borderColorObj), "black" }, - { "-orient", TK_OPTION_ANY, Tk_Offset(SliderElement,orientObj), + { "-orient", TK_OPTION_ANY, offsetof(SliderElement,orientObj), "horizontal" }, { NULL, 0, 0, NULL } }; @@ -1067,11 +1067,11 @@ typedef struct { static Ttk_ElementOptionSpec TreeitemIndicatorOptions[] = { { "-foreground", TK_OPTION_COLOR, - Tk_Offset(TreeitemIndicator,colorObj), DEFAULT_FOREGROUND }, + offsetof(TreeitemIndicator,colorObj), DEFAULT_FOREGROUND }, { "-diameter", TK_OPTION_PIXELS, - Tk_Offset(TreeitemIndicator,diameterObj), "9" }, + offsetof(TreeitemIndicator,diameterObj), "9" }, { "-indicatormargins", TK_OPTION_STRING, - Tk_Offset(TreeitemIndicator,marginObj), "2 2 4 2" }, + offsetof(TreeitemIndicator,marginObj), "2 2 4 2" }, { NULL, 0, 0, NULL } }; diff --git a/generic/ttk/ttkElements.c b/generic/ttk/ttkElements.c index 4dd2adb..b6bc1fd 100644 --- a/generic/ttk/ttkElements.c +++ b/generic/ttk/ttkElements.c @@ -58,7 +58,7 @@ typedef struct { static Ttk_ElementOptionSpec BackgroundElementOptions[] = { { "-background", TK_OPTION_BORDER, - Tk_Offset(BackgroundElement,backgroundObj), DEFAULT_BACKGROUND }, + offsetof(BackgroundElement,backgroundObj), DEFAULT_BACKGROUND }, { NULL, 0, 0, NULL } }; @@ -111,11 +111,11 @@ typedef struct { static Ttk_ElementOptionSpec BorderElementOptions[] = { { "-background", TK_OPTION_BORDER, - Tk_Offset(BorderElement,borderObj), DEFAULT_BACKGROUND }, + offsetof(BorderElement,borderObj), DEFAULT_BACKGROUND }, { "-borderwidth", TK_OPTION_PIXELS, - Tk_Offset(BorderElement,borderWidthObj), DEFAULT_BORDERWIDTH }, + offsetof(BorderElement,borderWidthObj), DEFAULT_BORDERWIDTH }, { "-relief", TK_OPTION_RELIEF, - Tk_Offset(BorderElement,reliefObj), "flat" }, + offsetof(BorderElement,reliefObj), "flat" }, { NULL, 0, 0, NULL } }; @@ -166,9 +166,9 @@ typedef struct { static Ttk_ElementOptionSpec FieldElementOptions[] = { { "-fieldbackground", TK_OPTION_BORDER, - Tk_Offset(FieldElement,borderObj), "white" }, + offsetof(FieldElement,borderObj), "white" }, { "-borderwidth", TK_OPTION_PIXELS, - Tk_Offset(FieldElement,borderWidthObj), "2" }, + offsetof(FieldElement,borderWidthObj), "2" }, { NULL, 0, 0, NULL } }; @@ -222,11 +222,11 @@ typedef struct { static Ttk_ElementOptionSpec PaddingElementOptions[] = { { "-padding", TK_OPTION_STRING, - Tk_Offset(PaddingElement,paddingObj), "0" }, + offsetof(PaddingElement,paddingObj), "0" }, { "-relief", TK_OPTION_RELIEF, - Tk_Offset(PaddingElement,reliefObj), "flat" }, + offsetof(PaddingElement,reliefObj), "flat" }, { "-shiftrelief", TK_OPTION_INT, - Tk_Offset(PaddingElement,shiftreliefObj), "0" }, + offsetof(PaddingElement,shiftreliefObj), "0" }, { NULL, 0, 0, NULL } }; @@ -288,9 +288,9 @@ static void DrawFocusRing( static Ttk_ElementOptionSpec FocusElementOptions[] = { { "-focuscolor",TK_OPTION_COLOR, - Tk_Offset(FocusElement,focusColorObj), "black" }, + offsetof(FocusElement,focusColorObj), "black" }, { "-focusthickness",TK_OPTION_PIXELS, - Tk_Offset(FocusElement,focusThicknessObj), "1" }, + offsetof(FocusElement,focusThicknessObj), "1" }, { NULL, 0, 0, NULL } }; @@ -340,9 +340,9 @@ typedef struct { static Ttk_ElementOptionSpec SeparatorElementOptions[] = { { "-orient", TK_OPTION_ANY, - Tk_Offset(SeparatorElement, orientObj), "horizontal" }, + offsetof(SeparatorElement, orientObj), "horizontal" }, { "-background", TK_OPTION_BORDER, - Tk_Offset(SeparatorElement,borderObj), DEFAULT_BACKGROUND }, + offsetof(SeparatorElement,borderObj), DEFAULT_BACKGROUND }, { NULL, 0, 0, NULL } }; @@ -432,7 +432,7 @@ typedef struct { static Ttk_ElementOptionSpec SizegripOptions[] = { { "-background", TK_OPTION_BORDER, - Tk_Offset(SizegripElement,backgroundObj), DEFAULT_BACKGROUND }, + offsetof(SizegripElement,backgroundObj), DEFAULT_BACKGROUND }, {0,0,0,0} }; @@ -493,17 +493,17 @@ typedef struct { static Ttk_ElementOptionSpec IndicatorElementOptions[] = { { "-background", TK_OPTION_BORDER, - Tk_Offset(IndicatorElement,backgroundObj), DEFAULT_BACKGROUND }, + offsetof(IndicatorElement,backgroundObj), DEFAULT_BACKGROUND }, { "-indicatorcolor", TK_OPTION_BORDER, - Tk_Offset(IndicatorElement,colorObj), DEFAULT_BACKGROUND }, + offsetof(IndicatorElement,colorObj), DEFAULT_BACKGROUND }, { "-indicatorrelief", TK_OPTION_RELIEF, - Tk_Offset(IndicatorElement,reliefObj), "raised" }, + offsetof(IndicatorElement,reliefObj), "raised" }, { "-indicatordiameter", TK_OPTION_PIXELS, - Tk_Offset(IndicatorElement,diameterObj), "12" }, + offsetof(IndicatorElement,diameterObj), "12" }, { "-indicatormargin", TK_OPTION_STRING, - Tk_Offset(IndicatorElement,marginObj), "0 2 4 2" }, + offsetof(IndicatorElement,marginObj), "0 2 4 2" }, { "-borderwidth", TK_OPTION_PIXELS, - Tk_Offset(IndicatorElement,borderWidthObj), DEFAULT_BORDERWIDTH }, + offsetof(IndicatorElement,borderWidthObj), DEFAULT_BORDERWIDTH }, { NULL, 0, 0, NULL } }; @@ -639,17 +639,17 @@ typedef struct { static Ttk_ElementOptionSpec MenuIndicatorElementOptions[] = { { "-background", TK_OPTION_BORDER, - Tk_Offset(MenuIndicatorElement,backgroundObj), DEFAULT_BACKGROUND }, + offsetof(MenuIndicatorElement,backgroundObj), DEFAULT_BACKGROUND }, { "-indicatorwidth", TK_OPTION_PIXELS, - Tk_Offset(MenuIndicatorElement,widthObj), "4.0m" }, + offsetof(MenuIndicatorElement,widthObj), "4.0m" }, { "-indicatorheight", TK_OPTION_PIXELS, - Tk_Offset(MenuIndicatorElement,heightObj), "1.7m" }, + offsetof(MenuIndicatorElement,heightObj), "1.7m" }, { "-borderwidth", TK_OPTION_PIXELS, - Tk_Offset(MenuIndicatorElement,borderWidthObj), DEFAULT_BORDERWIDTH }, + offsetof(MenuIndicatorElement,borderWidthObj), DEFAULT_BORDERWIDTH }, { "-indicatorrelief", TK_OPTION_RELIEF, - Tk_Offset(MenuIndicatorElement,reliefObj),"raised" }, + offsetof(MenuIndicatorElement,reliefObj),"raised" }, { "-indicatormargin", TK_OPTION_STRING, - Tk_Offset(MenuIndicatorElement,marginObj), "5 0" }, + offsetof(MenuIndicatorElement,marginObj), "5 0" }, { NULL, 0, 0, NULL } }; @@ -708,15 +708,15 @@ typedef struct { static Ttk_ElementOptionSpec ArrowElementOptions[] = { { "-background", TK_OPTION_BORDER, - Tk_Offset(ArrowElement,borderObj), DEFAULT_BACKGROUND }, + offsetof(ArrowElement,borderObj), DEFAULT_BACKGROUND }, { "-relief",TK_OPTION_RELIEF, - Tk_Offset(ArrowElement,reliefObj),"raised"}, + offsetof(ArrowElement,reliefObj),"raised"}, { "-borderwidth", TK_OPTION_PIXELS, - Tk_Offset(ArrowElement,borderWidthObj), "1" }, + offsetof(ArrowElement,borderWidthObj), "1" }, { "-arrowcolor",TK_OPTION_COLOR, - Tk_Offset(ArrowElement,colorObj),"black"}, + offsetof(ArrowElement,colorObj),"black"}, { "-arrowsize", TK_OPTION_PIXELS, - Tk_Offset(ArrowElement,sizeObj), "14" }, + offsetof(ArrowElement,sizeObj), "14" }, { NULL, 0, 0, NULL } }; @@ -779,11 +779,11 @@ typedef struct { static Ttk_ElementOptionSpec TroughElementOptions[] = { { "-borderwidth", TK_OPTION_PIXELS, - Tk_Offset(TroughElement,borderWidthObj), DEFAULT_BORDERWIDTH }, + offsetof(TroughElement,borderWidthObj), DEFAULT_BORDERWIDTH }, { "-troughcolor", TK_OPTION_BORDER, - Tk_Offset(TroughElement,colorObj), DEFAULT_BACKGROUND }, + offsetof(TroughElement,colorObj), DEFAULT_BACKGROUND }, { "-troughrelief",TK_OPTION_RELIEF, - Tk_Offset(TroughElement,reliefObj), "sunken" }, + offsetof(TroughElement,reliefObj), "sunken" }, { NULL, 0, 0, NULL } }; @@ -839,15 +839,15 @@ typedef struct { static Ttk_ElementOptionSpec ThumbElementOptions[] = { { "-orient", TK_OPTION_ANY, - Tk_Offset(ThumbElement, orientObj), "horizontal" }, + offsetof(ThumbElement, orientObj), "horizontal" }, { "-width", TK_OPTION_PIXELS, - Tk_Offset(ThumbElement,thicknessObj), DEFAULT_ARROW_SIZE }, + offsetof(ThumbElement,thicknessObj), DEFAULT_ARROW_SIZE }, { "-relief", TK_OPTION_RELIEF, - Tk_Offset(ThumbElement,reliefObj), "raised" }, + offsetof(ThumbElement,reliefObj), "raised" }, { "-background", TK_OPTION_BORDER, - Tk_Offset(ThumbElement,borderObj), DEFAULT_BACKGROUND }, + offsetof(ThumbElement,borderObj), DEFAULT_BACKGROUND }, { "-borderwidth", TK_OPTION_PIXELS, - Tk_Offset(ThumbElement,borderWidthObj), DEFAULT_BORDERWIDTH }, + offsetof(ThumbElement,borderWidthObj), DEFAULT_BORDERWIDTH }, { NULL, 0, 0, NULL } }; @@ -909,17 +909,17 @@ typedef struct { } SliderElement; static Ttk_ElementOptionSpec SliderElementOptions[] = { - { "-sliderlength", TK_OPTION_PIXELS, Tk_Offset(SliderElement,lengthObj), + { "-sliderlength", TK_OPTION_PIXELS, offsetof(SliderElement,lengthObj), "30" }, - { "-sliderthickness",TK_OPTION_PIXELS,Tk_Offset(SliderElement,thicknessObj), + { "-sliderthickness",TK_OPTION_PIXELS, offsetof(SliderElement,thicknessObj), "15" }, - { "-sliderrelief", TK_OPTION_RELIEF, Tk_Offset(SliderElement,reliefObj), + { "-sliderrelief", TK_OPTION_RELIEF, offsetof(SliderElement,reliefObj), "raised" }, - { "-borderwidth", TK_OPTION_PIXELS, Tk_Offset(SliderElement,borderWidthObj), + { "-borderwidth", TK_OPTION_PIXELS, offsetof(SliderElement,borderWidthObj), DEFAULT_BORDERWIDTH }, - { "-background", TK_OPTION_BORDER, Tk_Offset(SliderElement,borderObj), + { "-background", TK_OPTION_BORDER, offsetof(SliderElement,borderObj), DEFAULT_BACKGROUND }, - { "-orient", TK_OPTION_ANY, Tk_Offset(SliderElement,orientObj), + { "-orient", TK_OPTION_ANY, offsetof(SliderElement,orientObj), "horizontal" }, { NULL, 0, 0, NULL } }; @@ -1020,17 +1020,17 @@ typedef struct { } PbarElement; static Ttk_ElementOptionSpec PbarElementOptions[] = { - { "-orient", TK_OPTION_ANY, Tk_Offset(PbarElement,orientObj), + { "-orient", TK_OPTION_ANY, offsetof(PbarElement,orientObj), "horizontal" }, - { "-thickness", TK_OPTION_PIXELS, Tk_Offset(PbarElement,thicknessObj), + { "-thickness", TK_OPTION_PIXELS, offsetof(PbarElement,thicknessObj), DEFAULT_PBAR_THICKNESS }, - { "-barsize", TK_OPTION_PIXELS, Tk_Offset(PbarElement,lengthObj), + { "-barsize", TK_OPTION_PIXELS, offsetof(PbarElement,lengthObj), DEFAULT_PBAR_LENGTH }, - { "-pbarrelief", TK_OPTION_RELIEF, Tk_Offset(PbarElement,reliefObj), + { "-pbarrelief", TK_OPTION_RELIEF, offsetof(PbarElement,reliefObj), "raised" }, - { "-borderwidth", TK_OPTION_PIXELS, Tk_Offset(PbarElement,borderWidthObj), + { "-borderwidth", TK_OPTION_PIXELS, offsetof(PbarElement,borderWidthObj), DEFAULT_BORDERWIDTH }, - { "-background", TK_OPTION_BORDER, Tk_Offset(PbarElement,borderObj), + { "-background", TK_OPTION_BORDER, offsetof(PbarElement,borderObj), DEFAULT_BACKGROUND }, { NULL, 0, 0, NULL } }; @@ -1094,9 +1094,9 @@ typedef struct { static Ttk_ElementOptionSpec TabElementOptions[] = { { "-borderwidth", TK_OPTION_PIXELS, - Tk_Offset(TabElement,borderWidthObj),"1" }, + offsetof(TabElement,borderWidthObj),"1" }, { "-background", TK_OPTION_BORDER, - Tk_Offset(TabElement,backgroundObj), DEFAULT_BACKGROUND }, + offsetof(TabElement,backgroundObj), DEFAULT_BACKGROUND }, {0,0,0,0} }; diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c index b8146e2..38970d8 100644 --- a/generic/ttk/ttkEntry.c +++ b/generic/ttk/ttkEntry.c @@ -156,53 +156,53 @@ typedef struct { static Tk_OptionSpec EntryOptionSpecs[] = { {TK_OPTION_BOOLEAN, "-exportselection", "exportSelection", - "ExportSelection", "1", -1, Tk_Offset(Entry, entry.exportSelection), + "ExportSelection", "1", -1, offsetof(Entry, entry.exportSelection), 0,0,0 }, {TK_OPTION_FONT, "-font", "font", "Font", - DEF_ENTRY_FONT, Tk_Offset(Entry, entry.fontObj),-1, + DEF_ENTRY_FONT, offsetof(Entry, entry.fontObj),-1, 0,0,GEOMETRY_CHANGED}, {TK_OPTION_STRING, "-invalidcommand", "invalidCommand", "InvalidCommand", - NULL, -1, Tk_Offset(Entry, entry.invalidCmd), + NULL, -1, offsetof(Entry, entry.invalidCmd), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify", - "left", -1, Tk_Offset(Entry, entry.justify), + "left", -1, offsetof(Entry, entry.justify), 0, 0, GEOMETRY_CHANGED}, {TK_OPTION_STRING, "-placeholder", "placeHolder", "PlaceHolder", - NULL, Tk_Offset(Entry, entry.placeholderObj), -1, + NULL, offsetof(Entry, entry.placeholderObj), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-show", "show", "Show", - NULL, -1, Tk_Offset(Entry, entry.showChar), + NULL, -1, offsetof(Entry, entry.showChar), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-state", "state", "State", - "normal", Tk_Offset(Entry, entry.stateObj), -1, + "normal", offsetof(Entry, entry.stateObj), -1, 0,0,STATE_CHANGED}, {TK_OPTION_STRING, "-textvariable", "textVariable", "Variable", - NULL, Tk_Offset(Entry, entry.textVariableObj), -1, + NULL, offsetof(Entry, entry.textVariableObj), -1, TK_OPTION_NULL_OK,0,TEXTVAR_CHANGED}, {TK_OPTION_STRING_TABLE, "-validate", "validate", "Validate", - "none", -1, Tk_Offset(Entry, entry.validate), + "none", -1, offsetof(Entry, entry.validate), 0, (ClientData) validateStrings, 0}, {TK_OPTION_STRING, "-validatecommand", "validateCommand", "ValidateCommand", - NULL, -1, Tk_Offset(Entry, entry.validateCmd), + NULL, -1, offsetof(Entry, entry.validateCmd), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_INT, "-width", "width", "Width", - DEF_ENTRY_WIDTH, Tk_Offset(Entry, entry.widthObj), -1, + DEF_ENTRY_WIDTH, offsetof(Entry, entry.widthObj), -1, 0,0,GEOMETRY_CHANGED}, {TK_OPTION_STRING, "-xscrollcommand", "xScrollCommand", "ScrollCommand", - NULL, -1, Tk_Offset(Entry, entry.xscroll.scrollCmd), + NULL, -1, offsetof(Entry, entry.xscroll.scrollCmd), TK_OPTION_NULL_OK, 0, SCROLLCMD_CHANGED}, /* EntryStyleData options: */ {TK_OPTION_COLOR, "-background", "windowColor", "WindowColor", - NULL, Tk_Offset(Entry, entry.styleData.backgroundObj), -1, + NULL, offsetof(Entry, entry.styleData.backgroundObj), -1, TK_OPTION_NULL_OK,0,0}, {TK_OPTION_COLOR, "-foreground", "textColor", "TextColor", - NULL, Tk_Offset(Entry, entry.styleData.foregroundObj), -1, + NULL, offsetof(Entry, entry.styleData.foregroundObj), -1, TK_OPTION_NULL_OK,0,0}, {TK_OPTION_COLOR, "-placeholderforeground", "placeholderForeground", "PlaceholderForeground", NULL, - Tk_Offset(Entry, entry.styleData.placeholderForegroundObj), -1, + offsetof(Entry, entry.styleData.placeholderForegroundObj), -1, TK_OPTION_NULL_OK,0,0}, WIDGET_TAKEFOCUS_TRUE, @@ -1770,13 +1770,13 @@ typedef struct { static Tk_OptionSpec ComboboxOptionSpecs[] = { {TK_OPTION_STRING, "-height", "height", "Height", - DEF_LIST_HEIGHT, Tk_Offset(Combobox, combobox.heightObj), -1, + DEF_LIST_HEIGHT, offsetof(Combobox, combobox.heightObj), -1, 0,0,0 }, {TK_OPTION_STRING, "-postcommand", "postCommand", "PostCommand", - "", Tk_Offset(Combobox, combobox.postCommandObj), -1, + "", offsetof(Combobox, combobox.postCommandObj), -1, 0,0,0 }, {TK_OPTION_STRING, "-values", "values", "Values", - "", Tk_Offset(Combobox, combobox.valuesObj), -1, + "", offsetof(Combobox, combobox.valuesObj), -1, 0,0,0 }, WIDGET_INHERIT_OPTIONS(EntryOptionSpecs) }; @@ -1961,27 +1961,27 @@ typedef struct { static Tk_OptionSpec SpinboxOptionSpecs[] = { {TK_OPTION_STRING, "-values", "values", "Values", - "", Tk_Offset(Spinbox, spinbox.valuesObj), -1, + "", offsetof(Spinbox, spinbox.valuesObj), -1, 0,0,0 }, {TK_OPTION_DOUBLE, "-from", "from", "From", - "0", Tk_Offset(Spinbox,spinbox.fromObj), -1, + "0", offsetof(Spinbox,spinbox.fromObj), -1, 0,0,0 }, {TK_OPTION_DOUBLE, "-to", "to", "To", - "0", Tk_Offset(Spinbox,spinbox.toObj), -1, + "0", offsetof(Spinbox,spinbox.toObj), -1, 0,0,0 }, {TK_OPTION_DOUBLE, "-increment", "increment", "Increment", - "1", Tk_Offset(Spinbox,spinbox.incrementObj), -1, + "1", offsetof(Spinbox,spinbox.incrementObj), -1, 0,0,0 }, {TK_OPTION_STRING, "-format", "format", "Format", - "", Tk_Offset(Spinbox, spinbox.formatObj), -1, + "", offsetof(Spinbox, spinbox.formatObj), -1, 0,0,0 }, {TK_OPTION_STRING, "-command", "command", "Command", - "", Tk_Offset(Spinbox, spinbox.commandObj), -1, + "", offsetof(Spinbox, spinbox.commandObj), -1, 0,0,0 }, {TK_OPTION_BOOLEAN, "-wrap", "wrap", "Wrap", - "0", Tk_Offset(Spinbox,spinbox.wrapObj), -1, + "0", offsetof(Spinbox,spinbox.wrapObj), -1, 0,0,0 }, WIDGET_INHERIT_OPTIONS(EntryOptionSpecs) @@ -2063,9 +2063,9 @@ typedef struct { static Ttk_ElementOptionSpec TextareaElementOptions[] = { { "-font", TK_OPTION_FONT, - Tk_Offset(TextareaElement,fontObj), DEF_ENTRY_FONT }, + offsetof(TextareaElement,fontObj), DEF_ENTRY_FONT }, { "-width", TK_OPTION_INT, - Tk_Offset(TextareaElement,widthObj), "20" }, + offsetof(TextareaElement,widthObj), "20" }, { NULL, 0, 0, NULL } }; diff --git a/generic/ttk/ttkFrame.c b/generic/ttk/ttkFrame.c index 10106eb..794b184 100644 --- a/generic/ttk/ttkFrame.c +++ b/generic/ttk/ttkFrame.c @@ -28,19 +28,19 @@ typedef struct { static Tk_OptionSpec FrameOptionSpecs[] = { {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", NULL, - Tk_Offset(Frame,frame.borderWidthObj), -1, + offsetof(Frame,frame.borderWidthObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_STRING, "-padding", "padding", "Pad", NULL, - Tk_Offset(Frame,frame.paddingObj), -1, + offsetof(Frame,frame.paddingObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", NULL, - Tk_Offset(Frame,frame.reliefObj), -1, + offsetof(Frame,frame.reliefObj), -1, TK_OPTION_NULL_OK,0,0 }, {TK_OPTION_PIXELS, "-width", "width", "Width", "0", - Tk_Offset(Frame,frame.widthObj), -1, + offsetof(Frame,frame.widthObj), -1, 0,0,GEOMETRY_CHANGED }, {TK_OPTION_PIXELS, "-height", "height", "Height", "0", - Tk_Offset(Frame,frame.heightObj), -1, + offsetof(Frame,frame.heightObj), -1, 0,0,GEOMETRY_CHANGED }, WIDGET_TAKEFOCUS_FALSE, @@ -249,16 +249,16 @@ typedef struct { static Tk_OptionSpec LabelframeOptionSpecs[] = { {TK_OPTION_STRING, "-labelanchor", "labelAnchor", "LabelAnchor", - "nw", Tk_Offset(Labelframe, label.labelAnchorObj),-1, + "nw", offsetof(Labelframe, label.labelAnchorObj),-1, 0,0,GEOMETRY_CHANGED}, {TK_OPTION_STRING, "-text", "text", "Text", "", - Tk_Offset(Labelframe,label.textObj), -1, + offsetof(Labelframe,label.textObj), -1, 0,0,GEOMETRY_CHANGED }, {TK_OPTION_INT, "-underline", "underline", "Underline", - "-1", Tk_Offset(Labelframe,label.underlineObj), -1, + "-1", offsetof(Labelframe,label.underlineObj), -1, 0,0,0 }, {TK_OPTION_WINDOW, "-labelwidget", "labelWidget", "LabelWidget", NULL, - -1, Tk_Offset(Labelframe,label.labelWidget), + -1, offsetof(Labelframe,label.labelWidget), TK_OPTION_NULL_OK,0,LABELWIDGET_CHANGED|GEOMETRY_CHANGED }, WIDGET_INHERIT_OPTIONS(FrameOptionSpecs) diff --git a/generic/ttk/ttkInit.c b/generic/ttk/ttkInit.c index 60e3b6f..63df71d 100644 --- a/generic/ttk/ttkInit.c +++ b/generic/ttk/ttkInit.c @@ -178,11 +178,11 @@ int TtkGetOptionValue( Tk_OptionSpec ttkCoreOptionSpecs[] = { {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", NULL, - Tk_Offset(WidgetCore, cursorObj), -1, TK_OPTION_NULL_OK,0,0 }, + offsetof(WidgetCore, cursorObj), -1, TK_OPTION_NULL_OK,0,0 }, {TK_OPTION_STRING, "-style", "style", "Style", "", - Tk_Offset(WidgetCore,styleObj), -1, 0,0,STYLE_CHANGED}, + offsetof(WidgetCore,styleObj), -1, 0,0,STYLE_CHANGED}, {TK_OPTION_STRING, "-class", "", "", NULL, - Tk_Offset(WidgetCore,classObj), -1, 0,0,READONLY_OPTION}, + offsetof(WidgetCore,classObj), -1, 0,0,READONLY_OPTION}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0} }; diff --git a/generic/ttk/ttkLabel.c b/generic/ttk/ttkLabel.c index d7a1f93..2367f99 100644 --- a/generic/ttk/ttkLabel.c +++ b/generic/ttk/ttkLabel.c @@ -48,23 +48,23 @@ typedef struct { */ static Ttk_ElementOptionSpec TextElementOptions[] = { { "-text", TK_OPTION_STRING, - Tk_Offset(TextElement,textObj), "" }, + offsetof(TextElement,textObj), "" }, { "-font", TK_OPTION_FONT, - Tk_Offset(TextElement,fontObj), DEFAULT_FONT }, + offsetof(TextElement,fontObj), DEFAULT_FONT }, { "-foreground", TK_OPTION_COLOR, - Tk_Offset(TextElement,foregroundObj), "black" }, + offsetof(TextElement,foregroundObj), "black" }, { "-underline", TK_OPTION_INT, - Tk_Offset(TextElement,underlineObj), "-1"}, + offsetof(TextElement,underlineObj), "-1"}, { "-width", TK_OPTION_INT, - Tk_Offset(TextElement,widthObj), "-1"}, + offsetof(TextElement,widthObj), "-1"}, { "-anchor", TK_OPTION_ANCHOR, - Tk_Offset(TextElement,anchorObj), "w"}, + offsetof(TextElement,anchorObj), "w"}, { "-justify", TK_OPTION_JUSTIFY, - Tk_Offset(TextElement,justifyObj), "left" }, + offsetof(TextElement,justifyObj), "left" }, { "-wraplength", TK_OPTION_PIXELS, - Tk_Offset(TextElement,wrapLengthObj), "0" }, + offsetof(TextElement,wrapLengthObj), "0" }, { "-embossed", TK_OPTION_INT, - Tk_Offset(TextElement,embossedObj), "0"}, + offsetof(TextElement,embossedObj), "0"}, { NULL, 0, 0, NULL } }; @@ -248,11 +248,11 @@ typedef struct { */ static Ttk_ElementOptionSpec ImageElementOptions[] = { { "-image", TK_OPTION_STRING, - Tk_Offset(ImageElement,imageObj), "" }, + offsetof(ImageElement,imageObj), "" }, { "-stipple", TK_OPTION_STRING, /* Really: TK_OPTION_BITMAP */ - Tk_Offset(ImageElement,stippleObj), "gray50" }, + offsetof(ImageElement,stippleObj), "gray50" }, { "-background", TK_OPTION_COLOR, - Tk_Offset(ImageElement,backgroundObj), DEFAULT_BACKGROUND }, + offsetof(ImageElement,backgroundObj), DEFAULT_BACKGROUND }, { NULL, 0, 0, NULL } }; @@ -442,41 +442,41 @@ typedef struct { static Ttk_ElementOptionSpec LabelElementOptions[] = { { "-compound", TK_OPTION_ANY, - Tk_Offset(LabelElement,compoundObj), "none" }, + offsetof(LabelElement,compoundObj), "none" }, { "-space", TK_OPTION_PIXELS, - Tk_Offset(LabelElement,spaceObj), "4" }, + offsetof(LabelElement,spaceObj), "4" }, /* Text element part: * NB: Keep in sync with TextElementOptions. */ { "-text", TK_OPTION_STRING, - Tk_Offset(LabelElement,text.textObj), "" }, + offsetof(LabelElement,text.textObj), "" }, { "-font", TK_OPTION_FONT, - Tk_Offset(LabelElement,text.fontObj), DEFAULT_FONT }, + offsetof(LabelElement,text.fontObj), DEFAULT_FONT }, { "-foreground", TK_OPTION_COLOR, - Tk_Offset(LabelElement,text.foregroundObj), "black" }, + offsetof(LabelElement,text.foregroundObj), "black" }, { "-underline", TK_OPTION_INT, - Tk_Offset(LabelElement,text.underlineObj), "-1"}, + offsetof(LabelElement,text.underlineObj), "-1"}, { "-width", TK_OPTION_INT, - Tk_Offset(LabelElement,text.widthObj), ""}, + offsetof(LabelElement,text.widthObj), ""}, { "-anchor", TK_OPTION_ANCHOR, - Tk_Offset(LabelElement,text.anchorObj), "w"}, + offsetof(LabelElement,text.anchorObj), "w"}, { "-justify", TK_OPTION_JUSTIFY, - Tk_Offset(LabelElement,text.justifyObj), "left" }, + offsetof(LabelElement,text.justifyObj), "left" }, { "-wraplength", TK_OPTION_PIXELS, - Tk_Offset(LabelElement,text.wrapLengthObj), "0" }, + offsetof(LabelElement,text.wrapLengthObj), "0" }, { "-embossed", TK_OPTION_INT, - Tk_Offset(LabelElement,text.embossedObj), "0"}, + offsetof(LabelElement,text.embossedObj), "0"}, /* Image element part: * NB: Keep in sync with ImageElementOptions. */ { "-image", TK_OPTION_STRING, - Tk_Offset(LabelElement,image.imageObj), "" }, + offsetof(LabelElement,image.imageObj), "" }, { "-stipple", TK_OPTION_STRING, /* Really: TK_OPTION_BITMAP */ - Tk_Offset(LabelElement,image.stippleObj), "gray50" }, + offsetof(LabelElement,image.stippleObj), "gray50" }, { "-background", TK_OPTION_COLOR, - Tk_Offset(LabelElement,image.backgroundObj), DEFAULT_BACKGROUND }, + offsetof(LabelElement,image.backgroundObj), DEFAULT_BACKGROUND }, { NULL, 0, 0, NULL } }; diff --git a/generic/ttk/ttkNotebook.c b/generic/ttk/ttkNotebook.c index 0625af8..159a88d 100644 --- a/generic/ttk/ttkNotebook.c +++ b/generic/ttk/ttkNotebook.c @@ -58,26 +58,26 @@ typedef struct static Tk_OptionSpec TabOptionSpecs[] = { {TK_OPTION_STRING_TABLE, "-state", "", "", - "normal", -1,Tk_Offset(Tab,state), + "normal", -1, offsetof(Tab,state), 0,(ClientData)TabStateStrings,0 }, {TK_OPTION_STRING, "-text", "text", "Text", "", - Tk_Offset(Tab,textObj), -1, 0,0,GEOMETRY_CHANGED }, + offsetof(Tab,textObj), -1, 0,0,GEOMETRY_CHANGED }, {TK_OPTION_STRING, "-image", "image", "Image", NULL/*default*/, - Tk_Offset(Tab,imageObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, + offsetof(Tab,imageObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound", - "none", Tk_Offset(Tab,compoundObj), -1, + "none", offsetof(Tab,compoundObj), -1, 0,(ClientData)ttkCompoundStrings,GEOMETRY_CHANGED }, {TK_OPTION_INT, "-underline", "underline", "Underline", "-1", - Tk_Offset(Tab,underlineObj), -1, 0,0,GEOMETRY_CHANGED }, + offsetof(Tab,underlineObj), -1, 0,0,GEOMETRY_CHANGED }, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0 } }; static Tk_OptionSpec PaneOptionSpecs[] = { {TK_OPTION_STRING, "-padding", "padding", "Padding", "0", - Tk_Offset(Tab,paddingObj), -1, 0,0,GEOMETRY_CHANGED }, + offsetof(Tab,paddingObj), -1, 0,0,GEOMETRY_CHANGED }, {TK_OPTION_STRING, "-sticky", "sticky", "Sticky", "nsew", - Tk_Offset(Tab,stickyObj), -1, 0,0,GEOMETRY_CHANGED }, + offsetof(Tab,stickyObj), -1, 0,0,GEOMETRY_CHANGED }, WIDGET_INHERIT_OPTIONS(TabOptionSpecs) }; @@ -110,13 +110,13 @@ typedef struct static Tk_OptionSpec NotebookOptionSpecs[] = { {TK_OPTION_INT, "-width", "width", "Width", "0", - Tk_Offset(Notebook,notebook.widthObj),-1, + offsetof(Notebook,notebook.widthObj),-1, 0,0,GEOMETRY_CHANGED }, {TK_OPTION_INT, "-height", "height", "Height", "0", - Tk_Offset(Notebook,notebook.heightObj),-1, + offsetof(Notebook,notebook.heightObj),-1, 0,0,GEOMETRY_CHANGED }, {TK_OPTION_STRING, "-padding", "padding", "Padding", NULL, - Tk_Offset(Notebook,notebook.paddingObj),-1, + offsetof(Notebook,notebook.paddingObj),-1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, WIDGET_TAKEFOCUS_TRUE, diff --git a/generic/ttk/ttkPanedwindow.c b/generic/ttk/ttkPanedwindow.c index 8f8094e..1b6ff3d 100644 --- a/generic/ttk/ttkPanedwindow.c +++ b/generic/ttk/ttkPanedwindow.c @@ -76,13 +76,13 @@ typedef struct { */ static Tk_OptionSpec PanedOptionSpecs[] = { {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "vertical", - Tk_Offset(Paned,paned.orientObj), Tk_Offset(Paned,paned.orient), + offsetof(Paned,paned.orientObj), offsetof(Paned,paned.orient), 0,(ClientData)ttkOrientStrings,READONLY_OPTION|STYLE_CHANGED }, {TK_OPTION_INT, "-width", "width", "Width", "0", - -1,Tk_Offset(Paned,paned.width), + -1, offsetof(Paned,paned.width), 0,0,GEOMETRY_CHANGED }, {TK_OPTION_INT, "-height", "height", "Height", "0", - -1,Tk_Offset(Paned,paned.height), + -1, offsetof(Paned,paned.height), 0,0,GEOMETRY_CHANGED }, WIDGET_TAKEFOCUS_FALSE, @@ -100,7 +100,7 @@ typedef struct { static Tk_OptionSpec PaneOptionSpecs[] = { {TK_OPTION_INT, "-weight", "weight", "Weight", "0", - -1,Tk_Offset(Pane,weight), 0,0,GEOMETRY_CHANGED }, + -1, offsetof(Pane,weight), 0,0,GEOMETRY_CHANGED }, {TK_OPTION_END, 0,0,0, NULL, -1,-1, 0,0,0} }; @@ -922,7 +922,7 @@ typedef struct { static Ttk_ElementOptionSpec SashElementOptions[] = { { "-sashthickness", TK_OPTION_INT, - Tk_Offset(SashElement,thicknessObj), "5" }, + offsetof(SashElement,thicknessObj), "5" }, { NULL, 0, 0, NULL } }; diff --git a/generic/ttk/ttkProgress.c b/generic/ttk/ttkProgress.c index cb4b464..f1dbb2f 100644 --- a/generic/ttk/ttkProgress.c +++ b/generic/ttk/ttkProgress.c @@ -51,44 +51,44 @@ typedef struct { static Tk_OptionSpec ProgressbarOptionSpecs[] = { {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", - "w", Tk_Offset(Progressbar,progress.anchorObj), -1, + "w", offsetof(Progressbar,progress.anchorObj), -1, TK_OPTION_NULL_OK, 0, GEOMETRY_CHANGED}, {TK_OPTION_FONT, "-font", "font", "Font", - DEFAULT_FONT, Tk_Offset(Progressbar,progress.fontObj), -1, + DEFAULT_FONT, offsetof(Progressbar,progress.fontObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_COLOR, "-foreground", "textColor", "TextColor", - "black", Tk_Offset(Progressbar,progress.foregroundObj), -1, + "black", offsetof(Progressbar,progress.foregroundObj), -1, TK_OPTION_NULL_OK,0,0 }, {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify", - "left", Tk_Offset(Progressbar,progress.justifyObj), -1, + "left", offsetof(Progressbar,progress.justifyObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_PIXELS, "-length", "length", "Length", - DEF_PROGRESSBAR_LENGTH, Tk_Offset(Progressbar,progress.lengthObj), -1, + DEF_PROGRESSBAR_LENGTH, offsetof(Progressbar,progress.lengthObj), -1, 0, 0, GEOMETRY_CHANGED }, {TK_OPTION_DOUBLE, "-maximum", "maximum", "Maximum", - "100", Tk_Offset(Progressbar,progress.maximumObj), -1, + "100", offsetof(Progressbar,progress.maximumObj), -1, 0, 0, 0 }, {TK_OPTION_STRING_TABLE, "-mode", "mode", "ProgressMode", "determinate", - Tk_Offset(Progressbar,progress.modeObj), - Tk_Offset(Progressbar,progress.mode), + offsetof(Progressbar,progress.modeObj), + offsetof(Progressbar,progress.mode), 0, (ClientData)ProgressbarModeStrings, 0 }, {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", - "horizontal", Tk_Offset(Progressbar,progress.orientObj), -1, + "horizontal", offsetof(Progressbar,progress.orientObj), -1, 0, (ClientData)ttkOrientStrings, STYLE_CHANGED }, {TK_OPTION_INT, "-phase", "phase", "Phase", - "0", Tk_Offset(Progressbar,progress.phaseObj), -1, + "0", offsetof(Progressbar,progress.phaseObj), -1, 0, 0, 0 }, {TK_OPTION_STRING, "-text", "text", "Text", "", - Tk_Offset(Progressbar,progress.textObj), -1, + offsetof(Progressbar,progress.textObj), -1, 0,0,GEOMETRY_CHANGED }, {TK_OPTION_DOUBLE, "-value", "value", "Value", - "0.0", Tk_Offset(Progressbar,progress.valueObj), -1, + "0.0", offsetof(Progressbar,progress.valueObj), -1, 0, 0, 0 }, {TK_OPTION_STRING, "-variable", "variable", "Variable", - NULL, Tk_Offset(Progressbar,progress.variableObj), -1, + NULL, offsetof(Progressbar,progress.variableObj), -1, TK_OPTION_NULL_OK, 0, 0 }, {TK_OPTION_PIXELS, "-wraplength", "wrapLength", "WrapLength", - "0", Tk_Offset(Progressbar, progress.wrapLengthObj), -1, + "0", offsetof(Progressbar, progress.wrapLengthObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED}, WIDGET_TAKEFOCUS_FALSE, diff --git a/generic/ttk/ttkScale.c b/generic/ttk/ttkScale.c index 458bccd..0e20621 100644 --- a/generic/ttk/ttkScale.c +++ b/generic/ttk/ttkScale.c @@ -53,28 +53,28 @@ typedef struct static Tk_OptionSpec ScaleOptionSpecs[] = { {TK_OPTION_STRING, "-command", "command", "Command", "", - Tk_Offset(Scale,scale.commandObj), -1, + offsetof(Scale,scale.commandObj), -1, TK_OPTION_NULL_OK,0,0}, {TK_OPTION_STRING, "-variable", "variable", "Variable", "", - Tk_Offset(Scale,scale.variableObj), -1, + offsetof(Scale,scale.variableObj), -1, 0,0,0}, {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "horizontal", - Tk_Offset(Scale,scale.orientObj), - Tk_Offset(Scale,scale.orient), 0, + offsetof(Scale,scale.orientObj), + offsetof(Scale,scale.orient), 0, (ClientData)ttkOrientStrings, STYLE_CHANGED }, {TK_OPTION_DOUBLE, "-from", "from", "From", "0", - Tk_Offset(Scale,scale.fromObj), -1, 0, 0, 0}, + offsetof(Scale,scale.fromObj), -1, 0, 0, 0}, {TK_OPTION_DOUBLE, "-to", "to", "To", "1.0", - Tk_Offset(Scale,scale.toObj), -1, 0, 0, 0}, + offsetof(Scale,scale.toObj), -1, 0, 0, 0}, {TK_OPTION_DOUBLE, "-value", "value", "Value", "0", - Tk_Offset(Scale,scale.valueObj), -1, 0, 0, 0}, + offsetof(Scale,scale.valueObj), -1, 0, 0, 0}, {TK_OPTION_PIXELS, "-length", "length", "Length", - DEF_SCALE_LENGTH, Tk_Offset(Scale,scale.lengthObj), -1, 0, 0, + DEF_SCALE_LENGTH, offsetof(Scale,scale.lengthObj), -1, 0, 0, GEOMETRY_CHANGED}, {TK_OPTION_STRING, "-state", "state", "State", - "normal", Tk_Offset(Scale,scale.stateObj), -1, + "normal", offsetof(Scale,scale.stateObj), -1, 0,0,STATE_CHANGED}, WIDGET_TAKEFOCUS_TRUE, diff --git a/generic/ttk/ttkScrollbar.c b/generic/ttk/ttkScrollbar.c index f304ea9..2825c54 100644 --- a/generic/ttk/ttkScrollbar.c +++ b/generic/ttk/ttkScrollbar.c @@ -34,11 +34,11 @@ typedef struct static Tk_OptionSpec ScrollbarOptionSpecs[] = { {TK_OPTION_STRING, "-command", "command", "Command", "", - Tk_Offset(Scrollbar,scrollbar.commandObj), -1, 0,0,0}, + offsetof(Scrollbar,scrollbar.commandObj), -1, 0,0,0}, {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "vertical", - Tk_Offset(Scrollbar,scrollbar.orientObj), - Tk_Offset(Scrollbar,scrollbar.orient), + offsetof(Scrollbar,scrollbar.orientObj), + offsetof(Scrollbar,scrollbar.orient), 0,(ClientData)ttkOrientStrings,STYLE_CHANGED }, WIDGET_TAKEFOCUS_FALSE, diff --git a/generic/ttk/ttkSeparator.c b/generic/ttk/ttkSeparator.c index dae6d69..f7bacdc 100644 --- a/generic/ttk/ttkSeparator.c +++ b/generic/ttk/ttkSeparator.c @@ -24,8 +24,8 @@ typedef struct static Tk_OptionSpec SeparatorOptionSpecs[] = { {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "horizontal", - Tk_Offset(Separator,separator.orientObj), - Tk_Offset(Separator,separator.orient), + offsetof(Separator,separator.orientObj), + offsetof(Separator,separator.orient), 0,(ClientData)ttkOrientStrings,STYLE_CHANGED }, WIDGET_TAKEFOCUS_FALSE, diff --git a/generic/ttk/ttkSquare.c b/generic/ttk/ttkSquare.c index 5302eb7..b82faa2 100644 --- a/generic/ttk/ttkSquare.c +++ b/generic/ttk/ttkSquare.c @@ -51,28 +51,28 @@ typedef struct static Tk_OptionSpec SquareOptionSpecs[] = { {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", - DEFAULT_BORDERWIDTH, Tk_Offset(Square,square.borderWidthObj), -1, + DEFAULT_BORDERWIDTH, offsetof(Square,square.borderWidthObj), -1, 0,0,GEOMETRY_CHANGED }, {TK_OPTION_BORDER, "-foreground", "foreground", "Foreground", - DEFAULT_BACKGROUND, Tk_Offset(Square,square.foregroundObj), + DEFAULT_BACKGROUND, offsetof(Square,square.foregroundObj), -1, 0, 0, 0}, {TK_OPTION_PIXELS, "-width", "width", "Width", - "50", Tk_Offset(Square,square.widthObj), -1, 0, 0, + "50", offsetof(Square,square.widthObj), -1, 0, 0, GEOMETRY_CHANGED}, {TK_OPTION_PIXELS, "-height", "height", "Height", - "50", Tk_Offset(Square,square.heightObj), -1, 0, 0, + "50", offsetof(Square,square.heightObj), -1, 0, 0, GEOMETRY_CHANGED}, {TK_OPTION_STRING, "-padding", "padding", "Pad", NULL, - Tk_Offset(Square,square.paddingObj), -1, + offsetof(Square,square.paddingObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", - NULL, Tk_Offset(Square,square.reliefObj), -1, TK_OPTION_NULL_OK, 0, 0}, + NULL, offsetof(Square,square.reliefObj), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", - NULL, Tk_Offset(Square,square.anchorObj), -1, TK_OPTION_NULL_OK, 0, 0}, + NULL, offsetof(Square,square.anchorObj), -1, TK_OPTION_NULL_OK, 0, 0}, WIDGET_TAKEFOCUS_TRUE, WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) @@ -178,16 +178,16 @@ typedef struct static Ttk_ElementOptionSpec SquareElementOptions[] = { - { "-background", TK_OPTION_BORDER, Tk_Offset(SquareElement,borderObj), + { "-background", TK_OPTION_BORDER, offsetof(SquareElement,borderObj), DEFAULT_BACKGROUND }, - { "-foreground", TK_OPTION_BORDER, Tk_Offset(SquareElement,foregroundObj), + { "-foreground", TK_OPTION_BORDER, offsetof(SquareElement,foregroundObj), DEFAULT_BACKGROUND }, - { "-borderwidth", TK_OPTION_PIXELS, Tk_Offset(SquareElement,borderWidthObj), + { "-borderwidth", TK_OPTION_PIXELS, offsetof(SquareElement,borderWidthObj), DEFAULT_BORDERWIDTH }, - { "-relief", TK_OPTION_RELIEF, Tk_Offset(SquareElement,reliefObj), + { "-relief", TK_OPTION_RELIEF, offsetof(SquareElement,reliefObj), "raised" }, - { "-width", TK_OPTION_PIXELS, Tk_Offset(SquareElement,widthObj), "20"}, - { "-height", TK_OPTION_PIXELS, Tk_Offset(SquareElement,heightObj), "20"}, + { "-width", TK_OPTION_PIXELS, offsetof(SquareElement,widthObj), "20"}, + { "-height", TK_OPTION_PIXELS, offsetof(SquareElement,heightObj), "20"}, { NULL, 0, 0, NULL } }; diff --git a/generic/ttk/ttkTreeview.c b/generic/ttk/ttkTreeview.c index 7ca7f0c..cf7abe1 100644 --- a/generic/ttk/ttkTreeview.c +++ b/generic/ttk/ttkTreeview.c @@ -61,19 +61,19 @@ struct TreeItemRec { static Tk_OptionSpec ItemOptionSpecs[] = { {TK_OPTION_STRING, "-text", "text", "Text", - "", Tk_Offset(TreeItem,textObj), -1, + "", offsetof(TreeItem,textObj), -1, 0,0,0 }, {TK_OPTION_STRING, "-image", "image", "Image", - NULL, Tk_Offset(TreeItem,imageObj), -1, + NULL, offsetof(TreeItem,imageObj), -1, TK_OPTION_NULL_OK,0,ITEM_OPTION_IMAGE_CHANGED }, {TK_OPTION_STRING, "-values", "values", "Values", - NULL, Tk_Offset(TreeItem,valuesObj), -1, + NULL, offsetof(TreeItem,valuesObj), -1, TK_OPTION_NULL_OK,0,0 }, {TK_OPTION_BOOLEAN, "-open", "open", "Open", - "0", Tk_Offset(TreeItem,openObj), -1, + "0", offsetof(TreeItem,openObj), -1, 0,0,0 }, {TK_OPTION_STRING, "-tags", "tags", "Tags", - NULL, Tk_Offset(TreeItem,tagsObj), -1, + NULL, offsetof(TreeItem,tagsObj), -1, TK_OPTION_NULL_OK,0,ITEM_OPTION_TAGS_CHANGED }, {TK_OPTION_END, 0,0,0, NULL, -1,-1, 0,0,0} @@ -189,22 +189,22 @@ typedef struct { static Tk_OptionSpec TagOptionSpecs[] = { {TK_OPTION_STRING, "-text", "text", "Text", - NULL, Tk_Offset(DisplayItem,textObj), -1, + NULL, offsetof(DisplayItem,textObj), -1, TK_OPTION_NULL_OK,0,0 }, {TK_OPTION_STRING, "-image", "image", "Image", - NULL, Tk_Offset(DisplayItem,imageObj), -1, + NULL, offsetof(DisplayItem,imageObj), -1, TK_OPTION_NULL_OK,0,0 }, {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", - NULL, Tk_Offset(DisplayItem,anchorObj), -1, + NULL, offsetof(DisplayItem,anchorObj), -1, TK_OPTION_NULL_OK, 0, GEOMETRY_CHANGED}, /* <<NOTE-ANCHOR>> */ {TK_OPTION_COLOR, "-background", "windowColor", "WindowColor", - NULL, Tk_Offset(DisplayItem,backgroundObj), -1, + NULL, offsetof(DisplayItem,backgroundObj), -1, TK_OPTION_NULL_OK,0,0 }, {TK_OPTION_COLOR, "-foreground", "textColor", "TextColor", - NULL, Tk_Offset(DisplayItem,foregroundObj), -1, + NULL, offsetof(DisplayItem,foregroundObj), -1, TK_OPTION_NULL_OK,0,0 }, {TK_OPTION_FONT, "-font", "font", "Font", - NULL, Tk_Offset(DisplayItem,fontObj), -1, + NULL, offsetof(DisplayItem,fontObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_END, 0,0,0, NULL, -1,-1, 0,0,0} @@ -273,38 +273,38 @@ static void FreeColumn(TreeColumn *column) static Tk_OptionSpec ColumnOptionSpecs[] = { {TK_OPTION_INT, "-width", "width", "Width", - DEF_COLWIDTH, -1, Tk_Offset(TreeColumn,width), + DEF_COLWIDTH, -1, offsetof(TreeColumn,width), 0,0,GEOMETRY_CHANGED }, {TK_OPTION_INT, "-minwidth", "minWidth", "MinWidth", - DEF_MINWIDTH, -1, Tk_Offset(TreeColumn,minWidth), + DEF_MINWIDTH, -1, offsetof(TreeColumn,minWidth), 0,0,0 }, {TK_OPTION_BOOLEAN, "-stretch", "stretch", "Stretch", - "1", -1, Tk_Offset(TreeColumn,stretch), + "1", -1, offsetof(TreeColumn,stretch), 0,0,GEOMETRY_CHANGED }, {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", - "w", Tk_Offset(TreeColumn,anchorObj), -1, /* <<NOTE-ANCHOR>> */ + "w", offsetof(TreeColumn,anchorObj), -1, /* <<NOTE-ANCHOR>> */ 0,0,0 }, {TK_OPTION_STRING, "-id", "id", "ID", - NULL, Tk_Offset(TreeColumn,idObj), -1, + NULL, offsetof(TreeColumn,idObj), -1, TK_OPTION_NULL_OK,0,READONLY_OPTION }, {TK_OPTION_END, 0,0,0, NULL, -1,-1, 0,0,0} }; static Tk_OptionSpec HeadingOptionSpecs[] = { {TK_OPTION_STRING, "-text", "text", "Text", - "", Tk_Offset(TreeColumn,headingObj), -1, + "", offsetof(TreeColumn,headingObj), -1, 0,0,0 }, {TK_OPTION_STRING, "-image", "image", "Image", - "", Tk_Offset(TreeColumn,headingImageObj), -1, + "", offsetof(TreeColumn,headingImageObj), -1, 0,0,0 }, {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", - "center", Tk_Offset(TreeColumn,headingAnchorObj), -1, + "center", offsetof(TreeColumn,headingAnchorObj), -1, 0,0,0 }, {TK_OPTION_STRING, "-command", "", "", - "", Tk_Offset(TreeColumn,headingCommandObj), -1, + "", offsetof(TreeColumn,headingCommandObj), -1, TK_OPTION_NULL_OK,0,0 }, {TK_OPTION_STRING, "state", "", "", - "", Tk_Offset(TreeColumn,headingStateObj), -1, + "", offsetof(TreeColumn,headingStateObj), -1, 0,0,STATE_CHANGED }, {TK_OPTION_END, 0,0,0, NULL, -1,-1, 0,0,0} }; @@ -437,31 +437,31 @@ static const char *const SelectModeStrings[] = { "none", "browse", "extended", N static Tk_OptionSpec TreeviewOptionSpecs[] = { {TK_OPTION_STRING, "-columns", "columns", "Columns", - "", Tk_Offset(Treeview,tree.columnsObj), -1, + "", offsetof(Treeview,tree.columnsObj), -1, 0,0,COLUMNS_CHANGED | GEOMETRY_CHANGED /*| READONLY_OPTION*/ }, {TK_OPTION_STRING, "-displaycolumns","displayColumns","DisplayColumns", - "#all", Tk_Offset(Treeview,tree.displayColumnsObj), -1, + "#all", offsetof(Treeview,tree.displayColumnsObj), -1, 0,0,DCOLUMNS_CHANGED | GEOMETRY_CHANGED }, {TK_OPTION_STRING, "-show", "show", "Show", - DEFAULT_SHOW, Tk_Offset(Treeview,tree.showObj), -1, + DEFAULT_SHOW, offsetof(Treeview,tree.showObj), -1, 0,0,SHOW_CHANGED | GEOMETRY_CHANGED }, {TK_OPTION_STRING_TABLE, "-selectmode", "selectMode", "SelectMode", - "extended", Tk_Offset(Treeview,tree.selectModeObj), -1, + "extended", offsetof(Treeview,tree.selectModeObj), -1, 0,(ClientData)SelectModeStrings,0 }, {TK_OPTION_PIXELS, "-height", "height", "Height", - DEF_TREE_ROWS, Tk_Offset(Treeview,tree.heightObj), -1, + DEF_TREE_ROWS, offsetof(Treeview,tree.heightObj), -1, 0,0,GEOMETRY_CHANGED}, {TK_OPTION_STRING, "-padding", "padding", "Pad", - NULL, Tk_Offset(Treeview,tree.paddingObj), -1, + NULL, offsetof(Treeview,tree.paddingObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_STRING, "-xscrollcommand", "xScrollCommand", "ScrollCommand", - NULL, -1, Tk_Offset(Treeview, tree.xscroll.scrollCmd), + NULL, -1, offsetof(Treeview, tree.xscroll.scrollCmd), TK_OPTION_NULL_OK, 0, SCROLLCMD_CHANGED}, {TK_OPTION_STRING, "-yscrollcommand", "yScrollCommand", "ScrollCommand", - NULL, -1, Tk_Offset(Treeview, tree.yscroll.scrollCmd), + NULL, -1, offsetof(Treeview, tree.yscroll.scrollCmd), TK_OPTION_NULL_OK, 0, SCROLLCMD_CHANGED}, WIDGET_TAKEFOCUS_TRUE, @@ -3369,11 +3369,11 @@ typedef struct { static Ttk_ElementOptionSpec TreeitemIndicatorOptions[] = { { "-foreground", TK_OPTION_COLOR, - Tk_Offset(TreeitemIndicator,colorObj), DEFAULT_FOREGROUND }, + offsetof(TreeitemIndicator,colorObj), DEFAULT_FOREGROUND }, { "-indicatorsize", TK_OPTION_PIXELS, - Tk_Offset(TreeitemIndicator,sizeObj), "12" }, + offsetof(TreeitemIndicator,sizeObj), "12" }, { "-indicatormargins", TK_OPTION_STRING, - Tk_Offset(TreeitemIndicator,marginsObj), "2 2 4 2" }, + offsetof(TreeitemIndicator,marginsObj), "2 2 4 2" }, { NULL, 0, 0, NULL } }; @@ -3438,9 +3438,9 @@ typedef struct { static Ttk_ElementOptionSpec RowElementOptions[] = { { "-background", TK_OPTION_COLOR, - Tk_Offset(RowElement,backgroundObj), DEFAULT_BACKGROUND }, + offsetof(RowElement,backgroundObj), DEFAULT_BACKGROUND }, { "-rownumber", TK_OPTION_INT, - Tk_Offset(RowElement,rowNumberObj), "0" }, + offsetof(RowElement,rowNumberObj), "0" }, { NULL, 0, 0, NULL } }; diff --git a/generic/ttk/ttkWidget.h b/generic/ttk/ttkWidget.h index 6cd691b..e764c3a 100644 --- a/generic/ttk/ttkWidget.h +++ b/generic/ttk/ttkWidget.h @@ -117,10 +117,10 @@ MODULE_SCOPE int TtkWidgetConstructorObjCmd( */ #define WIDGET_TAKEFOCUS_TRUE \ {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", \ - "ttk::takefocus", Tk_Offset(WidgetCore, takeFocusPtr), -1, 0,0,0 } + "ttk::takefocus", offsetof(WidgetCore, takeFocusPtr), -1, 0,0,0 } #define WIDGET_TAKEFOCUS_FALSE \ {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", \ - "", Tk_Offset(WidgetCore, takeFocusPtr), -1, 0,0,0 } + "", offsetof(WidgetCore, takeFocusPtr), -1, 0,0,0 } /* WIDGET_INHERIT_OPTIONS(baseOptionSpecs) -- * Add this at the end of an OptionSpecs table to inherit diff --git a/library/entry.tcl b/library/entry.tcl index 6243d26..0cc9ffb 100644 --- a/library/entry.tcl +++ b/library/entry.tcl @@ -74,6 +74,11 @@ bind Entry <<TraverseIn>> { # Standard Motif bindings: +bind Entry <Map> { + if {[tk windowingsystem] eq "aqua"} { + ::tk::RegisterServiceWidget %W + } +} bind Entry <1> { tk::EntryButton1 %W %x %W selection clear @@ -652,3 +657,12 @@ proc ::tk::EntryGetSelection {w} { } return $entryString } + + + + + + + + + diff --git a/library/text.tcl b/library/text.tcl index e7cf061..9ccf90c 100644 --- a/library/text.tcl +++ b/library/text.tcl @@ -38,8 +38,16 @@ # The code below creates the default class bindings for text widgets. #------------------------------------------------------------------------- + + # Standard Motif bindings: +bind Text <Map> { + if {[tk windowingsystem] eq "aqua"} { + ::tk::RegisterServiceWidget %W + } +} + bind Text <1> { tk::TextButton1 %W %x %y %W tag remove sel 0.0 end @@ -83,6 +91,7 @@ bind Text <B1-Enter> { bind Text <ButtonRelease-1> { tk::CancelRepeat } + bind Text <Control-1> { %W mark set insert @%x,%y # An operation that moves the insert mark without making it @@ -1203,7 +1212,7 @@ proc ::tk::TextScanDrag {w x y} { } if {[info exists Priv(mouseMoved)] && $Priv(mouseMoved)} { $w scan dragto $x $y - } + } } # ::tk::TextUndoRedoProcessMarks -- @@ -1274,29 +1283,23 @@ proc ::tk::TextUndoRedoProcessMarks {w} { # -> further second ranges do not need to be considered # because ranges were sorted by increasing first index set j $nUndoMarks - } else { if {[$w compare $ir2 > $ir1]} { # second range overlaps first range # -> merge them into a single range set indices [lreplace $indices end-1 end] lappend indices $il1 $ir2 - } else { # second range is fully included in first range # -> ignore it - } # in both cases above, the second range shall be # trimmed out from the list of ranges set ind [lreplace $ind $j [expr {$j + 1}]] incr j -2 incr nUndoMarks -2 - } - } - } return $indices diff --git a/library/tk.tcl b/library/tk.tcl index 757eb7a..372752b 100644 --- a/library/tk.tcl +++ b/library/tk.tcl @@ -684,6 +684,14 @@ if {[tk windowingsystem] eq "aqua"} { } } +#register to send data to macOS Services +if {[tk windowingsystem] eq "aqua"} { +proc ::tk::RegisterServiceWidget {w} { + ::tk::mac::registerServiceWidget $w + } +} + + # Run the Ttk themed widget set initialization if {$::ttk::library ne ""} { uplevel \#0 [list source $::ttk::library/ttk.tcl] diff --git a/library/ttk/entry.tcl b/library/ttk/entry.tcl index e9f249c..383eebd 100644 --- a/library/ttk/entry.tcl +++ b/library/ttk/entry.tcl @@ -58,6 +58,13 @@ option add *TEntry.cursor [ttk::cursor text] widgetDefault # and I'll put it back. # +##Bindings to register with macOS Services API. +bind T.Entry <Map> { + if {[tk windowingsystem] eq "aqua"} { + ::tk::RegisterServiceWidget %W + } +} + ## Clipboard events: # bind TEntry <<Cut>> { ttk::entry::Cut %W } diff --git a/macosx/README b/macosx/README index 7afcdf1..3451385 100644 --- a/macosx/README +++ b/macosx/README @@ -59,11 +59,6 @@ $pkg/Resources/Scripts/pkgIndex.tcl as well as the usual $pkg/pkgIndex.tcl. This allows building extensions as frameworks with all script files contained in the Resources/Scripts directory of the framework. -- [load]able binary extensions can linked as either ordinary shared libraries -(.dylib) or as MachO bundles (since 8.4.10/8.5a3); bundles have the advantage -that they are [load]ed more efficiently from a tcl VFS (no temporary copy to the -native filesystem required). - - The 'deploy' target of macosx/GNUmakefile installs the html manpages into the standard documentation location in the Tcl/Tk frameworks: Tcl.framework/Resources/Documentation/Reference/Tcl @@ -87,28 +82,6 @@ particular PATH may not be what you expect. (Wish started by LaunchServices inherits loginwindow's environment variables, which are essentially those set in $HOME/.MacOSX/environment.plist, and are unrelated to those set in your shell). -- TkAqua drawing is antialiased by default, but (outline) linewidth can be used -to control whether a line/shape is drawn antialiased. The antialiasing threshold -is 0 by default (i.e. antialias everything), it can be changed by setting - set tk::mac::CGAntialiasLimit <limit> -in your script before drawing, in which case lines (or shapes with outlines) -thinner than <limit> pixels will not be antialiased. - -- Text antialiasing by default uses the standard OS antialising settings. -Setting the global variable '::tk::mac::antialiasedtext' allows to control text -antialiasing from Tcl: a value of 1 enables AA, 0 disables AA and -1 restores -the default behaviour of respecting the OS settings. - -- Scrollbars: There are two scrollbar variants in Aqua, normal & small. The -normal scrollbar has a small dimension of 15, the small variant 11. -Access to the small variant was added in Tk 8.4.2. - -- The default metrics of native buttons, radiobuttons, checkboxes and -menubuttons in the Cocoa-based Tk 8.5.7 and later preserve compatibility with -the older Carbon-based implementation, you can turn off the compatibility -metrics to get more native-looking spacing by setting: - set tk::mac::useCompatibilityMetrics 0 - - TkAqua provides access to native OS X images via the Tk native bitmap facility (including any image file readable by NSImage). A native bitmap name is interpreted as follows (in order): @@ -336,9 +309,7 @@ corresponding depth. 5. Building Tcl/Tk on macOS ------------------------------ -- At least macOS 10.3 is required to build Tcl and TkX11, and macOS 10.6 -is required to build TkAqua. The XCode application provides everything -needed to build Tk, but it is not necessary to install the full XCode. +- macOS 10.6 is required to build TkAqua and TkX11. The XCode application provides everything needed to build Tk, but it is not necessary to install the full XCode. It suffices to install the Command Line Tools package, which can be done by running the command: xcode-select --install @@ -397,17 +368,6 @@ need to manually change the TCL_SRCROOT and TK_SRCROOT settings by editing your ${USER}.pbxuser file (located inside the Tk.xcodeproj bundle directory) with a text editor. -- To build universal binaries outside of the Xcode IDE, set CFLAGS as follows: - export CFLAGS="-arch i386 -arch x86_64 -arch ppc" -This requires macOS 10.4 and Xcode 2.4 (or Xcode 2.2 if -arch x86_64 is -omitted, but _not_ Xcode 2.1) and will work on any architecture (on PowerPC -Tiger you need to add "-isysroot /Developer/SDKs/MacOSX10.4u.sdk"). -Note that configure requires CFLAGS to contain a least one architecture that can -be run on the build machine (i.e. ppc on G3/G4, ppc or ppc64 on G5, ppc or i386 -on Core and ppc, i386 or x86_64 on Core2/Xeon). -Universal builds of Tcl TEA extensions are also possible with CFLAGS set as -above, they will be [load]able by universal as well as thin binaries of Tcl. - - To enable weak-linking, set the MACOSX_DEPLOYMENT_TARGET environment variable to the minimal OS version the binaries should be able to run on, e.g: export MACOSX_DEPLOYMENT_TARGET=10.6 @@ -713,3 +673,54 @@ take on the appropriate appearance when the system appearance is changed. Because the window content itself is drawn by Tk, it will not change when the system mode changes. + +7.0 Mac Services +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +With 8.6.10, Tk supports the Mac's NSServices API, documented at +https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/SysServices/introduction.html#//apple_ref/doc/uid/10000101-SW1 +and in TIP 536 and Tk's man page. Tk presents a simple, +straightforward API to implement the Services functionality. + +The Tk implementation of the NSServices API is intended for standalone +applications, such as one wrapped by the standalone version of Wish +and re-named into a different application. In particular such an +application would specify its own unique CFBundleIdentifier in its +Info.plist file. During development, however, if Wish itself is being +used as the receiver, it may be necessary to take some care to ensure +that the correct version of Wish.app is available as a receiver of +NSServices data. + +When one macOS app uses NSServices to send data to another app that is +not running, LaunchServices will launch the receiver. LaunchServices +assumes that the CFBundleIdentifier uniquely identifies an app among +all of the apps installed on a system. But this may not be the case +for Wish.app if, for example, you have compiled Tk from source at some +time in the past. In that case the Tk build directory will contain +its own copy of Wish.app that will be visible to LaunchServices. It +may be necessary when testing your app to take some steps to ensure +that LaunchServices is launching the correct Wish.app. Instructions +for doing this are provided below. + +The command line tool which manages the LaunchServices database has +an amazingly unwieldy path name. So, first, run this command: + +alias lsregister='/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister' + +Then you can reset the LaunchServices database like this: + +$ lsregister -kill +$ lsregister -seed + +To find out which versions of Wish.app have been located by +LaunchServices, run: + +$ lsregister -dump | grep path | grep Wish + +If more than one version of Wish is showing up in this list, eliminate +all of the unintended targets by running + +lsregister -u /path/to/bad/Wish.app + +Continue this until only the correct version of Wish shows up in the +list. diff --git a/macosx/Wish-Info.plist.in b/macosx/Wish-Info.plist.in index d2fc388..d6f48e9 100644 --- a/macosx/Wish-Info.plist.in +++ b/macosx/Wish-Info.plist.in @@ -36,6 +36,19 @@ <string>Viewer</string> </dict> </array> + <key>CFBundleURLTypes</key> + <array> + <dict> + <key>CFBundleTypeRole</key> + <string>Viewer</string> + <key>CFBundleURLSchemes</key> + <array> + <string>foo</string> + </array> + <key>CFBundleURLName</key> + <string>Get Foo</string> + </dict> + </array> <key>CFBundleExecutable</key> <string>Wish</string> <key>CFBundleGetInfoString</key> @@ -78,5 +91,26 @@ <string>Wish.sdef</string> <key>NSHighResolutionCapable</key> <string>True</string> + <key>NSServices</key> + <array> + <dict> + <key>NSMenuItem</key> + <dict> + <key>default</key> + <string>Wish: Display Test Data</string> + </dict> + <key>NSMessage</key> + <string>provideService</string> + <key>NSPortName</key> + <string>Wish</string> + + <key>NSSendTypes</key> + <array> + <string>NSStringPboardType</string> + <string>NSPasteboardTypeString</string> + </array> + </dict> + </array> + </dict> </plist> diff --git a/macosx/Wish.sdef b/macosx/Wish.sdef index 8873e95..6639f70 100644 --- a/macosx/Wish.sdef +++ b/macosx/Wish.sdef @@ -33,5 +33,14 @@ <type type="text"/> </result> </command> + <command name="open location" code="GURLGURL" + description="Open a URL."> + <direct-parameter description="URL" type="text"> + <type type="text"/> + </direct-parameter> + <result description="Result"> + <type type="text"/> + </result> + </command> </suite> </dictionary> diff --git a/macosx/tkMacOSXHLEvents.c b/macosx/tkMacOSXHLEvents.c index 8f04e45..fa52613 100644 --- a/macosx/tkMacOSXHLEvents.c +++ b/macosx/tkMacOSXHLEvents.c @@ -105,8 +105,21 @@ static void RunSimpleTclCommand(Tcl_Interp *interp, - (void) handlePrintDocumentsEvent: (NSAppleEventDescriptor *)event withReplyEvent: (NSAppleEventDescriptor *)replyEvent { - tkMacOSXProcessFiles(event, replyEvent, _eventInterp, - "::tk::mac::PrintDocument"); + NSString* file = [[event paramDescriptorForKeyword:keyDirectObject] + stringValue]; + const char *printFile = [file UTF8String]; + Tcl_DString print; + + Tcl_DStringInit(&print); + if (Tcl_FindCommand(_eventInterp, "::tk::mac::PrintDocument", NULL, 0)) { + Tcl_DStringAppend(&print, "::tk::mac::PrintDocument", -1); + } + Tcl_DStringAppendElement(&print, printFile); + int tclErr = Tcl_EvalEx(_eventInterp, Tcl_DStringValue(&print), + Tcl_DStringLength(&print), TCL_EVAL_GLOBAL); + if (tclErr != TCL_OK) { + Tcl_BackgroundException(_eventInterp, tclErr); + } } - (void) handleDoScriptEvent: (NSAppleEventDescriptor *)event @@ -239,6 +252,27 @@ static void RunSimpleTclCommand(Tcl_Interp *interp, Tcl_Release(_eventInterp); return; } + +- (void)handleURLEvent:(NSAppleEventDescriptor*)event + withReplyEvent:(NSAppleEventDescriptor*)replyEvent +{ + NSString* url = [[event paramDescriptorForKeyword:keyDirectObject] + stringValue]; + const char *cURL = [url UTF8String]; + Tcl_DString launch; + + Tcl_DStringInit(&launch); + if (Tcl_FindCommand(_eventInterp, "::tk::mac::LaunchURL", NULL, 0)) { + Tcl_DStringAppend(&launch, "::tk::mac::LaunchURL", -1); + } + Tcl_DStringAppendElement(&launch, cURL); + int tclErr = Tcl_EvalEx(_eventInterp, Tcl_DStringValue(&launch), + Tcl_DStringLength(&launch), TCL_EVAL_GLOBAL); + if (tclErr != TCL_OK) { + Tcl_BackgroundException(_eventInterp, tclErr); + } +} + @end #pragma mark - @@ -423,12 +457,17 @@ TkMacOSXInitAppleEvents( forEventClass:kCoreEventClass andEventID:kAEOpenDocuments]; [aeManager setEventHandler:NSApp - andSelector:@selector(handleOpenDocumentsEvent:withReplyEvent:) + andSelector:@selector(handlePrintDocumentsEvent:withReplyEvent:) forEventClass:kCoreEventClass andEventID:kAEPrintDocuments]; [aeManager setEventHandler:NSApp andSelector:@selector(handleDoScriptEvent:withReplyEvent:) forEventClass:kAEMiscStandards andEventID:kAEDoScript]; + + [aeManager setEventHandler:NSApp + andSelector:@selector(handleURLEvent:withReplyEvent:) + forEventClass:kInternetEventClass andEventID:kAEGetURL]; + } } diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c index b21e95e..3efe0c6 100644 --- a/macosx/tkMacOSXInit.c +++ b/macosx/tkMacOSXInit.c @@ -116,6 +116,7 @@ static char scriptPath[PATH_MAX + 1] = ""; -(void)applicationDidFinishLaunching:(NSNotification *)notification { + /* * It is not safe to force activation of the NSApp until this method is * called. Activating too early can cause the menu bar to be unresponsive. @@ -335,7 +336,7 @@ TkpInit( * immediately since the queue is empty. */ - Tcl_DoOneEvent(TCL_WINDOW_EVENTS| TCL_DONT_WAIT); + Tcl_DoOneEvent(TCL_WINDOW_EVENTS | TCL_DONT_WAIT); /* * If we don't have a TTY and stdin is a special character file of @@ -383,8 +384,19 @@ TkpInit( Tcl_CreateObjCommand(interp, "::tk::mac::standardAboutPanel", TkMacOSXStandardAboutPanelObjCmd, NULL, NULL); + Tcl_CreateObjCommand(interp, "::tk::mac::registerServiceWidget", + TkMacOSXRegisterServiceWidgetObjCmd, NULL, NULL); Tcl_CreateObjCommand(interp, "::tk::mac::iconBitmap", TkMacOSXIconBitmapObjCmd, NULL, NULL); + Tcl_CreateObjCommand(interp, "::tk::mac::GetAppPath", TkMacOSXGetAppPath,(ClientData)NULL, (Tcl_CmdDeleteProc *)NULL); + + /* + * Initialize the NSServices object here. Apple's docs say to do this + * in applicationDidFinishLaunching, but the Tcl interpreter is not + * initialized until this function call. + */ + + TkMacOSXServices_Init(interp); return TCL_OK; } @@ -425,7 +437,58 @@ TkpGetAppName( } Tcl_DStringAppend(namePtr, name, -1); } - + +/* + *---------------------------------------------------------------------- + * + * TkMacOSXGetAppPath -- + * + * Returns the path of the Wish application bundle. + * + * Results: + * Returns the application path. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ +int TkMacOSXGetAppPath( + ClientData cd, + Tcl_Interp *ip, + int objc, + Tcl_Obj *CONST objv[]) +{ + + CFURLRef mainBundleURL = CFBundleCopyBundleURL(CFBundleGetMainBundle()); + + + /* + * Convert the URL reference into a string reference. + */ + + CFStringRef appPath = CFURLCopyFileSystemPath(mainBundleURL, kCFURLPOSIXPathStyle); + + /* + * Get the system encoding method. + */ + + CFStringEncoding encodingMethod = CFStringGetSystemEncoding(); + + /* + * Convert the string reference into a C string. + */ + + char *path = (char *) CFStringGetCStringPtr(appPath, encodingMethod); + + Tcl_SetResult(ip, path, NULL); + + CFRelease(mainBundleURL); + CFRelease(appPath); + return TCL_OK; + +} + /* *---------------------------------------------------------------------- * diff --git a/macosx/tkMacOSXPrivate.h b/macosx/tkMacOSXPrivate.h index 5632d95..a67f894 100644 --- a/macosx/tkMacOSXPrivate.h +++ b/macosx/tkMacOSXPrivate.h @@ -234,7 +234,11 @@ MODULE_SCOPE int TkMacOSXIconBitmapObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); MODULE_SCOPE void TkMacOSXDrawSolidBorder(Tk_Window tkwin, GC gc, - int inset, int thickness); + int inset, int thickness); +MODULE_SCOPE int TkMacOSXServices_Init(Tcl_Interp *interp); +MODULE_SCOPE int TkMacOSXRegisterServiceWidgetObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); #pragma mark Private Objective-C Classes @@ -328,6 +332,8 @@ VISIBILITY_HIDDEN withReplyEvent: (NSAppleEventDescriptor *)replyEvent; - (void) handleDoScriptEvent: (NSAppleEventDescriptor *)event withReplyEvent: (NSAppleEventDescriptor *)replyEvent; +- (void)handleURLEvent: (NSAppleEventDescriptor*)event + withReplyEvent: (NSAppleEventDescriptor*)replyEvent; @end VISIBILITY_HIDDEN @@ -425,6 +431,8 @@ VISIBILITY_HIDDEN #endif /* _TKMACPRIV */ +int TkMacOSXGetAppPath(ClientData cd, Tcl_Interp *ip, int objc, Tcl_Obj *CONST objv[]); + /* * Local Variables: * mode: objc diff --git a/macosx/tkMacOSXServices.c b/macosx/tkMacOSXServices.c new file mode 100644 index 0000000..af40a91 --- /dev/null +++ b/macosx/tkMacOSXServices.c @@ -0,0 +1,241 @@ +/* + * tkMacOSXServices.c -- + * + * This file allows the integration of Tk and the Cocoa NSServices API. + * + * Copyright (c) 2010-2019 Kevin Walzer/WordTech Communications LLC. + * Copyright (c) 2010 Adrian Robert. + * + * See the file "license.terms" for information on usage and redistribution + * of this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +#include <CoreServices/CoreServices.h> +#include <tkInt.h> +#include <tkMacOSXInt.h> + +static Tcl_Interp *ServicesInterp; + +/* + * Event proc which calls the PerformService procedure + */ + +static int +ServicesEventProc( + Tcl_Event *event, + int flags) +{ + Tcl_GlobalEval(ServicesInterp, "::tk::mac::PerformService"); + return 1; +} + +/* + * Class declarations for TkService class. + */ + +@interface TkService : NSView { + +} + ++ (void) initialize; +- (void)provideService:(NSPasteboard *)pboard userData:(NSString *)data error:(NSString **)error; +- (id)validRequestorForSendType:(NSString *)sendType returnType:(NSString *)returnType; +- (BOOL)writeSelectionToPasteboard:(NSPasteboard *)pboard types:(NSArray *)types; + +@end + +/* + * Class methods. + */ + +@implementation TkService + ++ (void) initialize { + NSArray *sendTypes = [NSArray arrayWithObjects:@"NSStringPboardType", + @"NSPasteboardTypeString", nil]; + [NSApp registerServicesMenuSendTypes:sendTypes returnTypes:sendTypes]; + NSUpdateDynamicServices(); + return; +} + + +- (id)validRequestorForSendType:(NSString *)sendType + returnType:(NSString *)returnType +{ + if ([sendType isEqualToString:@"NSStringPboardType"] || + [sendType isEqualToString:@"NSPasteboardTypeString"]) { + return self; + } + return [super validRequestorForSendType:sendType returnType:returnType]; +} + +/* + * Make sure the view accepts events. + */ + +- (BOOL)acceptsFirstResponder +{ + return YES; +} +- (BOOL)becomeFirstResponder +{ + return YES; +} + +/* + * Get selected text, copy to pasteboard. + */ + +- (BOOL)writeSelectionToPasteboard:(NSPasteboard *)pboard + types:(NSArray *)types +{ + NSArray *typesDeclared = nil; + NSString *pboardType = nil; + + for (NSString *typeString in types) { + if ([typeString isEqualToString:@"NSStringPboardType"] || + [typeString isEqualToString:@"NSPasteboardTypeString"]) { + typesDeclared = [NSArray arrayWithObject:typeString]; + pboardType = typeString; + break; + } + } + if (!typesDeclared) { + return NO; + } + Tcl_Eval(ServicesInterp, "selection get"); + + char *copystring = Tcl_GetString(Tcl_GetObjResult(ServicesInterp)); + NSString *writestring = [NSString stringWithUTF8String:copystring]; + + [pboard declareTypes:typesDeclared owner:nil]; + return [pboard setString:writestring forType:pboardType]; +} + +/* + * This is the method that actually calls the Tk service; this is the method + * that must be defined in info.plist. + */ + +- (void)provideService:(NSPasteboard *)pboard + userData:(NSString *)data + error:(NSString **)error +{ + NSString *pboardString, *pboardType; + NSArray *types = [pboard types]; + Tcl_Event *event; + + /* + * Get string from private pasteboard, write to general pasteboard to make + * available to Tcl service. + */ + + for (NSString *typeString in types) { + if ([typeString isEqualToString:@"NSStringPboardType"] || + [typeString isEqualToString:@"NSPasteboardTypeString"]) { + pboardString = [pboard stringForType:typeString]; + pboardType = typeString; + break; + } + } + if (pboardString) { + NSPasteboard *generalpasteboard = [NSPasteboard generalPasteboard]; + [generalpasteboard declareTypes:[NSArray arrayWithObjects:pboardType, nil] + owner:nil]; + [generalpasteboard setString:pboardString forType:pboardType]; + event = ckalloc(sizeof(Tcl_Event)); + event->proc = ServicesEventProc; + Tcl_QueueEvent((Tcl_Event *)event, TCL_QUEUE_TAIL); + } +} +@end + +/* + * Register a specific widget to access the Services menu. + */ + +int +TkMacOSXRegisterServiceWidgetObjCmd( + ClientData cd, + Tcl_Interp *ip, + int objc, + Tcl_Obj *CONST objv[]) +{ + /* + * Need proper number of args. + */ + + if (objc != 2) { + Tcl_WrongNumArgs(ip, 1, objv, "path?"); + return TCL_ERROR; + } + + /* + * Get the object that holds this Tk Window... + */ + + Rect bounds; + NSRect frame; + Tk_Window path = + Tk_NameToWindow(ip, Tcl_GetString(objv[1]), Tk_MainWindow(ip)); + + if (path == NULL) { + return TCL_ERROR; + } + + Tk_MakeWindowExist(path); + Tk_MapWindow(path); + Drawable d = Tk_WindowId(path); + + /* + * Get NSView from Tk window and add subview. + */ + + TkService *serviceview = [[TkService alloc] init]; + NSView *view = TkMacOSXGetRootControl(d); + + if ([serviceview superview] != view) { + [view addSubview:serviceview]; + } + TkMacOSXWinBounds((TkWindow*)path, &bounds); + + /* + * Hack to make sure subview is set to take up entire geometry of window. + */ + + frame = NSMakeRect(bounds.left, bounds.top, 100000, 100000); + frame.origin.y = 0; + if (!NSEqualRects(frame, [serviceview frame])) { + [serviceview setFrame:frame]; + } + [serviceview release]; + return TCL_OK; +} + +/* + * Initalize the package in the Tcl interpreter, create Tcl commands. + */ + +int +TkMacOSXServices_Init( + Tcl_Interp *interp) +{ + /* + * Initialize instance of TclServices to provide service functionality. + */ + + TkService *service = [[TkService alloc] init]; + + ServicesInterp = interp; + [NSApp setServicesProvider:service]; + return TCL_OK; +} + +/* + * Local Variables: + * mode: objc + * c-basic-offset: 4 + * fill-column: 79 + * coding: utf-8 + * End: + */ diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index b090ff2..767b9b4 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -2781,8 +2781,6 @@ WmManageCmd( Tk_MakeWindowExist((Tk_Window) winPtr); macWin = (MacDrawable *) winPtr->window; } - TkWmMapWindow(winPtr); - Tk_UnmapWindow(frameWin); } wmPtr = winPtr->wmInfoPtr; winPtr->flags &= ~TK_MAPPED; @@ -2793,6 +2791,7 @@ WmManageCmd( winPtr->flags |= (TK_TOP_HIERARCHY|TK_TOP_LEVEL|TK_HAS_WRAPPER|TK_WIN_MANAGED); TkMapTopFrame(frameWin); + TkWmMapWindow(winPtr); } else if (Tk_IsTopLevel(frameWin)) { /* Already managed by wm - ignore it */ } diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c index c33e8c9..66cd611 100644 --- a/macosx/ttkMacOSXTheme.c +++ b/macosx/ttkMacOSXTheme.c @@ -1656,9 +1656,9 @@ typedef struct { static Ttk_ElementOptionSpec EntryElementOptions[] = { {"-background", TK_OPTION_BORDER, - Tk_Offset(EntryElement, backgroundObj), ENTRY_DEFAULT_BACKGROUND}, + offsetof(EntryElement, backgroundObj), ENTRY_DEFAULT_BACKGROUND}, {"-fieldbackground", TK_OPTION_BORDER, - Tk_Offset(EntryElement, fieldbackgroundObj), ENTRY_DEFAULT_BACKGROUND}, + offsetof(EntryElement, fieldbackgroundObj), ENTRY_DEFAULT_BACKGROUND}, {0} }; @@ -2016,10 +2016,10 @@ typedef struct { } TrackElement; static Ttk_ElementOptionSpec TrackElementOptions[] = { - {"-from", TK_OPTION_DOUBLE, Tk_Offset(TrackElement, fromObj)}, - {"-to", TK_OPTION_DOUBLE, Tk_Offset(TrackElement, toObj)}, - {"-value", TK_OPTION_DOUBLE, Tk_Offset(TrackElement, valueObj)}, - {"-orient", TK_OPTION_STRING, Tk_Offset(TrackElement, orientObj)}, + {"-from", TK_OPTION_DOUBLE, offsetof(TrackElement, fromObj)}, + {"-to", TK_OPTION_DOUBLE, offsetof(TrackElement, toObj)}, + {"-value", TK_OPTION_DOUBLE, offsetof(TrackElement, valueObj)}, + {"-orient", TK_OPTION_STRING, offsetof(TrackElement, orientObj)}, {0, 0, 0} }; static void TrackElementSize( @@ -2151,15 +2151,15 @@ typedef struct { static Ttk_ElementOptionSpec PbarElementOptions[] = { {"-orient", TK_OPTION_STRING, - Tk_Offset(PbarElement, orientObj), "horizontal"}, + offsetof(PbarElement, orientObj), "horizontal"}, {"-value", TK_OPTION_DOUBLE, - Tk_Offset(PbarElement, valueObj), "0"}, + offsetof(PbarElement, valueObj), "0"}, {"-maximum", TK_OPTION_DOUBLE, - Tk_Offset(PbarElement, maximumObj), "100"}, + offsetof(PbarElement, maximumObj), "100"}, {"-phase", TK_OPTION_INT, - Tk_Offset(PbarElement, phaseObj), "0"}, + offsetof(PbarElement, phaseObj), "0"}, {"-mode", TK_OPTION_STRING, - Tk_Offset(PbarElement, modeObj), "determinate"}, + offsetof(PbarElement, modeObj), "determinate"}, {0, 0, 0, 0} }; static void PbarElementSize( @@ -2248,7 +2248,7 @@ typedef struct static Ttk_ElementOptionSpec ScrollbarElementOptions[] = { {"-orient", TK_OPTION_STRING, - Tk_Offset(ScrollbarElement, orientObj), "horizontal"}, + offsetof(ScrollbarElement, orientObj), "horizontal"}, {0, 0, 0, 0} }; static void TroughElementSize( @@ -2764,7 +2764,7 @@ typedef struct { static Ttk_ElementOptionSpec FieldElementOptions[] = { {"-fieldbackground", TK_OPTION_BORDER, - Tk_Offset(FieldElement, backgroundObj), "white"}, + offsetof(FieldElement, backgroundObj), "white"}, {NULL, 0, 0, NULL} }; diff --git a/unix/Makefile.in b/unix/Makefile.in index c89fefe..1f5db9e 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -396,10 +396,11 @@ AQUA_OBJS = tkMacOSXBitmap.o tkMacOSXButton.o tkMacOSXClipboard.o \ tkMacOSXColor.o tkMacOSXConfig.o tkMacOSXCursor.o tkMacOSXDebug.o \ tkMacOSXDialog.o tkMacOSXDraw.o tkMacOSXEmbed.o tkMacOSXEntry.o \ tkMacOSXEvent.o tkMacOSXFont.o tkMacOSXHLEvents.o tkMacOSXImage.o \ - tkMacOSXInit.o tkMacOSXKeyboard.o tkMacOSXKeyEvent.o tkMacOSXMenu.o \ + tkMacOSXInit.o tkMacOSXKeyboard.o tkMacOSXKeyEvent.o \ + tkMacOSXMenu.o \ tkMacOSXMenubutton.o tkMacOSXMenus.o tkMacOSXMouseEvent.o \ tkMacOSXNotify.o tkMacOSXRegion.o tkMacOSXScrlbr.o tkMacOSXSend.o \ - tkMacOSXSubwindows.o tkMacOSXWindowEvent.o \ + tkMacOSXServices.o tkMacOSXSubwindows.o tkMacOSXWindowEvent.o \ tkMacOSXWm.o tkMacOSXXStubs.o \ tkFileFilter.o tkMacWinMenu.o tkPointer.o tkUnix3d.o tkUnixScale.o \ xcolors.o xdraw.o xgc.o ximage.o xutil.o \ @@ -524,10 +525,12 @@ AQUA_SRCS = \ $(MAC_OSX_DIR)/tkMacOSXFont.c $(MAC_OSX_DIR)/tkMacOSXHLEvents.c \ $(MAC_OSX_DIR)/tkMacOSXImage.c \ $(MAC_OSX_DIR)/tkMacOSXInit.c $(MAC_OSX_DIR)/tkMacOSXKeyboard.c \ - $(MAC_OSX_DIR)/tkMacOSXKeyEvent.c $(MAC_OSX_DIR)/tkMacOSXMenu.c \ + $(MAC_OSX_DIR)/tkMacOSXKeyEvent.c \ + $(MAC_OSX_DIR)/tkMacOSXMenu.c \ $(MAC_OSX_DIR)/tkMacOSXMenubutton.c $(MAC_OSX_DIR)/tkMacOSXMenus.c \ $(MAC_OSX_DIR)/tkMacOSXMouseEvent.c $(MAC_OSX_DIR)/tkMacOSXNotify.c \ $(MAC_OSX_DIR)/tkMacOSXRegion.c $(MAC_OSX_DIR)/tkMacOSXScrlbr.c \ + $(MAC_OSX_DIR)/tkMacOSXServices.c \ $(MAC_OSX_DIR)/tkMacOSXSend.c $(MAC_OSX_DIR)/tkMacOSXSubwindows.c \ $(MAC_OSX_DIR)/tkMacOSXTest.c $(MAC_OSX_DIR)/tkMacOSXWindowEvent.c \ $(MAC_OSX_DIR)/tkMacOSXWm.c $(MAC_OSX_DIR)/tkMacOSXXStubs.c \ @@ -1348,6 +1351,9 @@ tkMacOSXScrlbr.o: $(MAC_OSX_DIR)/tkMacOSXScrlbr.c tkMacOSXSend.o: $(MAC_OSX_DIR)/tkMacOSXSend.c $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXSend.c +tkMacOSXServices.o: $(MAC_OSX_DIR)/tkMacOSXServices.c + $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXServices.c + tkMacOSXSubwindows.o: $(MAC_OSX_DIR)/tkMacOSXSubwindows.c $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXSubwindows.c diff --git a/unix/configure b/unix/configure index 66b1581..71bb0b4 100755 --- a/unix/configure +++ b/unix/configure @@ -740,7 +740,6 @@ infodir docdir oldincludedir includedir -runstatedir localstatedir sharedstatedir sysconfdir @@ -830,7 +829,6 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' -runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -1083,15 +1081,6 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; - -runstatedir | --runstatedir | --runstatedi | --runstated \ - | --runstate | --runstat | --runsta | --runst | --runs \ - | --run | --ru | --r) - ac_prev=runstatedir ;; - -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ - | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ - | --run=* | --ru=* | --r=*) - runstatedir=$ac_optarg ;; - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1229,7 +1218,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir runstatedir + libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1382,7 +1371,6 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] diff --git a/unix/tkUnixWm.c b/unix/tkUnixWm.c index a0adbde..d06f38a 100644 --- a/unix/tkUnixWm.c +++ b/unix/tkUnixWm.c @@ -36,7 +36,7 @@ typedef struct ProtocolHandler { } ProtocolHandler; #define HANDLER_SIZE(cmdLength) \ - (Tk_Offset(ProtocolHandler, command) + 1 + cmdLength) + (offsetof(ProtocolHandler, command) + 1 + cmdLength) /* * Data for [wm attributes] command: diff --git a/win/tkWinWm.c b/win/tkWinWm.c index 1337cbc..6c8e613 100644 --- a/win/tkWinWm.c +++ b/win/tkWinWm.c @@ -66,7 +66,7 @@ typedef struct ProtocolHandler { } ProtocolHandler; #define HANDLER_SIZE(cmdLength) \ - (Tk_Offset(ProtocolHandler, command) + 1 + cmdLength) + (offsetof(ProtocolHandler, command) + 1 + cmdLength) /* * Helper type passed via lParam to TkWmStackorderToplevelEnumProc diff --git a/win/ttkWinTheme.c b/win/ttkWinTheme.c index 63e9704..ad3c94e 100644 --- a/win/ttkWinTheme.c +++ b/win/ttkWinTheme.c @@ -188,7 +188,7 @@ typedef struct { } BorderElement; static Ttk_ElementOptionSpec BorderElementOptions[] = { - { "-relief",TK_OPTION_RELIEF,Tk_Offset(BorderElement,reliefObj), "flat" }, + { "-relief",TK_OPTION_RELIEF, offsetof(BorderElement,reliefObj), "flat" }, {NULL, 0, 0, NULL} }; @@ -239,7 +239,7 @@ typedef struct { static Ttk_ElementOptionSpec FieldElementOptions[] = { { "-fieldbackground", TK_OPTION_BORDER, - Tk_Offset(FieldElement,backgroundObj), "white" }, + offsetof(FieldElement,backgroundObj), "white" }, { NULL, 0, 0, NULL } }; @@ -290,11 +290,11 @@ typedef struct { static Ttk_ElementOptionSpec ButtonBorderElementOptions[] = { { "-relief",TK_OPTION_RELIEF, - Tk_Offset(ButtonBorderElement,reliefObj), "flat" }, + offsetof(ButtonBorderElement,reliefObj), "flat" }, { "-highlightcolor",TK_OPTION_COLOR, - Tk_Offset(ButtonBorderElement,highlightColorObj), "black" }, + offsetof(ButtonBorderElement,highlightColorObj), "black" }, { "-default", TK_OPTION_ANY, - Tk_Offset(ButtonBorderElement,defaultStateObj), "disabled" }, + offsetof(ButtonBorderElement,defaultStateObj), "disabled" }, {NULL, 0, 0, NULL} }; @@ -418,7 +418,7 @@ typedef struct { static Ttk_ElementOptionSpec FillFocusElementOptions[] = { { "-focusfill", TK_OPTION_COLOR, - Tk_Offset(FillFocusElement,fillColorObj), "white" }, + offsetof(FillFocusElement,fillColorObj), "white" }, {NULL, 0, 0, NULL} }; @@ -542,7 +542,7 @@ typedef struct { } ThumbElement; static Ttk_ElementOptionSpec ThumbElementOptions[] = { - { "-orient", TK_OPTION_ANY,Tk_Offset(ThumbElement,orientObj),"horizontal"}, + { "-orient", TK_OPTION_ANY, offsetof(ThumbElement,orientObj),"horizontal"}, { NULL, 0, 0, NULL } }; @@ -598,7 +598,7 @@ typedef struct { } SliderElement; static Ttk_ElementOptionSpec SliderElementOptions[] = { - { "-orient", TK_OPTION_ANY, Tk_Offset(SliderElement,orientObj), + { "-orient", TK_OPTION_ANY, offsetof(SliderElement,orientObj), "horizontal" }, { NULL, 0, 0, NULL } }; diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c index e217149..55446c5 100644 --- a/win/ttkWinXPTheme.c +++ b/win/ttkWinXPTheme.c @@ -811,9 +811,9 @@ typedef struct static Ttk_ElementOptionSpec TextElementOptions[] = { { "-text", TK_OPTION_STRING, - Tk_Offset(TextElement,textObj), "" }, + offsetof(TextElement,textObj), "" }, { "-font", TK_OPTION_FONT, - Tk_Offset(TextElement,fontObj), DEFAULT_FONT }, + offsetof(TextElement,fontObj), DEFAULT_FONT }, { NULL } }; |