diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-05-05 16:05:36 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-05-05 16:05:36 (GMT) |
commit | 5e41db84e2043ca8817733c622921f98c717fd92 (patch) | |
tree | 880c1466bb94733181fb7fe8eebf60c34dee5a0b /generic/tkConfig.c | |
parent | 0c947e17b940f7e248ede64d81449329cd8b1991 (diff) | |
parent | 2469ec79a7eedc59f089fe069bb239daaf988a82 (diff) | |
download | tk-5e41db84e2043ca8817733c622921f98c717fd92.zip tk-5e41db84e2043ca8817733c622921f98c717fd92.tar.gz tk-5e41db84e2043ca8817733c622921f98c717fd92.tar.bz2 |
Merge 8.6
Diffstat (limited to 'generic/tkConfig.c')
-rw-r--r-- | generic/tkConfig.c | 180 |
1 files changed, 90 insertions, 90 deletions
diff --git a/generic/tkConfig.c b/generic/tkConfig.c index 21b8afc..c98f4d9 100644 --- a/generic/tkConfig.c +++ b/generic/tkConfig.c @@ -700,8 +700,8 @@ DoObjConfig( if (internalPtr != NULL) { if (optionPtr->specPtr->flags & TYPE_MASK) { if ((optionPtr->specPtr->flags & TYPE_MASK) == TYPE_FLAGS(char)) { - *((signed char *) oldInternalPtr) = *((signed char *) internalPtr); - *((signed char *) internalPtr) = newValue; + *((char *) oldInternalPtr) = *((char *) internalPtr); + *((char *) internalPtr) = newValue; } else if ((optionPtr->specPtr->flags & TYPE_MASK) == TYPE_FLAGS(short)) { *((short *) oldInternalPtr) = *((short *) internalPtr); *((short *) internalPtr) = newValue; @@ -1435,7 +1435,7 @@ Tk_RestoreSavedOptions( case TK_OPTION_STRING_TABLE: if (optionPtr->specPtr->flags & TYPE_MASK) { if ((optionPtr->specPtr->flags & TYPE_MASK) == TYPE_FLAGS(char)) { - *((signed char *) internalPtr) = *((signed char *) ptr); + *((char *) internalPtr) = *((char *) ptr); } else if ((optionPtr->specPtr->flags & TYPE_MASK) == TYPE_FLAGS(short)) { *((short *) internalPtr) = *((short *) ptr); } else { @@ -1895,26 +1895,25 @@ GetObjectForOption( * *recordPtr. */ Tk_Window tkwin) /* Window corresponding to recordPtr. */ { - Tcl_Obj *objPtr; - char *internalPtr; /* Points to internal value of option in - * record. */ - - internalPtr = recordPtr + optionPtr->specPtr->internalOffset; - objPtr = NULL; - switch (optionPtr->specPtr->type) { - case TK_OPTION_BOOLEAN: - objPtr = Tcl_NewIntObj(*((int *)internalPtr)); - break; - case TK_OPTION_INT: - objPtr = Tcl_NewIntObj(*((int *)internalPtr)); - break; - case TK_OPTION_DOUBLE: - objPtr = Tcl_NewDoubleObj(*((double *)internalPtr)); - break; - case TK_OPTION_STRING: - objPtr = Tcl_NewStringObj(*((char **)internalPtr), -1); - break; - case TK_OPTION_STRING_TABLE: { + Tcl_Obj *objPtr = NULL; + char *internalPtr; /* Points to internal value of option in record. */ + + if (optionPtr->specPtr->internalOffset >= 0) { + internalPtr = recordPtr + optionPtr->specPtr->internalOffset; + switch (optionPtr->specPtr->type) { + case TK_OPTION_BOOLEAN: + objPtr = Tcl_NewIntObj(*((int *)internalPtr)); + break; + case TK_OPTION_INT: + objPtr = Tcl_NewIntObj(*((int *)internalPtr)); + break; + case TK_OPTION_DOUBLE: + objPtr = Tcl_NewDoubleObj(*((double *)internalPtr)); + break; + case TK_OPTION_STRING: + objPtr = Tcl_NewStringObj(*((char **)internalPtr), -1); + break; + case TK_OPTION_STRING_TABLE: { int value; if (optionPtr->specPtr->flags & TYPE_MASK) { if ((optionPtr->specPtr->flags & TYPE_MASK) == TYPE_FLAGS(char)) { @@ -1931,89 +1930,90 @@ GetObjectForOption( objPtr = Tcl_NewStringObj(((char **) optionPtr->specPtr->clientData)[ value], -1); } + break; } - break; - case TK_OPTION_COLOR: { - XColor *colorPtr = *((XColor **)internalPtr); + case TK_OPTION_COLOR: { + XColor *colorPtr = *((XColor **)internalPtr); - if (colorPtr != NULL) { - objPtr = Tcl_NewStringObj(Tk_NameOfColor(colorPtr), -1); + if (colorPtr != NULL) { + objPtr = Tcl_NewStringObj(Tk_NameOfColor(colorPtr), -1); + } + break; } - break; - } - case TK_OPTION_FONT: { - Tk_Font tkfont = *((Tk_Font *)internalPtr); + case TK_OPTION_FONT: { + Tk_Font tkfont = *((Tk_Font *)internalPtr); - if (tkfont != NULL) { - objPtr = Tcl_NewStringObj(Tk_NameOfFont(tkfont), -1); + if (tkfont != NULL) { + objPtr = Tcl_NewStringObj(Tk_NameOfFont(tkfont), -1); + } + break; } - break; - } - case TK_OPTION_STYLE: { - Tk_Style style = *((Tk_Style *)internalPtr); + case TK_OPTION_STYLE: { + Tk_Style style = *((Tk_Style *)internalPtr); - if (style != NULL) { - objPtr = Tcl_NewStringObj(Tk_NameOfStyle(style), -1); + if (style != NULL) { + objPtr = Tcl_NewStringObj(Tk_NameOfStyle(style), -1); + } + break; } - break; - } - case TK_OPTION_BITMAP: { - Pixmap pixmap = *((Pixmap *)internalPtr); + case TK_OPTION_BITMAP: { + Pixmap pixmap = *((Pixmap *)internalPtr); - if (pixmap != None) { - objPtr = Tcl_NewStringObj( - Tk_NameOfBitmap(Tk_Display(tkwin), pixmap), -1); + if (pixmap != None) { + objPtr = Tcl_NewStringObj( + Tk_NameOfBitmap(Tk_Display(tkwin), pixmap), -1); + } + break; } - break; - } - case TK_OPTION_BORDER: { - Tk_3DBorder border = *((Tk_3DBorder *)internalPtr); + case TK_OPTION_BORDER: { + Tk_3DBorder border = *((Tk_3DBorder *)internalPtr); - if (border != NULL) { - objPtr = Tcl_NewStringObj(Tk_NameOf3DBorder(border), -1); + if (border != NULL) { + objPtr = Tcl_NewStringObj(Tk_NameOf3DBorder(border), -1); + } + break; } - break; - } - case TK_OPTION_RELIEF: - objPtr = Tcl_NewStringObj(Tk_NameOfRelief(*((int *)internalPtr)), -1); - break; - case TK_OPTION_CURSOR: { - Tk_Cursor cursor = *((Tk_Cursor *)internalPtr); + case TK_OPTION_RELIEF: + objPtr = Tcl_NewStringObj(Tk_NameOfRelief(*((int *)internalPtr)), -1); + break; + case TK_OPTION_CURSOR: { + Tk_Cursor cursor = *((Tk_Cursor *)internalPtr); - if (cursor != NULL) { - objPtr = Tcl_NewStringObj( - Tk_NameOfCursor(Tk_Display(tkwin), cursor), -1); + if (cursor != NULL) { + objPtr = Tcl_NewStringObj( + Tk_NameOfCursor(Tk_Display(tkwin), cursor), -1); + } + break; } - break; - } - case TK_OPTION_JUSTIFY: - objPtr = Tcl_NewStringObj(Tk_NameOfJustify( - *((Tk_Justify *)internalPtr)), -1); - break; - case TK_OPTION_ANCHOR: - objPtr = Tcl_NewStringObj(Tk_NameOfAnchor( - *((Tk_Anchor *) internalPtr)), -1); - break; - case TK_OPTION_PIXELS: - objPtr = Tcl_NewIntObj(*((int *)internalPtr)); - break; - case TK_OPTION_WINDOW: { - tkwin = *((Tk_Window *)internalPtr); + case TK_OPTION_JUSTIFY: + objPtr = Tcl_NewStringObj(Tk_NameOfJustify( + *((Tk_Justify *)internalPtr)), -1); + break; + case TK_OPTION_ANCHOR: + objPtr = Tcl_NewStringObj(Tk_NameOfAnchor( + *((Tk_Anchor *)internalPtr)), -1); + break; + case TK_OPTION_PIXELS: + objPtr = Tcl_NewIntObj(*((int *)internalPtr)); + break; + case TK_OPTION_WINDOW: { + tkwin = *((Tk_Window *)internalPtr); - if (tkwin != NULL) { - objPtr = Tcl_NewStringObj(Tk_PathName(tkwin), -1); + if (tkwin != NULL) { + objPtr = Tcl_NewStringObj(Tk_PathName(tkwin), -1); + } + break; } - break; - } - case TK_OPTION_CUSTOM: { - const Tk_ObjCustomOption *custom = optionPtr->extra.custom; + case TK_OPTION_CUSTOM: { + const Tk_ObjCustomOption *custom = optionPtr->extra.custom; - objPtr = custom->getProc(custom->clientData, tkwin, recordPtr, - optionPtr->specPtr->internalOffset); - break; - } - default: - Tcl_Panic("bad option type in GetObjectForOption"); + objPtr = custom->getProc(custom->clientData, tkwin, recordPtr, + optionPtr->specPtr->internalOffset); + break; + } + default: + Tcl_Panic("bad option type in GetObjectForOption"); + } } if (objPtr == NULL) { objPtr = Tcl_NewObj(); |