summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2024-01-24 17:02:19 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2024-01-24 17:02:19 (GMT)
commitc719f5972f41a7a73b015d4f8bca1767d0c6e4d4 (patch)
tree0992659378448338222d380910e35907eb8171b6
parent0d7a766fd66325da73b747a5692ca44d42422709 (diff)
downloadtk-c719f5972f41a7a73b015d4f8bca1767d0c6e4d4.zip
tk-c719f5972f41a7a73b015d4f8bca1767d0c6e4d4.tar.gz
tk-c719f5972f41a7a73b015d4f8bca1767d0c6e4d4.tar.bz2
All TK_OPTION_PIXELS implementation need Tcl_Obj storage, otherwise the full option value will be lost, as proven by message-1.11 testcase
-rw-r--r--generic/tkMessage.c13
-rw-r--r--tests/message.test2
2 files changed, 10 insertions, 5 deletions
diff --git a/generic/tkMessage.c b/generic/tkMessage.c
index bfb10c2..cb37082 100644
--- a/generic/tkMessage.c
+++ b/generic/tkMessage.c
@@ -46,7 +46,7 @@ typedef struct {
*/
char *string; /* String displayed in message. */
- int numChars; /* Number of characters in string, not
+ Tcl_Size numChars; /* Number of characters in string, not
* including terminating NULL. */
char *textVarName; /* Name of variable (malloc'ed) or NULL.
* If non-NULL, message displays the contents
@@ -93,6 +93,11 @@ typedef struct {
* scripts. Malloc'ed, but may be NULL. */
int flags; /* Various flags; see below for
* definitions. */
+ Tcl_Obj *borderWidthObj; /* Width of border. */
+ Tcl_Obj *highlightWidthObj; /* Width in pixels of highlight to draw
+ * around widget when it has the focus. <= 0 means don't draw a highlight. */
+ Tcl_Obj *widthObj; /* User-requested width, in pixels. 0 means
+ * compute width using aspect ratio. */
} Message;
/*
@@ -127,7 +132,7 @@ static const Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL,
0, TCL_INDEX_NONE, 0, "-background", 0},
{TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
- DEF_MESSAGE_BORDER_WIDTH, TCL_INDEX_NONE,
+ DEF_MESSAGE_BORDER_WIDTH, offsetof(Message, borderWidthObj),
offsetof(Message, borderWidth), 0, 0, 0},
{TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor",
DEF_MESSAGE_CURSOR, TCL_INDEX_NONE, offsetof(Message, cursor),
@@ -145,7 +150,7 @@ static const Tk_OptionSpec optionSpecs[] = {
DEF_MESSAGE_HIGHLIGHT, TCL_INDEX_NONE, offsetof(Message, highlightColorPtr),
0, 0, 0},
{TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness",
- "HighlightThickness", DEF_MESSAGE_HIGHLIGHT_WIDTH, TCL_INDEX_NONE,
+ "HighlightThickness", DEF_MESSAGE_HIGHLIGHT_WIDTH, offsetof(Message, highlightWidthObj),
offsetof(Message, highlightWidth), 0, 0, 0},
{TK_OPTION_JUSTIFY, "-justify", "justify", "Justify",
DEF_MESSAGE_JUSTIFY, TCL_INDEX_NONE, offsetof(Message, justify), TK_OPTION_ENUM_VAR, 0, 0},
@@ -166,7 +171,7 @@ static const Tk_OptionSpec optionSpecs[] = {
DEF_MESSAGE_TEXT_VARIABLE, TCL_INDEX_NONE, offsetof(Message, textVarName),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_PIXELS, "-width", "width", "Width",
- DEF_MESSAGE_WIDTH, TCL_INDEX_NONE, offsetof(Message, width), 0, 0 ,0},
+ DEF_MESSAGE_WIDTH, offsetof(Message, widthObj), offsetof(Message, width), 0, 0 ,0},
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0}
};
diff --git a/tests/message.test b/tests/message.test
index 37e81b0..9018fc2 100644
--- a/tests/message.test
+++ b/tests/message.test
@@ -121,7 +121,7 @@ test message-1.11 {configuration option: "borderwidth"} -setup {
.m cget -borderwidth
} -cleanup {
destroy .m
-} -result 1
+} -result 1.3
test message-1.12 {configuration option: "borderwidth"} -setup {
message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .m