summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/onefiledist.yml2
-rw-r--r--doc/TextLayout.34
-rw-r--r--doc/canvas.n8
-rw-r--r--doc/dialog.n2
-rw-r--r--doc/entry.n2
-rw-r--r--doc/frame.n8
-rw-r--r--doc/labelframe.n4
-rw-r--r--doc/message.n2
-rw-r--r--doc/options.n2
-rw-r--r--doc/scale.n4
-rw-r--r--doc/scrollbar.n4
-rw-r--r--doc/spinbox.n2
-rw-r--r--doc/toplevel.n4
-rw-r--r--doc/ttk_entry.n2
-rw-r--r--doc/ttk_image.n4
-rw-r--r--doc/ttk_label.n2
-rw-r--r--doc/ttk_treeview.n4
-rw-r--r--generic/tk.h12
-rw-r--r--generic/tkCanvas.c2
-rw-r--r--generic/tkConfig.c254
-rw-r--r--generic/tkEntry.c2
-rw-r--r--generic/tkFont.c3
-rw-r--r--generic/tkFrame.c6
-rw-r--r--generic/tkImgBmap.c4
-rw-r--r--generic/tkImgGIF.c12
-rw-r--r--generic/tkImgPNG.c9
-rw-r--r--generic/tkImgPPM.c5
-rw-r--r--generic/tkImgPhoto.c13
-rw-r--r--generic/tkListbox.c116
-rw-r--r--generic/tkMenu.c120
-rw-r--r--generic/tkObj.c12
-rw-r--r--generic/tkOldConfig.c26
-rw-r--r--generic/tkOption.c10
-rw-r--r--generic/tkPack.c8
-rw-r--r--generic/tkPanedWindow.c130
-rw-r--r--generic/tkPlace.c100
-rw-r--r--generic/tkScrollbar.c10
-rw-r--r--generic/tkSelect.c8
-rw-r--r--generic/tkTextDisp.c2
-rw-r--r--generic/tkTextWind.c8
-rw-r--r--generic/tkWindow.c4
-rw-r--r--library/demos/cscroll.tcl116
-rw-r--r--library/demos/ctext.tcl6
-rw-r--r--library/demos/floor.tcl9
-rw-r--r--library/demos/items.tcl15
-rw-r--r--library/demos/widget2
-rw-r--r--library/tk.tcl18
-rw-r--r--macosx/README6
-rw-r--r--macosx/tkMacOSXClipboard.c4
-rw-r--r--macosx/tkMacOSXColor.c10
-rw-r--r--macosx/tkMacOSXDefault.h2
-rw-r--r--macosx/tkMacOSXDraw.c22
-rw-r--r--macosx/tkMacOSXEmbed.c10
-rw-r--r--macosx/tkMacOSXEvent.c16
-rw-r--r--macosx/tkMacOSXFileTypes.c6
-rw-r--r--macosx/tkMacOSXHLEvents.c90
-rw-r--r--macosx/tkMacOSXImage.c10
-rw-r--r--macosx/tkMacOSXInit.c62
-rw-r--r--macosx/tkMacOSXKeyEvent.c22
-rw-r--r--macosx/tkMacOSXKeyboard.c4
-rw-r--r--macosx/tkMacOSXMenu.c4
-rw-r--r--macosx/tkMacOSXMenubutton.c236
-rw-r--r--macosx/tkMacOSXMenus.c20
-rw-r--r--macosx/tkMacOSXMouseEvent.c4
-rw-r--r--macosx/tkMacOSXNotify.c4
-rw-r--r--macosx/tkMacOSXPrint.c208
-rw-r--r--macosx/tkMacOSXPrivate.h4
-rw-r--r--macosx/tkMacOSXScale.c10
-rw-r--r--macosx/tkMacOSXScrlbr.c6
-rw-r--r--macosx/tkMacOSXSubwindows.c14
-rw-r--r--macosx/tkMacOSXSysTray.c30
-rw-r--r--macosx/tkMacOSXTest.c44
-rw-r--r--macosx/tkMacOSXWindowEvent.c12
-rw-r--r--macosx/tkMacOSXWm.c54
-rw-r--r--macosx/ttkMacOSXTheme.c104
-rw-r--r--macosx/ttkMacOSXTheme.h2
-rw-r--r--tests/corruptTruncatedColormap.gifbin0 -> 10 bytes
-rw-r--r--tests/imgPhoto.test17
-rw-r--r--tests/textDisp.test2
-rw-r--r--tests/unixWm.test2
-rw-r--r--unix/tkUnixDefault.h2
-rw-r--r--unix/tkUnixMenubu.c2
-rw-r--r--unix/tkUnixScale.c2
-rw-r--r--unix/tkUnixScrlbr.c5
-rw-r--r--win/nmakehlp.c49
-rw-r--r--win/tkWinClipboard.c8
-rw-r--r--win/tkWinDefault.h2
-rw-r--r--win/tkWinDialog.c720
-rw-r--r--win/tkWinDraw.c24
-rw-r--r--win/tkWinEmbed.c10
-rw-r--r--win/tkWinGDI.c86
-rw-r--r--win/tkWinIco.c20
-rw-r--r--win/tkWinIco.h3
-rw-r--r--win/tkWinKey.c12
-rw-r--r--win/tkWinMenu.c38
-rw-r--r--win/tkWinPointer.c6
-rw-r--r--win/tkWinScrlbr.c4
-rw-r--r--win/tkWinSendCom.h6
-rw-r--r--win/tkWinSysTray.c806
-rw-r--r--win/tkWinTest.c58
-rw-r--r--win/tkWinWm.c5
-rw-r--r--win/tkWinX.c40
-rw-r--r--win/ttkWinXPTheme.c2
103 files changed, 2002 insertions, 2051 deletions
diff --git a/.github/workflows/onefiledist.yml b/.github/workflows/onefiledist.yml
index 2c707a4..0fbbdfd 100644
--- a/.github/workflows/onefiledist.yml
+++ b/.github/workflows/onefiledist.yml
@@ -76,7 +76,7 @@ jobs:
working-directory: ${{ env.INST_DIR }}
macos:
name: macOS
- runs-on: macos-11
+ runs-on: macos-12
defaults:
run:
shell: bash
diff --git a/doc/TextLayout.3 b/doc/TextLayout.3
index 5e83a7b..a5885b4 100644
--- a/doc/TextLayout.3
+++ b/doc/TextLayout.3
@@ -48,7 +48,7 @@ stored in the text layout. The \fIstring\fR must remain valid for the
lifetime of the text layout.
.AP int numChars in
The number of characters to consider from \fIstring\fR. If
-\fInumChars\fR is less than 0, then assumes \fIstring\fR is null
+\fInumChars\fR is negative, then assumes \fIstring\fR is null
terminated and uses \fBTcl_NumUtfChars\fR to determine the length of
\fIstring\fR.
.AP int wrapLength in
@@ -176,7 +176,7 @@ located at (0, 0). Any point whose \fIy\fR-value is less that 0 will be
considered closest to the first character in the text layout; any point
whose \fIy\fR-value is greater than the height of the text layout will be
considered closest to the last character in the text layout. Any point
-whose \fIx\fR-value is less than 0 will be considered closest to the first
+whose \fIx\fR-value is negative will be considered closest to the first
character on that line; any point whose \fIx\fR-value is greater than the
width of the text layout will be considered closest to the last character on
that line. The return value is the index of the character that was closest
diff --git a/doc/canvas.n b/doc/canvas.n
index 7484a6e..2942358 100644
--- a/doc/canvas.n
+++ b/doc/canvas.n
@@ -67,7 +67,7 @@ the canvas x coordinate at the left edge of the window is always an even
multiple of \fBxScrollIncrement\fR; furthermore, the units for scrolling
(e.g., the change in view when the left and right arrows of a scrollbar
are selected) will also be \fBxScrollIncrement\fR. If the value of
-this option is less than or equal to zero, then horizontal scrolling
+this option is negative or zero, then horizontal scrolling
is unconstrained.
.OP \-yscrollincrement yScrollIncrement ScrollIncrement
Specifies an increment for vertical scrolling, in any of the usual forms
@@ -77,7 +77,7 @@ the canvas y coordinate at the top edge of the window is always an even
multiple of \fByScrollIncrement\fR; furthermore, the units for scrolling
(e.g., the change in view when the top and bottom arrows of a scrollbar
are selected) will also be \fByScrollIncrement\fR. If the value of
-this option is less than or equal to zero, then vertical scrolling
+this option is negative or zero, then vertical scrolling
is unconstrained.
.BE
.SH INTRODUCTION
@@ -262,10 +262,10 @@ within the text item.
0 refers to the first character, 1 to the next character, and
so on. If indexes are odd for lines and polygons, they will be
automatically decremented by one.
-A number less than 0 is treated as if it were zero, and a
+A negative number is treated as if it were zero, and a
number greater than the length of the text item is treated
as if it were equal to the length of the text item. For
-polygons, numbers less than 0 or greater than the length
+polygons, negative numbers or numbers greater than the length
of the coordinate list will be adjusted by adding or subtracting
the length until the result is between zero and the length,
inclusive.
diff --git a/doc/dialog.n b/doc/dialog.n
index f1f63ef..ac0a73b 100644
--- a/doc/dialog.n
+++ b/doc/dialog.n
@@ -35,7 +35,7 @@ If this is an empty string then no bitmap is displayed in the dialog.
If this is an integer greater than or equal to zero, then it gives
the index of the button that is to be the default button for the dialog
(0 for the leftmost button, and so on).
-If less than zero or an empty string then there will not be any default
+If negative or an empty string then there will not be any default
button.
.IP \fIstring\fR
There will be one button for each of these arguments.
diff --git a/doc/entry.n b/doc/entry.n
index 747e99c..368ca42 100644
--- a/doc/entry.n
+++ b/doc/entry.n
@@ -77,7 +77,7 @@ See \fBVALIDATION\fR below for more information.
.OP \-width width Width
Specifies an integer value indicating the desired width of the entry window,
in average-size characters of the widget's font.
-If the value is less than or equal to zero, the widget picks a
+If the value is negative or zero, the widget picks a
size just large enough to hold its current text.
.BE
.SH DESCRIPTION
diff --git a/doc/frame.n b/doc/frame.n
index 078bac6..27d3b5a 100644
--- a/doc/frame.n
+++ b/doc/frame.n
@@ -66,8 +66,8 @@ Note that \fB\-borderwidth\fR, \fB\-padx\fR and \fB\-pady\fR are ignored when
configured as a container since a container has no border.
.OP \-height height Height
Specifies the desired height for the window in any of the forms
-acceptable to \fBTk_GetPixels\fR. If this option is less than or equal
-to zero then the window will not request any size at all. Note that this
+acceptable to \fBTk_GetPixels\fR. If this option is negative or
+zero then the window will not request any size at all. Note that this
sets the total height of the frame, any \fB\-borderwidth\fR or similar is
not added. Normally \fB\-height\fR should not be used if a propagating
geometry manager, such as \fBgrid\fR or \fBpack\fR, is used within the
@@ -90,8 +90,8 @@ The \fB\-visual\fR option may not be modified with the \fBconfigure\fR
widget command.
.OP \-width width Width
Specifies the desired width for the window in any of the forms
-acceptable to \fBTk_GetPixels\fR. If this option is less than or equal
-to zero then the window will not request any size at all. Note that this
+acceptable to \fBTk_GetPixels\fR. If this option is negative or
+zero then the window will not request any size at all. Note that this
sets the total width of the frame, any \fB\-borderwidth\fR or similar is
not added. Normally \fB\-width\fR should not be used if a propagating
geometry manager, such as \fBgrid\fR or \fBpack\fR, is used within the
diff --git a/doc/labelframe.n b/doc/labelframe.n
index 4d3aacb..5027d34 100644
--- a/doc/labelframe.n
+++ b/doc/labelframe.n
@@ -47,7 +47,7 @@ widget command.
.OP \-height height Height
Specifies the desired height for the window in any of the forms
acceptable to \fBTk_GetPixels\fR.
-If this option is less than or equal to zero then the window will
+If this option is negative or zero then the window will
not request any size at all.
.OP \-labelanchor labelAnchor LabelAnchor
Specifies where to place the label. A label is only displayed if the
@@ -71,7 +71,7 @@ widget command.
.OP \-width width Width
Specifies the desired width for the window in any of the forms
acceptable to \fBTk_GetPixels\fR.
-If this option is less than or equal to zero then the window will
+If this option is negative or zero then the window will
not request any size at all.
.BE
.SH DESCRIPTION
diff --git a/doc/message.n b/doc/message.n
index 95547c4..1ac1c02 100644
--- a/doc/message.n
+++ b/doc/message.n
@@ -57,7 +57,7 @@ The value may have any of the forms acceptable to \fBTk_GetPixels\fR.
If this option has a value greater than zero then the \fB\-aspect\fR
option is ignored and the \fB\-width\fR option determines the line
length.
-If this option has a value less than or equal to zero, then
+If this option value is negative or zero, then
the \fB\-aspect\fR option determines the line length.
.BE
.SH DESCRIPTION
diff --git a/doc/options.n b/doc/options.n
index f540c60..41bf565 100644
--- a/doc/options.n
+++ b/doc/options.n
@@ -325,7 +325,7 @@ Lines that would exceed this length are wrapped onto the next line,
so that no line is longer than the specified length.
The value may be specified in any of the standard forms for
screen distances.
-If this value is less than or equal to 0 then no wrapping is done: lines
+If this value is negative or zero then no wrapping is done: lines
will break only at newline characters in the text.
.OP \-xscrollcommand xScrollCommand ScrollCommand
Specifies the prefix for a command used to communicate with horizontal
diff --git a/doc/scale.n b/doc/scale.n
index 9aeb8c0..b73bd7f 100644
--- a/doc/scale.n
+++ b/doc/scale.n
@@ -36,7 +36,7 @@ new value of the scale.
.OP \-digits digits Digits
An integer specifying how many significant digits should be retained
when converting the value of the scale to a string.
-If the number is less than or equal to zero, then the scale picks
+If the number is negative or zero, then the scale picks
the smallest value that guarantees that every possible slider
position prints as a different string.
.OP \-from from From
@@ -56,7 +56,7 @@ it is the scale's width.
A real value specifying the resolution for the scale.
If this value is greater than zero then the scale's value will always be
rounded to an even multiple of this value, as will
-the endpoints of the scale. If the value is less than zero then no
+the endpoints of the scale. If the value is negative then no
rounding occurs. Defaults to 1 (i.e., the value will be integral).
.OP \-showvalue showValue ShowValue
Specifies a boolean value indicating whether or not the current
diff --git a/doc/scrollbar.n b/doc/scrollbar.n
index 0bbfb70..b7e177e 100644
--- a/doc/scrollbar.n
+++ b/doc/scrollbar.n
@@ -42,8 +42,8 @@ as described in \fBSCROLLING COMMANDS\fR below.
Specifies the width of borders drawn around the internal elements
of the scrollbar (the two arrows and the slider). The value may
have any of the forms acceptable to \fBTk_GetPixels\fR.
-If this value is less than zero, the value of the \fB\-borderwidth\fR
-option is used in its place.
+If this value is the empty string (the default), the value of
+the \fB\-borderwidth\fR option is used in its place.
.OP \-width width Width
Specifies the desired narrow dimension of the scrollbar window,
not including 3-D border, if any. For vertical
diff --git a/doc/spinbox.n b/doc/spinbox.n
index e7ed8e0..b90b822 100644
--- a/doc/spinbox.n
+++ b/doc/spinbox.n
@@ -109,7 +109,7 @@ option has precedence over the \fB\-from\fR and \fB\-to\fR range.
.OP \-width width Width
Specifies an integer value indicating the desired width of the spinbox window,
in average-size characters of the widget's font.
-If the value is less than or equal to zero, the widget picks a
+If the value is negative or zero, the widget picks a
size just large enough to hold its current text.
.OP \-wrap wrap wrap
Must be a proper boolean value. If on, the spinbox will wrap around the
diff --git a/doc/toplevel.n b/doc/toplevel.n
index d37faa2..701d383 100644
--- a/doc/toplevel.n
+++ b/doc/toplevel.n
@@ -68,7 +68,7 @@ widget command.
.OP \-height height Height
Specifies the desired height for the window in any of the forms
acceptable to \fBTk_GetPixels\fR.
-If this option is less than or equal to zero then the window will
+If this option is negative or zero then the window will
not request any size at all.
.OP \-menu menu Menu
Specifies a menu widget to be used as a menubar. On the Macintosh, the
@@ -113,7 +113,7 @@ widget command.
.OP \-width width Width
Specifies the desired width for the window in any of the forms
acceptable to \fBTk_GetPixels\fR.
-If this option is less than or equal to zero then the window will
+If this option is negative or zero then the window will
not request any size at all.
.BE
.SH DESCRIPTION
diff --git a/doc/ttk_entry.n b/doc/ttk_entry.n
index c4176ec..4f8e0a3 100644
--- a/doc/ttk_entry.n
+++ b/doc/ttk_entry.n
@@ -82,7 +82,7 @@ See \fBVALIDATION\fR below.
.OP \-width width Width
Specifies an integer value indicating the desired width of the entry window,
in average-size characters of the widget's font.
-.\" Not in ttk: If the value is less than or equal to zero, the widget picks a
+.\" Not in ttk: If the value is negative or zero, the widget picks a
.\" Not in ttk: size just large enough to hold its current text.
.SH NOTES
.PP
diff --git a/doc/ttk_image.n b/doc/ttk_image.n
index 09cf1f8..300a0e4 100644
--- a/doc/ttk_image.n
+++ b/doc/ttk_image.n
@@ -44,7 +44,7 @@ See \fBIMAGE STRETCHING\fR, below.
\fB\-height \fIheight\fR
.
Specifies a minimum height for the element.
-If less than zero, the base image's height is used as a default.
+If negative, the base image's height is used as a default.
.\" OPTION: -padding
.TP
\fB\-padding\fI padding\fR
@@ -76,7 +76,7 @@ or
\fB\-width \fIwidth\fR
.
Specifies a minimum width for the element.
-If less than zero, the base image's width is used as a default.
+If negative, the base image's width is used as a default.
.SH "IMAGE STRETCHING"
.PP
If the element's allocated parcel is larger than the image,
diff --git a/doc/ttk_label.n b/doc/ttk_label.n
index 149ef9b..49f6d6c 100644
--- a/doc/ttk_label.n
+++ b/doc/ttk_label.n
@@ -37,7 +37,7 @@ Valid values are
and \fBsunken\fR.
.OP \-wraplength wrapLength WrapLength
Specifies the maximum line length (in pixels).
-If this option is less than or equal to zero,
+If this option is negative or zero,
then automatic wrapping is not performed; otherwise
the text is split into lines such that no line is longer
than the specified value.
diff --git a/doc/ttk_treeview.n b/doc/ttk_treeview.n
index 05d9c75..404f95e 100644
--- a/doc/ttk_treeview.n
+++ b/doc/ttk_treeview.n
@@ -386,7 +386,7 @@ or the empty string \fB{}\fR
to create a new top-level item.
\fIindex\fR is an integer, or the value \fBend\fR, specifying where in the
list of \fIparent\fR's children to insert the new item.
-If \fIindex\fR is less than or equal to zero,
+If \fIindex\fR is negative or zero,
the new node is inserted at the beginning;
if \fIindex\fR is greater than or equal to the current number of children,
it is inserted at the end.
@@ -418,7 +418,7 @@ Moves \fIitem\fR to position \fIindex\fR in \fIparent\fR's list of children.
It is illegal to move an item under one of its descendants.
.RS
.PP
-If \fIindex\fR is less than or equal to zero, \fIitem\fR is moved
+If \fIindex\fR is negative or zero, \fIitem\fR is moved
to the beginning; if greater than or equal to the number of children,
it is moved to the end.
.RE
diff --git a/generic/tk.h b/generic/tk.h
index 7d7f2fe..016ea26 100644
--- a/generic/tk.h
+++ b/generic/tk.h
@@ -227,8 +227,12 @@ typedef struct Tk_OptionSpec {
* Tk_ConfigSpec structures, so be sure to coordinate any changes carefully.
*/
-#define TK_OPTION_NULL_OK (1 << 0)
#define TK_OPTION_DONT_SET_DEFAULT (1 << 3)
+#if TCL_MAJOR_VERSION > 8
+# define TK_OPTION_NULL_OK TCL_NULL_OK
+#else
+# define TK_OPTION_NULL_OK (1 << 0)
+#endif
#define TK_OPTION_VAR(type) ((sizeof(type) < 2 * sizeof(int)) ? ((int)(sizeof(type)&(sizeof(int)-1))<<6) : (3<<6))
#define TK_OPTION_ENUM_VAR TK_OPTION_VAR(Tk_OptionType)
@@ -409,10 +413,14 @@ typedef enum {
* (internal-use-only flags are defined there).
*/
-#define TK_CONFIG_NULL_OK (1 << 0)
#define TK_CONFIG_COLOR_ONLY (1 << 1)
#define TK_CONFIG_MONO_ONLY (1 << 2)
#define TK_CONFIG_DONT_SET_DEFAULT (1 << 3)
+#if TCL_MAJOR_VERSION > 8
+# define TK_CONFIG_NULL_OK TCL_NULL_OK
+#else
+# define TK_CONFIG_NULL_OK (1 << 0)
+#endif
#define TK_CONFIG_USER_BIT 0x100
#endif /* __NO_OLD_CONFIG */
diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c
index aa3fca3..879cf27 100644
--- a/generic/tkCanvas.c
+++ b/generic/tkCanvas.c
@@ -3196,7 +3196,7 @@ DisplayCanvas(
Tk_Height(tkwin) - 2*canvasPtr->highlightWidth,
canvasPtr->borderWidth, canvasPtr->relief);
}
- if (canvasPtr->highlightWidth != 0) {
+ if (canvasPtr->highlightWidth > 0) {
GC fgGC, bgGC;
bgGC = Tk_GCForColor(canvasPtr->highlightBgColorPtr,
diff --git a/generic/tkConfig.c b/generic/tkConfig.c
index 7362831..3336467 100644
--- a/generic/tkConfig.c
+++ b/generic/tkConfig.c
@@ -215,7 +215,7 @@ Tk_CreateOptionTable(
* reuse the existing table.
*/
- hashEntryPtr = Tcl_CreateHashEntry(&tsdPtr->hashTable, (char *) templatePtr,
+ hashEntryPtr = Tcl_CreateHashEntry(&tsdPtr->hashTable, (char *)templatePtr,
&newEntry);
if (!newEntry) {
tablePtr = (OptionTable *)Tcl_GetHashValue(hashEntryPtr);
@@ -262,7 +262,7 @@ Tk_CreateOptionTable(
Tcl_Panic("Tk_CreateOptionTable couldn't find synonym");
}
if (strcmp(specPtr2->optionName,
- (char *) specPtr->clientData) == 0) {
+ (char *)specPtr->clientData) == 0) {
optionPtr->extra.synonymPtr = tablePtr->options + i;
break;
}
@@ -621,11 +621,11 @@ DoObjConfig(
if (savedOptionPtr != NULL) {
savedOptionPtr->optionPtr = optionPtr;
savedOptionPtr->valuePtr = oldPtr;
- oldInternalPtr = (char *) &savedOptionPtr->internalForm;
+ oldInternalPtr = (char *)&savedOptionPtr->internalForm;
} else {
- oldInternalPtr = (char *) &internal.internalForm;
+ oldInternalPtr = (char *)&internal.internalForm;
}
- nullOK = (optionPtr->specPtr->flags & (TK_OPTION_NULL_OK|TCL_NULL_OK));
+ nullOK = (optionPtr->specPtr->flags & (TK_OPTION_NULL_OK|TCL_NULL_OK|1));
switch (optionPtr->specPtr->type) {
case TK_OPTION_BOOLEAN: {
int newBool;
@@ -643,17 +643,17 @@ DoObjConfig(
if (internalPtr != NULL) {
if (optionPtr->specPtr->flags & TYPE_MASK) {
if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(char)) {
- *((char *) oldInternalPtr) = *((char *) internalPtr);
- *((char *) internalPtr) = (char)newBool;
+ *((char *)oldInternalPtr) = *((char *)internalPtr);
+ *((char *)internalPtr) = (char)newBool;
} else if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(short)) {
- *((short *) oldInternalPtr) = *((short *) internalPtr);
- *((short *) internalPtr) = (short)newBool;
+ *((short *)oldInternalPtr) = *((short *)internalPtr);
+ *((short *)internalPtr) = (short)newBool;
} else {
Tcl_Panic("Invalid flags for %s", "TK_OPTION_BOOLEAN");
}
} else {
- *((int *) oldInternalPtr) = *((int *) internalPtr);
- *((int *) internalPtr) = newBool;
+ *((int *)oldInternalPtr) = *((int *)internalPtr);
+ *((int *)internalPtr) = newBool;
}
}
break;
@@ -670,13 +670,13 @@ DoObjConfig(
if (nullOK && interp) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"expected integer or \"\" but got \"%.50s\"", Tcl_GetString(valuePtr)));
- Tcl_SetErrorCode(interp, "TCL", "VALUE", "NUMBER", NULL);
+ Tcl_SetErrorCode(interp, "TCL", "VALUE", "NUMBER", (char *)NULL);
}
return TCL_ERROR;
}
if (internalPtr != NULL) {
- *((int *) oldInternalPtr) = *((int *) internalPtr);
- *((int *) internalPtr) = newInt;
+ *((int *)oldInternalPtr) = *((int *)internalPtr);
+ *((int *)internalPtr) = newInt;
}
} else if ((optionPtr->specPtr->flags & TYPE_MASK) == TYPE_MASK) {
Tcl_WideInt newWideInt;
@@ -688,11 +688,11 @@ DoObjConfig(
}
if (internalPtr != NULL) {
if (sizeof(long) > sizeof(int)) {
- *((long *) oldInternalPtr) = *((long *) internalPtr);
- *((long *) internalPtr) = (long)newWideInt;
+ *((long *)oldInternalPtr) = *((long *)internalPtr);
+ *((long *)internalPtr) = (long)newWideInt;
} else {
- *((long long *) oldInternalPtr) = *((long long *) internalPtr);
- *((long long *) internalPtr) = (long long)newWideInt;
+ *((long long *)oldInternalPtr) = *((long long *)internalPtr);
+ *((long long *)internalPtr) = (long long)newWideInt;
}
}
} else {
@@ -716,8 +716,8 @@ DoObjConfig(
newIndex = INT_MAX;
}
if (internalPtr != NULL) {
- *((int *) oldInternalPtr) = *((int *) internalPtr);
- *((int *) internalPtr) = (int)newIndex;
+ *((int *)oldInternalPtr) = *((int *)internalPtr);
+ *((int *)internalPtr) = (int)newIndex;
}
break;
}
@@ -739,15 +739,15 @@ DoObjConfig(
Tcl_AppendLimitedToObj(msg, Tcl_GetString(valuePtr), TCL_INDEX_NONE, 50, "");
Tcl_AppendToObj(msg, "\"", TCL_INDEX_NONE);
Tcl_SetObjResult(interp, msg);
- Tcl_SetErrorCode(interp, "TCL", "VALUE", "NUMBER", NULL);
+ Tcl_SetErrorCode(interp, "TCL", "VALUE", "NUMBER", (char *)NULL);
}
return TCL_ERROR;
}
}
if (internalPtr != NULL) {
- *((double *) oldInternalPtr) = *((double *) internalPtr);
- *((double *) internalPtr) = newDbl;
+ *((double *)oldInternalPtr) = *((double *)internalPtr);
+ *((double *)internalPtr) = newDbl;
}
break;
}
@@ -767,8 +767,8 @@ DoObjConfig(
} else {
newStr = NULL;
}
- *((char **) oldInternalPtr) = *((char **) internalPtr);
- *((char **) internalPtr) = newStr;
+ *((char **)oldInternalPtr) = *((char **)internalPtr);
+ *((char **)internalPtr) = newStr;
}
break;
}
@@ -792,17 +792,17 @@ DoObjConfig(
if (internalPtr != NULL) {
if (optionPtr->specPtr->flags & TYPE_MASK) {
if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(char)) {
- *((char *) oldInternalPtr) = *((char *) internalPtr);
- *((char *) internalPtr) = (char)newValue;
+ *((char *)oldInternalPtr) = *((char *)internalPtr);
+ *((char *)internalPtr) = (char)newValue;
} else if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(short)) {
- *((short *) oldInternalPtr) = *((short *) internalPtr);
- *((short *) internalPtr) = (short)newValue;
+ *((short *)oldInternalPtr) = *((short *)internalPtr);
+ *((short *)internalPtr) = (short)newValue;
} else {
Tcl_Panic("Invalid flags for %s", "TK_OPTION_STRING_TABLE");
}
} else {
- *((int *) oldInternalPtr) = *((int *) internalPtr);
- *((int *) internalPtr) = newValue;
+ *((int *)oldInternalPtr) = *((int *)internalPtr);
+ *((int *)internalPtr) = newValue;
}
}
break;
@@ -820,8 +820,8 @@ DoObjConfig(
}
}
if (internalPtr != NULL) {
- *((XColor **) oldInternalPtr) = *((XColor **) internalPtr);
- *((XColor **) internalPtr) = newPtr;
+ *((XColor **)oldInternalPtr) = *((XColor **)internalPtr);
+ *((XColor **)internalPtr) = newPtr;
}
break;
}
@@ -838,8 +838,8 @@ DoObjConfig(
}
}
if (internalPtr != NULL) {
- *((Tk_Font *) oldInternalPtr) = *((Tk_Font *) internalPtr);
- *((Tk_Font *) internalPtr) = newFont;
+ *((Tk_Font *)oldInternalPtr) = *((Tk_Font *)internalPtr);
+ *((Tk_Font *)internalPtr) = newFont;
}
break;
}
@@ -856,8 +856,8 @@ DoObjConfig(
}
}
if (internalPtr != NULL) {
- *((Tk_Style *) oldInternalPtr) = *((Tk_Style *) internalPtr);
- *((Tk_Style *) internalPtr) = newStyle;
+ *((Tk_Style *)oldInternalPtr) = *((Tk_Style *)internalPtr);
+ *((Tk_Style *)internalPtr) = newStyle;
}
break;
}
@@ -874,8 +874,8 @@ DoObjConfig(
}
}
if (internalPtr != NULL) {
- *((Pixmap *) oldInternalPtr) = *((Pixmap *) internalPtr);
- *((Pixmap *) internalPtr) = newBitmap;
+ *((Pixmap *)oldInternalPtr) = *((Pixmap *)internalPtr);
+ *((Pixmap *)internalPtr) = newBitmap;
}
break;
}
@@ -892,8 +892,8 @@ DoObjConfig(
}
}
if (internalPtr != NULL) {
- *((Tk_3DBorder *) oldInternalPtr) = *((Tk_3DBorder *) internalPtr);
- *((Tk_3DBorder *) internalPtr) = newBorder;
+ *((Tk_3DBorder *)oldInternalPtr) = *((Tk_3DBorder *)internalPtr);
+ *((Tk_3DBorder *)internalPtr) = newBorder;
}
break;
}
@@ -910,17 +910,17 @@ DoObjConfig(
if (internalPtr != NULL) {
if (optionPtr->specPtr->flags & TYPE_MASK) {
if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(char)) {
- *((char *) oldInternalPtr) = *((char *) internalPtr);
- *((char *) internalPtr) = (char)newRelief;
+ *((char *)oldInternalPtr) = *((char *)internalPtr);
+ *((char *)internalPtr) = (char)newRelief;
} else if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(short)) {
- *((short *) oldInternalPtr) = *((short *) internalPtr);
- *((short *) internalPtr) = (short)newRelief;
+ *((short *)oldInternalPtr) = *((short *)internalPtr);
+ *((short *)internalPtr) = (short)newRelief;
} else {
Tcl_Panic("Invalid flags for %s", "TK_OPTION_RELIEF");
}
} else {
- *((int *) oldInternalPtr) = *((int *) internalPtr);
- *((int *) internalPtr) = newRelief;
+ *((int *)oldInternalPtr) = *((int *)internalPtr);
+ *((int *)internalPtr) = newRelief;
}
}
if (slotPtrPtr != NULL && valuePtr != NULL) {
@@ -961,17 +961,17 @@ DoObjConfig(
if (internalPtr != NULL) {
if (optionPtr->specPtr->flags & TYPE_MASK) {
if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(char)) {
- *((char *) oldInternalPtr) = *((char *) internalPtr);
- *((char *) internalPtr) = (char)newJustify;
+ *((char *)oldInternalPtr) = *((char *)internalPtr);
+ *((char *)internalPtr) = (char)newJustify;
} else if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(short)) {
- *((short *) oldInternalPtr) = *((short *) internalPtr);
- *((short *) internalPtr) = (short)newJustify;
+ *((short *)oldInternalPtr) = *((short *)internalPtr);
+ *((short *)internalPtr) = (short)newJustify;
} else {
Tcl_Panic("Invalid flags for %s", "TK_OPTION_JUSTIFY");
}
} else {
- *((int *) oldInternalPtr) = *((int *) internalPtr);
- *((int *) internalPtr) = newJustify;
+ *((int *)oldInternalPtr) = *((int *)internalPtr);
+ *((int *)internalPtr) = newJustify;
}
}
if (slotPtrPtr != NULL && valuePtr != NULL) {
@@ -993,17 +993,17 @@ DoObjConfig(
if (internalPtr != NULL) {
if (optionPtr->specPtr->flags & TYPE_MASK) {
if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(char)) {
- *((char *) oldInternalPtr) = *((char *) internalPtr);
- *((char *) internalPtr) = (char)newAnchor;
+ *((char *)oldInternalPtr) = *((char *)internalPtr);
+ *((char *)internalPtr) = (char)newAnchor;
} else if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(short)) {
- *((short *) oldInternalPtr) = *((short *) internalPtr);
- *((short *) internalPtr) = (short)newAnchor;
+ *((short *)oldInternalPtr) = *((short *)internalPtr);
+ *((short *)internalPtr) = (short)newAnchor;
} else {
Tcl_Panic("Invalid flags for %s", "TK_OPTION_JUSTIFY");
}
} else {
- *((int *) oldInternalPtr) = *((int *) internalPtr);
- *((int *) internalPtr) = newAnchor;
+ *((int *)oldInternalPtr) = *((int *)internalPtr);
+ *((int *)internalPtr) = newAnchor;
}
}
if (slotPtrPtr != NULL && valuePtr != NULL) {
@@ -1020,16 +1020,16 @@ DoObjConfig(
newPixels = INT_MIN;
} else if (Tk_GetPixelsFromObj(nullOK ? NULL : interp, tkwin, valuePtr,
&newPixels) != TCL_OK) {
- if (nullOK && interp) {
+ if (nullOK) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"expected screen distance or \"\" but got \"%.50s\"", Tcl_GetString(valuePtr)));
- Tcl_SetErrorCode(interp, "TK", "VALUE", "PIXELS", NULL);
+ Tcl_SetErrorCode(interp, "TK", "VALUE", "PIXELS", (char *)NULL);
}
return TCL_ERROR;
}
if (internalPtr != NULL) {
- *((int *) oldInternalPtr) = *((int *) internalPtr);
- *((int *) internalPtr) = newPixels;
+ *((int *)oldInternalPtr) = *((int *)internalPtr);
+ *((int *)internalPtr) = newPixels;
}
break;
}
@@ -1044,8 +1044,8 @@ DoObjConfig(
return TCL_ERROR;
}
if (internalPtr != NULL) {
- *((Tk_Window *) oldInternalPtr) = *((Tk_Window *) internalPtr);
- *((Tk_Window *) internalPtr) = newWin;
+ *((Tk_Window *)oldInternalPtr) = *((Tk_Window *)internalPtr);
+ *((Tk_Window *)internalPtr) = newWin;
}
break;
}
@@ -1064,7 +1064,7 @@ DoObjConfig(
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"bad config table: unknown type %d",
optionPtr->specPtr->type));
- Tcl_SetErrorCode(interp, "TK", "BAD_CONFIG", NULL);
+ Tcl_SetErrorCode(interp, "TK", "BAD_CONFIG", (char *)NULL);
return TCL_ERROR;
}
@@ -1271,7 +1271,7 @@ GetOptionFromObj(
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"unknown option \"%s\"", name));
- Tcl_SetErrorCode(interp, "TK", "LOOKUP", "OPTION", name, NULL);
+ Tcl_SetErrorCode(interp, "TK", "LOOKUP", "OPTION", name, (char *)NULL);
}
return NULL;
}
@@ -1447,7 +1447,7 @@ Tk_SetOptions(
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"value for \"%s\" missing",
Tcl_GetString(*objv)));
- Tcl_SetErrorCode(interp, "TK", "VALUE_MISSING", NULL);
+ Tcl_SetErrorCode(interp, "TK", "VALUE_MISSING", (char *)NULL);
goto error;
}
}
@@ -1570,86 +1570,86 @@ Tk_RestoreSavedOptions(
= savePtr->items[i].valuePtr;
}
if (specPtr->internalOffset != TCL_INDEX_NONE) {
- char *ptr = (char *) &savePtr->items[i].internalForm;
+ char *ptr = (char *)&savePtr->items[i].internalForm;
CLANG_ASSERT(internalPtr);
switch (specPtr->type) {
case TK_OPTION_BOOLEAN:
if (optionPtr->specPtr->flags & TYPE_MASK) {
if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(char)) {
- *((char *) internalPtr) = *((char *) ptr);
+ *((char *)internalPtr) = *((char *)ptr);
} else if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(short)) {
- *((short *) internalPtr) = *((short *) ptr);
+ *((short *)internalPtr) = *((short *)ptr);
} else {
Tcl_Panic("Invalid flags for %s", "TK_OPTION_BOOLEAN");
}
} else {
- *((int *) internalPtr) = *((int *) ptr);
+ *((int *)internalPtr) = *((int *)ptr);
}
break;
case TK_OPTION_INT:
if (optionPtr->specPtr->flags & TYPE_MASK) {
if ((optionPtr->specPtr->flags & TYPE_MASK) == TYPE_MASK) {
if (sizeof(long) > sizeof(int)) {
- *((long *) internalPtr) = *((long *) ptr);
+ *((long *)internalPtr) = *((long *)ptr);
} else {
- *((long long *) internalPtr) = *((long long *) ptr);
+ *((long long *)internalPtr) = *((long long *)ptr);
}
} else {
Tcl_Panic("Invalid flags for %s", "TK_OPTION_INT");
}
} else {
- *((int *) internalPtr) = *((int *) ptr);
+ *((int *)internalPtr) = *((int *)ptr);
}
break;
case TK_OPTION_INDEX:
- *((int *) internalPtr) = *((int *) ptr);
+ *((int *)internalPtr) = *((int *)ptr);
break;
case TK_OPTION_DOUBLE:
- *((double *) internalPtr) = *((double *) ptr);
+ *((double *)internalPtr) = *((double *)ptr);
break;
case TK_OPTION_STRING:
- *((char **) internalPtr) = *((char **) ptr);
+ *((char **)internalPtr) = *((char **)ptr);
break;
case TK_OPTION_STRING_TABLE:
if (optionPtr->specPtr->flags & TYPE_MASK) {
if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(char)) {
- *((char *) internalPtr) = *((char *) ptr);
+ *((char *)internalPtr) = *((char *)ptr);
} else if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(short)) {
- *((short *) internalPtr) = *((short *) ptr);
+ *((short *)internalPtr) = *((short *)ptr);
} else {
Tcl_Panic("Invalid flags for %s", "TK_OPTION_STRING_TABLE");
}
} else {
- *((int *) internalPtr) = *((int *) ptr);
+ *((int *)internalPtr) = *((int *)ptr);
}
break;
case TK_OPTION_COLOR:
- *((XColor **) internalPtr) = *((XColor **) ptr);
+ *((XColor **)internalPtr) = *((XColor **)ptr);
break;
case TK_OPTION_FONT:
- *((Tk_Font *) internalPtr) = *((Tk_Font *) ptr);
+ *((Tk_Font *)internalPtr) = *((Tk_Font *)ptr);
break;
case TK_OPTION_STYLE:
- *((Tk_Style *) internalPtr) = *((Tk_Style *) ptr);
+ *((Tk_Style *)internalPtr) = *((Tk_Style *)ptr);
break;
case TK_OPTION_BITMAP:
- *((Pixmap *) internalPtr) = *((Pixmap *) ptr);
+ *((Pixmap *)internalPtr) = *((Pixmap *)ptr);
break;
case TK_OPTION_BORDER:
- *((Tk_3DBorder *) internalPtr) = *((Tk_3DBorder *) ptr);
+ *((Tk_3DBorder *)internalPtr) = *((Tk_3DBorder *)ptr);
break;
case TK_OPTION_RELIEF:
if (optionPtr->specPtr->flags & TYPE_MASK) {
if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(char)) {
- *((char *) internalPtr) = *((char *) ptr);
+ *((char *)internalPtr) = *((char *)ptr);
} else if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(short)) {
- *((short *) internalPtr) = *((short *) ptr);
+ *((short *)internalPtr) = *((short *)ptr);
} else {
Tcl_Panic("Invalid flags for %s", "TK_OPTION_RELIEF");
}
} else {
- *((int *) internalPtr) = *((int *) ptr);
+ *((int *)internalPtr) = *((int *)ptr);
}
break;
case TK_OPTION_CURSOR:
@@ -1659,34 +1659,34 @@ Tk_RestoreSavedOptions(
case TK_OPTION_JUSTIFY:
if (optionPtr->specPtr->flags & TYPE_MASK) {
if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(char)) {
- *((char *) internalPtr) = *((char *) ptr);
+ *((char *)internalPtr) = *((char *)ptr);
} else if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(short)) {
- *((short *) internalPtr) = *((short *) ptr);
+ *((short *)internalPtr) = *((short *)ptr);
} else {
Tcl_Panic("Invalid flags for %s", "TK_OPTION_JUSTIFY");
}
} else {
- *((int *) internalPtr) = *((int *) ptr);
+ *((int *)internalPtr) = *((int *)ptr);
}
break;
case TK_OPTION_ANCHOR:
if (optionPtr->specPtr->flags & TYPE_MASK) {
if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(char)) {
- *((char *) internalPtr) = *((char *) ptr);
+ *((char *)internalPtr) = *((char *)ptr);
} else if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(short)) {
- *((short *) internalPtr) = *((short *) ptr);
+ *((short *)internalPtr) = *((short *)ptr);
} else {
Tcl_Panic("Invalid flags for %s", "TK_OPTION_ANCHOR");
}
} else {
- *((int *) internalPtr) = *((int *) ptr);
+ *((int *)internalPtr) = *((int *)ptr);
}
break;
case TK_OPTION_PIXELS:
- *((int *) internalPtr) = *((int *) ptr);
+ *((int *)internalPtr) = *((int *)ptr);
break;
case TK_OPTION_WINDOW:
- *((Tk_Window *) internalPtr) = *((Tk_Window *) ptr);
+ *((Tk_Window *)internalPtr) = *((Tk_Window *)ptr);
break;
case TK_OPTION_CUSTOM: {
const Tk_ObjCustomOption *custom = optionPtr->extra.custom;
@@ -1738,7 +1738,7 @@ Tk_FreeSavedOptions(
savedOptionPtr = &savePtr->items[count-1];
if (savedOptionPtr->optionPtr->flags & OPTION_NEEDS_FREEING) {
FreeResources(savedOptionPtr->optionPtr, savedOptionPtr->valuePtr,
- (char *) &savedOptionPtr->internalForm, savePtr->tkwin);
+ (char *)&savedOptionPtr->internalForm, savePtr->tkwin);
}
if (savedOptionPtr->valuePtr != NULL) {
Tcl_DecrRefCount(savedOptionPtr->valuePtr);
@@ -1849,17 +1849,17 @@ FreeResources(
switch (optionPtr->specPtr->type) {
case TK_OPTION_STRING:
if (internalFormExists) {
- if (*((char **) internalPtr) != NULL) {
- ckfree(*((char **) internalPtr));
- *((char **) internalPtr) = NULL;
+ if (*((char **)internalPtr) != NULL) {
+ ckfree(*((char **)internalPtr));
+ *((char **)internalPtr) = NULL;
}
}
break;
case TK_OPTION_COLOR:
if (internalFormExists) {
- if (*((XColor **) internalPtr) != NULL) {
- Tk_FreeColor(*((XColor **) internalPtr));
- *((XColor **) internalPtr) = NULL;
+ if (*((XColor **)internalPtr) != NULL) {
+ Tk_FreeColor(*((XColor **)internalPtr));
+ *((XColor **)internalPtr) = NULL;
}
} else if (objPtr != NULL) {
Tk_FreeColorFromObj(tkwin, objPtr);
@@ -1867,23 +1867,23 @@ FreeResources(
break;
case TK_OPTION_FONT:
if (internalFormExists) {
- Tk_FreeFont(*((Tk_Font *) internalPtr));
- *((Tk_Font *) internalPtr) = NULL;
+ Tk_FreeFont(*((Tk_Font *)internalPtr));
+ *((Tk_Font *)internalPtr) = NULL;
} else if (objPtr != NULL) {
Tk_FreeFontFromObj(tkwin, objPtr);
}
break;
case TK_OPTION_STYLE:
if (internalFormExists) {
- Tk_FreeStyle(*((Tk_Style *) internalPtr));
- *((Tk_Style *) internalPtr) = NULL;
+ Tk_FreeStyle(*((Tk_Style *)internalPtr));
+ *((Tk_Style *)internalPtr) = NULL;
}
break;
case TK_OPTION_BITMAP:
if (internalFormExists) {
- if (*((Pixmap *) internalPtr) != None) {
- Tk_FreeBitmap(Tk_Display(tkwin), *((Pixmap *) internalPtr));
- *((Pixmap *) internalPtr) = None;
+ if (*((Pixmap *)internalPtr) != None) {
+ Tk_FreeBitmap(Tk_Display(tkwin), *((Pixmap *)internalPtr));
+ *((Pixmap *)internalPtr) = None;
}
} else if (objPtr != NULL) {
Tk_FreeBitmapFromObj(tkwin, objPtr);
@@ -1891,9 +1891,9 @@ FreeResources(
break;
case TK_OPTION_BORDER:
if (internalFormExists) {
- if (*((Tk_3DBorder *) internalPtr) != NULL) {
- Tk_Free3DBorder(*((Tk_3DBorder *) internalPtr));
- *((Tk_3DBorder *) internalPtr) = NULL;
+ if (*((Tk_3DBorder *)internalPtr) != NULL) {
+ Tk_Free3DBorder(*((Tk_3DBorder *)internalPtr));
+ *((Tk_3DBorder *)internalPtr) = NULL;
}
} else if (objPtr != NULL) {
Tk_Free3DBorderFromObj(tkwin, objPtr);
@@ -2130,7 +2130,7 @@ GetObjectForOption(
}
case TK_OPTION_INT: {
Tcl_WideInt value;
- int nullOK = (optionPtr->specPtr->flags & (TK_OPTION_NULL_OK|TCL_NULL_OK));
+ int nullOK = (optionPtr->specPtr->flags & (TK_OPTION_NULL_OK|TCL_NULL_OK|1));
if (optionPtr->specPtr->flags & TYPE_MASK) {
if ((optionPtr->specPtr->flags & TYPE_MASK) == TYPE_MASK) {
if (sizeof(long) > sizeof(int)) {
@@ -2151,25 +2151,25 @@ GetObjectForOption(
break;
}
case TK_OPTION_INDEX:
- if (!(optionPtr->specPtr->flags & (TK_OPTION_NULL_OK|TCL_NULL_OK)) || *((int *) internalPtr) != INT_MIN) {
- if (*((int *) internalPtr) == INT_MIN) {
+ if (!(optionPtr->specPtr->flags & (TK_OPTION_NULL_OK|TCL_NULL_OK|1)) || *((int *)internalPtr) != INT_MIN) {
+ if (*((int *)internalPtr) == INT_MIN) {
objPtr = TkNewIndexObj(TCL_INDEX_NONE);
- } else if (*((int *) internalPtr) == INT_MAX) {
+ } else if (*((int *)internalPtr) == INT_MAX) {
objPtr = Tcl_NewStringObj("end+1", TCL_INDEX_NONE);
- } else if (*((int *) internalPtr) == -1) {
+ } else if (*((int *)internalPtr) == -1) {
objPtr = Tcl_NewStringObj("end", TCL_INDEX_NONE);
- } else if (*((int *) internalPtr) < 0) {
+ } else if (*((int *)internalPtr) < 0) {
char buf[32];
- snprintf(buf, 32, "end%d", 1 + *((int *) internalPtr));
+ snprintf(buf, 32, "end%d", 1 + *((int *)internalPtr));
objPtr = Tcl_NewStringObj(buf, TCL_INDEX_NONE);
} else {
- objPtr = Tcl_NewWideIntObj(*((int *) internalPtr));
+ objPtr = Tcl_NewWideIntObj(*((int *)internalPtr));
}
}
break;
case TK_OPTION_DOUBLE:
- if (!(optionPtr->specPtr->flags & (TK_OPTION_NULL_OK|TCL_NULL_OK)) || !isnan(*((double *) internalPtr))) {
- objPtr = Tcl_NewDoubleObj(*((double *) internalPtr));
+ if (!(optionPtr->specPtr->flags & (TK_OPTION_NULL_OK|TCL_NULL_OK|1)) || !isnan(*((double *)internalPtr))) {
+ objPtr = Tcl_NewDoubleObj(*((double *)internalPtr));
}
break;
case TK_OPTION_STRING:
@@ -2189,7 +2189,7 @@ GetObjectForOption(
value = *((int *)internalPtr);
}
if (value >= 0) {
- objPtr = Tcl_NewStringObj(((char **) optionPtr->specPtr->clientData)[
+ objPtr = Tcl_NewStringObj(((char **)optionPtr->specPtr->clientData)[
value], TCL_INDEX_NONE);
}
break;
@@ -2299,12 +2299,12 @@ GetObjectForOption(
break;
}
case TK_OPTION_PIXELS:
- if (!(optionPtr->specPtr->flags & (TK_OPTION_NULL_OK|TCL_NULL_OK)) || *((int *) internalPtr) != INT_MIN) {
+ if (!(optionPtr->specPtr->flags & (TK_OPTION_NULL_OK|TCL_NULL_OK|1)) || *((int *)internalPtr) != INT_MIN) {
objPtr = Tcl_NewWideIntObj(*((int *)internalPtr));
}
break;
case TK_OPTION_WINDOW: {
- tkwin = *((Tk_Window *) internalPtr);
+ tkwin = *((Tk_Window *)internalPtr);
if (tkwin != NULL) {
objPtr = Tcl_NewStringObj(Tk_PathName(tkwin), TCL_INDEX_NONE);
diff --git a/generic/tkEntry.c b/generic/tkEntry.c
index d1514d1..3b9b00f 100644
--- a/generic/tkEntry.c
+++ b/generic/tkEntry.c
@@ -1316,7 +1316,7 @@ ConfigureEntry(
Tk_SetInternalBorder(entryPtr->tkwin,
entryPtr->borderWidth + entryPtr->highlightWidth);
- if (entryPtr->highlightWidth <= 0) {
+ if (entryPtr->highlightWidth < 0) {
entryPtr->highlightWidth = 0;
}
entryPtr->inset = entryPtr->highlightWidth
diff --git a/generic/tkFont.c b/generic/tkFont.c
index 6f566d2..6a90add 100644
--- a/generic/tkFont.c
+++ b/generic/tkFont.c
@@ -1318,7 +1318,6 @@ Tk_GetFontFromObj(
FreeFontObj(objPtr);
fontPtr = NULL;
} else if (Tk_Screen(tkwin) == fontPtr->screen) {
- fontPtr->resourceRefCount++;
return (Tk_Font) fontPtr;
}
}
@@ -4296,7 +4295,7 @@ Tcl_Obj *
TkDebugFont(
Tk_Window tkwin, /* The window in which the font will be used
* (not currently used). */
- const char *name) /* Name of the desired color. */
+ const char *name) /* Name of the desired font. */
{
TkFont *fontPtr;
Tcl_HashEntry *hashPtr;
diff --git a/generic/tkFrame.c b/generic/tkFrame.c
index c0d45e8..d49292b 100644
--- a/generic/tkFrame.c
+++ b/generic/tkFrame.c
@@ -1468,10 +1468,14 @@ DisplayFrame(
* off-screen memory, then copies it back on-screen in a single operation.
* This means there's no point in time where the on-screen image has been
* cleared.
+ * Also, ensure that the pixmap size is at least 1x1 pixels to prevent
+ * crashes, see [610aa08858].
*/
pixmap = Tk_GetPixmap(framePtr->display, Tk_WindowId(tkwin),
- Tk_Width(tkwin), Tk_Height(tkwin), Tk_Depth(tkwin));
+ (Tk_Width(tkwin) > 0 ? Tk_Width(tkwin) : 1),
+ (Tk_Height(tkwin) > 0 ? Tk_Height(tkwin) : 1),
+ Tk_Depth(tkwin));
#else
pixmap = Tk_WindowId(tkwin);
Tk_ClipDrawableToRect(Tk_Display(tkwin), pixmap, 0, 0,
diff --git a/generic/tkImgBmap.c b/generic/tkImgBmap.c
index 2fad264..116ef41 100644
--- a/generic/tkImgBmap.c
+++ b/generic/tkImgBmap.c
@@ -513,10 +513,6 @@ TkGetBitmapData(
!= TCL_OK) {
return NULL;
}
- if (Tcl_SetChannelOption(interp, pi.chan, "-encoding", "binary")
- != TCL_OK) {
- return NULL;
- }
} else {
pi.chan = NULL;
}
diff --git a/generic/tkImgGIF.c b/generic/tkImgGIF.c
index 6368972..32b01e4 100644
--- a/generic/tkImgGIF.c
+++ b/generic/tkImgGIF.c
@@ -498,7 +498,13 @@ FileReadGIF(
*/
if (Fread(gifConfPtr, buf, 1, 3, chan) != 3) {
- return TCL_OK;
+ /*
+ * Bug [865af0148c]: 3 bytes should be there, but data ended before
+ */
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
+ "GIF file truncated", -1));
+ Tcl_SetErrorCode(interp, "TK", "IMAGE", "GIF", "TRUNCATED", NULL);
+ return TCL_ERROR;
}
bitPixel = 2 << (buf[0] & 0x07);
@@ -1922,8 +1928,8 @@ FileWriteGIF(
if (!chan) {
return TCL_ERROR;
}
- if (Tcl_SetChannelOption(interp, chan, "-translation",
- "binary") != TCL_OK) {
+ if (Tcl_SetChannelOption(interp, chan, "-translation", "binary")
+ != TCL_OK) {
Tcl_Close(NULL, chan);
return TCL_ERROR;
}
diff --git a/generic/tkImgPNG.c b/generic/tkImgPNG.c
index 2879ae2..a49ed15 100644
--- a/generic/tkImgPNG.c
+++ b/generic/tkImgPNG.c
@@ -3765,13 +3765,8 @@ FileWritePNG(
goto cleanup;
}
- /*
- * Set the translation mode to binary so that CR and LF are not to the
- * platform's EOL sequence.
- */
-
- if (Tcl_SetChannelOption(interp, chan, "-translation",
- "binary") != TCL_OK) {
+ if (Tcl_SetChannelOption(interp, chan, "-translation", "binary")
+ != TCL_OK) {
goto cleanup;
}
diff --git a/generic/tkImgPPM.c b/generic/tkImgPPM.c
index 50d37d7..a9d0391 100644
--- a/generic/tkImgPPM.c
+++ b/generic/tkImgPPM.c
@@ -305,11 +305,6 @@ FileWritePPM(
Tcl_Close(NULL, chan);
return TCL_ERROR;
}
- if (Tcl_SetChannelOption(interp, chan, "-encoding", "binary")
- != TCL_OK) {
- Tcl_Close(NULL, chan);
- return TCL_ERROR;
- }
snprintf(header, sizeof(header), "P6\n%d %d\n255\n", blockPtr->width, blockPtr->height);
Tcl_Write(chan, header, TCL_INDEX_NONE);
diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c
index 0c38cc4..27ffbed 100644
--- a/generic/tkImgPhoto.c
+++ b/generic/tkImgPhoto.c
@@ -1053,11 +1053,6 @@ ImgPhotoCmd(
Tcl_Close(NULL, chan);
return TCL_ERROR;
}
- if (Tcl_SetChannelOption(interp, chan, "-encoding", "binary")
- != TCL_OK) {
- Tcl_Close(NULL, chan);
- return TCL_ERROR;
- }
if (MatchFileFormat(interp, chan,
Tcl_GetString(options.name), options.format,
@@ -2092,12 +2087,8 @@ ImgPhotoConfigureModel(
metadataOutObj = Tcl_NewDictObj();
Tcl_IncrRefCount(metadataOutObj);
- /*
- * -translation binary also sets -encoding binary
- */
-
- if ((Tcl_SetChannelOption(interp, chan,
- "-translation", "binary") != TCL_OK) ||
+ if ((Tcl_SetChannelOption(interp, chan, "-translation", "binary")
+ != TCL_OK) ||
(MatchFileFormat(interp, chan, modelPtr->fileString,
modelPtr->format, modelPtr->metadata, metadataOutObj,
&imageFormat, &imageFormatVersion3,
diff --git a/generic/tkListbox.c b/generic/tkListbox.c
index 4a2ea5f..4e4fa23 100644
--- a/generic/tkListbox.c
+++ b/generic/tkListbox.c
@@ -115,7 +115,7 @@ typedef struct {
* is offset to the left by this many pixels
* (0 means no offset, positive means there is
* an offset). This is x scrolling information
- * is not linked to justification. */
+ * is not linked to justification. */
/*
* Information about what's selected or active, if any.
@@ -874,7 +874,7 @@ ListboxWidgetObjCmd(
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"item number \"%s\" out of range",
Tcl_GetString(objv[2])));
- Tcl_SetErrorCode(interp, "TK", "LISTBOX", "ITEM_INDEX", NULL);
+ Tcl_SetErrorCode(interp, "TK", "LISTBOX", "ITEM_INDEX", (char *)NULL);
result = TCL_ERROR;
break;
}
@@ -911,7 +911,7 @@ ListboxWidgetObjCmd(
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"item number \"%s\" out of range",
Tcl_GetString(objv[2])));
- Tcl_SetErrorCode(interp, "TK", "LISTBOX", "ITEM_INDEX", NULL);
+ Tcl_SetErrorCode(interp, "TK", "LISTBOX", "ITEM_INDEX", (char *)NULL);
result = TCL_ERROR;
break;
}
@@ -1111,15 +1111,15 @@ ListboxBboxSubCmd(
Tk_GetFontMetrics(listPtr->tkfont, &fm);
pixelWidth = Tk_TextWidth(listPtr->tkfont, stringRep, stringLen);
- if (listPtr->justify == TK_JUSTIFY_LEFT) {
- x = (listPtr->inset + listPtr->selBorderWidth) - listPtr->xOffset;
- } else if (listPtr->justify == TK_JUSTIFY_RIGHT) {
- x = Tk_Width(tkwin) - (listPtr->inset + listPtr->selBorderWidth)
- - pixelWidth - listPtr->xOffset + GetMaxOffset(listPtr);
- } else {
- x = (Tk_Width(tkwin) - pixelWidth)/2
- - listPtr->xOffset + GetMaxOffset(listPtr)/2;
- }
+ if (listPtr->justify == TK_JUSTIFY_LEFT) {
+ x = (listPtr->inset + listPtr->selBorderWidth) - listPtr->xOffset;
+ } else if (listPtr->justify == TK_JUSTIFY_RIGHT) {
+ x = Tk_Width(tkwin) - (listPtr->inset + listPtr->selBorderWidth)
+ - pixelWidth - listPtr->xOffset + GetMaxOffset(listPtr);
+ } else {
+ x = (Tk_Width(tkwin) - pixelWidth)/2
+ - listPtr->xOffset + GetMaxOffset(listPtr)/2;
+ }
y = ((index - listPtr->topIndex)*listPtr->lineHeight)
+ listPtr->inset + listPtr->selBorderWidth;
results[0] = Tcl_NewWideIntObj(x);
@@ -2072,24 +2072,24 @@ DisplayListbox(
* Draw the actual text of this item.
*/
- Tcl_ListObjIndex(listPtr->interp, listPtr->listObj, i, &curElement);
- stringRep = Tcl_GetStringFromObj(curElement, &stringLen);
- textWidth = Tk_TextWidth(listPtr->tkfont, stringRep, stringLen);
+ Tcl_ListObjIndex(listPtr->interp, listPtr->listObj, i, &curElement);
+ stringRep = Tcl_GetStringFromObj(curElement, &stringLen);
+ textWidth = Tk_TextWidth(listPtr->tkfont, stringRep, stringLen);
Tk_GetFontMetrics(listPtr->tkfont, &fm);
y += fm.ascent + listPtr->selBorderWidth;
- if (listPtr->justify == TK_JUSTIFY_LEFT) {
- x = (listPtr->inset + listPtr->selBorderWidth) - listPtr->xOffset;
- } else if (listPtr->justify == TK_JUSTIFY_RIGHT) {
- x = Tk_Width(tkwin) - (listPtr->inset + listPtr->selBorderWidth)
- - textWidth - listPtr->xOffset + GetMaxOffset(listPtr);
- } else {
- x = (Tk_Width(tkwin) - textWidth)/2
- - listPtr->xOffset + GetMaxOffset(listPtr)/2;
- }
-
- Tk_DrawChars(listPtr->display, pixmap, gc, listPtr->tkfont,
+ if (listPtr->justify == TK_JUSTIFY_LEFT) {
+ x = (listPtr->inset + listPtr->selBorderWidth) - listPtr->xOffset;
+ } else if (listPtr->justify == TK_JUSTIFY_RIGHT) {
+ x = Tk_Width(tkwin) - (listPtr->inset + listPtr->selBorderWidth)
+ - textWidth - listPtr->xOffset + GetMaxOffset(listPtr);
+ } else {
+ x = (Tk_Width(tkwin) - textWidth)/2
+ - listPtr->xOffset + GetMaxOffset(listPtr)/2;
+ }
+
+ Tk_DrawChars(listPtr->display, pixmap, gc, listPtr->tkfont,
stringRep, stringLen, x, y);
/*
@@ -2769,9 +2769,9 @@ GetListboxIndex(
stringRep = Tcl_GetString(indexObj);
if (stringRep[0] == '@') {
- /*
- * @x,y index
- */
+ /*
+ * @x,y index
+ */
int y;
char *start;
@@ -2804,7 +2804,7 @@ GetListboxIndex(
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"bad listbox index \"%s\": must be active, anchor, end, @x,y,"
" or an index", Tcl_GetString(indexObj)));
- Tcl_SetErrorCode(interp, "TK", "VALUE", "LISTBOX_INDEX", NULL);
+ Tcl_SetErrorCode(interp, "TK", "VALUE", "LISTBOX_INDEX", (char *)NULL);
return TCL_ERROR;
}
@@ -3203,7 +3203,7 @@ ListboxLostSelection(
if ((listPtr->exportSelection) && (!Tcl_IsSafe(listPtr->interp))
&& (listPtr->nElements > 0)) {
ListboxSelect(listPtr, 0, listPtr->nElements-1, 0);
- GenerateListboxSelectEvent(listPtr);
+ GenerateListboxSelectEvent(listPtr);
}
}
@@ -3448,27 +3448,27 @@ ListboxListVarProc(
if (flags & TCL_TRACE_UNSETS) {
- if (!Tcl_InterpDeleted(interp) && listPtr->listVarName) {
- void *probe = NULL;
-
- do {
- probe = Tcl_VarTraceInfo(interp,
- listPtr->listVarName,
- TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
- ListboxListVarProc, probe);
- if (probe == (void *)listPtr) {
- break;
- }
- } while (probe);
- if (probe) {
- /*
- * We were able to fetch the unset trace for our
- * listVarName, which means it is not unset and not
- * the cause of this unset trace. Instead some outdated
- * former variable must be, and we should ignore it.
- */
- return NULL;
- }
+ if (!Tcl_InterpDeleted(interp) && listPtr->listVarName) {
+ void *probe = NULL;
+
+ do {
+ probe = Tcl_VarTraceInfo(interp,
+ listPtr->listVarName,
+ TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
+ ListboxListVarProc, probe);
+ if (probe == (void *)listPtr) {
+ break;
+ }
+ } while (probe);
+ if (probe) {
+ /*
+ * We were able to fetch the unset trace for our
+ * listVarName, which means it is not unset and not
+ * the cause of this unset trace. Instead some outdated
+ * former variable must be, and we should ignore it.
+ */
+ return NULL;
+ }
Tcl_SetVar2Ex(interp, listPtr->listVarName, NULL,
listPtr->listObj, TCL_GLOBAL_ONLY);
Tcl_TraceVar2(interp, listPtr->listVarName,
@@ -3650,15 +3650,15 @@ static int GetMaxOffset(
int maxOffset;
maxOffset = listPtr->maxWidth -
- (Tk_Width(listPtr->tkwin) - 2*listPtr->inset -
- 2*listPtr->selBorderWidth) + listPtr->xScrollUnit - 1;
+ (Tk_Width(listPtr->tkwin) - 2*listPtr->inset -
+ 2*listPtr->selBorderWidth) + listPtr->xScrollUnit - 1;
if (maxOffset < 0) {
- /*
- * Listbox is larger in width than its largest width item.
- */
+ /*
+ * Listbox is larger in width than its largest width item.
+ */
- maxOffset = 0;
+ maxOffset = 0;
}
maxOffset -= maxOffset % listPtr->xScrollUnit;
diff --git a/generic/tkMenu.c b/generic/tkMenu.c
index a0cee25..be60f2a 100644
--- a/generic/tkMenu.c
+++ b/generic/tkMenu.c
@@ -900,9 +900,9 @@ MenuWidgetObjCmd(
goto error;
}
if (objc == 5) {
- if (GetMenuIndex(interp, menuPtr, objv[4], 0, &index) != TCL_OK) {
- goto error;
- }
+ if (GetMenuIndex(interp, menuPtr, objv[4], 0, &index) != TCL_OK) {
+ goto error;
+ }
}
/*
@@ -914,9 +914,9 @@ MenuWidgetObjCmd(
*/
if (menuPtr->menuType == MENUBAR) {
- Tcl_AppendResult(interp, "a menubar menu cannot be posted", NULL);
- return TCL_ERROR;
- } else if (menuPtr->menuType != TEAROFF_MENU) {
+ Tcl_AppendResult(interp, "a menubar menu cannot be posted", NULL);
+ return TCL_ERROR;
+ } else if (menuPtr->menuType != TEAROFF_MENU) {
result = TkpPostMenu(interp, menuPtr, x, y, index);
} else {
result = TkpPostTearoffMenu(interp, menuPtr, x, y, index);
@@ -1197,16 +1197,16 @@ DestroyMenuInstance(
*/
for (i = menuPtr->numEntries; --i >= 0; ) {
- /*
- * Clean up the hash entry for the menu item ID.
- * This cannot be postponed until the entry is eventually freed,
- * because the hash table may already have been deleted by then.
- */
+ /*
+ * Clean up the hash entry for the menu item ID.
+ * This cannot be postponed until the entry is eventually freed,
+ * because the hash table may already have been deleted by then.
+ */
- if (menuPtr->entries[i]->entryPtr) {
- Tcl_DeleteHashEntry(menuPtr->entries[i]->entryPtr);
- menuPtr->entries[i]->entryPtr = NULL;
- }
+ if (menuPtr->entries[i]->entryPtr) {
+ Tcl_DeleteHashEntry(menuPtr->entries[i]->entryPtr);
+ menuPtr->entries[i]->entryPtr = NULL;
+ }
/*
* As each menu entry is deleted from the end of the array of entries,
@@ -1495,8 +1495,8 @@ DestroyMenuEntry(
MenuVarProc, mePtr);
}
if (mePtr->entryPtr) {
- Tcl_DeleteHashEntry(mePtr->entryPtr);
- mePtr->entryPtr = NULL;
+ Tcl_DeleteHashEntry(mePtr->entryPtr);
+ mePtr->entryPtr = NULL;
}
TkpDestroyMenuEntry(mePtr);
TkMenuEntryFreeDrawOptions(mePtr);
@@ -2199,9 +2199,9 @@ GetMenuIndex(
entryPtr = Tcl_FindHashEntry(&menuPtr->items, string);
if (entryPtr) {
- TkMenuEntry *mePtr = (TkMenuEntry *)Tcl_GetHashValue(entryPtr);
- *indexPtr = mePtr->index;
- return TCL_OK;
+ TkMenuEntry *mePtr = (TkMenuEntry *)Tcl_GetHashValue(entryPtr);
+ *indexPtr = mePtr->index;
+ return TCL_OK;
}
for (i = 0; i < menuPtr->numEntries; i++) {
@@ -2216,7 +2216,7 @@ GetMenuIndex(
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"bad menu entry index \"%s\"", string));
- Tcl_SetErrorCode(interp, "TK", "MENU", "INDEX", NULL);
+ Tcl_SetErrorCode(interp, "TK", "MENU", "INDEX", (char *)NULL);
return TCL_ERROR;
}
@@ -2407,7 +2407,7 @@ MenuAddOrInsert(
if (index < 0) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"bad menu entry index \"%s\"", Tcl_GetString(indexPtr)));
- Tcl_SetErrorCode(interp, "TK", "MENU", "INDEX", NULL);
+ Tcl_SetErrorCode(interp, "TK", "MENU", "INDEX", (char *)NULL);
return TCL_ERROR;
}
if (menuPtr->tearoff && (index == 0)) {
@@ -2429,14 +2429,14 @@ MenuAddOrInsert(
*/
if (objc % 2 == 0) {
- idPtr = objv[offs];
- if (Tcl_FindHashEntry(&menuPtr->items, Tcl_GetString(idPtr))) {
- Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ idPtr = objv[offs];
+ if (Tcl_FindHashEntry(&menuPtr->items, Tcl_GetString(idPtr))) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"entry \"%s\" already exists", Tcl_GetString(idPtr)));
- Tcl_SetErrorCode(interp, "TK", "MENU", "ENTRY_EXISTS", NULL);
- return TCL_ERROR;
- }
- offs++;
+ Tcl_SetErrorCode(interp, "TK", "MENU", "ENTRY_EXISTS", (char *)NULL);
+ return TCL_ERROR;
+ }
+ offs++;
}
/*
@@ -2473,22 +2473,22 @@ MenuAddOrInsert(
return TCL_ERROR;
}
- if (idPtr == NULL) {
- char idbuf[16];
- /* Generate an id for the new entry on the main menu */
- do {
- snprintf(idbuf, sizeof(idbuf), "e%03X", ++menuPtr->serial);
- entryPtr = Tcl_CreateHashEntry(
+ if (idPtr == NULL) {
+ char idbuf[16];
+ /* Generate an id for the new entry on the main menu */
+ do {
+ snprintf(idbuf, sizeof(idbuf), "e%03X", ++menuPtr->serial);
+ entryPtr = Tcl_CreateHashEntry(
&menuListPtr->items, idbuf, &isNew);
- } while (!isNew);
- idPtr = Tcl_NewStringObj(idbuf, TCL_INDEX_NONE);
- } else {
- /* Reuse the specified or previously generated id on all clones */
- entryPtr = Tcl_CreateHashEntry(
+ } while (!isNew);
+ idPtr = Tcl_NewStringObj(idbuf, TCL_INDEX_NONE);
+ } else {
+ /* Reuse the specified or previously generated id on all clones */
+ entryPtr = Tcl_CreateHashEntry(
&menuListPtr->items, Tcl_GetString(idPtr), &isNew);
- }
- Tcl_SetHashValue(entryPtr, mePtr);
- mePtr->entryPtr = entryPtr;
+ }
+ Tcl_SetHashValue(entryPtr, mePtr);
+ mePtr->entryPtr = entryPtr;
/*
* If a menu has cascades, then every instance of the menu has to have
@@ -2593,26 +2593,26 @@ MenuVarProc(
*/
if (flags & TCL_TRACE_UNSETS) {
- void *probe = NULL;
+ void *probe = NULL;
mePtr->entryFlags &= ~ENTRY_SELECTED;
- do {
- probe = Tcl_VarTraceInfo(interp, name,
- TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
- MenuVarProc, probe);
- if (probe == (void *)mePtr) {
- break;
- }
- } while (probe);
- if (probe) {
- /*
- * We were able to fetch the unset trace for our
- * namePtr, which means it is not unset and not
- * the cause of this unset trace. Instead some outdated
- * former variable must be, and we should ignore it.
- */
+ do {
+ probe = Tcl_VarTraceInfo(interp, name,
+ TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
+ MenuVarProc, probe);
+ if (probe == (void *)mePtr) {
+ break;
+ }
+ } while (probe);
+ if (probe) {
+ /*
+ * We were able to fetch the unset trace for our
+ * namePtr, which means it is not unset and not
+ * the cause of this unset trace. Instead some outdated
+ * former variable must be, and we should ignore it.
+ */
return NULL;
- }
+ }
Tcl_TraceVar2(interp, name, NULL,
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
MenuVarProc, clientData);
diff --git a/generic/tkObj.c b/generic/tkObj.c
index afcf7c8..cdea2ed 100644
--- a/generic/tkObj.c
+++ b/generic/tkObj.c
@@ -518,7 +518,7 @@ SetPixelFromAny(
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"expected screen distance but got \"%.50s\"", string));
- Tcl_SetErrorCode(interp, "TK", "VALUE", "PIXELS", NULL);
+ Tcl_SetErrorCode(interp, "TK", "VALUE", "PIXELS", (char *)NULL);
}
return TCL_ERROR;
}
@@ -802,7 +802,7 @@ SetMMFromAny(
error:
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"expected screen distance but got \"%.50s\"", string));
- Tcl_SetErrorCode(interp, "TK", "VALUE", "PIXELS", NULL);
+ Tcl_SetErrorCode(interp, "TK", "VALUE", "PIXELS", (char *)NULL);
return TCL_ERROR;
}
switch (*rest) {
@@ -1103,7 +1103,7 @@ TkParsePadAmount(
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"bad pad value \"%s\": must be positive screen distance",
Tcl_GetString(specObj)));
- Tcl_SetErrorCode(interp, "TK", "VALUE", "PADDING", "DIST", NULL);
+ Tcl_SetErrorCode(interp, "TK", "VALUE", "PADDING", "DIST", (char *)NULL);
return TCL_ERROR;
}
secondInt = firstInt;
@@ -1121,7 +1121,7 @@ TkParsePadAmount(
if (objc != 1 && objc != 2) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"wrong number of parts to pad specification", TCL_INDEX_NONE));
- Tcl_SetErrorCode(interp, "TK", "VALUE", "PADDING", "PARTS", NULL);
+ Tcl_SetErrorCode(interp, "TK", "VALUE", "PADDING", "PARTS", (char *)NULL);
return TCL_ERROR;
}
@@ -1134,7 +1134,7 @@ TkParsePadAmount(
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"bad pad value \"%s\": must be positive screen distance",
Tcl_GetString(objv[0])));
- Tcl_SetErrorCode(interp, "TK", "VALUE", "PADDING", "DIST", NULL);
+ Tcl_SetErrorCode(interp, "TK", "VALUE", "PADDING", "DIST", (char *)NULL);
return TCL_ERROR;
}
@@ -1150,7 +1150,7 @@ TkParsePadAmount(
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"bad 2nd pad value \"%s\": must be positive screen distance",
Tcl_GetString(objv[1])));
- Tcl_SetErrorCode(interp, "TK", "VALUE", "PADDING", "DIST", NULL);
+ Tcl_SetErrorCode(interp, "TK", "VALUE", "PADDING", "DIST", (char *)NULL);
return TCL_ERROR;
}
diff --git a/generic/tkOldConfig.c b/generic/tkOldConfig.c
index 9ca5a7a..0f22e3b 100644
--- a/generic/tkOldConfig.c
+++ b/generic/tkOldConfig.c
@@ -343,7 +343,7 @@ DoConfig(
int nullValue;
nullValue = 0;
- if ((*value == 0) && (specPtr->specFlags & (TK_CONFIG_NULL_OK|TCL_NULL_OK))) {
+ if ((*value == 0) && (specPtr->specFlags & (TK_CONFIG_NULL_OK|TCL_NULL_OK|1))) {
nullValue = 1;
}
@@ -354,17 +354,17 @@ DoConfig(
ptr = (char *)widgRec + specPtr->offset;
switch (specPtr->type) {
case TK_CONFIG_BOOLEAN:
- if (Tcl_GetBoolean(interp, value, (int *) ptr) != TCL_OK) {
+ if (Tcl_GetBoolean(interp, value, (int *)ptr) != TCL_OK) {
return TCL_ERROR;
}
break;
case TK_CONFIG_INT:
- if (Tcl_GetInt(interp, value, (int *) ptr) != TCL_OK) {
+ if (Tcl_GetInt(interp, value, (int *)ptr) != TCL_OK) {
return TCL_ERROR;
}
break;
case TK_CONFIG_DOUBLE:
- if (Tcl_GetDouble(interp, value, (double *) ptr) != TCL_OK) {
+ if (Tcl_GetDouble(interp, value, (double *)ptr) != TCL_OK) {
return TCL_ERROR;
}
break;
@@ -466,7 +466,7 @@ DoConfig(
}
case TK_CONFIG_RELIEF:
uid = valueIsUid ? (Tk_Uid) value : Tk_GetUid(value);
- if (Tk_GetRelief(interp, uid, (int *) ptr) != TCL_OK) {
+ if (Tk_GetRelief(interp, uid, (int *)ptr) != TCL_OK) {
return TCL_ERROR;
}
break;
@@ -507,24 +507,26 @@ DoConfig(
break;
case TK_CONFIG_CAP_STYLE:
uid = valueIsUid ? (Tk_Uid) value : Tk_GetUid(value);
- if (Tk_GetCapStyle(interp, uid, (int *) ptr) != TCL_OK) {
+ if (Tk_GetCapStyle(interp, uid, (int *)ptr) != TCL_OK) {
return TCL_ERROR;
}
break;
case TK_CONFIG_JOIN_STYLE:
uid = valueIsUid ? (Tk_Uid) value : Tk_GetUid(value);
- if (Tk_GetJoinStyle(interp, uid, (int *) ptr) != TCL_OK) {
+ if (Tk_GetJoinStyle(interp, uid, (int *)ptr) != TCL_OK) {
return TCL_ERROR;
}
break;
case TK_CONFIG_PIXELS:
- if (Tk_GetPixels(interp, tkwin, value, (int *) ptr)
+ if (nullValue) {
+ *(int *)ptr = INT_MIN;
+ } else if (Tk_GetPixels(interp, tkwin, value, (int *)ptr)
!= TCL_OK) {
return TCL_ERROR;
}
break;
case TK_CONFIG_MM:
- if (Tk_GetScreenMM(interp, tkwin, value, (double*)ptr) != TCL_OK) {
+ if (Tk_GetScreenMM(interp, tkwin, value, (double *)ptr) != TCL_OK) {
return TCL_ERROR;
}
break;
@@ -857,8 +859,10 @@ FormatConfigValue(
result = Tk_NameOfJoinStyle(*((int *)ptr));
break;
case TK_CONFIG_PIXELS:
- snprintf(buffer, 200, "%d", *((int *)ptr));
- result = buffer;
+ if ((*(int *)ptr != INT_MIN) || !(specPtr->specFlags & (TK_CONFIG_NULL_OK|TCL_NULL_OK|1))) {
+ snprintf(buffer, 200, "%d", *((int *)ptr));
+ result = buffer;
+ }
break;
case TK_CONFIG_MM:
Tcl_PrintDouble(interp, *((double *)ptr), buffer);
diff --git a/generic/tkOption.c b/generic/tkOption.c
index e626930..f6976bd 100644
--- a/generic/tkOption.c
+++ b/generic/tkOption.c
@@ -881,7 +881,7 @@ ParsePriority(
"bad priority level \"%s\": must be "
"widgetDefault, startupFile, userDefault, "
"interactive, or a number between 0 and 100", string));
- Tcl_SetErrorCode(interp, "TK", "VALUE", "PRIORITY", NULL);
+ Tcl_SetErrorCode(interp, "TK", "VALUE", "PRIORITY", (char *)NULL);
return -1;
}
}
@@ -965,7 +965,7 @@ AddFromString(
if ((*src == '\0') || (*src == '\n')) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"missing colon on line %d", lineNum));
- Tcl_SetErrorCode(interp, "TK", "OPTIONDB", "COLON", NULL);
+ Tcl_SetErrorCode(interp, "TK", "OPTIONDB", "COLON", (char *)NULL);
return TCL_ERROR;
}
if ((src[0] == '\\') && (src[1] == '\n')) {
@@ -1002,7 +1002,7 @@ AddFromString(
if (*src == '\0') {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"missing value on line %d", lineNum));
- Tcl_SetErrorCode(interp, "TK", "OPTIONDB", "VALUE", NULL);
+ Tcl_SetErrorCode(interp, "TK", "OPTIONDB", "VALUE", (char *)NULL);
return TCL_ERROR;
}
@@ -1016,7 +1016,7 @@ AddFromString(
if (*src == '\0') {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"missing newline on line %d", lineNum));
- Tcl_SetErrorCode(interp, "TK", "OPTIONDB", "NEWLINE", NULL);
+ Tcl_SetErrorCode(interp, "TK", "OPTIONDB", "NEWLINE", (char *)NULL);
return TCL_ERROR;
}
if (*src == '\\'){
@@ -1096,7 +1096,7 @@ ReadOptionFile(
if (Tcl_IsSafe(interp)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"can't read options from a file in a safe interpreter", TCL_INDEX_NONE));
- Tcl_SetErrorCode(interp, "TK", "SAFE", "OPTION_FILE", NULL);
+ Tcl_SetErrorCode(interp, "TK", "SAFE", "OPTION_FILE", (char *)NULL);
return TCL_ERROR;
}
diff --git a/generic/tkPack.c b/generic/tkPack.c
index baf2a70..3ad8cae 100644
--- a/generic/tkPack.c
+++ b/generic/tkPack.c
@@ -1108,7 +1108,7 @@ PackStructureProc(
Tcl_DoWhenIdle(ArrangePacking, packPtr);
}
if ((packPtr->containerPtr != NULL)
- && (packPtr->doubleBw != 2*Tk_Changes(packPtr->tkwin)->border_width)) {
+ && (packPtr->doubleBw != 2*Tk_Changes(packPtr->tkwin)->border_width)) {
if (!(packPtr->containerPtr->flags & REQUESTED_REPACK)) {
packPtr->doubleBw = 2*Tk_Changes(packPtr->tkwin)->border_width;
packPtr->containerPtr->flags |= REQUESTED_REPACK;
@@ -1133,7 +1133,7 @@ PackStructureProc(
if (packPtr->tkwin != NULL) {
TkDisplay *dispPtr = ((TkWindow *) packPtr->tkwin)->dispPtr;
- Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->packerHashTable,
+ Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->packerHashTable,
packPtr->tkwin));
}
@@ -1485,8 +1485,8 @@ ConfigureContent(
container = (TkWindow *)TkGetContainer(container)) {
if (container == (TkWindow *)content) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't put \"%s\" inside \"%s\": would cause management loop",
- Tcl_GetString(objv[j]), Tk_PathName(containerPtr->tkwin)));
+ "can't put \"%s\" inside \"%s\": would cause management loop",
+ Tcl_GetString(objv[j]), Tk_PathName(containerPtr->tkwin)));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "LOOP", NULL);
return TCL_ERROR;
}
diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c
index d7f2d45..b244c9a 100644
--- a/generic/tkPanedWindow.c
+++ b/generic/tkPanedWindow.c
@@ -86,7 +86,7 @@ typedef struct Pane {
* the x dimension. */
int pady; /* Additional padding requested for pane, in
* the y dimension. */
- Tcl_Obj *widthPtr, *heightPtr;
+ Tcl_Obj *widthObj, *heightObj;
/* Tcl_Obj rep's of pane width/height, to
* allow for null values. */
int width; /* Pane width. */
@@ -125,8 +125,8 @@ typedef struct PanedWindow {
Tk_3DBorder background; /* Background color. */
int borderWidth; /* Value of -borderwidth option. */
int relief; /* 3D border effect (TK_RELIEF_RAISED, etc) */
- Tcl_Obj *widthPtr; /* Tcl_Obj rep for width. */
- Tcl_Obj *heightPtr; /* Tcl_Obj rep for height. */
+ Tcl_Obj *widthObj; /* Tcl_Obj rep for width. */
+ Tcl_Obj *heightObj; /* Tcl_Obj rep for height. */
int width, height; /* Width and height of the widget. */
enum orient orient; /* Orientation of the widget. */
Tk_Cursor cursor; /* Current cursor for window, or None. */
@@ -291,7 +291,7 @@ static const Tk_OptionSpec optionSpecs[] = {
DEF_PANEDWINDOW_HANDLESIZE, offsetof(PanedWindow, handleSizePtr),
offsetof(PanedWindow, handleSize), 0, 0, GEOMETRY},
{TK_OPTION_PIXELS, "-height", "height", "Height",
- DEF_PANEDWINDOW_HEIGHT, offsetof(PanedWindow, heightPtr),
+ DEF_PANEDWINDOW_HEIGHT, offsetof(PanedWindow, heightObj),
offsetof(PanedWindow, height), TK_OPTION_NULL_OK, 0, GEOMETRY},
{TK_OPTION_BOOLEAN, "-opaqueresize", "opaqueResize", "OpaqueResize",
DEF_PANEDWINDOW_OPAQUERESIZE, TCL_INDEX_NONE,
@@ -326,7 +326,7 @@ static const Tk_OptionSpec optionSpecs[] = {
DEF_PANEDWINDOW_SHOWHANDLE, TCL_INDEX_NONE, offsetof(PanedWindow, showHandle),
0, 0, GEOMETRY},
{TK_OPTION_PIXELS, "-width", "width", "Width",
- DEF_PANEDWINDOW_WIDTH, offsetof(PanedWindow, widthPtr),
+ DEF_PANEDWINDOW_WIDTH, offsetof(PanedWindow, widthObj),
offsetof(PanedWindow, width), TK_OPTION_NULL_OK, 0, GEOMETRY},
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0}
};
@@ -339,7 +339,7 @@ static const Tk_OptionSpec paneOptionSpecs[] = {
DEF_PANEDWINDOW_PANE_BEFORE, TCL_INDEX_NONE, offsetof(Pane, before),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_PIXELS, "-height", NULL, NULL,
- DEF_PANEDWINDOW_PANE_HEIGHT, offsetof(Pane, heightPtr),
+ DEF_PANEDWINDOW_PANE_HEIGHT, offsetof(Pane, heightObj),
offsetof(Pane, height), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_BOOLEAN, "-hide", "hide", "Hide",
DEF_PANEDWINDOW_PANE_HIDE, TCL_INDEX_NONE, offsetof(Pane, hide), 0,0,GEOMETRY},
@@ -356,7 +356,7 @@ static const Tk_OptionSpec paneOptionSpecs[] = {
DEF_PANEDWINDOW_PANE_STRETCH, TCL_INDEX_NONE, offsetof(Pane, stretch),
TK_OPTION_ENUM_VAR, stretchStrings, 0},
{TK_OPTION_PIXELS, "-width", NULL, NULL,
- DEF_PANEDWINDOW_PANE_WIDTH, offsetof(Pane, widthPtr),
+ DEF_PANEDWINDOW_PANE_WIDTH, offsetof(Pane, widthObj),
offsetof(Pane, width), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0}
};
@@ -674,7 +674,7 @@ PanedWindowWidgetObjCmd(
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"not managed by this window", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TK", "PANEDWINDOW", "UNMANAGED",
- NULL);
+ (char *)NULL);
}
result = TCL_ERROR;
} else {
@@ -693,15 +693,15 @@ PanedWindowWidgetObjCmd(
if (objc <= 4) {
tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[2]),
pwPtr->tkwin);
- if (tkwin == NULL) {
- /*
- * Just a plain old bad window; Tk_NameToWindow filled in an
- * error message for us.
- */
-
- result = TCL_ERROR;
- break;
- }
+ if (tkwin == NULL) {
+ /*
+ * Just a plain old bad window; Tk_NameToWindow filled in an
+ * error message for us.
+ */
+
+ result = TCL_ERROR;
+ break;
+ }
for (i = 0; i < pwPtr->numPanes; i++) {
if (pwPtr->panes[i]->tkwin == tkwin) {
resultObj = Tk_GetOptionInfo(interp,
@@ -799,7 +799,7 @@ ConfigurePanes(
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't add %s to itself", arg));
- Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "SELF", NULL);
+ Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "SELF", (char *)NULL);
return TCL_ERROR;
} else if (Tk_IsTopLevel(tkwin)) {
/*
@@ -809,7 +809,7 @@ ConfigurePanes(
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't add toplevel %s to %s", arg,
Tk_PathName(pwPtr->tkwin)));
- Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "TOPLEVEL", NULL);
+ Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "TOPLEVEL", (char *)NULL);
return TCL_ERROR;
} else {
/*
@@ -827,7 +827,7 @@ ConfigurePanes(
"can't add %s to %s", arg,
Tk_PathName(pwPtr->tkwin)));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY",
- "HIERARCHY", NULL);
+ "HIERARCHY", (char *)NULL);
return TCL_ERROR;
}
}
@@ -887,7 +887,7 @@ ConfigurePanes(
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"window \"%s\" is not managed by %s",
Tk_PathName(tkwin), Tk_PathName(pwPtr->tkwin)));
- Tcl_SetErrorCode(interp, "TK", "PANEDWINDOW", "UNMANAGED", NULL);
+ Tcl_SetErrorCode(interp, "TK", "PANEDWINDOW", "UNMANAGED", (char *)NULL);
Tk_FreeConfigOptions(&options, pwPtr->paneOpts,
pwPtr->tkwin);
return TCL_ERROR;
@@ -1127,7 +1127,7 @@ PanedWindowSashCommand(
if (!ValidSashIndex(pwPtr, sash)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"invalid sash index", TCL_INDEX_NONE));
- Tcl_SetErrorCode(interp, "TK", "VALUE", "SASH_INDEX", NULL);
+ Tcl_SetErrorCode(interp, "TK", "VALUE", "SASH_INDEX", (char *)NULL);
return TCL_ERROR;
}
panePtr = pwPtr->panes[sash];
@@ -1150,7 +1150,7 @@ PanedWindowSashCommand(
if (!ValidSashIndex(pwPtr, sash)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"invalid sash index", TCL_INDEX_NONE));
- Tcl_SetErrorCode(interp, "TK", "VALUE", "SASH_INDEX", NULL);
+ Tcl_SetErrorCode(interp, "TK", "VALUE", "SASH_INDEX", (char *)NULL);
return TCL_ERROR;
}
@@ -1186,7 +1186,7 @@ PanedWindowSashCommand(
if (!ValidSashIndex(pwPtr, sash)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"invalid sash index", TCL_INDEX_NONE));
- Tcl_SetErrorCode(interp, "TK", "VALUE", "SASH_INDEX", NULL);
+ Tcl_SetErrorCode(interp, "TK", "VALUE", "SASH_INDEX", (char *)NULL);
return TCL_ERROR;
}
@@ -1369,17 +1369,17 @@ PanedWindowEventProc(
} else if (eventPtr->type == DestroyNotify) {
DestroyPanedWindow(pwPtr);
} else if (eventPtr->type == UnmapNotify) {
- for (i = 0; i < pwPtr->numPanes; i++) {
- if (!pwPtr->panes[i]->hide) {
- Tk_UnmapWindow(pwPtr->panes[i]->tkwin);
- }
- }
+ for (i = 0; i < pwPtr->numPanes; i++) {
+ if (!pwPtr->panes[i]->hide) {
+ Tk_UnmapWindow(pwPtr->panes[i]->tkwin);
+ }
+ }
} else if (eventPtr->type == MapNotify) {
- for (i = 0; i < pwPtr->numPanes; i++) {
- if (!pwPtr->panes[i]->hide) {
- Tk_MapWindow(pwPtr->panes[i]->tkwin);
- }
- }
+ for (i = 0; i < pwPtr->numPanes; i++) {
+ if (!pwPtr->panes[i]->hide) {
+ Tk_MapWindow(pwPtr->panes[i]->tkwin);
+ }
+ }
}
}
@@ -1789,18 +1789,18 @@ ArrangePanes(
*/
if (horizontal) {
- if (panePtr->width > 0) {
- paneSize = panePtr->width;
- } else {
- paneSize = panePtr->paneWidth;
- }
+ if (panePtr->width > 0) {
+ paneSize = panePtr->width;
+ } else {
+ paneSize = panePtr->paneWidth;
+ }
stretchReserve -= paneSize + (2 * panePtr->padx);
} else {
- if (panePtr->height > 0) {
- paneSize = panePtr->height;
- } else {
- paneSize = panePtr->paneHeight;
- }
+ if (panePtr->height > 0) {
+ paneSize = panePtr->height;
+ } else {
+ paneSize = panePtr->paneHeight;
+ }
stretchReserve -= paneSize + (2 * panePtr->pady);
}
if (IsStretchable(panePtr->stretch,i,first,last)
@@ -1850,18 +1850,18 @@ ArrangePanes(
*/
if (horizontal) {
- if (panePtr->width > 0) {
- paneSize = panePtr->width;
- } else {
- paneSize = panePtr->paneWidth;
- }
+ if (panePtr->width > 0) {
+ paneSize = panePtr->width;
+ } else {
+ paneSize = panePtr->paneWidth;
+ }
pwSize = pwWidth;
} else {
- if (panePtr->height > 0) {
- paneSize = panePtr->height;
- } else {
- paneSize = panePtr->paneHeight;
- }
+ if (panePtr->height > 0) {
+ paneSize = panePtr->height;
+ } else {
+ paneSize = panePtr->paneHeight;
+ }
pwSize = pwHeight;
}
if (IsStretchable(panePtr->stretch, i, first, last)) {
@@ -2491,7 +2491,7 @@ SetSticky(
"bad stickyness value \"%s\": must be a string"
" containing zero or more of n, e, s, and w",
Tcl_GetString(*value)));
- Tcl_SetErrorCode(interp, "TK", "VALUE", "STICKY", NULL);
+ Tcl_SetErrorCode(interp, "TK", "VALUE", "STICKY", (char *)NULL);
return TCL_ERROR;
}
}
@@ -2907,16 +2907,16 @@ PanedWindowProxyCommand(
return TCL_ERROR;
}
- internalBW = Tk_InternalBorderLeft(pwPtr->tkwin);
+ internalBW = Tk_InternalBorderLeft(pwPtr->tkwin);
if (pwPtr->orient == ORIENT_HORIZONTAL) {
if (x < 0) {
x = 0;
}
- pwWidth = Tk_Width(pwPtr->tkwin) - (2 * internalBW);
- if (x > pwWidth) {
- x = pwWidth;
- }
- y = Tk_InternalBorderLeft(pwPtr->tkwin);
+ pwWidth = Tk_Width(pwPtr->tkwin) - (2 * internalBW);
+ if (x > pwWidth) {
+ x = pwWidth;
+ }
+ y = Tk_InternalBorderLeft(pwPtr->tkwin);
sashWidth = pwPtr->sashWidth;
sashHeight = Tk_Height(pwPtr->tkwin) -
(2 * Tk_InternalBorderLeft(pwPtr->tkwin));
@@ -2924,10 +2924,10 @@ PanedWindowProxyCommand(
if (y < 0) {
y = 0;
}
- pwHeight = Tk_Height(pwPtr->tkwin) - (2 * internalBW);
- if (y > pwHeight) {
- y = pwHeight;
- }
+ pwHeight = Tk_Height(pwPtr->tkwin) - (2 * internalBW);
+ if (y > pwHeight) {
+ y = pwHeight;
+ }
x = Tk_InternalBorderLeft(pwPtr->tkwin);
sashHeight = pwPtr->sashWidth;
sashWidth = Tk_Width(pwPtr->tkwin) -
diff --git a/generic/tkPlace.c b/generic/tkPlace.c
index 774ad79..013c531 100644
--- a/generic/tkPlace.c
+++ b/generic/tkPlace.c
@@ -54,19 +54,19 @@ typedef struct Content {
*/
int x, y; /* X and Y pixel coordinates for tkwin. */
- Tcl_Obj *xPtr, *yPtr; /* Tcl_Obj rep's of x, y coords, to keep pixel
+ Tcl_Obj *xObj, *yObj; /* Tcl_Obj rep's of x, y coords, to keep pixel
* spec. information. */
double relX, relY; /* X and Y coordinates relative to size of
* container. */
int width, height; /* Absolute dimensions for tkwin. */
- Tcl_Obj *widthPtr; /* Tcl_Obj rep of width, to keep pixel
+ Tcl_Obj *widthObj; /* Tcl_Obj rep of width, to keep pixel
* spec. */
- Tcl_Obj *heightPtr; /* Tcl_Obj rep of height, to keep pixel
+ Tcl_Obj *heightObj; /* Tcl_Obj rep of height, to keep pixel
* spec. */
double relWidth, relHeight; /* Dimensions for tkwin relative to size of
* container. */
- Tcl_Obj *relWidthPtr;
- Tcl_Obj *relHeightPtr;
+ Tcl_Obj *relWidthObj;
+ Tcl_Obj *relHeightObj;
Tk_Anchor anchor; /* Which point on tkwin is placed at the given
* position. */
BorderMode borderMode; /* How to treat borders of container window. */
@@ -80,29 +80,29 @@ typedef struct Content {
static const Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_ANCHOR, "-anchor", NULL, NULL, "nw", TCL_INDEX_NONE,
- offsetof(Content, anchor), TK_OPTION_ENUM_VAR, 0, 0},
+ offsetof(Content, anchor), TK_OPTION_ENUM_VAR, 0, 0},
{TK_OPTION_STRING_TABLE, "-bordermode", NULL, NULL, "inside", TCL_INDEX_NONE,
- offsetof(Content, borderMode), TK_OPTION_ENUM_VAR, borderModeStrings, 0},
- {TK_OPTION_PIXELS, "-height", NULL, NULL, "", offsetof(Content, heightPtr),
- offsetof(Content, height), TK_OPTION_NULL_OK, 0, 0},
+ offsetof(Content, borderMode), TK_OPTION_ENUM_VAR, borderModeStrings, 0},
+ {TK_OPTION_PIXELS, "-height", NULL, NULL, NULL, offsetof(Content, heightObj),
+ offsetof(Content, height), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_WINDOW, "-in", NULL, NULL, "", TCL_INDEX_NONE, offsetof(Content, inTkwin),
- 0, 0, IN_MASK},
- {TK_OPTION_DOUBLE, "-relheight", NULL, NULL, "",
- offsetof(Content, relHeightPtr), offsetof(Content, relHeight),
- TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_DOUBLE, "-relwidth", NULL, NULL, "",
- offsetof(Content, relWidthPtr), offsetof(Content, relWidth),
- TK_OPTION_NULL_OK, 0, 0},
+ 0, 0, IN_MASK},
+ {TK_OPTION_DOUBLE, "-relheight", NULL, NULL, NULL,
+ offsetof(Content, relHeightObj), offsetof(Content, relHeight),
+ TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_DOUBLE, "-relwidth", NULL, NULL, NULL,
+ offsetof(Content, relWidthObj), offsetof(Content, relWidth),
+ TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_DOUBLE, "-relx", NULL, NULL, "0.0", TCL_INDEX_NONE,
- offsetof(Content, relX), 0, 0, 0},
+ offsetof(Content, relX), 0, 0, 0},
{TK_OPTION_DOUBLE, "-rely", NULL, NULL, "0.0", TCL_INDEX_NONE,
- offsetof(Content, relY), 0, 0, 0},
- {TK_OPTION_PIXELS, "-width", NULL, NULL, "", offsetof(Content, widthPtr),
- offsetof(Content, width), TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_PIXELS, "-x", NULL, NULL, "0", offsetof(Content, xPtr),
- offsetof(Content, x), TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_PIXELS, "-y", NULL, NULL, "0", offsetof(Content, yPtr),
- offsetof(Content, y), TK_OPTION_NULL_OK, 0, 0},
+ offsetof(Content, relY), 0, 0, 0},
+ {TK_OPTION_PIXELS, "-width", NULL, NULL, NULL, offsetof(Content, widthObj),
+ offsetof(Content, width), TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_PIXELS, "-x", NULL, NULL, "0", offsetof(Content, xObj),
+ offsetof(Content, x), 0, 0, 0},
+ {TK_OPTION_PIXELS, "-y", NULL, NULL, "0", offsetof(Content, yObj),
+ offsetof(Content, y), 0, 0, 0},
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0, 0, 0}
};
@@ -626,7 +626,7 @@ ConfigureContent(
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't use placer on top-level window \"%s\"; use "
"wm command instead", Tk_PathName(tkwin)));
- Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "TOPLEVEL", NULL);
+ Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "TOPLEVEL", (char *)NULL);
return TCL_ERROR;
}
@@ -666,7 +666,7 @@ ConfigureContent(
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't place \"%s\" relative to \"%s\"",
Tk_PathName(contentPtr->tkwin), Tk_PathName(win)));
- Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "HIERARCHY", NULL);
+ Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "HIERARCHY", (char *)NULL);
goto error;
}
}
@@ -674,7 +674,7 @@ ConfigureContent(
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't place \"%s\" relative to itself",
Tk_PathName(contentPtr->tkwin)));
- Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "LOOP", NULL);
+ Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "LOOP", (char *)NULL);
goto error;
}
@@ -686,9 +686,9 @@ ConfigureContent(
container = (TkWindow *)TkGetContainer(container)) {
if (container == (TkWindow *)contentPtr->tkwin) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't put \"%s\" inside \"%s\": would cause management loop",
- Tk_PathName(contentPtr->tkwin), Tk_PathName(win)));
- Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "LOOP", NULL);
+ "can't put \"%s\" inside \"%s\": would cause management loop",
+ Tk_PathName(contentPtr->tkwin), Tk_PathName(win)));
+ Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "LOOP", (char *)NULL);
goto error;
}
}
@@ -794,23 +794,23 @@ PlaceInfoCommand(
Tcl_AppendPrintfToObj(infoObj,
"-x %d -relx %.4g -y %d -rely %.4g",
contentPtr->x, contentPtr->relX, contentPtr->y, contentPtr->relY);
- if (contentPtr->widthPtr) {
+ if (contentPtr->widthObj) {
Tcl_AppendPrintfToObj(infoObj, " -width %d", contentPtr->width);
} else {
Tcl_AppendToObj(infoObj, " -width {}", TCL_INDEX_NONE);
}
- if (contentPtr->relWidthPtr) {
+ if (contentPtr->relWidthObj) {
Tcl_AppendPrintfToObj(infoObj,
" -relwidth %.4g", contentPtr->relWidth);
} else {
Tcl_AppendToObj(infoObj, " -relwidth {}", TCL_INDEX_NONE);
}
- if (contentPtr->heightPtr) {
+ if (contentPtr->heightObj) {
Tcl_AppendPrintfToObj(infoObj, " -height %d", contentPtr->height);
} else {
Tcl_AppendToObj(infoObj, " -height {}", TCL_INDEX_NONE);
}
- if (contentPtr->relHeightPtr) {
+ if (contentPtr->relHeightObj) {
Tcl_AppendPrintfToObj(infoObj,
" -relheight %.4g", contentPtr->relHeight);
} else {
@@ -906,12 +906,12 @@ RecomputePlacement(
x = (int) (x1 + ((x1 > 0) ? 0.5 : -0.5));
y1 = contentPtr->y + containerY + (contentPtr->relY*containerHeight);
y = (int) (y1 + ((y1 > 0) ? 0.5 : -0.5));
- if ((contentPtr->widthPtr) || contentPtr->relWidthPtr) {
+ if ((contentPtr->widthObj) || contentPtr->relWidthObj) {
width = 0;
- if (contentPtr->widthPtr) {
+ if (contentPtr->widthObj) {
width += contentPtr->width;
}
- if (contentPtr->relWidthPtr) {
+ if (contentPtr->relWidthObj) {
/*
* The code below is a bit tricky. In order to round correctly
* when both relX and relWidth are specified, compute the
@@ -928,12 +928,12 @@ RecomputePlacement(
width = Tk_ReqWidth(contentPtr->tkwin)
+ 2*Tk_Changes(contentPtr->tkwin)->border_width;
}
- if (contentPtr->heightPtr || contentPtr->relHeightPtr) {
+ if (contentPtr->heightObj || contentPtr->relHeightObj) {
height = 0;
- if (contentPtr->heightPtr) {
+ if (contentPtr->heightObj) {
height += contentPtr->height;
}
- if (contentPtr->relHeightPtr) {
+ if (contentPtr->relHeightObj) {
/*
* See note above for rounding errors in width computation.
*/
@@ -1015,9 +1015,9 @@ RecomputePlacement(
|| (height != Tk_Height(contentPtr->tkwin))) {
Tk_MoveResizeWindow(contentPtr->tkwin, x, y, width, height);
}
- if (abort) {
- break;
- }
+ if (abort) {
+ break;
+ }
/*
* Don't map the content unless the container is mapped: the content will
@@ -1184,14 +1184,14 @@ PlaceRequestProc(
Content *contentPtr = (Content *)clientData;
Container *containerPtr;
- if ((contentPtr->widthPtr || contentPtr->relWidthPtr)
- && (contentPtr->heightPtr || contentPtr->relHeightPtr)) {
- /*
- * Send a ConfigureNotify to indicate that the size change
- * request was rejected.
- */
+ if ((contentPtr->widthObj || contentPtr->relWidthObj)
+ && (contentPtr->heightObj || contentPtr->relHeightObj)) {
+ /*
+ * Send a ConfigureNotify to indicate that the size change
+ * request was rejected.
+ */
- TkDoConfigureNotify((TkWindow *)(contentPtr->tkwin));
+ TkDoConfigureNotify((TkWindow *)(contentPtr->tkwin));
return;
}
containerPtr = contentPtr->containerPtr;
diff --git a/generic/tkScrollbar.c b/generic/tkScrollbar.c
index f0abe18..5f03fee 100644
--- a/generic/tkScrollbar.c
+++ b/generic/tkScrollbar.c
@@ -57,7 +57,7 @@ static const Tk_ConfigSpec configSpecs[] = {
DEF_SCROLLBAR_CURSOR, offsetof(TkScrollbar, cursor), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_PIXELS, "-elementborderwidth", "elementBorderWidth",
"BorderWidth", DEF_SCROLLBAR_EL_BORDER_WIDTH,
- offsetof(TkScrollbar, elementBorderWidth), 0, NULL},
+ offsetof(TkScrollbar, elementBorderWidth), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_COLOR, "-highlightbackground", "highlightBackground",
"HighlightBackground", DEF_SCROLLBAR_HIGHLIGHT_BG,
offsetof(TkScrollbar, highlightBgColorPtr), 0, NULL},
@@ -172,7 +172,7 @@ Tk_ScrollbarObjCmd(
scrollPtr->highlightBgColorPtr = NULL;
scrollPtr->highlightColorPtr = NULL;
scrollPtr->inset = 0;
- scrollPtr->elementBorderWidth = -1;
+ scrollPtr->elementBorderWidth = INT_MIN;
scrollPtr->arrowLength = 0;
scrollPtr->sliderFirst = 0;
scrollPtr->sliderLast = 0;
@@ -487,6 +487,12 @@ ConfigureScrollbar(
} else {
scrollPtr->commandSize = 0;
}
+ if (scrollPtr->highlightWidth < 0) {
+ scrollPtr->highlightWidth = 0;
+ }
+ if (scrollPtr->elementBorderWidth < 0) {
+ scrollPtr->elementBorderWidth = INT_MIN;
+ }
/*
* Configure platform specific options.
diff --git a/generic/tkSelect.c b/generic/tkSelect.c
index ef15a7e..752b5ea 100644
--- a/generic/tkSelect.c
+++ b/generic/tkSelect.c
@@ -715,7 +715,7 @@ Tk_SelectionObjCmd(
if (count < 2) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"value for \"%s\" missing", string));
- Tcl_SetErrorCode(interp, "TK", "SELECTION", "VALUE", NULL);
+ Tcl_SetErrorCode(interp, "TK", "SELECTION", "VALUE", (char *)NULL);
return TCL_ERROR;
}
@@ -775,7 +775,7 @@ Tk_SelectionObjCmd(
if (count < 2) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"value for \"%s\" missing", string));
- Tcl_SetErrorCode(interp, "TK", "SELECTION", "VALUE", NULL);
+ Tcl_SetErrorCode(interp, "TK", "SELECTION", "VALUE", (char *)NULL);
return TCL_ERROR;
}
@@ -853,7 +853,7 @@ Tk_SelectionObjCmd(
if (count < 2) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"value for \"%s\" missing", string));
- Tcl_SetErrorCode(interp, "TK", "SELECTION", "VALUE", NULL);
+ Tcl_SetErrorCode(interp, "TK", "SELECTION", "VALUE", (char *)NULL);
return TCL_ERROR;
}
@@ -940,7 +940,7 @@ Tk_SelectionObjCmd(
if (count < 2) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"value for \"%s\" missing", string));
- Tcl_SetErrorCode(interp, "TK", "SELECTION", "VALUE", NULL);
+ Tcl_SetErrorCode(interp, "TK", "SELECTION", "VALUE", (char *)NULL);
return TCL_ERROR;
}
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c
index 78dad1d..027efc8 100644
--- a/generic/tkTextDisp.c
+++ b/generic/tkTextDisp.c
@@ -4414,7 +4414,7 @@ DisplayText(
Tk_Width(textPtr->tkwin) - 2*textPtr->highlightWidth,
Tk_Height(textPtr->tkwin) - 2*textPtr->highlightWidth,
textPtr->borderWidth, textPtr->relief);
- if (textPtr->highlightWidth != 0) {
+ if (textPtr->highlightWidth > 0) {
GC fgGC, bgGC;
bgGC = Tk_GCForColor(textPtr->highlightBgColorPtr,
diff --git a/generic/tkTextWind.c b/generic/tkTextWind.c
index 954e16f..8c71e48 100644
--- a/generic/tkTextWind.c
+++ b/generic/tkTextWind.c
@@ -171,7 +171,7 @@ TkTextWindowCmd(
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"no embedded window at index \"%s\"",
Tcl_GetString(objv[3])));
- Tcl_SetErrorCode(interp, "TK", "TEXT", "NO_WINDOW", NULL);
+ Tcl_SetErrorCode(interp, "TK", "TEXT", "NO_WINDOW", (char *)NULL);
return TCL_ERROR;
}
@@ -209,7 +209,7 @@ TkTextWindowCmd(
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"no embedded window at index \"%s\"",
Tcl_GetString(objv[3])));
- Tcl_SetErrorCode(interp, "TK", "TEXT", "NO_WINDOW", NULL);
+ Tcl_SetErrorCode(interp, "TK", "TEXT", "NO_WINDOW", (char *)NULL);
return TCL_ERROR;
}
if (objc <= 5) {
@@ -443,7 +443,7 @@ EmbWinConfigure(
Tk_PathName(ewPtr->body.ew.tkwin),
Tk_PathName(textPtr->tkwin)));
Tcl_SetErrorCode(textPtr->interp, "TK", "GEOMETRY",
- "HIERARCHY", NULL);
+ "HIERARCHY", (char *)NULL);
ewPtr->body.ew.tkwin = NULL;
if (client != NULL) {
client->tkwin = NULL;
@@ -940,7 +940,7 @@ EmbWinLayoutProc(
Tk_PathName(ewPtr->body.ew.tkwin),
Tk_PathName(textPtr->tkwin)));
Tcl_SetErrorCode(textPtr->interp, "TK", "GEOMETRY", "HIERARCHY",
- NULL);
+ (char *)NULL);
Tcl_BackgroundException(textPtr->interp, TCL_ERROR);
ewPtr->body.ew.tkwin = NULL;
goto gotWindow;
diff --git a/generic/tkWindow.c b/generic/tkWindow.c
index 64f6ce0..9d36e9f 100644
--- a/generic/tkWindow.c
+++ b/generic/tkWindow.c
@@ -1367,7 +1367,7 @@ static void SendEnterLeaveForDestroy(
Tk_UpdatePointer((Tk_Window) containerPtr, x, y, state);
}
}
-
+
if (pointerWin && (tkwin == Tk_Parent(pointerWin))) {
Tk_UpdatePointer(Tk_Parent(tkwin), x, y, state);
}
@@ -1401,7 +1401,7 @@ Tk_DestroyWindow(
if ((winPtr->flags & TK_DONT_DESTROY_WINDOW) == 0) {
SendEnterLeaveForDestroy(tkwin);
}
-
+
winPtr->flags |= TK_ALREADY_DEAD;
/*
diff --git a/library/demos/cscroll.tcl b/library/demos/cscroll.tcl
index 3d14146..0463cec 100644
--- a/library/demos/cscroll.tcl
+++ b/library/demos/cscroll.tcl
@@ -56,94 +56,50 @@ for {set i 0} {$i < 20} {incr i} {
$c bind all <Enter> "scrollEnter $c"
$c bind all <Leave> "scrollLeave $c"
$c bind all <Button-1> "scrollButton $c"
-if {([tk windowingsystem] eq "aqua") && ![package vsatisfies [package provide tk] 8.7-]} {
- bind $c <Button-3> "$c scan mark %x %y"
- bind $c <B3-Motion> "$c scan dragto %x %y"
- bind $c <MouseWheel> {
- %W yview scroll [expr {-%D}] units
- }
- bind $c <Option-MouseWheel> {
- %W yview scroll [expr {-10*%D}] units
- }
- bind $c <Shift-MouseWheel> {
- %W xview scroll [expr {-%D}] units
- }
- bind $c <Shift-Option-MouseWheel> {
- %W xview scroll [expr {-10*%D}] units
- }
-} else {
- bind $c <Button-2> "$c scan mark %x %y"
- bind $c <B2-Motion> "$c scan dragto %x %y"
- # We must make sure that positive and negative movements are rounded
- # equally to integers, avoiding the problem that
- # (int)1/-30 = -1,
- # but
- # (int)-1/-30 = 0
- # The following code ensure equal +/- behaviour.
- bind $c <MouseWheel> {
- if {%D >= 0} {
- %W yview scroll [expr {%D/-30}] units
- } else {
- %W yview scroll [expr {(%D-29)/-30}] units
- }
- }
- bind $c <Option-MouseWheel> {
- if {%D >= 0} {
- %W yview scroll [expr {%D/-3}] units
- } else {
- %W yview scroll [expr {(%D-2)/-3}] units
- }
- }
- bind $c <Shift-MouseWheel> {
- if {%D >= 0} {
- %W xview scroll [expr {%D/-30}] units
- } else {
- %W xview scroll [expr {(%D-29)/-30}] units
- }
- }
- bind $c <Shift-Option-MouseWheel> {
- if {%D >= 0} {
- %W xview scroll [expr {%D/-3}] units
- } else {
- %W xview scroll [expr {(%D-2)/-3}] units
- }
- }
- bind $c <TouchpadScroll> {
- lassign [tk::PreciseScrollDeltas %D] deltaX deltaY
- if {$deltaX != 0 || $deltaY != 0} {
- tk::ScrollByPixels %W $deltaX $deltaY
- }
+bind $c <Button-2> "$c scan mark %x %y"
+bind $c <B2-Motion> "$c scan dragto %x %y"
+
+# We must make sure that positive and negative movements are rounded
+# equally to integers, avoiding the problem that
+# (int)1/-40 = -1,
+# but
+# (int)-1/-40 = 0
+# The following code ensures equal +/- behaviour.
+bind $c <MouseWheel> {
+ if {%D >= 0} {
+ %W yview scroll [expr {%D/-40}] units
+ } else {
+ %W yview scroll [expr {(%D-39)/-40}] units
}
}
-
-if {[tk windowingsystem] eq "x11" && ![package vsatisfies [package provide tk] 8.7-]} {
- # Support for mousewheels on Linux/Unix commonly comes through mapping
- # the wheel to the extended buttons. If you have a mousewheel, find
- # Linux configuration info at:
- # https://linuxreviews.org/HOWTO_change_the_mouse_speed_in_X
- bind $c <Button-4> {
- if {!$tk_strictMotif} {
- %W yview scroll -5 units
- }
+bind $c <Option-MouseWheel> {
+ if {%D >= 0} {
+ %W yview scroll [expr {%D/-12}] units
+ } else {
+ %W yview scroll [expr {(%D-11)/-12}] units
}
- bind $c <Shift-Button-4> {
- if {!$tk_strictMotif} {
- %W xview scroll -5 units
- }
+}
+bind $c <Shift-MouseWheel> {
+ if {%D >= 0} {
+ %W xview scroll [expr {%D/-40}] units
+ } else {
+ %W xview scroll [expr {(%D-39)/-40}] units
}
- bind $c <Button-5> {
- if {!$tk_strictMotif} {
- %W yview scroll 5 units
- }
+}
+bind $c <Shift-Option-MouseWheel> {
+ if {%D >= 0} {
+ %W xview scroll [expr {%D/-12}] units
+ } else {
+ %W xview scroll [expr {(%D-11)/-12}] units
}
- bind $c <Shift-Button-5> {
- if {!$tk_strictMotif} {
- %W xview scroll 5 units
- }
+}
+bind $c <TouchpadScroll> {
+ lassign [tk::PreciseScrollDeltas %D] deltaX deltaY
+ if {$deltaX != 0 || $deltaY != 0} {
+ tk::ScrollByPixels %W $deltaX $deltaY
}
}
-
proc scrollEnter canvas {
global oldFill
set id [$canvas find withtag current]
diff --git a/library/demos/ctext.tcl b/library/demos/ctext.tcl
index db78a20..57fbb13 100644
--- a/library/demos/ctext.tcl
+++ b/library/demos/ctext.tcl
@@ -50,11 +50,7 @@ $c bind text <Return> "textInsert $c \\n"
$c bind text <Control-h> "textBs $c"
$c bind text <BackSpace> "textBs $c"
$c bind text <Delete> "textDel $c"
-if {[tk windowingsystem] eq "aqua" && ![package vsatisfies [package provide tk] 8.7-]} {
- $c bind text <Button-3> "textPaste $c @%x,%y"
-} else {
- $c bind text <Button-2> "textPaste $c @%x,%y"
-}
+$c bind text <Button-2> "textPaste $c @%x,%y"
# Next, create some items that allow the text's anchor position
# to be edited.
diff --git a/library/demos/floor.tcl b/library/demos/floor.tcl
index 3cec5de..4bf3ce4 100644
--- a/library/demos/floor.tcl
+++ b/library/demos/floor.tcl
@@ -1372,13 +1372,8 @@ $c bind floor2 <Button-1> "floorDisplay $c 2"
$c bind floor3 <Button-1> "floorDisplay $c 3"
$c bind room <Enter> "newRoom $c"
$c bind room <Leave> {set currentRoom ""}
-if {[tk windowingsystem] eq "aqua" && ![package vsatisfies [package provide tk] 8.7-]} {
- bind $c <Button-3> "$c scan mark %x %y"
- bind $c <B3-Motion> "$c scan dragto %x %y"
-} else {
- bind $c <Button-2> "$c scan mark %x %y"
- bind $c <B2-Motion> "$c scan dragto %x %y"
-}
+bind $c <Button-2> "$c scan mark %x %y"
+bind $c <B2-Motion> "$c scan dragto %x %y"
bind $c <Destroy> "unset currentRoom"
set currentRoom ""
trace add variable currentRoom write "roomChanged $c"
diff --git a/library/demos/items.tcl b/library/demos/items.tcl
index 56080fd..7b45cf5 100644
--- a/library/demos/items.tcl
+++ b/library/demos/items.tcl
@@ -185,17 +185,10 @@ $c create text 28.5c 17.4c -text Scale: -anchor s
$c bind item <Enter> "itemEnter $c"
$c bind item <Leave> "itemLeave $c"
-if {[tk windowingsystem] eq "aqua" && ![package vsatisfies [package provide tk] 8.7-]} {
- bind $c <Button-2> "itemMark $c %x %y"
- bind $c <B2-Motion> "itemStroke $c %x %y"
- bind $c <Button-3> "$c scan mark %x %y"
- bind $c <B3-Motion> "$c scan dragto %x %y"
-} else {
- bind $c <Button-2> "$c scan mark %x %y"
- bind $c <B2-Motion> "$c scan dragto %x %y"
- bind $c <Button-3> "itemMark $c %x %y"
- bind $c <B3-Motion> "itemStroke $c %x %y"
-}
+bind $c <Button-2> "$c scan mark %x %y"
+bind $c <B2-Motion> "$c scan dragto %x %y"
+bind $c <Button-3> "itemMark $c %x %y"
+bind $c <B3-Motion> "itemStroke $c %x %y"
bind $c <<NextChar>> "itemsUnderArea $c"
bind $c <Button-1> "itemStartDrag $c %x %y"
bind $c <B1-Motion> "itemDrag $c %x %y"
diff --git a/library/demos/widget b/library/demos/widget
index 62ed3d6..d2dff1c 100644
--- a/library/demos/widget
+++ b/library/demos/widget
@@ -10,7 +10,7 @@ exec wish "$0" ${1+"$@"}
# separate ".tcl" files is this directory, which are sourced by this script as
# needed.
-package require tk
+package require tk 8.7-
package require msgcat
destroy {*}[winfo children .]
diff --git a/library/tk.tcl b/library/tk.tcl
index f12470f..7741fd0 100644
--- a/library/tk.tcl
+++ b/library/tk.tcl
@@ -558,18 +558,16 @@ proc ::tk::PreciseScrollDeltas {dxdy} {
return [list $deltaX $deltaY]
}
-# Helper for smooth scrolling of widgets that support xview moveto,
-# yview moveto, height and width.
+## Helper for smooth scrolling of widgets that support xview moveto and
+## yview moveto.
proc ::tk::ScrollByPixels {w deltaX deltaY} {
- set width [expr {1.0 * [$w cget -width]}]
- set height [expr {1.0 * [$w cget -height]}]
- set X [lindex [$w xview] 0]
- set Y [lindex [$w yview] 0]
- set x [expr {$X - $deltaX / $width}]
- set y [expr {$Y - $deltaY / $height}]
- $w xview moveto $x
- $w yview moveto $y
+ set fracX [lindex [$w xview] 0]
+ set fracY [lindex [$w yview] 0]
+ set width [expr {1.0 * [winfo width $w]}]
+ set height [expr {1.0 * [winfo height $w]}]
+ $w xview moveto [expr {$fracX - $deltaX / $width}]
+ $w yview moveto [expr {$fracY - $deltaY / $height}]
}
# ::tk::TabToWindow --
diff --git a/macosx/README b/macosx/README
index 64be140..c6159a6 100644
--- a/macosx/README
+++ b/macosx/README
@@ -477,9 +477,9 @@ https://developer.apple.com/library/mac/documentation/Cocoa/\
Reference/ApplicationKit/Classes/NSApplication_Class)
void NSApplicationMain(int argc, char *argv[]) {
- [NSApplication sharedApplication];
- [NSBundle loadNibNamed:@"myMain" owner:NSApp];
- [NSApp run];
+ [NSApplication sharedApplication];
+ [NSBundle loadNibNamed:@"myMain" owner:NSApp];
+ [NSApp run];
}
Here NSApp is a standard global variable, initialized by the OS, which
points to an object in a subclass of NSApplication (called
diff --git a/macosx/tkMacOSXClipboard.c b/macosx/tkMacOSXClipboard.c
index f16ab0d..8d5f727 100644
--- a/macosx/tkMacOSXClipboard.c
+++ b/macosx/tkMacOSXClipboard.c
@@ -126,8 +126,8 @@ TkSelGetSelection(
([[NSPasteboard generalPasteboard] changeCount] != changeCount);
if (dispPtr && (haveExternalClip || dispPtr->clipboardActive)
- && selection == dispPtr->clipboardAtom
- && (target == XA_STRING || target == dispPtr->utf8Atom)) {
+ && selection == dispPtr->clipboardAtom
+ && (target == XA_STRING || target == dispPtr->utf8Atom)) {
NSString *string = nil;
NSPasteboard *pb = [NSPasteboard generalPasteboard];
NSString *type = [pb availableTypeFromArray:[NSArray arrayWithObject:
diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c
index cd42be8..436597f 100644
--- a/macosx/tkMacOSXColor.c
+++ b/macosx/tkMacOSXColor.c
@@ -52,7 +52,7 @@ static void initColorTable()
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400
if (@available(macOS 10.14, *)) {
darkAqua = [NSAppearance appearanceNamed:NSAppearanceNameDarkAqua];
- lightAqua = [NSAppearance appearanceNamed:NSAppearanceNameAqua];
+ lightAqua = [NSAppearance appearanceNamed:NSAppearanceNameAqua];
}
#endif
@@ -103,7 +103,7 @@ static void initColorTable()
name = (char *)ckalloc(length + 1);
strcpy(name, key.UTF8String);
name[0] = (char)toupper(UCHAR(name[0]));
- if (!strcmp(name, "WindowBackgroundColor")) {
+ if (!strcmp(name, "WindowBackgroundColor")) {
/*
* Avoid black windows on old systems.
@@ -192,8 +192,8 @@ TkMacOSXRGBPixel(
MacPixel p = {0};
p.pixel.colortype = rgbColor;
p.pixel.value = (unsigned int)(((red & 0xff) << 16) |
- ((green & 0xff) << 8) |
- (blue & 0xff));
+ ((green & 0xff) << 8) |
+ (blue & 0xff));
return p.ulong;
}
@@ -436,7 +436,7 @@ TkMacOSXInDarkMode(Tk_Window tkwin)
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400
if (@available(macOS 10.14, *)) {
- TkWindow *winPtr = (TkWindow*) tkwin;
+ TkWindow *winPtr = (TkWindow*) tkwin;
NSAppearanceName name;
NSView *view = nil;
if (winPtr && winPtr->privatePtr) {
diff --git a/macosx/tkMacOSXDefault.h b/macosx/tkMacOSXDefault.h
index 6fc98e9..60430be 100644
--- a/macosx/tkMacOSXDefault.h
+++ b/macosx/tkMacOSXDefault.h
@@ -475,7 +475,7 @@
#define DEF_SCROLLBAR_BORDER_WIDTH "0"
#define DEF_SCROLLBAR_COMMAND ""
#define DEF_SCROLLBAR_CURSOR ""
-#define DEF_SCROLLBAR_EL_BORDER_WIDTH "-1"
+#define DEF_SCROLLBAR_EL_BORDER_WIDTH NULL
#define DEF_SCROLLBAR_HIGHLIGHT_BG NORMAL_BG
#define DEF_SCROLLBAR_HIGHLIGHT NORMAL_FG
#define DEF_SCROLLBAR_HIGHLIGHT_WIDTH "0"
diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c
index b9b0bcf..8ebdde4 100644
--- a/macosx/tkMacOSXDraw.c
+++ b/macosx/tkMacOSXDraw.c
@@ -419,16 +419,16 @@ XDrawLines(
}
}
- /*
- * In the case of closed polylines, the first and last points are the
- * same. We want miter or bevel join be rendered also at this point,
- * this needs telling CoreGraphics that the path is closed.
- */
-
- if ((points[0].x == points[npoints-1].x) &&
- (points[0].y == points[npoints-1].y)) {
- CGContextClosePath(dc.context);
- }
+ /*
+ * In the case of closed polylines, the first and last points are the
+ * same. We want miter or bevel join be rendered also at this point,
+ * this needs telling CoreGraphics that the path is closed.
+ */
+
+ if ((points[0].x == points[npoints-1].x) &&
+ (points[0].y == points[npoints-1].y)) {
+ CGContextClosePath(dc.context);
+ }
CGContextStrokePath(dc.context);
}
TkMacOSXRestoreDrawingContext(&dc);
@@ -1330,7 +1330,7 @@ TkMacOSXSetupDrawingContext(
};
CGContextConcatCTM(dc.context, t);
}
-//#if 0 // disable clipping
+//#if 0 // disable clipping
if (dc.clipRgn) {
#ifdef TK_MAC_DEBUG_DRAWING
diff --git a/macosx/tkMacOSXEmbed.c b/macosx/tkMacOSXEmbed.c
index ef4f44d..f95d5d1 100644
--- a/macosx/tkMacOSXEmbed.c
+++ b/macosx/tkMacOSXEmbed.c
@@ -850,12 +850,12 @@ EmbedStructureProc(
if (eventPtr->type == ConfigureNotify) {
/*
- * Send a ConfigureNotify to the embedded application.
- */
+ * Send a ConfigureNotify to the embedded application.
+ */
- if (containerPtr->embeddedPtr != NULL) {
- TkDoConfigureNotify(containerPtr->embeddedPtr);
- }
+ if (containerPtr->embeddedPtr != NULL) {
+ TkDoConfigureNotify(containerPtr->embeddedPtr);
+ }
if (containerPtr->embedded != None) {
/*
* Ignore errors, since the embedded application could have
diff --git a/macosx/tkMacOSXEvent.c b/macosx/tkMacOSXEvent.c
index 4f36915..63493bc 100644
--- a/macosx/tkMacOSXEvent.c
+++ b/macosx/tkMacOSXEvent.c
@@ -35,7 +35,7 @@ enum {
switch ((NSInteger)type) {
case NSAppKitDefined:
- subtype = [theEvent subtype];
+ subtype = [theEvent subtype];
switch (subtype) {
/* Ignored at the moment. */
@@ -49,11 +49,11 @@ enum {
break;
case NSWindowMovedEventType:
break;
- case NSWindowWillMoveEventType:
- break;
+ case NSWindowWillMoveEventType:
+ break;
- default:
- break;
+ default:
+ break;
}
break; /* AppkitEvent. Return theEvent */
case NSKeyUp:
@@ -80,7 +80,7 @@ enum {
break; /* Mouse event. Return the processed event. */
#if 0
case NSSystemDefined:
- subtype = [theEvent subtype];
+ subtype = [theEvent subtype];
break;
case NSApplicationDefined: {
id win;
@@ -88,14 +88,14 @@ enum {
break;
}
case NSCursorUpdate:
- break;
+ break;
case NSEventTypeGesture:
case NSEventTypeMagnify:
case NSEventTypeRotate:
case NSEventTypeSwipe:
case NSEventTypeBeginGesture:
case NSEventTypeEndGesture:
- break;
+ break;
#endif
default:
diff --git a/macosx/tkMacOSXFileTypes.c b/macosx/tkMacOSXFileTypes.c
index 5df7ddd..acf2da9 100644
--- a/macosx/tkMacOSXFileTypes.c
+++ b/macosx/tkMacOSXFileTypes.c
@@ -26,9 +26,9 @@ without generating deprecation warnings.
#include "tkMacOSXPrivate.h"
#define CHARS_TO_OSTYPE(string) (OSType) string[0] << 24 | \
- (OSType) string[1] << 16 | \
- (OSType) string[2] << 8 | \
- (OSType) string[3]
+ (OSType) string[1] << 16 | \
+ (OSType) string[2] << 8 | \
+ (OSType) string[3]
MODULE_SCOPE NSString *TkMacOSXOSTypeToUTI(OSType ostype) {
char string[5];
diff --git a/macosx/tkMacOSXHLEvents.c b/macosx/tkMacOSXHLEvents.c
index 8e1fff5..0d07fdf 100644
--- a/macosx/tkMacOSXHLEvents.c
+++ b/macosx/tkMacOSXHLEvents.c
@@ -307,34 +307,34 @@ static const char getSdefProc[] = "::tk::mac::GetDynamicSdef";
/*
* This descriptor can be coerced to a file url. Construct a Tcl
* expression which passes the file path as a string argument to
- * ::tk::mac::DoScriptFile.
+ * ::tk::mac::DoScriptFile.
*/
if (noErr == AEGetParamPtr(theDesc, keyDirectObject, typeFileURL, &type,
- (Ptr) URLBuffer, URL_MAX_LENGTH, &actual)) {
- if (actual > 0) {
- URLBuffer[actual] = '\0';
- NSString *urlString = [NSString stringWithUTF8String:(char*)URLBuffer];
- NSURL *fileURL = [NSURL URLWithString:urlString];
- AppleEventInfo *AEInfo = (AppleEventInfo *)ckalloc(sizeof(AppleEventInfo));
- Tcl_DString *scriptFileCommand = &AEInfo->command;
- Tcl_DStringInit(scriptFileCommand);
- Tcl_DStringAppend(scriptFileCommand, scriptFileProc, TCL_INDEX_NONE);
- Tcl_DStringAppendElement(scriptFileCommand, [[fileURL path] UTF8String]);
- AEInfo->interp = _eventInterp;
- AEInfo->procedure = scriptFileProc;
- AEInfo->replyEvent = nil;
+ (Ptr) URLBuffer, URL_MAX_LENGTH, &actual)) {
+ if (actual > 0) {
+ URLBuffer[actual] = '\0';
+ NSString *urlString = [NSString stringWithUTF8String:(char*)URLBuffer];
+ NSURL *fileURL = [NSURL URLWithString:urlString];
+ AppleEventInfo *AEInfo = (AppleEventInfo *)ckalloc(sizeof(AppleEventInfo));
+ Tcl_DString *scriptFileCommand = &AEInfo->command;
+ Tcl_DStringInit(scriptFileCommand);
+ Tcl_DStringAppend(scriptFileCommand, scriptFileProc, TCL_INDEX_NONE);
+ Tcl_DStringAppendElement(scriptFileCommand, [[fileURL path] UTF8String]);
+ AEInfo->interp = _eventInterp;
+ AEInfo->procedure = scriptFileProc;
+ AEInfo->replyEvent = nil;
AEInfo->retryCount = 0;
- ProcessAppleEvent((void *)AEInfo);
- }
- }
+ ProcessAppleEvent((void *)AEInfo);
+ }
+ }
} else if (noErr == AEGetParamPtr(theDesc, keyDirectObject, typeUTF8Text, &type,
NULL, 0, &actual)) {
- /*
- * The descriptor cannot be coerced to a file URL but can be coerced to
- * text. Construct a Tcl expression which passes the text as a string
- * argument to ::tk::mac::DoScriptText.
- */
+ /*
+ * The descriptor cannot be coerced to a file URL but can be coerced to
+ * text. Construct a Tcl expression which passes the text as a string
+ * argument to ::tk::mac::DoScriptText.
+ */
if (actual > 0) {
char *data = (char *)ckalloc(actual + 1);
@@ -350,23 +350,23 @@ static const char getSdefProc[] = "::tk::mac::GetDynamicSdef";
AEInfo->interp = _eventInterp;
AEInfo->procedure = scriptTextProc;
AEInfo->retryCount = 0;
- if (Tcl_FindCommand(AEInfo->interp, AEInfo->procedure, NULL, 0)) {
- AEInfo->replyEvent = replyEvent;
- ProcessAppleEvent(AEInfo);
- } else {
- AEInfo->replyEvent = nil;
- ProcessAppleEvent(AEInfo);
- }
+ if (Tcl_FindCommand(AEInfo->interp, AEInfo->procedure, NULL, 0)) {
+ AEInfo->replyEvent = replyEvent;
+ ProcessAppleEvent(AEInfo);
+ } else {
+ AEInfo->replyEvent = nil;
+ ProcessAppleEvent(AEInfo);
+ }
}
}
}
}
- (void)handleURLEvent:(NSAppleEventDescriptor*)event
- withReplyEvent:(NSAppleEventDescriptor*)replyEvent
+ withReplyEvent:(NSAppleEventDescriptor*)replyEvent
{
NSString* url = [[event paramDescriptorForKeyword:keyDirectObject]
- stringValue];
+ stringValue];
const char *cURL=[url UTF8String];
AppleEventInfo *AEInfo = (AppleEventInfo *)ckalloc(sizeof(AppleEventInfo));
Tcl_DString *launchCommand = &AEInfo->command;
@@ -456,18 +456,18 @@ static void ProcessAppleEvent(
Tcl_DStringLength(&AEInfo->command), TCL_EVAL_GLOBAL);
if (AEInfo->replyEvent && code >= 0) {
- Tcl_Size reslen;
- const char *result = Tcl_GetStringFromObj(Tcl_GetObjResult(AEInfo->interp),
- &reslen);
- if (code == TCL_OK) {
- AEPutParamPtr((AppleEvent*)[AEInfo->replyEvent aeDesc],
- keyDirectObject, typeChar, result, reslen);
- } else {
- AEPutParamPtr((AppleEvent*)[AEInfo->replyEvent aeDesc],
- keyErrorString, typeChar, result, reslen);
- AEPutParamPtr((AppleEvent*)[AEInfo->replyEvent aeDesc],
- keyErrorNumber, typeSInt32, (Ptr) &code, sizeof(int));
- }
+ Tcl_Size reslen;
+ const char *result = Tcl_GetStringFromObj(Tcl_GetObjResult(AEInfo->interp),
+ &reslen);
+ if (code == TCL_OK) {
+ AEPutParamPtr((AppleEvent*)[AEInfo->replyEvent aeDesc],
+ keyDirectObject, typeChar, result, reslen);
+ } else {
+ AEPutParamPtr((AppleEvent*)[AEInfo->replyEvent aeDesc],
+ keyErrorString, typeChar, result, reslen);
+ AEPutParamPtr((AppleEvent*)[AEInfo->replyEvent aeDesc],
+ keyErrorNumber, typeSInt32, (Ptr) &code, sizeof(int));
+ }
} else if (code != TCL_OK) {
Tcl_BackgroundException(AEInfo->interp, code);
}
@@ -537,8 +537,8 @@ TkMacOSXInitAppleEvents(
/*
* We do not load our sdef dynamically but this event handler
- * is required to silence error messages from inline execution
- * of AppleScript at the Objective-C level.
+ * is required to silence error messages from inline execution
+ * of AppleScript at the Objective-C level.
*/
[aeManager setEventHandler:NSApp
andSelector:@selector(handleGetSDEFEvent:withReplyEvent:)
diff --git a/macosx/tkMacOSXImage.c b/macosx/tkMacOSXImage.c
index 87d1276..488f029 100644
--- a/macosx/tkMacOSXImage.c
+++ b/macosx/tkMacOSXImage.c
@@ -1012,7 +1012,7 @@ XCopyPlane(
TkpClipMask *clipPtr = (TkpClipMask *) gc->clip_mask;
unsigned long imageBackground = gc->background;
- if (clipPtr && clipPtr->type == TKP_CLIP_PIXMAP) {
+ if (clipPtr && clipPtr->type == TKP_CLIP_PIXMAP) {
srcRect = CGRectMake(src_x, src_y, width, height);
CGImageRef mask = CreateCGImageFromPixmap(
clipPtr->value.pixmap);
@@ -1387,7 +1387,7 @@ TkMacOSXNSImageConfigureModel(
case NAME_SOURCE:
Tcl_SetObjResult(interp, Tcl_NewStringObj("Unknown named NSImage.\n"
"Try omitting ImageName, "
- "e.g. use NSCaution for NSImageNameCaution.", TCL_INDEX_NONE));
+ "e.g. use NSCaution for NSImageNameCaution.", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TK", "IMAGE", "SYSTEM", "BAD_VALUE", NULL);
goto errorExit;
case FILE_SOURCE:
@@ -1491,9 +1491,9 @@ TkMacOSXNSImageObjCmd(
objPtr = Tk_GetOptionValue(interp, (char *)modelPtr, optionTable,
objv[2], NULL);
if (objPtr == NULL) {
- goto error;
- }
- Tcl_SetObjResult(interp, objPtr);
+ goto error;
+ }
+ Tcl_SetObjResult(interp, objPtr);
break;
case CONFIGURE:
if (objc == 2) {
diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c
index b1f6855..bbd41ee 100644
--- a/macosx/tkMacOSXInit.c
+++ b/macosx/tkMacOSXInit.c
@@ -386,7 +386,7 @@ static void closePanels(
[[NSFontPanel sharedFontPanel] orderOut:nil];
}
if ([NSColorPanel sharedColorPanelExists]) {
- [[NSColorPanel sharedColorPanel] orderOut:nil];
+ [[NSColorPanel sharedColorPanel] orderOut:nil];
}
}
@@ -425,9 +425,9 @@ TCL_NORETURN void TkpExitProc(
/*
* At this point it is too late to be looking up the Tk window associated
* to any NSWindows, but it can happen. This makes sure the answer is None
- * if such a query is attempted.
+ * if such a query is attempted.
*/
-
+
for (TKWindow *w in [NSApp orderedWindows]) {
if ([w respondsToSelector: @selector (tkWindow)]) {
[w setTkWindow: None];
@@ -475,7 +475,7 @@ TkpInit(
if (!initialized) {
struct stat st;
Bool shouldOpenConsole = NO;
- Bool stdinIsNullish = (!isatty(0) &&
+ Bool stdinIsNullish = (!isatty(0) &&
(fstat(0, &st) || (S_ISCHR(st.st_mode) && st.st_blocks == 0)));
/*
@@ -499,7 +499,7 @@ TkpInit(
if (Tcl_MacOSXOpenVersionedBundleResources(interp,
"com.tcltk.tklibrary", TK_FRAMEWORK_VERSION, 0, PATH_MAX,
tkLibPath) != TCL_OK) {
- # if 0 /* This is not really an error. Wish still runs fine. */
+ # if 0 /* This is not really an error. Wish still runs fine. */
TkMacOSXDbgMsg("Tcl_MacOSXOpenVersionedBundleResources failed");
# endif
}
@@ -521,40 +521,40 @@ TkpInit(
[TKApplication sharedApplication];
[pool drain];
- /*
- * WARNING: The finishLaunching method runs asynchronously. This
- * creates a race between the initialization of the NSApplication and
- * the initialization of Tk. If Tk wins the race bad things happen
- * with the root window (see below). If the NSApplication wins then an
- * AppleEvent created during launch, e.g. by dropping a file icon on
- * the application icon, will be delivered before the procedure meant
- * to to handle the AppleEvent has been defined. This is handled in
- * tkMacOSXHLEvents.c by scheduling a timer event to handle the
- * AppleEvent later, after the required procedure has been defined.
- */
+ /*
+ * WARNING: The finishLaunching method runs asynchronously. This
+ * creates a race between the initialization of the NSApplication and
+ * the initialization of Tk. If Tk wins the race bad things happen
+ * with the root window (see below). If the NSApplication wins then an
+ * AppleEvent created during launch, e.g. by dropping a file icon on
+ * the application icon, will be delivered before the procedure meant
+ * to to handle the AppleEvent has been defined. This is handled in
+ * tkMacOSXHLEvents.c by scheduling a timer event to handle the
+ * AppleEvent later, after the required procedure has been defined.
+ */
[NSApp _setup:interp];
[NSApp finishLaunching];
- /*
- * Create a Tk event source based on the Appkit event queue.
- */
+ /*
+ * Create a Tk event source based on the Appkit event queue.
+ */
Tk_MacOSXSetupTkNotifier();
/*
* If Tk initialization wins the race, the root window is mapped before
- * the NSApplication is initialized. This can cause bad things to
- * happen. The root window can open off screen with no way to make it
- * appear on screen until the app icon is clicked. This will happen if
- * a Tk application opens a modal window in its startup script (see
- * ticket 56a1823c73). In other cases, an empty root window can open
- * on screen and remain visible for a noticeable amount of time while
- * the Tk initialization finishes (see ticket d1989fb7cf). The call
- * below forces Tk to block until the Appkit event queue has been
- * created. This seems to be sufficient to ensure that the
- * NSApplication initialization wins the race, avoiding these bad
- * window behaviors.
+ * the NSApplication is initialized. This can cause bad things to
+ * happen. The root window can open off screen with no way to make it
+ * appear on screen until the app icon is clicked. This will happen if
+ * a Tk application opens a modal window in its startup script (see
+ * ticket 56a1823c73). In other cases, an empty root window can open
+ * on screen and remain visible for a noticeable amount of time while
+ * the Tk initialization finishes (see ticket d1989fb7cf). The call
+ * below forces Tk to block until the Appkit event queue has been
+ * created. This seems to be sufficient to ensure that the
+ * NSApplication initialization wins the race, avoiding these bad
+ * window behaviors.
*/
Tcl_DoOneEvent(TCL_WINDOW_EVENTS | TCL_DONT_WAIT);
@@ -679,7 +679,7 @@ TkpInit(
Tcl_CreateObjCommand(interp, "::tk::mac::GetAppPath",
TkMacOSXGetAppPathObjCmd, NULL, NULL);
Tcl_CreateObjCommand(interp, "::tk::mac::macOSVersion",
- TkMacOSVersionObjCmd, NULL, NULL);
+ TkMacOSVersionObjCmd, NULL, NULL);
MacSystrayInit(interp);
MacPrint_Init(interp);
diff --git a/macosx/tkMacOSXKeyEvent.c b/macosx/tkMacOSXKeyEvent.c
index a16eb42..42698ca 100644
--- a/macosx/tkMacOSXKeyEvent.c
+++ b/macosx/tkMacOSXKeyEvent.c
@@ -64,8 +64,8 @@ static NSUInteger textInputModifiers;
static NSMutableArray *nsEvArray = nil;
if (nsEvArray == nil) {
- nsEvArray = [[NSMutableArray alloc] initWithCapacity: 1];
- processingCompose = NO;
+ nsEvArray = [[NSMutableArray alloc] initWithCapacity: 1];
+ processingCompose = NO;
}
if (!winPtr) {
return theEvent;
@@ -80,7 +80,7 @@ static NSUInteger textInputModifiers;
if ([theEvent type] == NSKeyDown &&
[theEvent isARepeat] &&
[NSEvent keyRepeatDelay] < 0) {
- return theEvent;
+ return theEvent;
}
/*
@@ -311,7 +311,7 @@ static NSUInteger textInputModifiers;
Bool sendingIMEText = NO;
str = ([aString isKindOfClass: [NSAttributedString class]]) ?
- [aString string] : aString;
+ [aString string] : aString;
len = [str length];
if (NS_KEYLOG) {
@@ -426,7 +426,7 @@ static NSUInteger textInputModifiers;
(void)selRange;
str = ([aString isKindOfClass: [NSAttributedString class]]) ?
- [aString string] : aString;
+ [aString string] : aString;
if (focusWin) {
/*
@@ -636,12 +636,12 @@ setupXEvent(XEvent *xEvent, Tk_Window tkwin, NSUInteger modifiers)
display = Tk_Display(tkwin);
if (modifiers) {
state = (modifiers & NSAlphaShiftKeyMask ? LockMask : 0) |
- (modifiers & NSShiftKeyMask ? ShiftMask : 0) |
- (modifiers & NSControlKeyMask ? ControlMask : 0) |
- (modifiers & NSCommandKeyMask ? Mod1Mask : 0) |
- (modifiers & NSAlternateKeyMask ? Mod2Mask : 0) |
- (modifiers & NSNumericPadKeyMask ? Mod3Mask : 0) |
- (modifiers & NSFunctionKeyMask ? Mod4Mask : 0) ;
+ (modifiers & NSShiftKeyMask ? ShiftMask : 0) |
+ (modifiers & NSControlKeyMask ? ControlMask : 0) |
+ (modifiers & NSCommandKeyMask ? Mod1Mask : 0) |
+ (modifiers & NSAlternateKeyMask ? Mod2Mask : 0) |
+ (modifiers & NSNumericPadKeyMask ? Mod3Mask : 0) |
+ (modifiers & NSFunctionKeyMask ? Mod4Mask : 0) ;
}
memset(xEvent, 0, sizeof(XEvent));
xEvent->xany.serial = LastKnownRequestProcessed(display);
diff --git a/macosx/tkMacOSXKeyboard.c b/macosx/tkMacOSXKeyboard.c
index 3874dbd..f898496 100644
--- a/macosx/tkMacOSXKeyboard.c
+++ b/macosx/tkMacOSXKeyboard.c
@@ -268,7 +268,7 @@ UpdateKeymaps()
*/
for (index = 3; index >= 0; index--) {
- for (virt = 0; virt < 128; virt++) {
+ for (virt = 0; virt < 128; virt++) {
MacKeycode macKC;
macKC.v = (keycode_v) {.virt = virt, .o_s = index, .keychar = 0};
int modifiers = INDEX2CARBON(index);
@@ -288,7 +288,7 @@ UpdateKeymaps()
hPtr = Tcl_CreateHashEntry(&unichar2xvirtual,
INT2PTR(macKC.x.keychar), &dummy);
Tcl_SetHashValue(hPtr, INT2PTR(macKC.x.xvirtual));
- }
+ }
xvirtual2unichar[macKC.x.xvirtual] = macKC.x.keychar;
}
}
diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c
index 8a8d613..bf41d66 100644
--- a/macosx/tkMacOSXMenu.c
+++ b/macosx/tkMacOSXMenu.c
@@ -969,8 +969,8 @@ TkpPostMenu(
inPostMenu = true;
result = TkPreprocessMenu(menuPtr);
if (result != TCL_OK) {
- inPostMenu = false;
- return result;
+ inPostMenu = false;
+ return result;
}
if (itemIndex >= numItems) {
itemIndex = numItems - 1;
diff --git a/macosx/tkMacOSXMenubutton.c b/macosx/tkMacOSXMenubutton.c
index ac7befd..6d71ffc 100644
--- a/macosx/tkMacOSXMenubutton.c
+++ b/macosx/tkMacOSXMenubutton.c
@@ -173,7 +173,7 @@ TkpDisplayMenuButton(
butPtr->flags &= ~REDRAW_PENDING;
if ((butPtr->tkwin == NULL) || !Tk_IsMapped(tkwin)) {
- return;
+ return;
}
pixmap = (Pixmap) Tk_WindowId(tkwin);
@@ -191,7 +191,7 @@ TkpDisplayMenuButton(
*/
if (butPtr->highlightWidth < 3) {
- if (butPtr->flags & GOT_FOCUS) {
+ if (butPtr->flags & GOT_FOCUS) {
GC gc = Tk_GCForColor(butPtr->highlightColorPtr, pixmap);
TkMacOSXDrawSolidBorder(tkwin, gc, 0, butPtr->highlightWidth);
}
@@ -259,23 +259,23 @@ TkpComputeMenuButtonGeometry(
avgWidth = 0;
if (butPtr->image != NULL) {
- Tk_SizeOfImage(butPtr->image, &width, &height);
- haveImage = 1;
+ Tk_SizeOfImage(butPtr->image, &width, &height);
+ haveImage = 1;
} else if (butPtr->bitmap != None) {
- Tk_SizeOfBitmap(butPtr->display, butPtr->bitmap, &width, &height);
- haveImage = 1;
+ Tk_SizeOfBitmap(butPtr->display, butPtr->bitmap, &width, &height);
+ haveImage = 1;
}
if (butPtr->text && strlen(butPtr->text) > 0) {
haveText = 1;
- Tk_FreeTextLayout(butPtr->textLayout);
- butPtr->textLayout = Tk_ComputeTextLayout(butPtr->tkfont,
- butPtr->text, TCL_INDEX_NONE, butPtr->wrapLength,
- butPtr->justify, 0, &butPtr->textWidth, &butPtr->textHeight);
- txtWidth = butPtr->textWidth;
- txtHeight = butPtr->textHeight;
- avgWidth = Tk_TextWidth(butPtr->tkfont, "0", 1);
- Tk_GetFontMetrics(butPtr->tkfont, &fm);
+ Tk_FreeTextLayout(butPtr->textLayout);
+ butPtr->textLayout = Tk_ComputeTextLayout(butPtr->tkfont,
+ butPtr->text, TCL_INDEX_NONE, butPtr->wrapLength,
+ butPtr->justify, 0, &butPtr->textWidth, &butPtr->textHeight);
+ txtWidth = butPtr->textWidth;
+ txtHeight = butPtr->textHeight;
+ avgWidth = Tk_TextWidth(butPtr->tkfont, "0", 1);
+ Tk_GetFontMetrics(butPtr->tkfont, &fm);
}
/*
@@ -286,7 +286,7 @@ TkpComputeMenuButtonGeometry(
*/
if (haveImage && haveText) {
- switch ((enum compound) butPtr->compound) {
+ switch ((enum compound) butPtr->compound) {
case COMPOUND_TOP:
case COMPOUND_BOTTOM:
/*
@@ -315,33 +315,33 @@ TkpComputeMenuButtonGeometry(
break;
case COMPOUND_NONE:
break;
- }
+ }
- if (butPtr->width > 0) {
- width = butPtr->width;
- }
- if (butPtr->height > 0) {
- height = butPtr->height;
- }
+ if (butPtr->width > 0) {
+ width = butPtr->width;
+ }
+ if (butPtr->height > 0) {
+ height = butPtr->height;
+ }
} else {
- if (haveImage) { /* Image only */
- if (butPtr->width > 0) {
- width = butPtr->width;
- }
- if (butPtr->height > 0) {
- height = butPtr->height;
- }
- } else { /* Text only */
- width = txtWidth;
- height = txtHeight;
- if (butPtr->width > 0) {
- width = butPtr->width * avgWidth + 2*butPtr->padX;
- }
- if (butPtr->height > 0) {
- height = butPtr->height * fm.linespace + 2*butPtr->padY;
- }
- }
+ if (haveImage) { /* Image only */
+ if (butPtr->width > 0) {
+ width = butPtr->width;
+ }
+ if (butPtr->height > 0) {
+ height = butPtr->height;
+ }
+ } else { /* Text only */
+ width = txtWidth;
+ height = txtHeight;
+ if (butPtr->width > 0) {
+ width = butPtr->width * avgWidth + 2*butPtr->padX;
+ }
+ if (butPtr->height > 0) {
+ height = butPtr->height * fm.linespace + 2*butPtr->padY;
+ }
+ }
}
butPtr->inset = highlightWidth + butPtr->borderWidth;
@@ -381,30 +381,30 @@ DrawMenuButtonImageAndText(
int fullWidth = 0, fullHeight = 0;
if (tkwin == NULL || !Tk_IsMapped(tkwin)) {
- return;
+ return;
}
DrawParams *dpPtr = &mbPtr->drawParams;
pixmap = (Pixmap) Tk_WindowId(tkwin);
if (butPtr->image != NULL) {
- Tk_SizeOfImage(butPtr->image, &width, &height);
- haveImage = 1;
+ Tk_SizeOfImage(butPtr->image, &width, &height);
+ haveImage = 1;
} else if (butPtr->bitmap != None) {
- Tk_SizeOfBitmap(butPtr->display, butPtr->bitmap, &width, &height);
- haveImage = 1;
+ Tk_SizeOfBitmap(butPtr->display, butPtr->bitmap, &width, &height);
+ haveImage = 1;
}
haveText = (butPtr->textWidth != 0 && butPtr->textHeight != 0);
if (butPtr->compound != COMPOUND_NONE && haveImage && haveText) {
- int x = 0, y = 0;
+ int x = 0, y = 0;
- textXOffset = 0;
- textYOffset = 0;
- fullWidth = 0;
- fullHeight = 0;
+ textXOffset = 0;
+ textYOffset = 0;
+ fullWidth = 0;
+ fullHeight = 0;
- switch ((enum compound) butPtr->compound) {
+ switch ((enum compound) butPtr->compound) {
case COMPOUND_TOP:
case COMPOUND_BOTTOM:
/*
@@ -435,7 +435,7 @@ DrawMenuButtonImageAndText(
}
fullWidth = butPtr->textWidth + butPtr->padX + width;
fullHeight = (height > butPtr->textHeight ? height :
- butPtr->textHeight);
+ butPtr->textHeight);
textYOffset = (fullHeight - butPtr->textHeight)/2;
imageYOffset = (fullHeight - height)/2;
break;
@@ -446,7 +446,7 @@ DrawMenuButtonImageAndText(
fullWidth = (width > butPtr->textWidth ? width : butPtr->textWidth);
fullHeight = (height > butPtr->textHeight ? height :
- butPtr->textHeight);
+ butPtr->textHeight);
textXOffset = (fullWidth - butPtr->textWidth) / 2;
imageXOffset = (fullWidth - width) / 2;
textYOffset = (fullHeight - butPtr->textHeight) / 2;
@@ -456,54 +456,54 @@ DrawMenuButtonImageAndText(
break;
}
- TkComputeAnchor(butPtr->anchor, tkwin,
- butPtr->padX + butPtr->inset, butPtr->padY + butPtr->inset,
- fullWidth, fullHeight, &x, &y);
- imageXOffset = LEFT_INSET;
- imageYOffset += y;
- textYOffset -= 1;
+ TkComputeAnchor(butPtr->anchor, tkwin,
+ butPtr->padX + butPtr->inset, butPtr->padY + butPtr->inset,
+ fullWidth, fullHeight, &x, &y);
+ imageXOffset = LEFT_INSET;
+ imageYOffset += y;
+ textYOffset -= 1;
- if (butPtr->image != NULL) {
+ if (butPtr->image != NULL) {
Tk_RedrawImage(butPtr->image, 0, 0, width,
- height, pixmap, imageXOffset, imageYOffset);
- } else {
- XSetClipOrigin(butPtr->display, dpPtr->gc,
- imageXOffset, imageYOffset);
- XCopyPlane(butPtr->display, butPtr->bitmap, pixmap, dpPtr->gc,
- 0, 0, (unsigned int) width, (unsigned int) height,
- imageXOffset, imageYOffset, 1);
- XSetClipOrigin(butPtr->display, dpPtr->gc, 0, 0);
- }
-
- Tk_DrawTextLayout(butPtr->display, pixmap,
- dpPtr->gc, butPtr->textLayout,
- x + textXOffset, y + textYOffset, 0, -1);
- Tk_UnderlineTextLayout(butPtr->display, pixmap, dpPtr->gc,
- butPtr->textLayout, x + textXOffset, y + textYOffset,
- butPtr->underline);
+ height, pixmap, imageXOffset, imageYOffset);
+ } else {
+ XSetClipOrigin(butPtr->display, dpPtr->gc,
+ imageXOffset, imageYOffset);
+ XCopyPlane(butPtr->display, butPtr->bitmap, pixmap, dpPtr->gc,
+ 0, 0, (unsigned int) width, (unsigned int) height,
+ imageXOffset, imageYOffset, 1);
+ XSetClipOrigin(butPtr->display, dpPtr->gc, 0, 0);
+ }
+
+ Tk_DrawTextLayout(butPtr->display, pixmap,
+ dpPtr->gc, butPtr->textLayout,
+ x + textXOffset, y + textYOffset, 0, -1);
+ Tk_UnderlineTextLayout(butPtr->display, pixmap, dpPtr->gc,
+ butPtr->textLayout, x + textXOffset, y + textYOffset,
+ butPtr->underline);
} else {
int x, y;
- if (haveImage) {
- TkComputeAnchor(butPtr->anchor, tkwin,
- butPtr->padX + butPtr->borderWidth,
- butPtr->padY + butPtr->borderWidth,
- width, height, &x, &y);
+ if (haveImage) {
+ TkComputeAnchor(butPtr->anchor, tkwin,
+ butPtr->padX + butPtr->borderWidth,
+ butPtr->padY + butPtr->borderWidth,
+ width, height, &x, &y);
imageXOffset = LEFT_INSET;
imageYOffset += y;
if (butPtr->image != NULL) {
Tk_RedrawImage(butPtr->image, 0, 0, width, height,
pixmap, imageXOffset, imageYOffset);
- } else {
- XSetClipOrigin(butPtr->display, dpPtr->gc, x, y);
- XCopyPlane(butPtr->display, butPtr->bitmap,
+ } else {
+ XSetClipOrigin(butPtr->display, dpPtr->gc, x, y);
+ XCopyPlane(butPtr->display, butPtr->bitmap,
pixmap, dpPtr->gc,
0, 0, (unsigned int) width,
(unsigned int) height,
imageXOffset, imageYOffset, 1);
- XSetClipOrigin(butPtr->display, dpPtr->gc, 0, 0);
- }
- } else {
+ XSetClipOrigin(butPtr->display, dpPtr->gc, 0, 0);
+ }
+ } else {
textXOffset = LEFT_INSET;
TkComputeAnchor(butPtr->anchor, tkwin, butPtr->padX, butPtr->padY,
butPtr->textWidth, butPtr->textHeight, &x, &y);
@@ -537,7 +537,7 @@ TkMacOSXDrawMenuButton(
MacMenuButton *mbPtr, /* Mac menubutton. */
TCL_UNUSED(GC), /* The GC we are drawing into - not used */
Pixmap pixmap) /* The pixmap we are drawing into - needed for the
- * bevel button */
+ * bevel button */
{
TkMenuButton *butPtr = (TkMenuButton *) mbPtr;
TkWindow *winPtr = (TkWindow *) butPtr->tkwin;
@@ -552,23 +552,23 @@ TkMacOSXDrawMenuButton(
Tk_Width(butPtr->tkwin), Tk_Height(butPtr->tkwin));
if (useNewerHITools == 1) {
- HIRect contHIRec;
- static HIThemeButtonDrawInfo hiinfo;
+ HIRect contHIRec;
+ static HIThemeButtonDrawInfo hiinfo;
- MenuButtonBackgroundDrawCB(mbPtr, 32, true);
+ MenuButtonBackgroundDrawCB(mbPtr, 32, true);
if (!TkMacOSXSetupDrawingContext(pixmap, dpPtr->gc, &dc)) {
return;
}
- hiinfo.version = 0;
- hiinfo.state = mbPtr->drawinfo.state;
- hiinfo.kind = mbPtr->btnkind;
- hiinfo.value = mbPtr->drawinfo.value;
- hiinfo.adornment = mbPtr->drawinfo.adornment;
- hiinfo.animation.time.current = CFAbsoluteTimeGetCurrent();
- if (hiinfo.animation.time.start == 0) {
- hiinfo.animation.time.start = hiinfo.animation.time.current;
- }
+ hiinfo.version = 0;
+ hiinfo.state = mbPtr->drawinfo.state;
+ hiinfo.kind = mbPtr->btnkind;
+ hiinfo.value = mbPtr->drawinfo.value;
+ hiinfo.adornment = mbPtr->drawinfo.adornment;
+ hiinfo.animation.time.current = CFAbsoluteTimeGetCurrent();
+ if (hiinfo.animation.time.start == 0) {
+ hiinfo.animation.time.start = hiinfo.animation.time.current;
+ }
/*
* To avoid menubuttons with white text on a white background, we
@@ -581,10 +581,10 @@ TkMacOSXDrawMenuButton(
hiinfo.state = kThemeStateInactive;
}
- HIThemeDrawButton(&cntrRect, &hiinfo, dc.context,
+ HIThemeDrawButton(&cntrRect, &hiinfo, dc.context,
kHIThemeOrientationNormal, &contHIRec);
TkMacOSXRestoreDrawingContext(&dc);
- MenuButtonContentDrawCB(mbPtr->btnkind, &mbPtr->drawinfo,
+ MenuButtonContentDrawCB(mbPtr->btnkind, &mbPtr->drawinfo,
mbPtr, 32, true);
} else {
if (!TkMacOSXSetupDrawingContext(pixmap, dpPtr->gc, &dc)) {
@@ -623,11 +623,11 @@ MenuButtonBackgroundDrawCB (
Pixmap pixmap;
if (tkwin == NULL || !Tk_IsMapped(tkwin)) {
- return;
+ return;
}
pixmap = (Pixmap) Tk_WindowId(tkwin);
Tk_Fill3DRectangle(tkwin, pixmap, butPtr->normalBorder, 0, 0,
- Tk_Width(tkwin), Tk_Height(tkwin), 0, TK_RELIEF_FLAT);
+ Tk_Width(tkwin), Tk_Height(tkwin), 0, TK_RELIEF_FLAT);
}
/*
@@ -658,7 +658,7 @@ MenuButtonContentDrawCB (
Tk_Window tkwin = butPtr->tkwin;
if (tkwin == NULL || !Tk_IsMapped(tkwin)) {
- return;
+ return;
}
DrawMenuButtonImageAndText(butPtr);
}
@@ -749,22 +749,22 @@ TkMacOSXComputeMenuButtonParams(
drawinfo->state = kThemeStateInactive;
if ((mbPtr->flags & ACTIVE) == 0) {
- if (butPtr->state == STATE_DISABLED) {
- drawinfo->state = kThemeStateUnavailableInactive;
- } else {
- drawinfo->state = kThemeStateInactive;
- }
+ if (butPtr->state == STATE_DISABLED) {
+ drawinfo->state = kThemeStateUnavailableInactive;
+ } else {
+ drawinfo->state = kThemeStateInactive;
+ }
} else if (butPtr->state == STATE_DISABLED) {
- drawinfo->state = kThemeStateUnavailable;
+ drawinfo->state = kThemeStateUnavailable;
} else {
- drawinfo->state = kThemeStateActive;
+ drawinfo->state = kThemeStateActive;
}
drawinfo->adornment = kThemeAdornmentNone;
if (butPtr->highlightWidth >= 3) {
- if ((butPtr->flags & GOT_FOCUS)) {
- drawinfo->adornment |= kThemeAdornmentFocus;
- }
+ if ((butPtr->flags & GOT_FOCUS)) {
+ drawinfo->adornment |= kThemeAdornmentFocus;
+ }
}
drawinfo->adornment |= kThemeAdornmentArrowDoubleArrow;
}
@@ -795,12 +795,12 @@ TkMacOSXComputeMenuButtonDrawParams(
((butPtr->image != NULL) || (butPtr->bitmap != None));
dpPtr->border = butPtr->normalBorder;
if ((butPtr->state == STATE_DISABLED) && (butPtr->disabledFg != NULL)) {
- dpPtr->gc = butPtr->disabledGC;
+ dpPtr->gc = butPtr->disabledGC;
} else if (butPtr->state == STATE_ACTIVE) {
- dpPtr->gc = butPtr->activeTextGC;
- dpPtr->border = butPtr->activeBorder;
+ dpPtr->gc = butPtr->activeTextGC;
+ dpPtr->border = butPtr->activeBorder;
} else {
- dpPtr->gc = butPtr->normalTextGC;
+ dpPtr->gc = butPtr->normalTextGC;
}
}
diff --git a/macosx/tkMacOSXMenus.c b/macosx/tkMacOSXMenus.c
index b1b8bad..b717352 100644
--- a/macosx/tkMacOSXMenus.c
+++ b/macosx/tkMacOSXMenus.c
@@ -116,18 +116,18 @@ static Tcl_Obj * GetWidgetDemoPath(Tcl_Interp *interp);
_defaultWindowsMenuItems = [_defaultWindowsMenuItems
arrayByAddingObjectsFromArray:
[NSArray arrayWithObjects:
- [NSMenuItem separatorItem],
+ [NSMenuItem separatorItem],
[NSMenuItem itemWithTitle:@"Show Previous Tab"
- action:@selector(selectPreviousTab:)
- target:nil
+ action:@selector(selectPreviousTab:)
+ target:nil
keyEquivalent:@"\t"
- keyEquivalentModifierMask:
+ keyEquivalentModifierMask:
NSControlKeyMask|NSShiftKeyMask],
- [NSMenuItem itemWithTitle:@"Show Next Tab"
- action:@selector(selectNextTab:)
- target:nil
+ [NSMenuItem itemWithTitle:@"Show Next Tab"
+ action:@selector(selectNextTab:)
+ target:nil
keyEquivalent:@"\t"
- keyEquivalentModifierMask:NSControlKeyMask],
+ keyEquivalentModifierMask:NSControlKeyMask],
[NSMenuItem itemWithTitle:@"Move Tab To New Window"
action:@selector(moveTabToNewWindow:)
target:nil],
@@ -135,7 +135,7 @@ static Tcl_Obj * GetWidgetDemoPath(Tcl_Interp *interp);
action:@selector(mergeAllWindows:)
target:nil],
[NSMenuItem separatorItem],
- nil]];
+ nil]];
}
_defaultWindowsMenuItems = [_defaultWindowsMenuItems arrayByAddingObject:
[NSMenuItem itemWithTitle:@"Bring All to Front"
@@ -193,7 +193,7 @@ static Tcl_Obj * GetWidgetDemoPath(Tcl_Interp *interp);
}
return haveDemo;
} else {
- return [super validateUserInterfaceItem:anItem];
+ return [super validateUserInterfaceItem:anItem];
}
}
diff --git a/macosx/tkMacOSXMouseEvent.c b/macosx/tkMacOSXMouseEvent.c
index 9eca985..062a125 100644
--- a/macosx/tkMacOSXMouseEvent.c
+++ b/macosx/tkMacOSXMouseEvent.c
@@ -884,9 +884,9 @@ TkpWarpPointer(
CGWarpMouseCursorPosition(pt);
if (dispPtr->warpWindow) {
- TkGenerateButtonEventForXPointer(Tk_WindowId(dispPtr->warpWindow));
+ TkGenerateButtonEventForXPointer(Tk_WindowId(dispPtr->warpWindow));
} else {
- TkGenerateButtonEventForXPointer(None);
+ TkGenerateButtonEventForXPointer(None);
}
}
diff --git a/macosx/tkMacOSXNotify.c b/macosx/tkMacOSXNotify.c
index 5530e22..f353380 100644
--- a/macosx/tkMacOSXNotify.c
+++ b/macosx/tkMacOSXNotify.c
@@ -361,7 +361,7 @@ TkMacOSXDrawAllViews(
if (dirtyCount) {
*dirtyCount = count;
}
-
+
/*
* Trigger calls to updateLayer methods for the views flagged above.
*/
@@ -436,7 +436,7 @@ TkMacOSXEventsSetupProc(
*/
NSEvent *currentEvent =
- [NSApp nextEventMatchingMask:NSAnyEventMask
+ [NSApp nextEventMatchingMask:NSAnyEventMask
untilDate:[NSDate distantPast]
inMode:GetRunLoopMode(TkMacOSXGetModalSession())
dequeue:NO];
diff --git a/macosx/tkMacOSXPrint.c b/macosx/tkMacOSXPrint.c
index ee30e1f..ac29714 100644
--- a/macosx/tkMacOSXPrint.c
+++ b/macosx/tkMacOSXPrint.c
@@ -92,8 +92,8 @@ StartPrint(
/* Check for proper number of arguments. */
if (objc < 2) {
- Tcl_WrongNumArgs(interp, 1, objv, "file");
- return TCL_ERROR;
+ Tcl_WrongNumArgs(interp, 1, objv, "file");
+ return TCL_ERROR;
}
fileName = [NSString stringWithUTF8String: Tcl_GetString(objv[1])];
@@ -105,20 +105,20 @@ StartPrint(
status = PMCreateSession( & printSession);
if (status != noErr) {
- NSLog(@ "Error creating print session.");
- return TCL_ERROR;
+ NSLog(@ "Error creating print session.");
+ return TCL_ERROR;
}
status = PMCreatePrintSettings( & printSettings);
if (status != noErr) {
- NSLog(@ "Error creating print settings.");
- return TCL_ERROR;
+ NSLog(@ "Error creating print settings.");
+ return TCL_ERROR;
}
status = PMSessionDefaultPrintSettings(printSession, printSettings);
if (status != noErr) {
- NSLog(@ "Error creating default print settings.");
- return TCL_ERROR;
+ NSLog(@ "Error creating default print settings.");
+ return TCL_ERROR;
}
printSession = (PMPrintSession)[printInfo PMPrintSession];
@@ -163,25 +163,25 @@ FinishPrint(
* otherwise printing will occur regardless of value.
*/
if (buttonValue == NSModalResponseCancel) {
- return noErr;
+ return noErr;
}
status = PMCreateSession( & printSession);
if (status != noErr) {
- NSLog(@ "Error creating print session.");
- return status;
+ NSLog(@ "Error creating print session.");
+ return status;
}
status = PMCreatePrintSettings( & printSettings);
if (status != noErr) {
- NSLog(@ "Error creating print settings.");
- return status;
+ NSLog(@ "Error creating print settings.");
+ return status;
}
status = PMSessionDefaultPrintSettings(printSession, printSettings);
if (status != noErr) {
- NSLog(@ "Error creating default print settings.");
- return status;
+ NSLog(@ "Error creating default print settings.");
+ return status;
}
printSession = (PMPrintSession)[printInfo PMPrintSession];
@@ -191,81 +191,81 @@ FinishPrint(
/*Handle print operation.*/
if (buttonValue == NSModalResponseOK) {
- if (urlFile == NULL) {
- NSLog(@ "Could not get file to print.");
- return noErr;
- }
-
- fileName = file;
-
- CFURLRef printURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, urlFile, kCFURLPOSIXPathStyle, false);
-
- PMPrinter currentPrinter;
- PMDestinationType printDestination;
-
- /*Get the intended destination.*/
- status = PMSessionGetDestinationType(printSession, printSettings, & printDestination);
-
- /*Destination is printer. Send file to printer.*/
- if (status == noErr && printDestination == kPMDestinationPrinter) {
-
- status = PMSessionGetCurrentPrinter(printSession, & currentPrinter);
- if (status == noErr) {
- CFArrayRef mimeTypes;
- status = PMPrinterGetMimeTypes(currentPrinter, printSettings, & mimeTypes);
- if (status == noErr && mimeTypes != NULL) {
- mimeType = CFSTR("application/pdf");
- if (CFArrayContainsValue(mimeTypes, CFRangeMake(0, CFArrayGetCount(mimeTypes)), mimeType)) {
- status = PMPrinterPrintWithFile(currentPrinter, printSettings, pageFormat, mimeType, printURL);
- CFRelease(urlFile);
- return status;
- }
- }
- }
- }
-
- /* Destination is file. Determine how to handle. */
- if (status == noErr && printDestination == kPMDestinationFile) {
- CFURLRef outputLocation = NULL;
-
- status = PMSessionCopyDestinationLocation(printSession, printSettings, & outputLocation);
- if (status == noErr) {
- /*Get the source file and target destination, convert to strings.*/
- CFStringRef sourceFile = CFURLCopyFileSystemPath(printURL, kCFURLPOSIXPathStyle);
- CFStringRef savePath = CFURLCopyFileSystemPath(outputLocation, kCFURLPOSIXPathStyle);
- NSString * sourcePath = (NSString * ) sourceFile;
- NSString * finalPath = (NSString * ) savePath;
- NSString * pathExtension = [finalPath pathExtension];
- NSFileManager * fileManager = [NSFileManager defaultManager];
+ if (urlFile == NULL) {
+ NSLog(@ "Could not get file to print.");
+ return noErr;
+ }
+
+ fileName = file;
+
+ CFURLRef printURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, urlFile, kCFURLPOSIXPathStyle, false);
+
+ PMPrinter currentPrinter;
+ PMDestinationType printDestination;
+
+ /*Get the intended destination.*/
+ status = PMSessionGetDestinationType(printSession, printSettings, & printDestination);
+
+ /*Destination is printer. Send file to printer.*/
+ if (status == noErr && printDestination == kPMDestinationPrinter) {
+
+ status = PMSessionGetCurrentPrinter(printSession, & currentPrinter);
+ if (status == noErr) {
+ CFArrayRef mimeTypes;
+ status = PMPrinterGetMimeTypes(currentPrinter, printSettings, & mimeTypes);
+ if (status == noErr && mimeTypes != NULL) {
+ mimeType = CFSTR("application/pdf");
+ if (CFArrayContainsValue(mimeTypes, CFRangeMake(0, CFArrayGetCount(mimeTypes)), mimeType)) {
+ status = PMPrinterPrintWithFile(currentPrinter, printSettings, pageFormat, mimeType, printURL);
+ CFRelease(urlFile);
+ return status;
+ }
+ }
+ }
+ }
+
+ /* Destination is file. Determine how to handle. */
+ if (status == noErr && printDestination == kPMDestinationFile) {
+ CFURLRef outputLocation = NULL;
+
+ status = PMSessionCopyDestinationLocation(printSession, printSettings, & outputLocation);
+ if (status == noErr) {
+ /*Get the source file and target destination, convert to strings.*/
+ CFStringRef sourceFile = CFURLCopyFileSystemPath(printURL, kCFURLPOSIXPathStyle);
+ CFStringRef savePath = CFURLCopyFileSystemPath(outputLocation, kCFURLPOSIXPathStyle);
+ NSString * sourcePath = (NSString * ) sourceFile;
+ NSString * finalPath = (NSString * ) savePath;
+ NSString * pathExtension = [finalPath pathExtension];
+ NSFileManager * fileManager = [NSFileManager defaultManager];
NSError * error = nil;
- /*
+ /*
* Is the target file a PDF? If so, copy print file
* to output location.
*/
- if ([pathExtension isEqualToString: @ "pdf"]) {
+ if ([pathExtension isEqualToString: @ "pdf"]) {
/*Make sure no file conflict exists.*/
if ([fileManager fileExistsAtPath: finalPath]) {
[fileManager removeItemAtPath: finalPath error: &error];
}
- if ([fileManager fileExistsAtPath: sourcePath]) {
- error = nil;
- [fileManager copyItemAtPath: sourcePath toPath: finalPath error: & error];
- }
+ if ([fileManager fileExistsAtPath: sourcePath]) {
+ error = nil;
+ [fileManager copyItemAtPath: sourcePath toPath: finalPath error: & error];
+ }
return status;
- }
-
- /*
- * Is the target file PostScript? If so, run print file
- * through CUPS filter to convert back to PostScript.
- */
-
- if ([pathExtension isEqualToString: @ "ps"]) {
- char source[5012];
- char target[5012];
- [sourcePath getCString: source maxLength: (sizeof source) encoding: NSUTF8StringEncoding];
- [finalPath getCString: target maxLength: (sizeof target) encoding: NSUTF8StringEncoding];
+ }
+
+ /*
+ * Is the target file PostScript? If so, run print file
+ * through CUPS filter to convert back to PostScript.
+ */
+
+ if ([pathExtension isEqualToString: @ "ps"]) {
+ char source[5012];
+ char target[5012];
+ [sourcePath getCString: source maxLength: (sizeof source) encoding: NSUTF8StringEncoding];
+ [finalPath getCString: target maxLength: (sizeof target) encoding: NSUTF8StringEncoding];
/*Make sure no file conflict exists.*/
if ([fileManager fileExistsAtPath: finalPath]) {
[fileManager removeItemAtPath: finalPath error: &error];
@@ -290,39 +290,39 @@ FinishPrint(
}
}
- /* Destination is preview. Open file in default application for PDF. */
- if ((status == noErr) && (printDestination == kPMDestinationPreview)) {
- CFStringRef urlpath = CFURLCopyFileSystemPath(printURL, kCFURLPOSIXPathStyle);
- NSString * path = (NSString * ) urlpath;
- NSURL * url = [NSURL fileURLWithPath: path];
- NSWorkspace * ws = [NSWorkspace sharedWorkspace];
- [ws openURL: url];
- status = noErr;
- return status;
- }
-
- /*
- * If destination is not printer, file or preview,
- * we do not support it. Display alert.
- */
+ /* Destination is preview. Open file in default application for PDF. */
+ if ((status == noErr) && (printDestination == kPMDestinationPreview)) {
+ CFStringRef urlpath = CFURLCopyFileSystemPath(printURL, kCFURLPOSIXPathStyle);
+ NSString * path = (NSString * ) urlpath;
+ NSURL * url = [NSURL fileURLWithPath: path];
+ NSWorkspace * ws = [NSWorkspace sharedWorkspace];
+ [ws openURL: url];
+ status = noErr;
+ return status;
+ }
+
+ /*
+ * If destination is not printer, file or preview,
+ * we do not support it. Display alert.
+ */
if (((status == noErr) && (printDestination != kPMDestinationPreview)) || ((status == noErr) && (printDestination != kPMDestinationFile)) || ((status == noErr) && (printDestination != kPMDestinationPrinter))) {
- NSAlert * alert = [[[NSAlert alloc] init] autorelease];
- [alert addButtonWithTitle: @ "OK"];
+ NSAlert * alert = [[[NSAlert alloc] init] autorelease];
+ [alert addButtonWithTitle: @ "OK"];
- [alert setMessageText: @ "Unsupported Printing Operation"];
- [alert setInformativeText: @ "This printing operation is not supported."];
- [alert setAlertStyle: NSAlertStyleInformational];
- [alert runModal];
- return status;
- }
+ [alert setMessageText: @ "Unsupported Printing Operation"];
+ [alert setInformativeText: @ "This printing operation is not supported."];
+ [alert setAlertStyle: NSAlertStyleInformational];
+ [alert runModal];
+ return status;
+ }
}
/* Return because cancel button was clicked. */
if (buttonValue == NSModalResponseCancel) {
- PMRelease(printSession);
- return status;
+ PMRelease(printSession);
+ return status;
}
return status;
diff --git a/macosx/tkMacOSXPrivate.h b/macosx/tkMacOSXPrivate.h
index c4352a0..5143515 100644
--- a/macosx/tkMacOSXPrivate.h
+++ b/macosx/tkMacOSXPrivate.h
@@ -166,7 +166,7 @@ typedef union MacKeycode_t {
#define ON_KEYPAD(virt) ((virt >= 0x41) && (virt <= 0x5C))
#define IS_PRINTABLE(keychar) ((keychar >= 0x20) && (keychar != 0x7f) && \
- ((keychar < 0xF700) || keychar >= 0xF8FF))
+ ((keychar < 0xF700) || keychar >= 0xF8FF))
/*
* An "index" is 2-bit bitfield showing the state of the Option and Shift
@@ -389,7 +389,7 @@ VISIBILITY_HIDDEN
- (void) handleDoScriptEvent: (NSAppleEventDescriptor *)event
withReplyEvent: (NSAppleEventDescriptor *)replyEvent;
- (void)handleURLEvent: (NSAppleEventDescriptor*)event
- withReplyEvent: (NSAppleEventDescriptor*)replyEvent;
+ withReplyEvent: (NSAppleEventDescriptor*)replyEvent;
@end
VISIBILITY_HIDDEN
diff --git a/macosx/tkMacOSXScale.c b/macosx/tkMacOSXScale.c
index a66bba7..38ff385 100644
--- a/macosx/tkMacOSXScale.c
+++ b/macosx/tkMacOSXScale.c
@@ -169,10 +169,10 @@ TkpDisplayScale(
Tcl_Preserve(scalePtr);
if ((scalePtr->flags & INVOKE_COMMAND) && (scalePtr->command != NULL)) {
Tcl_Preserve(interp);
- if (snprintf(string, TCL_DOUBLE_SPACE, scalePtr->format,
- scalePtr->value) < 0) {
- string[TCL_DOUBLE_SPACE - 1] = '\0';
- }
+ if (snprintf(string, TCL_DOUBLE_SPACE, scalePtr->format,
+ scalePtr->value) < 0) {
+ string[TCL_DOUBLE_SPACE - 1] = '\0';
+ }
Tcl_DStringInit(&buf);
Tcl_DStringAppend(&buf, scalePtr->command, TCL_INDEX_NONE);
Tcl_DStringAppend(&buf, " ", TCL_INDEX_NONE);
@@ -197,7 +197,7 @@ TkpDisplayScale(
* vertical scales: border and traversal highlight.
*/
- if (scalePtr->highlightWidth != 0) {
+ if (scalePtr->highlightWidth > 0) {
GC gc = Tk_GCForColor(scalePtr->highlightColorPtr, Tk_WindowId(tkwin));
Tk_DrawFocusHighlight(tkwin, gc, scalePtr->highlightWidth,
diff --git a/macosx/tkMacOSXScrlbr.c b/macosx/tkMacOSXScrlbr.c
index ec54d42..f5b25f1 100644
--- a/macosx/tkMacOSXScrlbr.c
+++ b/macosx/tkMacOSXScrlbr.c
@@ -284,7 +284,7 @@ TkpDisplayScrollbar(
* Draw a 3D rectangle to provide a base for the native scrollbar.
*/
- if (scrollPtr->highlightWidth != 0) {
+ if (scrollPtr->highlightWidth > 0) {
GC fgGC, bgGC;
bgGC = Tk_GCForColor(scrollPtr->highlightBgColorPtr, (Pixmap) macWin);
@@ -649,8 +649,8 @@ UpdateControlValues(
|| height <= metrics.minHeight) {
msPtr->info.enableState = kThemeTrackHideTrack;
} else {
- msPtr->info.enableState = kThemeTrackActive;
- msPtr->info.attributes =
+ msPtr->info.enableState = kThemeTrackActive;
+ msPtr->info.attributes =
kThemeTrackShowThumb | kThemeTrackThumbRgnIsNotGhost;
}
}
diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c
index 5a253e7..0d71236 100644
--- a/macosx/tkMacOSXSubwindows.c
+++ b/macosx/tkMacOSXSubwindows.c
@@ -78,15 +78,15 @@ XDestroyWindow(
}
if (macWin->visRgn) {
CFRelease(macWin->visRgn);
- macWin->visRgn = NULL;
+ macWin->visRgn = NULL;
}
if (macWin->aboveVisRgn) {
CFRelease(macWin->aboveVisRgn);
- macWin->aboveVisRgn = NULL;
+ macWin->aboveVisRgn = NULL;
}
if (macWin->drawRgn) {
CFRelease(macWin->drawRgn);
- macWin->drawRgn = NULL;
+ macWin->drawRgn = NULL;
}
if (macWin->toplevel->referenceCount == 0) {
@@ -98,15 +98,15 @@ XDestroyWindow(
}
if (macWin->visRgn) {
CFRelease(macWin->visRgn);
- macWin->visRgn = NULL;
+ macWin->visRgn = NULL;
}
if (macWin->aboveVisRgn) {
CFRelease(macWin->aboveVisRgn);
- macWin->aboveVisRgn = NULL;
+ macWin->aboveVisRgn = NULL;
}
if (macWin->drawRgn) {
CFRelease(macWin->drawRgn);
- macWin->drawRgn = NULL;
+ macWin->drawRgn = NULL;
}
macWin->view = nil;
macWin->winPtr->privatePtr = NULL;
@@ -155,7 +155,7 @@ XMapWindow(
static Bool initialized = NO;
NSPoint mouse = [NSEvent mouseLocation];
int x = mouse.x, y = TkMacOSXZeroScreenHeight() - mouse.y;
- //fprintf(stderr, "XMapWindow: %s\n", Tk_PathName(macWin->winPtr));
+ //fprintf(stderr, "XMapWindow: %s\n", Tk_PathName(macWin->winPtr));
/*
* Under certain situations it's possible for this function to be called
diff --git a/macosx/tkMacOSXSysTray.c b/macosx/tkMacOSXSysTray.c
index 76186cc..99ffc9b 100644
--- a/macosx/tkMacOSXSysTray.c
+++ b/macosx/tkMacOSXSysTray.c
@@ -205,7 +205,7 @@ MacSystrayObjCmd(
static const char *modifyOptions[] =
{"image", "text", "b1_callback", "b3_callback", NULL};
typedef enum {TRAY_IMAGE, TRAY_TEXT, TRAY_B1_CALLBACK, TRAY_B3_CALLBACK
- } modifyOptionsEnum;
+ } modifyOptionsEnum;
if ([NSApp macOSVersion] < 101000) {
Tcl_AppendResult(interp,
@@ -329,9 +329,9 @@ MacSystrayObjCmd(
break;
}
- /*
- * Modify the text for the tooltip.
- */
+ /*
+ * Modify the text for the tooltip.
+ */
case TRAY_TEXT: {
NSString *tooltip = [NSString stringWithUTF8String:Tcl_GetString(objv[3])];
@@ -345,9 +345,9 @@ MacSystrayObjCmd(
break;
}
- /*
- * Modify the proc for the callback.
- */
+ /*
+ * Modify the proc for the callback.
+ */
case TRAY_B1_CALLBACK: {
[statusItem setB1Callback : objv[3]];
@@ -365,14 +365,14 @@ MacSystrayObjCmd(
/*
* Set all properties to nil, and release statusItem.
*/
- [statusItem setImagewithImage: nil];
- [statusItem setTextwithString: nil];
- [statusItem setB1Callback : NULL];
- [statusItem setB3Callback : NULL];
- [statusItem release];
- *info = NULL;
- statusItem = NULL;
- break;
+ [statusItem setImagewithImage: nil];
+ [statusItem setTextwithString: nil];
+ [statusItem setB1Callback : NULL];
+ [statusItem setB3Callback : NULL];
+ [statusItem release];
+ *info = NULL;
+ statusItem = NULL;
+ break;
}
}
diff --git a/macosx/tkMacOSXTest.c b/macosx/tkMacOSXTest.c
index 19feb8d..b36c283 100644
--- a/macosx/tkMacOSXTest.c
+++ b/macosx/tkMacOSXTest.c
@@ -198,8 +198,8 @@ PressButtonObjCmd(
}
if (objc != 3) {
- Tcl_WrongNumArgs(interp, 1, objv, "x y");
- return TCL_ERROR;
+ Tcl_WrongNumArgs(interp, 1, objv, "x y");
+ return TCL_ERROR;
}
for (i = 1; i < objc; i++) {
if (Tcl_GetIntFromObj(interp,objv[i],&value) != TCL_OK) {
@@ -297,8 +297,8 @@ MoveMouseObjCmd(
}
if (objc != 3) {
- Tcl_WrongNumArgs(interp, 1, objv, "x y");
- return TCL_ERROR;
+ Tcl_WrongNumArgs(interp, 1, objv, "x y");
+ return TCL_ERROR;
}
for (i = 1; i < objc; i++) {
if (Tcl_GetIntFromObj(interp,objv[i],&value) != TCL_OK) {
@@ -359,12 +359,12 @@ InjectKeyEventObjCmd(
if (objc < 3) {
wrongArgs:
- Tcl_WrongNumArgs(interp, 1, objv, "option keysym ?arg?");
- return TCL_ERROR;
+ Tcl_WrongNumArgs(interp, 1, objv, "option keysym ?arg?");
+ return TCL_ERROR;
}
if (Tcl_GetIndexFromObjStruct(interp, objv[1], optionStrings,
- sizeof(char *), "option", 0, &index) != TCL_OK) {
- return TCL_ERROR;
+ sizeof(char *), "option", 0, &index) != TCL_OK) {
+ return TCL_ERROR;
}
type = types[index];
if (Tcl_GetIntFromObj(interp, objv[2], &keysym) != TCL_OK) {
@@ -376,37 +376,37 @@ InjectKeyEventObjCmd(
macKC.uint = XKeysymToKeycode(NULL, keysym);
for (i = 3; i < objc; i++) {
if (Tcl_GetIndexFromObjStruct(interp, objv[i], argStrings,
- sizeof(char *), "option", TCL_EXACT, &index) != TCL_OK) {
- return TCL_ERROR;
- }
- switch ((enum args) index) {
+ sizeof(char *), "option", TCL_EXACT, &index) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ switch ((enum args) index) {
case KEYEVENT_SHIFT:
mods |= NSShiftKeyMask;
- break;
+ break;
case KEYEVENT_CONTROL:
mods |= NSControlKeyMask;
- break;
+ break;
case KEYEVENT_OPTION:
mods |= NSAlternateKeyMask;
- break;
+ break;
case KEYEVENT_COMMAND:
mods |= NSCommandKeyMask;
- break;
+ break;
case KEYEVENT_FUNCTION:
mods |= NSFunctionKeyMask;
- break;
+ break;
case KEYEVENT_X:
if (++i >= objc) {
- goto wrongArgs;
- }
+ goto wrongArgs;
+ }
if (Tcl_GetIntFromObj(interp,objv[i], &x) != TCL_OK) {
return TCL_ERROR;
}
break;
case KEYEVENT_Y:
if (++i >= objc) {
- goto wrongArgs;
- }
+ goto wrongArgs;
+ }
if (Tcl_GetIntFromObj(interp,objv[i], &y) != TCL_OK) {
return TCL_ERROR;
}
@@ -434,7 +434,7 @@ InjectKeyEventObjCmd(
}
keyEvent = [NSEvent keyEventWithType:type
location:NSMakePoint(x, y)
- modifierFlags:mods
+ modifierFlags:mods
timestamp:GetCurrentEventTime()
windowNumber:0
context:nil
diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c
index cffd1c5..8065962 100644
--- a/macosx/tkMacOSXWindowEvent.c
+++ b/macosx/tkMacOSXWindowEvent.c
@@ -150,7 +150,7 @@ extern NSString *NSWindowDidOrderOffScreenNotification;
}
- (NSRect)windowWillUseStandardFrame:(NSWindow *)window
- defaultFrame:(NSRect)newFrame
+ defaultFrame:(NSRect)newFrame
{
(void)window;
@@ -286,7 +286,7 @@ extern NSString *NSWindowDidOrderOffScreenNotification;
#if 0
if (winPtr) {
- Tk_UnmapWindow((Tk_Window)winPtr);
+ Tk_UnmapWindow((Tk_Window)winPtr);
}
#endif
}
@@ -398,7 +398,7 @@ static void RefocusGrabWindow(void *data) {
}
- (BOOL)applicationShouldHandleReopen:(NSApplication *)sender
- hasVisibleWindows:(BOOL)flag
+ hasVisibleWindows:(BOOL)flag
{
(void)sender;
(void)flag;
@@ -972,7 +972,7 @@ ConfigureRestrictProc(
NSTrackingActiveAlways)
owner:self
userInfo:nil];
- [self addTrackingArea:trackingArea];
+ [self addTrackingArea:trackingArea];
}
return self;
}
@@ -1000,7 +1000,7 @@ ConfigureRestrictProc(
/*
* Run any pending widget display procs as part of the update.
*/
-
+
while(Tcl_DoOneEvent(TCL_IDLE_EVENTS)){}
[self setTkNeedsDisplay:NO];
}
@@ -1220,7 +1220,7 @@ static const char *const accentNames[] = {
}
NSString *accent = [preferences stringForKey:@"AppleAccentColor"];
NSArray *words = [[preferences stringForKey:@"AppleHighlightColor"]
- componentsSeparatedByString: @" "];
+ componentsSeparatedByString: @" "];
NSString *highlight = [words count] > 3 ? [words objectAtIndex:3] : nil;
const char *accentName = accent ? accentNames[1 + accent.intValue] : defaultColor;
const char *highlightName = highlight ? highlight.UTF8String: defaultColor;
diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c
index 04a3ce5..6eed301 100644
--- a/macosx/tkMacOSXWm.c
+++ b/macosx/tkMacOSXWm.c
@@ -112,7 +112,7 @@ static const struct {
.forceOnAttrs = kWindowNoTitleBarAttribute |
kWindowDoesNotCycleAttribute,
.flags = WM_TOPMOST,
- .styleMask = 0},
+ .styleMask = 0},
[kSheetWindowClass] = {
.validAttrs = kWindowResizableAttribute,
.forceOnAttrs = kWindowNoTitleBarAttribute |
@@ -622,7 +622,7 @@ static void placeAsTab(TKWindow *macWindow) {
#endif
- (NSSize)windowWillResize:(NSWindow *)sender
- toSize:(NSSize)frameSize
+ toSize:(NSSize)frameSize
{
NSRect currentFrame = [sender frame];
TkWindow *winPtr = TkMacOSXGetTkWindow(sender);
@@ -1101,7 +1101,7 @@ TkWmUnmapWindow(
* This procedure is invoked when a top-level window is about to be
* deleted. It cleans up the wm-related data structures for the window.
* If the dead window contains the pointer, TkUpdatePointer is called
- * to tell Tk which window will be the new pointer window.
+ * to tell Tk which window will be the new pointer window.
*
* Results:
* None.
@@ -1201,7 +1201,7 @@ TkWmDeadWindow(
NSPoint mouse = [NSEvent mouseLocation];
[NSApp setTkPointerWindow:nil];
winPtr2 = NULL;
-
+
for (w in [NSApp orderedWindows]) {
if (w == deadNSWindow || w == NULL) {
continue;
@@ -1246,9 +1246,9 @@ TkWmDeadWindow(
if (deadNSWindow && !Tk_IsEmbedded(winPtr)) {
NSWindow *parent = [deadNSWindow parentWindow];
[deadNSWindow setTkWindow:None];
- if (winPtr->window) {
- ((MacDrawable *)winPtr->window)->view = nil;
- }
+ if (winPtr->window) {
+ ((MacDrawable *)winPtr->window)->view = nil;
+ }
wmPtr->window = NULL;
if (parent) {
@@ -1780,7 +1780,7 @@ WmSetAttribute(
} else if (![macWindow isKindOfClass: [NSPanel class]] &&
styleMaskBits[index].allowed == NSWindowClass_panel) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "styleMask bit \"%s\" can only be used with an NSPanel",
+ "styleMask bit \"%s\" can only be used with an NSPanel",
styleMaskBits[index].bitname));
Tcl_SetErrorCode(interp, "TK", "INVALID_STYLEMASK_BIT", NULL);
return TCL_ERROR;
@@ -1825,7 +1825,7 @@ WmSetAttribute(
fprintf(stderr, "Current styleMask: %lx\n", [macWindow styleMask]);
fprintf(stderr, "Setting styleMask to %lx\n", styleMaskValue);
#endif
- macWindow.styleMask = (unsigned long) styleMaskValue;
+ macWindow.styleMask = (unsigned long) styleMaskValue;
NSRect newFrame = [macWindow frame];
int heightDiff = newFrame.size.height - oldFrame.size.height;
int newHeight = heightDiff < 0 ? newFrame.size.height :
@@ -2578,16 +2578,16 @@ WmForgetCmd(
RemapWindows(winPtr, (MacDrawable *)winPtr->parentPtr->window);
- /*
- * Make sure wm no longer manages this window
- */
- Tk_ManageGeometry(frameWin, NULL, NULL);
+ /*
+ * Make sure wm no longer manages this window
+ */
+ Tk_ManageGeometry(frameWin, NULL, NULL);
winPtr->flags &= ~(TK_TOP_HIERARCHY|TK_TOP_LEVEL|TK_HAS_WRAPPER|TK_WIN_MANAGED);
/*
- * Flags (above) must be cleared before calling TkMapTopFrame (below).
- */
+ * Flags (above) must be cleared before calling TkMapTopFrame (below).
+ */
TkMapTopFrame(frameWin);
} else {
@@ -3673,7 +3673,7 @@ WmOverrideredirectCmd(
win = TkMacOSXGetNSWindowForDrawable(winPtr->window);
}
-
+
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?boolean?");
return TCL_ERROR;
@@ -4357,12 +4357,12 @@ WmTransientCmd(
RemoveTransient(winPtr);
containerPtr = (TkWindow*) container;
while (!Tk_TopWinHierarchy(containerPtr)) {
- /*
- * Ensure that the container window is actually a Tk toplevel.
- */
+ /*
+ * Ensure that the container window is actually a Tk toplevel.
+ */
- containerPtr = containerPtr->parentPtr;
- }
+ containerPtr = containerPtr->parentPtr;
+ }
Tk_MakeWindowExist((Tk_Window)containerPtr);
if (wmPtr->iconFor != NULL) {
@@ -5262,7 +5262,7 @@ Tk_GetRootCoords(
*/
winPtr = otherPtr;
- continue;
+ continue;
}
winPtr = winPtr->parentPtr;
}
@@ -6303,7 +6303,7 @@ TkUnsupported1ObjCmd(
case TKMWS_APPEARANCE:
if ([NSApp macOSVersion] < 100900) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "Window appearances did not exist until OSX 10.9.", TCL_INDEX_NONE));
+ "Window appearances did not exist until OSX 10.9.", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TK", "WINDOWSTYLE", "APPEARANCE", NULL);
return TCL_ERROR;
}
@@ -6857,7 +6857,7 @@ TkMacOSXMakeRealWindowExist(
}
if ((styleMask & (NSTexturedBackgroundWindowMask|NSHUDWindowMask)) &&
!(styleMask & NSDocModalWindowMask)) {
- /*
+ /*
* Workaround for [Bug 2824538]: Textured windows are draggable from
* opaque content.
*/
@@ -7642,9 +7642,9 @@ ApplyContainerOverrideChanges(
wmPtr->attributes &= ~kWindowNoActivatesAttribute;
if ([NSApp macOSVersion] == 100600) {
styleMask = NSTitledWindowMask |
- NSClosableWindowMask |
- NSMiniaturizableWindowMask |
- NSResizableWindowMask;
+ NSClosableWindowMask |
+ NSMiniaturizableWindowMask |
+ NSResizableWindowMask;
} else {
styleMask |= NSTitledWindowMask;
}
diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c
index ff850f0..2d8d3da 100644
--- a/macosx/ttkMacOSXTheme.c
+++ b/macosx/ttkMacOSXTheme.c
@@ -214,9 +214,9 @@ static GrayPalette LookupGrayPalette(
{
const PaletteStateTable *entry = design->palettes;
while ((state & entry->onBits) != entry->onBits ||
- (~state & entry->offBits) != entry->offBits)
+ (~state & entry->offBits) != entry->offBits)
{
- ++entry;
+ ++entry;
}
return isDark ? entry->dark : entry->light;
}
@@ -356,12 +356,12 @@ static void GetBackgroundColorRGBA(
rgba[i] -= Ttk_ContrastDelta*contrast / 255.0;
}
}
- if (save && winPtr->privatePtr) {
- winPtr->privatePtr->flags |= TTK_HAS_CONTRASTING_BG;
- for (int i = 0; i < 4; i++) {
- winPtr->privatePtr->fillRGBA[i] = rgba[i];
- }
- }
+ if (save && winPtr->privatePtr) {
+ winPtr->privatePtr->flags |= TTK_HAS_CONTRASTING_BG;
+ for (int i = 0; i < 4; i++) {
+ winPtr->privatePtr->fillRGBA[i] = rgba[i];
+ }
+ }
}
}
@@ -931,8 +931,8 @@ DrawHelpSymbol(
NSColor *foreground = state & TTK_STATE_DISABLED ?
[NSColor disabledControlTextColor] : [NSColor controlTextColor];
NSDictionary *attrs = @{
- NSForegroundColorAttributeName : foreground,
- NSFontAttributeName : font
+ NSForegroundColorAttributeName : foreground,
+ NSFontAttributeName : font
};
NSAttributedString *attributedString = [[NSAttributedString alloc]
initWithString:@"?"
@@ -1505,10 +1505,10 @@ DrawTab(
if (!(state & TTK_STATE_SELECTED)) {
DrawGrayButton(context, bounds, &tabDesign, state, tkwin);
- /*
- * Draw a separator line on the left side of the tab if it
- * not first.
- */
+ /*
+ * Draw a separator line on the left side of the tab if it
+ * not first.
+ */
if (!(state & TTK_STATE_FIRST)) {
CGContextSaveGState(context);
@@ -1653,20 +1653,20 @@ static void ButtonElementMinSize(
if (params->heightMetric != NoThemeMetric) {
ChkErr(GetThemeMetric, params->heightMetric, minHeight);
- /*
- * The theme height does not include the 1-pixel border around
- * the button, although it does include the 1-pixel shadow at
- * the bottom.
- */
+ /*
+ * The theme height does not include the 1-pixel border around
+ * the button, although it does include the 1-pixel shadow at
+ * the bottom.
+ */
*minHeight += 2;
- /*
- * For buttons with labels the minwidth must be 0 to force the
- * correct text layout. For example, a non-zero value will cause the
- * text to be left justified, no matter what -anchor setting is used in
- * the style.
- */
+ /*
+ * For buttons with labels the minwidth must be 0 to force the
+ * correct text layout. For example, a non-zero value will cause the
+ * text to be left justified, no matter what -anchor setting is used in
+ * the style.
+ */
if (params->widthMetric != NoThemeMetric) {
ChkErr(GetThemeMetric, params->widthMetric, minWidth);
@@ -1700,10 +1700,10 @@ static void ButtonElementSize(
return;
case TkGradientButton:
*paddingPtr = Ttk_MakePadding(1, 1, 1, 1);
- /* Fall through. */
+ /* Fall through. */
case kThemeArrowButton:
case kThemeRoundButtonHelp:
- return;
+ return;
/* Buttons which are sized like PushButtons but unknown to HITheme. */
case TkRoundedRectButton:
case TkRecessedButton:
@@ -1711,7 +1711,7 @@ static void ButtonElementSize(
info.kind = kThemePushButton;
break;
default:
- break;
+ break;
}
/*
@@ -2152,14 +2152,14 @@ static void EntryElementDraw(
.isFocused = state & TTK_STATE_FOCUS,
};
- /*
- * Earlier versions of the Aqua theme ignored the -fieldbackground
- * option and used the -background as if it were -fieldbackground.
- * Here we are enabling -fieldbackground. For backwards
- * compatibility, if -fieldbackground is set to the default color and
- * -background is set to a different color then we use -background as
- * -fieldbackground.
- */
+ /*
+ * Earlier versions of the Aqua theme ignored the -fieldbackground
+ * option and used the -background as if it were -fieldbackground.
+ * Here we are enabling -fieldbackground. For backwards
+ * compatibility, if -fieldbackground is set to the default color and
+ * -background is set to a different color then we use -background as
+ * -fieldbackground.
+ */
if (0 != strcmp(Tcl_GetString(e->fieldbackgroundObj), defaultBG)) {
backgroundPtr =
@@ -2828,14 +2828,14 @@ static void ThumbElementDraw(
CGRect troughBounds = {{macWin->xOff, macWin->yOff},
{Tk_Width(tkwin), Tk_Height(tkwin)}};
- /*
- * The info struct has integer fields, which will be converted to
- * floats in the drawing routine. All of values provided in the info
- * struct, namely min, max, value, and viewSize are only defined up to
- * an arbitrary scale factor. To avoid roundoff error we scale so
- * that the viewSize is a large float which is smaller than the
- * largest int.
- */
+ /*
+ * The info struct has integer fields, which will be converted to
+ * floats in the drawing routine. All of values provided in the info
+ * struct, namely min, max, value, and viewSize are only defined up to
+ * an arbitrary scale factor. To avoid roundoff error we scale so
+ * that the viewSize is a large float which is smaller than the
+ * largest int.
+ */
HIThemeTrackDrawInfo info = {
.version = 0,
@@ -2941,7 +2941,7 @@ static void SeparatorElementDraw(
CGRect bounds = BoxToRect(d, b);
const HIThemeSeparatorDrawInfo info = {
.version = 0,
- /* Separator only supports kThemeStateActive, kThemeStateInactive */
+ /* Separator only supports kThemeStateActive, kThemeStateInactive */
.state = Ttk_StateTableLookup(ThemeStateTable,
state & TTK_STATE_BACKGROUND),
};
@@ -3004,7 +3004,7 @@ static void SizegripElementDraw(
CGRect bounds = BoxToRect(d, b);
HIThemeGrowBoxDrawInfo info = {
.version = 0,
- /* Grow box only supports kThemeStateActive, kThemeStateInactive */
+ /* Grow box only supports kThemeStateActive, kThemeStateInactive */
.state = Ttk_StateTableLookup(ThemeStateTable,
state & TTK_STATE_BACKGROUND),
.kind = kHIThemeGrowBoxKindNormal,
@@ -3295,10 +3295,10 @@ static void TreeHeaderElementDraw(
BEGIN_DRAWING(d)
if ([NSApp macOSVersion] > 100800) {
- /*
- * Compensate for the padding added in TreeHeaderElementSize, so
- * the larger heading will be drawn at the top of the widget.
- */
+ /*
+ * Compensate for the padding added in TreeHeaderElementSize, so
+ * the larger heading will be drawn at the top of the widget.
+ */
bounds.origin.y -= 4;
DrawListHeader(bounds, dc.context, tkwin, state);
@@ -3484,13 +3484,13 @@ TTK_LAYOUT("TSpinbox",
TTK_LAYOUT("TEntry",
TTK_GROUP("Entry.field", TTK_FILL_BOTH|TTK_BORDER,
- TTK_GROUP("Entry.padding", TTK_FILL_BOTH,
+ TTK_GROUP("Entry.padding", TTK_FILL_BOTH,
TTK_NODE("Entry.textarea", TTK_FILL_BOTH))))
/* Searchbox */
TTK_LAYOUT("Searchbox",
TTK_GROUP("Searchbox.field", TTK_FILL_BOTH|TTK_BORDER,
- TTK_GROUP("Entry.padding", TTK_FILL_BOTH,
+ TTK_GROUP("Entry.padding", TTK_FILL_BOTH,
TTK_NODE("Entry.textarea", TTK_FILL_BOTH))))
/* Progress bars -- track only */
diff --git a/macosx/ttkMacOSXTheme.h b/macosx/ttkMacOSXTheme.h
index 1e2b7ae..2092b02 100644
--- a/macosx/ttkMacOSXTheme.h
+++ b/macosx/ttkMacOSXTheme.h
@@ -561,7 +561,7 @@ static ThemeFrameParams
#define CHECK_RADIUS(radius, bounds) \
if ((radius) > (bounds).size.width / 2 || (radius) > (bounds).size.height / 2) { \
- return; \
+ return; \
}
/*
diff --git a/tests/corruptTruncatedColormap.gif b/tests/corruptTruncatedColormap.gif
new file mode 100644
index 0000000..21d4add
--- /dev/null
+++ b/tests/corruptTruncatedColormap.gif
Binary files differ
diff --git a/tests/imgPhoto.test b/tests/imgPhoto.test
index 29e6b53..0a2cf7f 100644
--- a/tests/imgPhoto.test
+++ b/tests/imgPhoto.test
@@ -1938,6 +1938,23 @@ test imgPhoto-20.6 {Reject truncated GIF (file)} -setup {
} -cleanup {
catch {image delete gif1}
} -returnCodes error -result {error reading color map}
+test imgPhoto-20.6.1 {Reject truncated GIF in Colormap - ticket 865af0148c - file} -setup {
+ set fileName [file join [file dirname [info script]] corruptTruncatedColormap.gif]
+} -body {
+ image create photo gif1 -file $fileName
+} -cleanup {
+ catch {image delete gif1}
+} -returnCodes error -result {GIF file truncated}
+test imgPhoto-20.6.2 {Reject truncated GIF in Colormap - ticket 865af0148c - data} -setup {
+ set fileName [file join [file dirname [info script]] corruptTruncatedColormap.gif]
+ set h [open $fileName rb]
+ set d [read $h]
+ close $h
+} -body {
+ image create photo gif1 -data $d
+} -cleanup {
+ catch {image delete gif1}
+} -returnCodes error -result {GIF file truncated}
test imgPhoto-20.7 {Reject corrupted GIF (> 4Gb) (binary string)} -constraints {
nonPortable
} -setup {
diff --git a/tests/textDisp.test b/tests/textDisp.test
index ffb2b2a..67df965 100644
--- a/tests/textDisp.test
+++ b/tests/textDisp.test
@@ -1109,7 +1109,7 @@ test textDisp-6.9 {DisplayText, horizontal scrollbar updates} {
test textDisp-6.10 {DisplayText, redisplay embedded windows after scroll} {aqua} {
# For this test to pass line 8 must be out of the text widget.
# With macOS 14 this requires making the buttons a little larger.
- # So we set the pady option. This may depend on the OS version.
+ # So we set the pady option. This may depend on the OS version.
.t configure -wrap char
update
.t delete 1.0 end
diff --git a/tests/unixWm.test b/tests/unixWm.test
index e70242d..9194796 100644
--- a/tests/unixWm.test
+++ b/tests/unixWm.test
@@ -2093,7 +2093,7 @@ test unixWm-51.8 {TkWmRestackToplevel procedure, overrideredirect windows} unix
wm overrideredirect .t2 1
wm geometry .t2 +0+0
tkwait visibility .t2
-
+
# Need to use vrootx and vrooty to make tests work correctly with
# virtual root window measures managers: overrideredirect windows
# come up at (0,0) in display coordinates, not virtual root
diff --git a/unix/tkUnixDefault.h b/unix/tkUnixDefault.h
index dfcf858..16fdcc6 100644
--- a/unix/tkUnixDefault.h
+++ b/unix/tkUnixDefault.h
@@ -448,7 +448,7 @@
#define DEF_SCROLLBAR_BORDER_WIDTH "1"
#define DEF_SCROLLBAR_COMMAND ""
#define DEF_SCROLLBAR_CURSOR ""
-#define DEF_SCROLLBAR_EL_BORDER_WIDTH "-1"
+#define DEF_SCROLLBAR_EL_BORDER_WIDTH NULL
#define DEF_SCROLLBAR_HIGHLIGHT_BG NORMAL_BG
#define DEF_SCROLLBAR_HIGHLIGHT BLACK
#define DEF_SCROLLBAR_HIGHLIGHT_WIDTH "0"
diff --git a/unix/tkUnixMenubu.c b/unix/tkUnixMenubu.c
index dd67639..c9a33aa 100644
--- a/unix/tkUnixMenubu.c
+++ b/unix/tkUnixMenubu.c
@@ -279,7 +279,7 @@ TkpDisplayMenuButton(
Tk_Height(tkwin) - 2*mbPtr->highlightWidth,
mbPtr->borderWidth, mbPtr->relief);
}
- if (mbPtr->highlightWidth != 0) {
+ if (mbPtr->highlightWidth > 0) {
if (mbPtr->flags & GOT_FOCUS) {
gc = Tk_GCForColor(mbPtr->highlightColorPtr, pixmap);
} else {
diff --git a/unix/tkUnixScale.c b/unix/tkUnixScale.c
index 6e73268..8f4d23b 100644
--- a/unix/tkUnixScale.c
+++ b/unix/tkUnixScale.c
@@ -632,7 +632,7 @@ TkpDisplayScale(
Tk_Height(tkwin) - 2*scalePtr->highlightWidth,
scalePtr->borderWidth, scalePtr->relief);
}
- if (scalePtr->highlightWidth != 0) {
+ if (scalePtr->highlightWidth > 0) {
GC gc;
if (scalePtr->flags & GOT_FOCUS) {
diff --git a/unix/tkUnixScrlbr.c b/unix/tkUnixScrlbr.c
index 9660718..65166e4 100644
--- a/unix/tkUnixScrlbr.c
+++ b/unix/tkUnixScrlbr.c
@@ -128,7 +128,7 @@ TkpDisplayScrollbar(
pixmap = Tk_GetPixmap(scrollPtr->display, Tk_WindowId(tkwin),
Tk_Width(tkwin), Tk_Height(tkwin), Tk_Depth(tkwin));
- if (scrollPtr->highlightWidth != 0) {
+ if (scrollPtr->highlightWidth > 0) {
GC gc;
if (scrollPtr->flags & GOT_FOCUS) {
@@ -283,9 +283,6 @@ TkpComputeScrollbarGeometry(
{
int width, fieldLength;
- if (scrollPtr->highlightWidth < 0) {
- scrollPtr->highlightWidth = 0;
- }
scrollPtr->inset = scrollPtr->highlightWidth + scrollPtr->borderWidth;
width = (scrollPtr->vertical) ? Tk_Width(scrollPtr->tkwin)
: Tk_Height(scrollPtr->tkwin);
diff --git a/win/nmakehlp.c b/win/nmakehlp.c
index 4d95662..4fc9f7a 100644
--- a/win/nmakehlp.c
+++ b/win/nmakehlp.c
@@ -19,7 +19,6 @@
#pragma comment (lib, "kernel32.lib")
#endif
#include <stdio.h>
-#include <math.h>
/*
* This library is required for x64 builds with _some_ versions of MSVC
@@ -91,7 +90,7 @@ main(
case 'c':
if (argc != 3) {
chars = snprintf(msg, sizeof(msg) - 1,
- "usage: %s -c <compiler option>\n"
+ "usage: %s -c <compiler option>\n"
"Tests for whether cl.exe supports an option\n"
"exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]);
WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
@@ -319,11 +318,11 @@ CheckForCompilerFeature(
*/
return !(strstr(Out.buffer, "D4002") != NULL
- || strstr(Err.buffer, "D4002") != NULL
- || strstr(Out.buffer, "D9002") != NULL
- || strstr(Err.buffer, "D9002") != NULL
- || strstr(Out.buffer, "D2021") != NULL
- || strstr(Err.buffer, "D2021") != NULL);
+ || strstr(Err.buffer, "D4002") != NULL
+ || strstr(Out.buffer, "D9002") != NULL
+ || strstr(Err.buffer, "D9002") != NULL
+ || strstr(Out.buffer, "D2021") != NULL
+ || strstr(Err.buffer, "D2021") != NULL);
}
static int
@@ -601,9 +600,9 @@ list_free(list_item_t **listPtrPtr)
*
* Usage is something like:
* nmakehlp -S << $** > $@
- * @PACKAGE_NAME@ $(PACKAGE_NAME)
- * @PACKAGE_VERSION@ $(PACKAGE_VERSION)
- * <<
+ * @PACKAGE_NAME@ $(PACKAGE_NAME)
+ * @PACKAGE_VERSION@ $(PACKAGE_VERSION)
+ * <<
*/
static int
@@ -727,11 +726,13 @@ static int LocateDependencyHelper(const char *dir, const char *keypath)
int keylen, ret;
WIN32_FIND_DATA finfo;
- if (dir == NULL || keypath == NULL)
+ if (dir == NULL || keypath == NULL) {
return 2; /* Have no real error reporting mechanism into nmake */
+ }
dirlen = strlen(dir);
- if ((dirlen + 3) > sizeof(path))
+ if ((dirlen + 3) > sizeof(path)) {
return 2;
+ }
strncpy(path, dir, dirlen);
strncpy(path+dirlen, "\\*", 3); /* Including terminating \0 */
keylen = strlen(keypath);
@@ -746,8 +747,9 @@ static int LocateDependencyHelper(const char *dir, const char *keypath)
#else
hSearch = FindFirstFile(path, &finfo);
#endif
- if (hSearch == INVALID_HANDLE_VALUE)
+ if (hSearch == INVALID_HANDLE_VALUE) {
return 1; /* Not found */
+ }
/* Loop through all subdirs checking if the keypath is under there */
ret = 1; /* Assume not found */
@@ -757,11 +759,13 @@ static int LocateDependencyHelper(const char *dir, const char *keypath)
* We need to check it is a directory despite the
* FindExSearchLimitToDirectories in the above call. See SDK docs
*/
- if ((finfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
+ if ((finfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) {
continue;
+ }
sublen = strlen(finfo.cFileName);
- if ((dirlen+1+sublen+1+keylen+1) > sizeof(path))
+ if ((dirlen+1+sublen+1+keylen+1) > sizeof(path)) {
continue; /* Path does not fit, assume not matched */
+ }
strncpy(path+dirlen+1, finfo.cFileName, sublen);
path[dirlen+1+sublen] = '\\';
strncpy(path+dirlen+1+sublen+1, keypath, keylen+1);
@@ -781,13 +785,13 @@ static int LocateDependencyHelper(const char *dir, const char *keypath)
* LocateDependency --
*
* Locates a dependency for a package.
- * keypath - a relative path within the package directory
- * that is used to confirm it is the correct directory.
+ * keypath - a relative path within the package directory
+ * that is used to confirm it is the correct directory.
* The search path for the package directory is currently only
- * the parent and grandparent of the current working directory.
- * If found, the command prints
- * name_DIRPATH=<full path of located directory>
- * and returns 0. If not found, does not print anything and returns 1.
+ * the parent and grandparent of the current working directory.
+ * If found, the command prints
+ * name_DIRPATH=<full path of located directory>
+ * and returns 0. If not found, does not print anything and returns 1.
*/
static int LocateDependency(const char *keypath)
{
@@ -797,8 +801,9 @@ static int LocateDependency(const char *keypath)
for (i = 0; i < (sizeof(paths)/sizeof(paths[0])); ++i) {
ret = LocateDependencyHelper(paths[i], keypath);
- if (ret == 0)
+ if (ret == 0) {
return ret;
+ }
}
return ret;
}
diff --git a/win/tkWinClipboard.c b/win/tkWinClipboard.c
index 7de4338..f51bf8a 100644
--- a/win/tkWinClipboard.c
+++ b/win/tkWinClipboard.c
@@ -60,10 +60,10 @@ TkSelGetSelection(
goto error;
}
if (!OpenClipboard(NULL)) {
- Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "clipboard cannot be opened, another application grabbed it"));
- Tcl_SetErrorCode(interp, "TK", "CLIPBOARD", "BUSY", NULL);
- return TCL_ERROR;
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "clipboard cannot be opened, another application grabbed it"));
+ Tcl_SetErrorCode(interp, "TK", "CLIPBOARD", "BUSY", NULL);
+ return TCL_ERROR;
}
/*
diff --git a/win/tkWinDefault.h b/win/tkWinDefault.h
index 5318f84..5af7877 100644
--- a/win/tkWinDefault.h
+++ b/win/tkWinDefault.h
@@ -450,7 +450,7 @@
#define DEF_SCROLLBAR_BORDER_WIDTH "0"
#define DEF_SCROLLBAR_COMMAND ""
#define DEF_SCROLLBAR_CURSOR ""
-#define DEF_SCROLLBAR_EL_BORDER_WIDTH "-1"
+#define DEF_SCROLLBAR_EL_BORDER_WIDTH NULL
#define DEF_SCROLLBAR_HIGHLIGHT_BG NORMAL_BG
#define DEF_SCROLLBAR_HIGHLIGHT HIGHLIGHT
#define DEF_SCROLLBAR_HIGHLIGHT_WIDTH "0"
diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c
index 77f8e98..0b0494b 100644
--- a/win/tkWinDialog.c
+++ b/win/tkWinDialog.c
@@ -177,9 +177,9 @@ typedef struct OFNOpts {
int mustExist; /* Used only for */
int forceXPStyle; /* XXX - Force XP style even on newer systems */
WCHAR file[TK_MULTI_MAX_PATH]; /* File name
- XXX - fixed size because it was so
- historically. Why not malloc'ed ?
- */
+ XXX - fixed size because it was so
+ historically. Why not malloc'ed ?
+ */
} OFNOpts;
/* Define the operation for which option parsing is to be done. */
@@ -254,26 +254,26 @@ typedef struct IShellItemArrayVtbl
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IShellItemArray *, REFIID riid,void **ppvObject);
+ IShellItemArray *, REFIID riid,void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(IShellItemArray *);
ULONG ( STDMETHODCALLTYPE *Release )(IShellItemArray *);
HRESULT ( STDMETHODCALLTYPE *BindToHandler )(IShellItemArray *,
- IBindCtx *, REFGUID, REFIID, void **);
+ IBindCtx *, REFGUID, REFIID, void **);
/* flags is actually is enum GETPROPERTYSTOREFLAGS */
HRESULT ( STDMETHODCALLTYPE *GetPropertyStore )(
- IShellItemArray *, int, REFIID, void **);
+ IShellItemArray *, int, REFIID, void **);
/* keyType actually REFPROPERTYKEY */
HRESULT ( STDMETHODCALLTYPE *GetPropertyDescriptionList )(
- IShellItemArray *, void *, REFIID, void **);
+ IShellItemArray *, void *, REFIID, void **);
HRESULT ( STDMETHODCALLTYPE *GetAttributes )(IShellItemArray *,
- SIATTRIBFLAGS, SFGAOF, SFGAOF *);
+ SIATTRIBFLAGS, SFGAOF, SFGAOF *);
HRESULT ( STDMETHODCALLTYPE *GetCount )(
- IShellItemArray *, DWORD *);
+ IShellItemArray *, DWORD *);
HRESULT ( STDMETHODCALLTYPE *GetItemAt )(
- IShellItemArray *, DWORD, IShellItem **);
+ IShellItemArray *, DWORD, IShellItem **);
/* ppenumShellItems actually (IEnumShellItems **) */
HRESULT ( STDMETHODCALLTYPE *EnumItems )(
- IShellItemArray *, void **);
+ IShellItemArray *, void **);
END_INTERFACE
} IShellItemArrayVtbl;
@@ -354,56 +354,56 @@ typedef struct IFileDialogVtbl
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IFileDialog *, REFIID, void **);
+ IFileDialog *, REFIID, void **);
ULONG ( STDMETHODCALLTYPE *AddRef )( IFileDialog *);
ULONG ( STDMETHODCALLTYPE *Release )( IFileDialog *);
HRESULT ( STDMETHODCALLTYPE *Show )( IFileDialog *, HWND);
HRESULT ( STDMETHODCALLTYPE *SetFileTypes )( IFileDialog *,
- UINT, const TCLCOMDLG_FILTERSPEC *);
+ UINT, const TCLCOMDLG_FILTERSPEC *);
HRESULT ( STDMETHODCALLTYPE *SetFileTypeIndex )(IFileDialog *, UINT);
HRESULT ( STDMETHODCALLTYPE *GetFileTypeIndex )(IFileDialog *, UINT *);
/* XXX - Actually pfde is IFileDialogEvents* but we do not use
this call and do not want to define IFileDialogEvents as that
pulls in a whole bunch of other stuff. */
HRESULT ( STDMETHODCALLTYPE *Advise )(
- IFileDialog *, void *, DWORD *);
+ IFileDialog *, void *, DWORD *);
HRESULT ( STDMETHODCALLTYPE *Unadvise )(IFileDialog *, DWORD);
HRESULT ( STDMETHODCALLTYPE *SetOptions )(
- IFileDialog *, FILEOPENDIALOGOPTIONS);
+ IFileDialog *, FILEOPENDIALOGOPTIONS);
HRESULT ( STDMETHODCALLTYPE *GetOptions )(
- IFileDialog *, FILEOPENDIALOGOPTIONS *);
+ IFileDialog *, FILEOPENDIALOGOPTIONS *);
HRESULT ( STDMETHODCALLTYPE *SetDefaultFolder )(
- IFileDialog *, IShellItem *);
+ IFileDialog *, IShellItem *);
HRESULT ( STDMETHODCALLTYPE *SetFolder )(
- IFileDialog *, IShellItem *);
+ IFileDialog *, IShellItem *);
HRESULT ( STDMETHODCALLTYPE *GetFolder )(
- IFileDialog *, IShellItem **);
+ IFileDialog *, IShellItem **);
HRESULT ( STDMETHODCALLTYPE *GetCurrentSelection )(
- IFileDialog *, IShellItem **);
+ IFileDialog *, IShellItem **);
HRESULT ( STDMETHODCALLTYPE *SetFileName )(
- IFileDialog *, LPCWSTR);
+ IFileDialog *, LPCWSTR);
HRESULT ( STDMETHODCALLTYPE *GetFileName )(
- IFileDialog *, LPWSTR *);
+ IFileDialog *, LPWSTR *);
HRESULT ( STDMETHODCALLTYPE *SetTitle )(
- IFileDialog *, LPCWSTR);
+ IFileDialog *, LPCWSTR);
HRESULT ( STDMETHODCALLTYPE *SetOkButtonLabel )(
- IFileDialog *, LPCWSTR);
+ IFileDialog *, LPCWSTR);
HRESULT ( STDMETHODCALLTYPE *SetFileNameLabel )(
- IFileDialog *, LPCWSTR);
+ IFileDialog *, LPCWSTR);
HRESULT ( STDMETHODCALLTYPE *GetResult )(
- IFileDialog *, IShellItem **);
+ IFileDialog *, IShellItem **);
HRESULT ( STDMETHODCALLTYPE *AddPlace )(
- IFileDialog *, IShellItem *, FDAP);
+ IFileDialog *, IShellItem *, FDAP);
HRESULT ( STDMETHODCALLTYPE *SetDefaultExtension )(
- IFileDialog *, LPCWSTR);
+ IFileDialog *, LPCWSTR);
HRESULT ( STDMETHODCALLTYPE *Close )( IFileDialog *, HRESULT);
HRESULT ( STDMETHODCALLTYPE *SetClientGuid )(
- IFileDialog *, REFGUID);
+ IFileDialog *, REFGUID);
HRESULT ( STDMETHODCALLTYPE *ClearClientData )( IFileDialog *);
/* pFilter actually IShellItemFilter. But deprecated in Win7 AND we do
not use it anyways. So define as void* */
HRESULT ( STDMETHODCALLTYPE *SetFilter )(
- IFileDialog *, void *);
+ IFileDialog *, void *);
END_INTERFACE
} IFileDialogVtbl;
@@ -418,67 +418,67 @@ typedef struct IFileSaveDialogVtbl {
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IFileSaveDialog *, REFIID, void **);
+ IFileSaveDialog *, REFIID, void **);
ULONG ( STDMETHODCALLTYPE *AddRef )( IFileSaveDialog *);
ULONG ( STDMETHODCALLTYPE *Release )( IFileSaveDialog *);
HRESULT ( STDMETHODCALLTYPE *Show )(
- IFileSaveDialog *, HWND);
+ IFileSaveDialog *, HWND);
HRESULT ( STDMETHODCALLTYPE *SetFileTypes )( IFileSaveDialog *,
- UINT, const TCLCOMDLG_FILTERSPEC *);
+ UINT, const TCLCOMDLG_FILTERSPEC *);
HRESULT ( STDMETHODCALLTYPE *SetFileTypeIndex )(
- IFileSaveDialog *, UINT);
+ IFileSaveDialog *, UINT);
HRESULT ( STDMETHODCALLTYPE *GetFileTypeIndex )(
- IFileSaveDialog *, UINT *);
+ IFileSaveDialog *, UINT *);
/* Actually pfde is IFileSaveDialogEvents* */
HRESULT ( STDMETHODCALLTYPE *Advise )(
- IFileSaveDialog *, void *, DWORD *);
+ IFileSaveDialog *, void *, DWORD *);
HRESULT ( STDMETHODCALLTYPE *Unadvise )( IFileSaveDialog *, DWORD);
HRESULT ( STDMETHODCALLTYPE *SetOptions )(
- IFileSaveDialog *, FILEOPENDIALOGOPTIONS);
+ IFileSaveDialog *, FILEOPENDIALOGOPTIONS);
HRESULT ( STDMETHODCALLTYPE *GetOptions )(
- IFileSaveDialog *, FILEOPENDIALOGOPTIONS *);
+ IFileSaveDialog *, FILEOPENDIALOGOPTIONS *);
HRESULT ( STDMETHODCALLTYPE *SetDefaultFolder )(
- IFileSaveDialog *, IShellItem *);
+ IFileSaveDialog *, IShellItem *);
HRESULT ( STDMETHODCALLTYPE *SetFolder )(
- IFileSaveDialog *, IShellItem *);
+ IFileSaveDialog *, IShellItem *);
HRESULT ( STDMETHODCALLTYPE *GetFolder )(
- IFileSaveDialog *, IShellItem **);
+ IFileSaveDialog *, IShellItem **);
HRESULT ( STDMETHODCALLTYPE *GetCurrentSelection )(
- IFileSaveDialog *, IShellItem **);
+ IFileSaveDialog *, IShellItem **);
HRESULT ( STDMETHODCALLTYPE *SetFileName )(
- IFileSaveDialog *, LPCWSTR);
+ IFileSaveDialog *, LPCWSTR);
HRESULT ( STDMETHODCALLTYPE *GetFileName )(
- IFileSaveDialog *, LPWSTR *);
+ IFileSaveDialog *, LPWSTR *);
HRESULT ( STDMETHODCALLTYPE *SetTitle )(
- IFileSaveDialog *, LPCWSTR);
+ IFileSaveDialog *, LPCWSTR);
HRESULT ( STDMETHODCALLTYPE *SetOkButtonLabel )(
- IFileSaveDialog *, LPCWSTR);
+ IFileSaveDialog *, LPCWSTR);
HRESULT ( STDMETHODCALLTYPE *SetFileNameLabel )(
- IFileSaveDialog *, LPCWSTR);
+ IFileSaveDialog *, LPCWSTR);
HRESULT ( STDMETHODCALLTYPE *GetResult )(
- IFileSaveDialog *, IShellItem **);
+ IFileSaveDialog *, IShellItem **);
HRESULT ( STDMETHODCALLTYPE *AddPlace )(
- IFileSaveDialog *, IShellItem *, FDAP);
+ IFileSaveDialog *, IShellItem *, FDAP);
HRESULT ( STDMETHODCALLTYPE *SetDefaultExtension )(
- IFileSaveDialog *, LPCWSTR);
+ IFileSaveDialog *, LPCWSTR);
HRESULT ( STDMETHODCALLTYPE *Close )( IFileSaveDialog *, HRESULT);
HRESULT ( STDMETHODCALLTYPE *SetClientGuid )(
- IFileSaveDialog *, REFGUID);
+ IFileSaveDialog *, REFGUID);
HRESULT ( STDMETHODCALLTYPE *ClearClientData )( IFileSaveDialog *);
/* pFilter Actually IShellItemFilter* */
HRESULT ( STDMETHODCALLTYPE *SetFilter )(
- IFileSaveDialog *, void *);
+ IFileSaveDialog *, void *);
HRESULT ( STDMETHODCALLTYPE *SetSaveAsItem )(
- IFileSaveDialog *, IShellItem *);
+ IFileSaveDialog *, IShellItem *);
HRESULT ( STDMETHODCALLTYPE *SetProperties )(
- IFileSaveDialog *, IPropertyStore *);
+ IFileSaveDialog *, IPropertyStore *);
HRESULT ( STDMETHODCALLTYPE *SetCollectedProperties )(
- IFileSaveDialog *, IPropertyDescriptionList *, BOOL);
+ IFileSaveDialog *, IPropertyDescriptionList *, BOOL);
HRESULT ( STDMETHODCALLTYPE *GetProperties )(
- IFileSaveDialog *, IPropertyStore **);
+ IFileSaveDialog *, IPropertyStore **);
HRESULT ( STDMETHODCALLTYPE *ApplyProperties )(
- IFileSaveDialog *, IShellItem *, IPropertyStore *,
- HWND, IFileOperationProgressSink *);
+ IFileSaveDialog *, IShellItem *, IPropertyStore *,
+ HWND, IFileOperationProgressSink *);
END_INTERFACE
@@ -493,61 +493,61 @@ typedef struct IFileOpenDialogVtbl {
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IFileOpenDialog *, REFIID, void **);
+ IFileOpenDialog *, REFIID, void **);
ULONG ( STDMETHODCALLTYPE *AddRef )( IFileOpenDialog *);
ULONG ( STDMETHODCALLTYPE *Release )( IFileOpenDialog *);
HRESULT ( STDMETHODCALLTYPE *Show )( IFileOpenDialog *, HWND);
HRESULT ( STDMETHODCALLTYPE *SetFileTypes )( IFileOpenDialog *,
- UINT, const TCLCOMDLG_FILTERSPEC *);
+ UINT, const TCLCOMDLG_FILTERSPEC *);
HRESULT ( STDMETHODCALLTYPE *SetFileTypeIndex )(
- IFileOpenDialog *, UINT);
+ IFileOpenDialog *, UINT);
HRESULT ( STDMETHODCALLTYPE *GetFileTypeIndex )(
- IFileOpenDialog *, UINT *);
+ IFileOpenDialog *, UINT *);
/* Actually pfde is IFileDialogEvents* */
HRESULT ( STDMETHODCALLTYPE *Advise )(
- IFileOpenDialog *, void *, DWORD *);
+ IFileOpenDialog *, void *, DWORD *);
HRESULT ( STDMETHODCALLTYPE *Unadvise )( IFileOpenDialog *, DWORD);
HRESULT ( STDMETHODCALLTYPE *SetOptions )(
- IFileOpenDialog *, FILEOPENDIALOGOPTIONS);
+ IFileOpenDialog *, FILEOPENDIALOGOPTIONS);
HRESULT ( STDMETHODCALLTYPE *GetOptions )(
- IFileOpenDialog *, FILEOPENDIALOGOPTIONS *);
+ IFileOpenDialog *, FILEOPENDIALOGOPTIONS *);
HRESULT ( STDMETHODCALLTYPE *SetDefaultFolder )(
- IFileOpenDialog *, IShellItem *);
+ IFileOpenDialog *, IShellItem *);
HRESULT ( STDMETHODCALLTYPE *SetFolder )(
- IFileOpenDialog *, IShellItem *);
+ IFileOpenDialog *, IShellItem *);
HRESULT ( STDMETHODCALLTYPE *GetFolder )(
- IFileOpenDialog *, IShellItem **);
+ IFileOpenDialog *, IShellItem **);
HRESULT ( STDMETHODCALLTYPE *GetCurrentSelection )(
- IFileOpenDialog *, IShellItem **);
+ IFileOpenDialog *, IShellItem **);
HRESULT ( STDMETHODCALLTYPE *SetFileName )(
- IFileOpenDialog *, LPCWSTR);
+ IFileOpenDialog *, LPCWSTR);
HRESULT ( STDMETHODCALLTYPE *GetFileName )(
- IFileOpenDialog *, LPWSTR *);
+ IFileOpenDialog *, LPWSTR *);
HRESULT ( STDMETHODCALLTYPE *SetTitle )(
- IFileOpenDialog *, LPCWSTR);
+ IFileOpenDialog *, LPCWSTR);
HRESULT ( STDMETHODCALLTYPE *SetOkButtonLabel )(
- IFileOpenDialog *, LPCWSTR);
+ IFileOpenDialog *, LPCWSTR);
HRESULT ( STDMETHODCALLTYPE *SetFileNameLabel )(
- IFileOpenDialog *, LPCWSTR);
+ IFileOpenDialog *, LPCWSTR);
HRESULT ( STDMETHODCALLTYPE *GetResult )(
- IFileOpenDialog *, IShellItem **);
+ IFileOpenDialog *, IShellItem **);
HRESULT ( STDMETHODCALLTYPE *AddPlace )(
- IFileOpenDialog *, IShellItem *, FDAP);
+ IFileOpenDialog *, IShellItem *, FDAP);
HRESULT ( STDMETHODCALLTYPE *SetDefaultExtension )(
- IFileOpenDialog *, LPCWSTR);
+ IFileOpenDialog *, LPCWSTR);
HRESULT ( STDMETHODCALLTYPE *Close )( IFileOpenDialog *, HRESULT);
HRESULT ( STDMETHODCALLTYPE *SetClientGuid )(
- IFileOpenDialog *, REFGUID);
+ IFileOpenDialog *, REFGUID);
HRESULT ( STDMETHODCALLTYPE *ClearClientData )(
- IFileOpenDialog *);
+ IFileOpenDialog *);
HRESULT ( STDMETHODCALLTYPE *SetFilter )(
- IFileOpenDialog *,
- /* pFilter is actually IShellItemFilter */
- void *);
+ IFileOpenDialog *,
+ /* pFilter is actually IShellItemFilter */
+ void *);
HRESULT ( STDMETHODCALLTYPE *GetResults )(
- IFileOpenDialog *, IShellItemArray **);
+ IFileOpenDialog *, IShellItemArray **);
HRESULT ( STDMETHODCALLTYPE *GetSelectedItems )(
- IFileOpenDialog *, IShellItemArray **);
+ IFileOpenDialog *, IShellItemArray **);
END_INTERFACE
} IFileOpenDialogVtbl;
@@ -569,18 +569,18 @@ static UINT CALLBACK ColorDlgHookProc(HWND hDlg, UINT uMsg, WPARAM wParam,
LPARAM lParam);
static void CleanupOFNOptions(OFNOpts *optsPtr);
static int ParseOFNOptions(void *clientData,
- Tcl_Interp *interp, int objc,
- Tcl_Obj *const objv[], enum OFNOper oper, OFNOpts *optsPtr);
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[], enum OFNOper oper, OFNOpts *optsPtr);
static int GetFileNameXP(Tcl_Interp *interp, OFNOpts *optsPtr,
- enum OFNOper oper);
+ enum OFNOper oper);
static int GetFileNameVista(Tcl_Interp *interp, OFNOpts *optsPtr,
- enum OFNOper oper);
+ enum OFNOper oper);
static int GetFileName(void *clientData,
- Tcl_Interp *interp, int objc,
- Tcl_Obj *const objv[], enum OFNOper oper);
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[], enum OFNOper oper);
static int MakeFilterVista(Tcl_Interp *interp, OFNOpts *optsPtr,
- DWORD *countPtr, TCLCOMDLG_FILTERSPEC **dlgFilterPtrPtr,
- DWORD *defaultFilterIndexPtr);
+ DWORD *countPtr, TCLCOMDLG_FILTERSPEC **dlgFilterPtrPtr,
+ DWORD *defaultFilterIndexPtr);
static void FreeFilterVista(DWORD count, TCLCOMDLG_FILTERSPEC *dlgFilterPtr);
static int MakeFilter(Tcl_Interp *interp, Tcl_Obj *valuePtr,
Tcl_DString *dsPtr, Tcl_Obj *initialPtr,
@@ -984,7 +984,7 @@ ParseOFNOptions(
enum options {
FILE_DEFAULT, FILE_TYPES, FILE_INITDIR, FILE_INITFILE, FILE_PARENT,
FILE_TITLE, FILE_TYPEVARIABLE, FILE_MULTIPLE, FILE_CONFIRMOW,
- FILE_MUSTEXIST,
+ FILE_MUSTEXIST,
};
struct Options {
const char *name;
@@ -1042,31 +1042,31 @@ ParseOFNOptions(
if (Tcl_GetIndexFromObjStruct(interp, objv[i], options,
sizeof(struct Options), "option", 0, &index) != TCL_OK) {
- /*
- * XXX -xpstyle is explicitly checked for as it is undocumented
- * and we do not want it to show in option error messages.
- */
- if (strcmp(Tcl_GetString(objv[i]), "-xpstyle"))
- goto error_return;
- if (i + 1 == objc) {
- Tcl_SetObjResult(interp, Tcl_NewStringObj("value for \"-xpstyle\" missing", TCL_INDEX_NONE));
- Tcl_SetErrorCode(interp, "TK", "FILEDIALOG", "VALUE", NULL);
- goto error_return;
- }
+ /*
+ * XXX -xpstyle is explicitly checked for as it is undocumented
+ * and we do not want it to show in option error messages.
+ */
+ if (strcmp(Tcl_GetString(objv[i]), "-xpstyle"))
+ goto error_return;
+ if (i + 1 == objc) {
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("value for \"-xpstyle\" missing", TCL_INDEX_NONE));
+ Tcl_SetErrorCode(interp, "TK", "FILEDIALOG", "VALUE", NULL);
+ goto error_return;
+ }
if (Tcl_GetBooleanFromObj(interp, objv[i+1],
- &optsPtr->forceXPStyle) != TCL_OK)
- goto error_return;
+ &optsPtr->forceXPStyle) != TCL_OK)
+ goto error_return;
- continue;
+ continue;
} else if (i + 1 == objc) {
- Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "value for \"%s\" missing", options[index].name));
- Tcl_SetErrorCode(interp, "TK", "FILEDIALOG", "VALUE", NULL);
- goto error_return;
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "value for \"%s\" missing", options[index].name));
+ Tcl_SetErrorCode(interp, "TK", "FILEDIALOG", "VALUE", NULL);
+ goto error_return;
}
- valuePtr = objv[i + 1];
+ valuePtr = objv[i + 1];
string = Tcl_GetString(valuePtr);
switch (options[index].value) {
case FILE_DEFAULT:
@@ -1078,16 +1078,16 @@ ParseOFNOptions(
case FILE_INITDIR:
Tcl_DStringFree(&optsPtr->utfDirString);
if (Tcl_TranslateFileName(interp, string,
- &optsPtr->utfDirString) == NULL)
+ &optsPtr->utfDirString) == NULL)
goto error_return;
break;
case FILE_INITFILE:
if (Tcl_TranslateFileName(interp, string, &ds) == NULL)
goto error_return;
Tcl_UtfToExternal(NULL, TkWinGetUnicodeEncoding(),
- Tcl_DStringValue(&ds), Tcl_DStringLength(&ds),
- TCL_ENCODING_PROFILE_TCL8, NULL, (char *)&optsPtr->file[0],
- sizeof(optsPtr->file), NULL, NULL, NULL);
+ Tcl_DStringValue(&ds), Tcl_DStringLength(&ds),
+ TCL_ENCODING_PROFILE_TCL8, NULL, (char *)&optsPtr->file[0],
+ sizeof(optsPtr->file), NULL, NULL, NULL);
Tcl_DStringFree(&ds);
break;
case FILE_PARENT:
@@ -1101,23 +1101,23 @@ ParseOFNOptions(
case FILE_TYPEVARIABLE:
optsPtr->typeVariableObj = valuePtr;
optsPtr->initialTypeObj = Tcl_ObjGetVar2(interp, valuePtr,
- NULL, TCL_GLOBAL_ONLY);
+ NULL, TCL_GLOBAL_ONLY);
break;
case FILE_MULTIPLE:
if (Tcl_GetBooleanFromObj(interp, valuePtr,
- &optsPtr->multi) != TCL_OK)
- goto error_return;
+ &optsPtr->multi) != TCL_OK)
+ goto error_return;
break;
case FILE_CONFIRMOW:
if (Tcl_GetBooleanFromObj(interp, valuePtr,
- &optsPtr->confirmOverwrite) != TCL_OK)
- goto error_return;
+ &optsPtr->confirmOverwrite) != TCL_OK)
+ goto error_return;
break;
- case FILE_MUSTEXIST:
+ case FILE_MUSTEXIST:
if (Tcl_GetBooleanFromObj(interp, valuePtr,
- &optsPtr->mustExist) != TCL_OK)
- goto error_return;
- break;
+ &optsPtr->mustExist) != TCL_OK)
+ goto error_return;
+ break;
}
}
@@ -1151,7 +1151,7 @@ static int VistaFileDialogsAvailable(void)
HRESULT hr;
IFileDialog *fdlgPtr = NULL;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (tsdPtr->newFileDialogsState == FDLG_STATE_INIT) {
tsdPtr->newFileDialogsState = FDLG_STATE_USE_OLD;
@@ -1198,7 +1198,7 @@ static int VistaFileDialogsAvailable(void)
*----------------------------------------------------------------------
*/
static int GetFileNameVista(Tcl_Interp *interp, OFNOpts *optsPtr,
- enum OFNOper oper)
+ enum OFNOper oper)
{
HRESULT hr;
HWND hWnd;
@@ -1232,8 +1232,8 @@ static int GetFileNameVista(Tcl_Interp *interp, OFNOpts *optsPtr,
* is the filter specification so do that before creating
*/
if (MakeFilterVista(interp, optsPtr, &nfilters, &filterPtr,
- &defaultFilterIndex) != TCL_OK)
- return TCL_ERROR;
+ &defaultFilterIndex) != TCL_OK)
+ return TCL_ERROR;
/*
* Beyond this point, do not just return on error as there will be
@@ -1241,14 +1241,14 @@ static int GetFileNameVista(Tcl_Interp *interp, OFNOpts *optsPtr,
*/
if (oper == OFN_FILE_OPEN || oper == OFN_DIR_CHOOSE)
- hr = CoCreateInstance(&ClsidFileOpenDialog, NULL,
- CLSCTX_INPROC_SERVER, &IIDIFileOpenDialog, (void **) &fdlgIf);
+ hr = CoCreateInstance(&ClsidFileOpenDialog, NULL,
+ CLSCTX_INPROC_SERVER, &IIDIFileOpenDialog, (void **) &fdlgIf);
else
- hr = CoCreateInstance(&ClsidFileSaveDialog, NULL,
- CLSCTX_INPROC_SERVER, &IIDIFileSaveDialog, (void **) &fdlgIf);
+ hr = CoCreateInstance(&ClsidFileSaveDialog, NULL,
+ CLSCTX_INPROC_SERVER, &IIDIFileSaveDialog, (void **) &fdlgIf);
if (FAILED(hr))
- goto vamoose;
+ goto vamoose;
/*
* Get current settings first because we want to preserve existing
@@ -1257,20 +1257,20 @@ static int GetFileNameVista(Tcl_Interp *interp, OFNOpts *optsPtr,
*/
hr = fdlgIf->lpVtbl->GetOptions(fdlgIf, &flags);
if (FAILED(hr))
- goto vamoose;
+ goto vamoose;
if (filterPtr) {
- /*
- * Causes -filetypes {{All *}} -defaultextension ext to return
- * foo.ext.ext when foo is typed into the entry box
- * flags |= FOS_STRICTFILETYPES;
- */
- hr = fdlgIf->lpVtbl->SetFileTypes(fdlgIf, nfilters, filterPtr);
- if (FAILED(hr))
- goto vamoose;
- hr = fdlgIf->lpVtbl->SetFileTypeIndex(fdlgIf, defaultFilterIndex);
- if (FAILED(hr))
- goto vamoose;
+ /*
+ * Causes -filetypes {{All *}} -defaultextension ext to return
+ * foo.ext.ext when foo is typed into the entry box
+ * flags |= FOS_STRICTFILETYPES;
+ */
+ hr = fdlgIf->lpVtbl->SetFileTypes(fdlgIf, nfilters, filterPtr);
+ if (FAILED(hr))
+ goto vamoose;
+ hr = fdlgIf->lpVtbl->SetFileTypeIndex(fdlgIf, defaultFilterIndex);
+ if (FAILED(hr))
+ goto vamoose;
}
/* Flags are equivalent to those we used in the older API */
@@ -1281,88 +1281,88 @@ static int GetFileNameVista(Tcl_Interp *interp, OFNOpts *optsPtr,
* semantics than OFN_NOVALIDATE in the old API.
*/
flags |=
- FOS_FORCEFILESYSTEM | /* Only want files, not other shell items */
- FOS_NOVALIDATE | /* Don't check for access denied etc. */
- FOS_PATHMUSTEXIST; /* The *directory* path must exist */
+ FOS_FORCEFILESYSTEM | /* Only want files, not other shell items */
+ FOS_NOVALIDATE | /* Don't check for access denied etc. */
+ FOS_PATHMUSTEXIST; /* The *directory* path must exist */
if (oper == OFN_DIR_CHOOSE) {
- flags |= FOS_PICKFOLDERS;
- if (optsPtr->mustExist)
- flags |= FOS_FILEMUSTEXIST; /* XXX - check working */
+ flags |= FOS_PICKFOLDERS;
+ if (optsPtr->mustExist)
+ flags |= FOS_FILEMUSTEXIST; /* XXX - check working */
} else
- flags &= ~ FOS_PICKFOLDERS;
+ flags &= ~ FOS_PICKFOLDERS;
if (optsPtr->multi)
- flags |= FOS_ALLOWMULTISELECT;
+ flags |= FOS_ALLOWMULTISELECT;
else
- flags &= ~FOS_ALLOWMULTISELECT;
+ flags &= ~FOS_ALLOWMULTISELECT;
if (optsPtr->confirmOverwrite)
- flags |= FOS_OVERWRITEPROMPT;
+ flags |= FOS_OVERWRITEPROMPT;
else
- flags &= ~FOS_OVERWRITEPROMPT;
+ flags &= ~FOS_OVERWRITEPROMPT;
hr = fdlgIf->lpVtbl->SetOptions(fdlgIf, flags);
if (FAILED(hr))
- goto vamoose;
+ goto vamoose;
if (optsPtr->extObj != NULL) {
- Tcl_DString ds;
- const char *src;
+ Tcl_DString ds;
+ const char *src;
- src = Tcl_GetString(optsPtr->extObj);
- Tcl_DStringInit(&ds);
- wstr = Tcl_UtfToWCharDString(src, optsPtr->extObj->length, &ds);
- if (wstr[0] == '.')
- ++wstr;
- hr = fdlgIf->lpVtbl->SetDefaultExtension(fdlgIf, wstr);
- Tcl_DStringFree(&ds);
- if (FAILED(hr))
- goto vamoose;
+ src = Tcl_GetString(optsPtr->extObj);
+ Tcl_DStringInit(&ds);
+ wstr = Tcl_UtfToWCharDString(src, optsPtr->extObj->length, &ds);
+ if (wstr[0] == '.')
+ ++wstr;
+ hr = fdlgIf->lpVtbl->SetDefaultExtension(fdlgIf, wstr);
+ Tcl_DStringFree(&ds);
+ if (FAILED(hr))
+ goto vamoose;
}
if (optsPtr->titleObj != NULL) {
- Tcl_DString ds;
- const char *src;
+ Tcl_DString ds;
+ const char *src;
- src = Tcl_GetString(optsPtr->titleObj);
- Tcl_DStringInit(&ds);
- wstr = Tcl_UtfToWCharDString(src, optsPtr->titleObj->length, &ds);
- hr = fdlgIf->lpVtbl->SetTitle(fdlgIf, wstr);
- Tcl_DStringFree(&ds);
- if (FAILED(hr))
- goto vamoose;
+ src = Tcl_GetString(optsPtr->titleObj);
+ Tcl_DStringInit(&ds);
+ wstr = Tcl_UtfToWCharDString(src, optsPtr->titleObj->length, &ds);
+ hr = fdlgIf->lpVtbl->SetTitle(fdlgIf, wstr);
+ Tcl_DStringFree(&ds);
+ if (FAILED(hr))
+ goto vamoose;
}
if (optsPtr->file[0]) {
- hr = fdlgIf->lpVtbl->SetFileName(fdlgIf, optsPtr->file);
- if (FAILED(hr))
- goto vamoose;
+ hr = fdlgIf->lpVtbl->SetFileName(fdlgIf, optsPtr->file);
+ if (FAILED(hr))
+ goto vamoose;
}
if (Tcl_DStringValue(&optsPtr->utfDirString)[0] != '\0') {
- Tcl_Obj *normPath, *iniDirPath;
- iniDirPath = Tcl_NewStringObj(Tcl_DStringValue(&optsPtr->utfDirString), TCL_INDEX_NONE);
- Tcl_IncrRefCount(iniDirPath);
- normPath = Tcl_FSGetNormalizedPath(interp, iniDirPath);
- /* XXX - Note on failures do not raise error, simply ignore ini dir */
- if (normPath) {
- LPCWSTR nativePath;
- Tcl_IncrRefCount(normPath);
- nativePath = (LPCWSTR)Tcl_FSGetNativePath(normPath); /* Points INTO normPath*/
- if (nativePath) {
- hr = SHCreateItemFromParsingName(
- nativePath, NULL,
- &IIDIShellItem, (void **) &dirIf);
- if (SUCCEEDED(hr)) {
- /* Note we use SetFolder, not SetDefaultFolder - see MSDN */
- fdlgIf->lpVtbl->SetFolder(fdlgIf, dirIf); /* Ignore errors */
- }
- }
- Tcl_DecrRefCount(normPath); /* ALSO INVALIDATES nativePath !! */
- }
- Tcl_DecrRefCount(iniDirPath);
+ Tcl_Obj *normPath, *iniDirPath;
+ iniDirPath = Tcl_NewStringObj(Tcl_DStringValue(&optsPtr->utfDirString), TCL_INDEX_NONE);
+ Tcl_IncrRefCount(iniDirPath);
+ normPath = Tcl_FSGetNormalizedPath(interp, iniDirPath);
+ /* XXX - Note on failures do not raise error, simply ignore ini dir */
+ if (normPath) {
+ LPCWSTR nativePath;
+ Tcl_IncrRefCount(normPath);
+ nativePath = (LPCWSTR)Tcl_FSGetNativePath(normPath); /* Points INTO normPath*/
+ if (nativePath) {
+ hr = SHCreateItemFromParsingName(
+ nativePath, NULL,
+ &IIDIShellItem, (void **) &dirIf);
+ if (SUCCEEDED(hr)) {
+ /* Note we use SetFolder, not SetDefaultFolder - see MSDN */
+ fdlgIf->lpVtbl->SetFolder(fdlgIf, dirIf); /* Ignore errors */
+ }
+ }
+ Tcl_DecrRefCount(normPath); /* ALSO INVALIDATES nativePath !! */
+ }
+ Tcl_DecrRefCount(iniDirPath);
}
oldMode = Tcl_SetServiceMode(TCL_SERVICE_ALL);
@@ -1377,7 +1377,7 @@ static int GetFileNameVista(Tcl_Interp *interp, OFNOpts *optsPtr,
*/
if (hWnd)
- EnableWindow(hWnd, 1);
+ EnableWindow(hWnd, 1);
/*
* Clear interp result since it might have been set during the modal loop.
@@ -1386,108 +1386,108 @@ static int GetFileNameVista(Tcl_Interp *interp, OFNOpts *optsPtr,
Tcl_ResetResult(interp);
if (SUCCEEDED(hr)) {
- if ((oper == OFN_FILE_OPEN) && optsPtr->multi) {
- IShellItemArray *multiIf;
- DWORD dw, count;
- IFileOpenDialog *fodIf = (IFileOpenDialog *) fdlgIf;
- hr = fodIf->lpVtbl->GetResults(fodIf, &multiIf);
- if (SUCCEEDED(hr)) {
- Tcl_Obj *multiObj;
- hr = multiIf->lpVtbl->GetCount(multiIf, &count);
- multiObj = Tcl_NewListObj(count, NULL);
- if (SUCCEEDED(hr)) {
- IShellItem *itemIf;
- for (dw = 0; dw < count; ++dw) {
- hr = multiIf->lpVtbl->GetItemAt(multiIf, dw, &itemIf);
- if (FAILED(hr))
- break;
- hr = itemIf->lpVtbl->GetDisplayName(itemIf,
- SIGDN_FILESYSPATH, &wstr);
- if (SUCCEEDED(hr)) {
- Tcl_DString fnds;
-
- ConvertExternalFilename(wstr, &fnds);
- CoTaskMemFree(wstr);
- Tcl_ListObjAppendElement(
- interp, multiObj,
- Tcl_NewStringObj(Tcl_DStringValue(&fnds),
- Tcl_DStringLength(&fnds)));
- Tcl_DStringFree(&fnds);
- }
- itemIf->lpVtbl->Release(itemIf);
- if (FAILED(hr))
- break;
- }
- }
- multiIf->lpVtbl->Release(multiIf);
- if (SUCCEEDED(hr))
- resultObj = multiObj;
- else
- Tcl_DecrRefCount(multiObj);
- }
- } else {
- IShellItem *resultIf;
- hr = fdlgIf->lpVtbl->GetResult(fdlgIf, &resultIf);
- if (SUCCEEDED(hr)) {
- hr = resultIf->lpVtbl->GetDisplayName(resultIf, SIGDN_FILESYSPATH,
- &wstr);
- if (SUCCEEDED(hr)) {
- Tcl_DString fnds;
-
- ConvertExternalFilename(wstr, &fnds);
- resultObj = Tcl_NewStringObj(Tcl_DStringValue(&fnds),
- Tcl_DStringLength(&fnds));
- CoTaskMemFree(wstr);
- Tcl_DStringFree(&fnds);
- }
- resultIf->lpVtbl->Release(resultIf);
- }
- }
- if (SUCCEEDED(hr)) {
- if (filterPtr && optsPtr->typeVariableObj) {
- UINT ftix;
-
- hr = fdlgIf->lpVtbl->GetFileTypeIndex(fdlgIf, &ftix);
- if (SUCCEEDED(hr)) {
- /* Note ftix is a 1-based index */
- if (ftix > 0 && ftix <= nfilters) {
- Tcl_DString ftds;
- Tcl_Obj *ftobj;
-
- Tcl_DStringInit(&ftds);
- Tcl_WCharToUtfDString(filterPtr[ftix-1].pszName, wcslen(filterPtr[ftix-1].pszName), &ftds);
- ftobj = Tcl_NewStringObj(Tcl_DStringValue(&ftds),
- Tcl_DStringLength(&ftds));
- Tcl_ObjSetVar2(interp, optsPtr->typeVariableObj, NULL,
- ftobj, TCL_GLOBAL_ONLY|TCL_LEAVE_ERR_MSG);
- Tcl_DStringFree(&ftds);
- }
- }
- }
- }
+ if ((oper == OFN_FILE_OPEN) && optsPtr->multi) {
+ IShellItemArray *multiIf;
+ DWORD dw, count;
+ IFileOpenDialog *fodIf = (IFileOpenDialog *) fdlgIf;
+ hr = fodIf->lpVtbl->GetResults(fodIf, &multiIf);
+ if (SUCCEEDED(hr)) {
+ Tcl_Obj *multiObj;
+ hr = multiIf->lpVtbl->GetCount(multiIf, &count);
+ multiObj = Tcl_NewListObj(count, NULL);
+ if (SUCCEEDED(hr)) {
+ IShellItem *itemIf;
+ for (dw = 0; dw < count; ++dw) {
+ hr = multiIf->lpVtbl->GetItemAt(multiIf, dw, &itemIf);
+ if (FAILED(hr))
+ break;
+ hr = itemIf->lpVtbl->GetDisplayName(itemIf,
+ SIGDN_FILESYSPATH, &wstr);
+ if (SUCCEEDED(hr)) {
+ Tcl_DString fnds;
+
+ ConvertExternalFilename(wstr, &fnds);
+ CoTaskMemFree(wstr);
+ Tcl_ListObjAppendElement(
+ interp, multiObj,
+ Tcl_NewStringObj(Tcl_DStringValue(&fnds),
+ Tcl_DStringLength(&fnds)));
+ Tcl_DStringFree(&fnds);
+ }
+ itemIf->lpVtbl->Release(itemIf);
+ if (FAILED(hr))
+ break;
+ }
+ }
+ multiIf->lpVtbl->Release(multiIf);
+ if (SUCCEEDED(hr))
+ resultObj = multiObj;
+ else
+ Tcl_DecrRefCount(multiObj);
+ }
+ } else {
+ IShellItem *resultIf;
+ hr = fdlgIf->lpVtbl->GetResult(fdlgIf, &resultIf);
+ if (SUCCEEDED(hr)) {
+ hr = resultIf->lpVtbl->GetDisplayName(resultIf, SIGDN_FILESYSPATH,
+ &wstr);
+ if (SUCCEEDED(hr)) {
+ Tcl_DString fnds;
+
+ ConvertExternalFilename(wstr, &fnds);
+ resultObj = Tcl_NewStringObj(Tcl_DStringValue(&fnds),
+ Tcl_DStringLength(&fnds));
+ CoTaskMemFree(wstr);
+ Tcl_DStringFree(&fnds);
+ }
+ resultIf->lpVtbl->Release(resultIf);
+ }
+ }
+ if (SUCCEEDED(hr)) {
+ if (filterPtr && optsPtr->typeVariableObj) {
+ UINT ftix;
+
+ hr = fdlgIf->lpVtbl->GetFileTypeIndex(fdlgIf, &ftix);
+ if (SUCCEEDED(hr)) {
+ /* Note ftix is a 1-based index */
+ if (ftix > 0 && ftix <= nfilters) {
+ Tcl_DString ftds;
+ Tcl_Obj *ftobj;
+
+ Tcl_DStringInit(&ftds);
+ Tcl_WCharToUtfDString(filterPtr[ftix-1].pszName, wcslen(filterPtr[ftix-1].pszName), &ftds);
+ ftobj = Tcl_NewStringObj(Tcl_DStringValue(&ftds),
+ Tcl_DStringLength(&ftds));
+ Tcl_ObjSetVar2(interp, optsPtr->typeVariableObj, NULL,
+ ftobj, TCL_GLOBAL_ONLY|TCL_LEAVE_ERR_MSG);
+ Tcl_DStringFree(&ftds);
+ }
+ }
+ }
+ }
} else {
- if (hr == HRESULT_FROM_WIN32(ERROR_CANCELLED))
- hr = 0; /* User cancelled, return empty string */
+ if (hr == HRESULT_FROM_WIN32(ERROR_CANCELLED))
+ hr = 0; /* User cancelled, return empty string */
}
vamoose: /* (hr != 0) => error */
if (dirIf)
- dirIf->lpVtbl->Release(dirIf);
+ dirIf->lpVtbl->Release(dirIf);
if (fdlgIf)
- fdlgIf->lpVtbl->Release(fdlgIf);
+ fdlgIf->lpVtbl->Release(fdlgIf);
if (filterPtr)
- FreeFilterVista(nfilters, filterPtr);
+ FreeFilterVista(nfilters, filterPtr);
if (hr == 0) {
- if (resultObj) /* May be NULL if user cancelled */
- Tcl_SetObjResult(interp, resultObj);
- return TCL_OK;
+ if (resultObj) /* May be NULL if user cancelled */
+ Tcl_SetObjResult(interp, resultObj);
+ return TCL_OK;
} else {
- if (resultObj)
- Tcl_DecrRefCount(resultObj);
- Tcl_SetObjResult(interp, TkWin32ErrorObj(hr));
- return TCL_ERROR;
+ if (resultObj)
+ Tcl_DecrRefCount(resultObj);
+ Tcl_SetObjResult(interp, TkWin32ErrorObj(hr));
+ return TCL_ERROR;
}
}
@@ -1518,16 +1518,16 @@ static int GetFileNameXP(Tcl_Interp *interp, OFNOpts *optsPtr, enum OFNOper oper
Tcl_DString extString, filterString, dirString, titleString;
const char *str;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
memset(&ofnData, 0, sizeof(OFNData));
Tcl_DStringInit(&utfFilterString);
Tcl_DStringInit(&dirString); /* XXX - original code was missing this
- leaving dirString uninitialized for
- the unlikely code path where cwd failed */
+ leaving dirString uninitialized for
+ the unlikely code path where cwd failed */
if (MakeFilter(interp, optsPtr->filterObj, &utfFilterString,
- optsPtr->initialTypeObj, &filterIndex) != TCL_OK) {
+ optsPtr->initialTypeObj, &filterIndex) != TCL_OK) {
goto end;
}
@@ -1594,7 +1594,7 @@ static int GetFileNameXP(Tcl_Interp *interp, OFNOpts *optsPtr, enum OFNOper oper
Tcl_DStringFree(&optsPtr->utfDirString);
if ((Tcl_GetCwd(interp, &optsPtr->utfDirString) == NULL) ||
(Tcl_TranslateFileName(interp,
- Tcl_DStringValue(&optsPtr->utfDirString), &cwd) == NULL)) {
+ Tcl_DStringValue(&optsPtr->utfDirString), &cwd) == NULL)) {
Tcl_ResetResult(interp);
} else {
Tcl_DStringInit(&dirString);
@@ -1738,23 +1738,23 @@ static int GetFileNameXP(Tcl_Interp *interp, OFNOpts *optsPtr, enum OFNOper oper
&typeInfo) != TCL_OK) {
result = TCL_ERROR;
} else {
- /*
- * BUGFIX for d43a10ce2fed950e00890049f3c273f2cdd12583
- * The original code was broken because it passed typeinfo[0]
- * directly into Tcl_ObjSetVar2. In the case of typeInfo[0]
- * pointing into a list which is also referenced by
- * typeVariableObj, TOSV2 shimmers the object into
- * variable intrep which loses the list representation.
- * This invalidates typeInfo[0] which is freed but
- * nevertheless stored as the value of the variable.
- */
- Tcl_Obj *selFilterObj = typeInfo[0];
- Tcl_IncrRefCount(selFilterObj);
- if (Tcl_ObjSetVar2(interp, optsPtr->typeVariableObj, NULL,
- selFilterObj, TCL_GLOBAL_ONLY|TCL_LEAVE_ERR_MSG) == NULL) {
- result = TCL_ERROR;
- }
- Tcl_DecrRefCount(selFilterObj);
+ /*
+ * BUGFIX for d43a10ce2fed950e00890049f3c273f2cdd12583
+ * The original code was broken because it passed typeinfo[0]
+ * directly into Tcl_ObjSetVar2. In the case of typeInfo[0]
+ * pointing into a list which is also referenced by
+ * typeVariableObj, TOSV2 shimmers the object into
+ * variable intrep which loses the list representation.
+ * This invalidates typeInfo[0] which is freed but
+ * nevertheless stored as the value of the variable.
+ */
+ Tcl_Obj *selFilterObj = typeInfo[0];
+ Tcl_IncrRefCount(selFilterObj);
+ if (Tcl_ObjSetVar2(interp, optsPtr->typeVariableObj, NULL,
+ selFilterObj, TCL_GLOBAL_ONLY|TCL_LEAVE_ERR_MSG) == NULL) {
+ result = TCL_ERROR;
+ }
+ Tcl_DecrRefCount(selFilterObj);
}
}
} else if (cdlgerr == FNERR_INVALIDFILENAME) {
@@ -1772,8 +1772,8 @@ static int GetFileNameXP(Tcl_Interp *interp, OFNOpts *optsPtr, enum OFNOper oper
Tcl_DStringFree(&titleString);
}
if (ofn.lpstrInitialDir != NULL) {
- /* XXX - huh? lpstrInitialDir is set from Tcl_DStringValue which
- can never return NULL */
+ /* XXX - huh? lpstrInitialDir is set from Tcl_DStringValue which
+ can never return NULL */
Tcl_DStringFree(&dirString);
}
Tcl_DStringFree(&filterString);
@@ -1822,12 +1822,12 @@ GetFileName(
result = ParseOFNOptions(clientData, interp, objc, objv, oper, &ofnOpts);
if (result != TCL_OK)
- return result;
+ return result;
if (VistaFileDialogsAvailable() && ! ofnOpts.forceXPStyle)
- result = GetFileNameVista(interp, &ofnOpts, oper);
+ result = GetFileNameVista(interp, &ofnOpts, oper);
else
- result = GetFileNameXP(interp, &ofnOpts, oper);
+ result = GetFileNameXP(interp, &ofnOpts, oper);
CleanupOFNOptions(&ofnOpts);
return result;
@@ -2163,14 +2163,14 @@ MakeFilter(
static void FreeFilterVista(DWORD count, TCLCOMDLG_FILTERSPEC *dlgFilterPtr)
{
if (dlgFilterPtr != NULL) {
- DWORD dw;
- for (dw = 0; dw < count; ++dw) {
- if (dlgFilterPtr[dw].pszName != NULL)
- ckfree((void *)dlgFilterPtr[dw].pszName);
- if (dlgFilterPtr[dw].pszSpec != NULL)
- ckfree((void *)dlgFilterPtr[dw].pszSpec);
- }
- ckfree(dlgFilterPtr);
+ DWORD dw;
+ for (dw = 0; dw < count; ++dw) {
+ if (dlgFilterPtr[dw].pszName != NULL)
+ ckfree((void *)dlgFilterPtr[dw].pszName);
+ if (dlgFilterPtr[dw].pszSpec != NULL)
+ ckfree((void *)dlgFilterPtr[dw].pszSpec);
+ }
+ ckfree(dlgFilterPtr);
}
}
@@ -2195,9 +2195,9 @@ static int MakeFilterVista(
OFNOpts *optsPtr, /* Caller specified options */
DWORD *countPtr, /* Will hold number of filters */
TCLCOMDLG_FILTERSPEC **dlgFilterPtrPtr, /* Will hold pointer to filter array.
- Set to NULL if no filters specified.
- Must be freed by calling
- FreeFilterVista */
+ Set to NULL if no filters specified.
+ Must be freed by calling
+ FreeFilterVista */
DWORD *initialIndexPtr) /* Will hold index of default type */
{
TCLCOMDLG_FILTERSPEC *dlgFilterPtr;
@@ -2209,9 +2209,9 @@ static int MakeFilterVista(
int i;
if (optsPtr->filterObj == NULL) {
- *dlgFilterPtrPtr = NULL;
- *countPtr = 0;
- return TCL_OK;
+ *dlgFilterPtrPtr = NULL;
+ *countPtr = 0;
+ return TCL_OK;
}
if (optsPtr->initialTypeObj)
@@ -2222,9 +2222,9 @@ static int MakeFilterVista(
return TCL_ERROR;
if (flist.filters == NULL) {
- *dlgFilterPtrPtr = NULL;
- *countPtr = 0;
- return TCL_OK;
+ *dlgFilterPtrPtr = NULL;
+ *countPtr = 0;
+ return TCL_OK;
}
Tcl_DStringInit(&ds);
@@ -2232,19 +2232,19 @@ static int MakeFilterVista(
dlgFilterPtr = (TCLCOMDLG_FILTERSPEC *)ckalloc(flist.numFilters * sizeof(*dlgFilterPtr));
for (i = 0, filterPtr = flist.filters;
- filterPtr;
- filterPtr = filterPtr->next, ++i) {
+ filterPtr;
+ filterPtr = filterPtr->next, ++i) {
const char *sep;
FileFilterClause *clausePtr;
size_t nbytes;
/* Check if this entry should be shown as the default */
if (initial && strcmp(initial, filterPtr->name) == 0)
- initialIndex = i+1; /* Windows filter indices are 1-based */
+ initialIndex = i+1; /* Windows filter indices are 1-based */
/* First stash away the text description of the pattern */
- Tcl_DStringInit(&ds);
- Tcl_UtfToWCharDString(filterPtr->name, TCL_INDEX_NONE, &ds);
+ Tcl_DStringInit(&ds);
+ Tcl_UtfToWCharDString(filterPtr->name, TCL_INDEX_NONE, &ds);
nbytes = Tcl_DStringLength(&ds); /* # bytes, not Unicode chars */
nbytes += sizeof(WCHAR); /* Terminating \0 */
dlgFilterPtr[i].pszName = (LPCWSTR)ckalloc(nbytes);
@@ -2272,8 +2272,8 @@ static int MakeFilterVista(
}
/* Again we need a Unicode form of the string */
- Tcl_DStringInit(&ds);
- Tcl_UtfToWCharDString(Tcl_DStringValue(&patterns), TCL_INDEX_NONE, &ds);
+ Tcl_DStringInit(&ds);
+ Tcl_UtfToWCharDString(Tcl_DStringValue(&patterns), TCL_INDEX_NONE, &ds);
nbytes = Tcl_DStringLength(&ds); /* # bytes, not Unicode chars */
nbytes += sizeof(WCHAR); /* Terminating \0 */
dlgFilterPtr[i].pszSpec = (LPCWSTR)ckalloc(nbytes);
@@ -2387,15 +2387,15 @@ Tk_ChooseDirectoryObjCmd(
const char *utfDir;
result = ParseOFNOptions(clientData, interp, objc, objv,
- OFN_DIR_CHOOSE, &ofnOpts);
+ OFN_DIR_CHOOSE, &ofnOpts);
if (result != TCL_OK)
- return result;
+ return result;
/* Use new dialogs if available */
if (VistaFileDialogsAvailable() && ! ofnOpts.forceXPStyle) {
- result = GetFileNameVista(interp, &ofnOpts, OFN_DIR_CHOOSE);
- CleanupOFNOptions(&ofnOpts);
- return result;
+ result = GetFileNameVista(interp, &ofnOpts, OFN_DIR_CHOOSE);
+ CleanupOFNOptions(&ofnOpts);
+ return result;
}
/* Older dialogs */
@@ -2411,13 +2411,13 @@ Tk_ChooseDirectoryObjCmd(
Tcl_DStringInit(&tempString);
Tcl_UtfToWCharDString(Tcl_DStringValue(&ofnOpts.utfDirString), TCL_INDEX_NONE,
- &tempString);
- uniStr = (WCHAR *) Tcl_DStringValue(&tempString);
+ &tempString);
+ uniStr = (WCHAR *) Tcl_DStringValue(&tempString);
- /* Convert possible relative path to full path to keep dialog happy. */
+ /* Convert possible relative path to full path to keep dialog happy. */
- GetFullPathNameW(uniStr, MAX_PATH, saveDir, NULL);
- wcsncpy(cdCBData.initDir, saveDir, MAX_PATH);
+ GetFullPathNameW(uniStr, MAX_PATH, saveDir, NULL);
+ wcsncpy(cdCBData.initDir, saveDir, MAX_PATH);
}
/* XXX - rest of this (original) code has no error checks at all. */
@@ -2480,10 +2480,10 @@ Tk_ChooseDirectoryObjCmd(
oldMode = Tcl_SetServiceMode(TCL_SERVICE_ALL);
GetCurrentDirectoryW(MAX_PATH, saveDir);
if (SHGetMalloc(&pMalloc) == NOERROR) {
- /*
- * XXX - MSDN says CoInitialize must have been called before
- * SHBrowseForFolder can be used but don't see that called anywhere.
- */
+ /*
+ * XXX - MSDN says CoInitialize must have been called before
+ * SHBrowseForFolder can be used but don't see that called anywhere.
+ */
pidl = SHBrowseForFolderW(&bInfo);
/*
@@ -2620,7 +2620,7 @@ ChooseDirectoryValidateProc(
*/
wsprintfW(selDir, L"Directory '%s' does not exist,\n"
- L"please select or enter an existing directory.",
+ L"please select or enter an existing directory.",
chooseDirSharedData->retDir);
MessageBoxW(NULL, selDir, NULL, MB_ICONEXCLAMATION|MB_OK);
chooseDirSharedData->retDir[0] = '\0';
diff --git a/win/tkWinDraw.c b/win/tkWinDraw.c
index 7943aa3..1022be4 100644
--- a/win/tkWinDraw.c
+++ b/win/tkWinDraw.c
@@ -761,7 +761,7 @@ MakeAndStrokePath(
POINT *winPoints,
int npoints,
WinDrawFunc func) /* Name of the Windows GDI drawing function:
- this is either Polyline or Polygon. */
+ this is either Polyline or Polygon. */
{
BeginPath(dc);
func(dc, winPoints, (int)npoints);
@@ -772,15 +772,15 @@ MakeAndStrokePath(
* path is closed.
*/
if (func == Polyline) {
- if ((winPoints[0].x == winPoints[npoints-1].x) &&
- (winPoints[0].y == winPoints[npoints-1].y)) {
- CloseFigure(dc);
- }
- EndPath(dc);
- StrokePath(dc);
+ if ((winPoints[0].x == winPoints[npoints-1].x) &&
+ (winPoints[0].y == winPoints[npoints-1].y)) {
+ CloseFigure(dc);
+ }
+ EndPath(dc);
+ StrokePath(dc);
} else {
- EndPath(dc);
- StrokeAndFillPath(dc);
+ EndPath(dc);
+ StrokeAndFillPath(dc);
}
}
@@ -879,7 +879,7 @@ RenderObject(
SetPolyFillMode(dcMem, (gc->fill_rule == EvenOddRule) ? ALTERNATE
: WINDING);
oldMemBrush = (HBRUSH)SelectObject(dcMem, CreateSolidBrush(gc->foreground));
- MakeAndStrokePath(dcMem, winPoints, npoints, func);
+ MakeAndStrokePath(dcMem, winPoints, npoints, func);
BitBlt(dc, rect.left, rect.top, width, height, dcMem, 0, 0, COPYFG);
/*
@@ -891,7 +891,7 @@ RenderObject(
if (gc->fill_style == FillOpaqueStippled) {
DeleteObject(SelectObject(dcMem,
CreateSolidBrush(gc->background)));
- MakeAndStrokePath(dcMem, winPoints, npoints, func);
+ MakeAndStrokePath(dcMem, winPoints, npoints, func);
BitBlt(dc, rect.left, rect.top, width, height, dcMem, 0, 0,
COPYBG);
}
@@ -907,7 +907,7 @@ RenderObject(
SetPolyFillMode(dc, (gc->fill_rule == EvenOddRule) ? ALTERNATE
: WINDING);
- MakeAndStrokePath(dc, winPoints, npoints, func);
+ MakeAndStrokePath(dc, winPoints, npoints, func);
SelectObject(dc, oldPen);
}
DeleteObject(SelectObject(dc, oldBrush));
diff --git a/win/tkWinEmbed.c b/win/tkWinEmbed.c
index 0a2b543..34cd8ca 100644
--- a/win/tkWinEmbed.c
+++ b/win/tkWinEmbed.c
@@ -862,12 +862,12 @@ ContainerEventProc(
if (eventPtr->type == ConfigureNotify) {
/*
- * Send a ConfigureNotify to the embedded application.
- */
+ * Send a ConfigureNotify to the embedded application.
+ */
- if (containerPtr->embeddedPtr != NULL) {
- TkDoConfigureNotify(containerPtr->embeddedPtr);
- }
+ if (containerPtr->embeddedPtr != NULL) {
+ TkDoConfigureNotify(containerPtr->embeddedPtr);
+ }
/*
* Resize the embedded window, if there is any.
diff --git a/win/tkWinGDI.c b/win/tkWinGDI.c
index 7ed36ff..2cded45 100644
--- a/win/tkWinGDI.c
+++ b/win/tkWinGDI.c
@@ -574,20 +574,20 @@ static int Bezierize(
inPointList = (double *)attemptckalloc(2 * sizeof(double) * npoly);
if (inPointList == 0) {
/* TODO: unreachable */
- return nbpoints; /* 0. */
+ return nbpoints; /* 0. */
}
for (n=0; n<npoly; n++) {
- inPointList[2*n] = polypoints[n].x;
- inPointList[2*n + 1] = polypoints[n].y;
+ inPointList[2*n] = polypoints[n].x;
+ inPointList[2*n + 1] = polypoints[n].y;
}
nbpoints = 1 + npoly * nStep; /* this is the upper limit. */
outPointList = (double *)attemptckalloc(2 * sizeof(double) * nbpoints);
if (outPointList == 0) {
/* TODO: unreachable */
- ckfree(inPointList);
- return 0;
+ ckfree(inPointList);
+ return 0;
}
nbpoints = TkMakeBezierCurve(NULL, inPointList, npoly, nStep,
@@ -597,13 +597,13 @@ static int Bezierize(
bpoints = (POINT *)attemptckalloc(sizeof(POINT)*nbpoints);
if (bpoints == 0) {
/* TODO: unreachable */
- ckfree(outPointList);
- return 0;
+ ckfree(outPointList);
+ return 0;
}
for (n=0; n<nbpoints; n++) {
- bpoints[n].x = (long)outPointList[2*n];
- bpoints[n].y = (long)outPointList[2*n + 1];
+ bpoints[n].x = (long)outPointList[2*n];
+ bpoints[n].y = (long)outPointList[2*n + 1];
}
ckfree(outPointList);
*bpointptr = *bpoints;
@@ -1420,7 +1420,7 @@ static int GdiCharWidths(
DWORD val = GetLastError();
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "::tk::print::_gdi character failed with code %ld", val));
+ "::tk::print::_gdi character failed with code %ld", val));
if (made_font) {
SelectObject(hDC, oldfont);
DeleteObject(hfont);
@@ -2981,7 +2981,7 @@ static HANDLE CopyToDIB(
/* Check for a valid window handle. */
if (!hWnd) {
- return NULL;
+ return NULL;
}
switch (type) {
@@ -3150,16 +3150,16 @@ static HBITMAP CopyScreenToBitmap(
/* Make sure bitmap rectangle is visible. */
if (nX < 0) {
- nX = 0;
+ nX = 0;
}
if (nY < 0) {
- nY = 0;
+ nY = 0;
}
if (nX2 > xScrn) {
- nX2 = xScrn;
+ nX2 = xScrn;
}
if (nY2 > yScrn) {
- nY2 = yScrn;
+ nY2 = yScrn;
}
nWidth = nX2 - nX;
@@ -3220,19 +3220,19 @@ static HANDLE BitmapToDIB(
/* Check if bitmap handle is valid. */
if (!hBitmap) {
- return NULL;
+ return NULL;
}
/* Fill in BITMAP structure, return NULL if it didn't work. */
if (!GetObjectW(hBitmap, sizeof(bm), (LPWSTR)&bm)) {
- return NULL;
+ return NULL;
}
/* Ff no palette is specified, use default palette. */
if (hPal == NULL) {
- hPal = (HPALETTE)GetStockObject(DEFAULT_PALETTE);
+ hPal = (HPALETTE)GetStockObject(DEFAULT_PALETTE);
}
/* Calculate bits per pixel. */
@@ -3242,13 +3242,13 @@ static HANDLE BitmapToDIB(
/* Make sure bits per pixel is valid. */
if (biBits <= 1) {
- biBits = 1;
+ biBits = 1;
} else if (biBits <= 4) {
- biBits = 4;
+ biBits = 4;
} else if (biBits <= 8) {
- biBits = 8;
+ biBits = 8;
} else { /* If greater than 8-bit, force to 24-bit. */
- biBits = 24;
+ biBits = 24;
}
/* Initialize BITMAPINFOHEADER. */
@@ -3315,7 +3315,7 @@ static HANDLE BitmapToDIB(
/* If the driver did not fill in the biSizeImage field, make one up. */
if (bi.biSizeImage == 0) {
- bi.biSizeImage = (((((DWORD)bm.bmWidth * biBits) + 31) / 32) * 4)
+ bi.biSizeImage = (((((DWORD)bm.bmWidth * biBits) + 31) / 32) * 4)
* bm.bmHeight;
}
@@ -3324,7 +3324,7 @@ static HANDLE BitmapToDIB(
dwLen = bi.biSize + DIBNumColors(&bi) * sizeof(RGBQUAD) + bi.biSizeImage;
if ((h = GlobalReAlloc(hDIB, dwLen, 0)) != 0) {
- hDIB = h;
+ hDIB = h;
} else {
/* Clean up and return NULL. */
@@ -3442,7 +3442,7 @@ static HPALETTE GetSystemPalette(void)
hDC = GetDC(NULL);
if (!hDC) {
- return NULL;
+ return NULL;
}
nColors = PalEntriesOnDevice(hDC); /* Number of palette entries. */
@@ -3454,7 +3454,7 @@ static HPALETTE GetSystemPalette(void)
if (!hLogPal) {
/* If we didn't get a logical palette, return NULL. */
- return NULL;
+ return NULL;
}
/* get a pointer to the logical palette. */
@@ -3645,23 +3645,23 @@ static int PrintSelectPrinter(
* script level.
*/
if (localPrinterName != NULL) {
- char* varlink1 = (char*)ckalloc(100 * sizeof(char));
- char** varlink2 = (char**)ckalloc(sizeof(char*));
- *varlink2 = varlink1;
- WideCharToMultiByte(CP_UTF8, 0, localPrinterName, -1, varlink1, 0, NULL, NULL);
-
- Tcl_LinkVar(interp, "::tk::print::printer_name", varlink2,
- TCL_LINK_STRING | TCL_LINK_READ_ONLY);
- Tcl_LinkVar(interp, "::tk::print::copies", &copies,
- TCL_LINK_INT | TCL_LINK_READ_ONLY);
- Tcl_LinkVar(interp, "::tk::print::dpi_x", &dpi_x,
- TCL_LINK_INT | TCL_LINK_READ_ONLY);
- Tcl_LinkVar(interp, "::tk::print::dpi_y", &dpi_y,
- TCL_LINK_INT | TCL_LINK_READ_ONLY);
- Tcl_LinkVar(interp, "::tk::print::paper_width", &paper_width,
- TCL_LINK_INT | TCL_LINK_READ_ONLY);
- Tcl_LinkVar(interp, "::tk::print::paper_height", &paper_height,
- TCL_LINK_INT | TCL_LINK_READ_ONLY);
+ char* varlink1 = (char*)ckalloc(100 * sizeof(char));
+ char** varlink2 = (char**)ckalloc(sizeof(char*));
+ *varlink2 = varlink1;
+ WideCharToMultiByte(CP_UTF8, 0, localPrinterName, -1, varlink1, 0, NULL, NULL);
+
+ Tcl_LinkVar(interp, "::tk::print::printer_name", varlink2,
+ TCL_LINK_STRING | TCL_LINK_READ_ONLY);
+ Tcl_LinkVar(interp, "::tk::print::copies", &copies,
+ TCL_LINK_INT | TCL_LINK_READ_ONLY);
+ Tcl_LinkVar(interp, "::tk::print::dpi_x", &dpi_x,
+ TCL_LINK_INT | TCL_LINK_READ_ONLY);
+ Tcl_LinkVar(interp, "::tk::print::dpi_y", &dpi_y,
+ TCL_LINK_INT | TCL_LINK_READ_ONLY);
+ Tcl_LinkVar(interp, "::tk::print::paper_width", &paper_width,
+ TCL_LINK_INT | TCL_LINK_READ_ONLY);
+ Tcl_LinkVar(interp, "::tk::print::paper_height", &paper_height,
+ TCL_LINK_INT | TCL_LINK_READ_ONLY);
}
return TCL_OK;
diff --git a/win/tkWinIco.c b/win/tkWinIco.c
index 134e7f0..899d437 100644
--- a/win/tkWinIco.c
+++ b/win/tkWinIco.c
@@ -171,9 +171,9 @@ CreateIcoFromPhoto(
bmInfo.bmiHeader.biCompression = BI_RGB;
iconInfo.hbmColor = CreateDIBSection(NULL, &bmInfo, DIB_RGB_COLORS,
- &bgraPixel.voidPtr, NULL, 0);
+ &bgraPixel.voidPtr, NULL, 0);
if (!iconInfo.hbmColor) {
- return NULL;
+ return NULL;
}
/*
@@ -182,10 +182,10 @@ CreateIcoFromPhoto(
bufferSize = height * width * 4;
for (idx = 0 ; idx < bufferSize ; idx += 4) {
- bgraPixel.ptr[idx] = block.pixelPtr[idx+2];
- bgraPixel.ptr[idx+1] = block.pixelPtr[idx+1];
- bgraPixel.ptr[idx+2] = block.pixelPtr[idx+0];
- bgraPixel.ptr[idx+3] = block.pixelPtr[idx+3];
+ bgraPixel.ptr[idx] = block.pixelPtr[idx+2];
+ bgraPixel.ptr[idx+1] = block.pixelPtr[idx+1];
+ bgraPixel.ptr[idx+2] = block.pixelPtr[idx+0];
+ bgraPixel.ptr[idx+3] = block.pixelPtr[idx+3];
}
/*
@@ -197,10 +197,10 @@ CreateIcoFromPhoto(
bmInfo.bmiHeader.biBitCount = 1;
iconInfo.hbmMask = CreateDIBSection(NULL, &bmInfo, DIB_RGB_COLORS,
- &bgraMask.voidPtr, NULL, 0);
+ &bgraMask.voidPtr, NULL, 0);
if (!iconInfo.hbmMask) {
- DeleteObject(iconInfo.hbmColor);
- return NULL;
+ DeleteObject(iconInfo.hbmColor);
+ return NULL;
}
memset(bgraMask.ptr, 0, width*height/8);
@@ -213,7 +213,7 @@ CreateIcoFromPhoto(
DeleteObject(iconInfo.hbmColor);
DeleteObject(iconInfo.hbmMask);
if (hIcon == NULL) {
- return NULL;
+ return NULL;
}
return hIcon;
diff --git a/win/tkWinIco.h b/win/tkWinIco.h
index 16cbb77..d690f49 100644
--- a/win/tkWinIco.h
+++ b/win/tkWinIco.h
@@ -86,8 +86,7 @@ typedef struct {
DWORD BytesPerLine(LPBITMAPINFOHEADER lpBMIH);
LPSTR FindDIBBits(LPSTR lpbi);
-HICON CreateIcoFromPhoto(int width, int height,
- Tk_PhotoImageBlock block);
+HICON CreateIcoFromPhoto(int width, int height, Tk_PhotoImageBlock block);
/*
diff --git a/win/tkWinKey.c b/win/tkWinKey.c
index f2230c9..61cb06e 100644
--- a/win/tkWinKey.c
+++ b/win/tkWinKey.c
@@ -358,9 +358,9 @@ KeycodeToKeysym(
*/
case VK_CONTROL:
- if (state & EXTENDED_MASK) {
- return XK_Control_R;
- }
+ if (state & EXTENDED_MASK) {
+ return XK_Control_R;
+ }
break;
case VK_SHIFT:
if (GetKeyState(VK_RSHIFT) & 0x80) {
@@ -368,9 +368,9 @@ KeycodeToKeysym(
}
break;
case VK_MENU:
- if (state & EXTENDED_MASK) {
- return XK_Alt_R;
- }
+ if (state & EXTENDED_MASK) {
+ return XK_Alt_R;
+ }
break;
}
return keymap[keycode];
diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c
index 5dadf56..909237c 100644
--- a/win/tkWinMenu.c
+++ b/win/tkWinMenu.c
@@ -1601,14 +1601,14 @@ GetMenuIndicatorGeometry(
menuPtr->borderWidthPtr, &borderWidth);
*widthPtr = indicatorDimensions[1] - borderWidth;
- /*
- * Quite dubious about the above (why would borderWidth play a role?)
- * and about how indicatorDimensions[1] is obtained in SetDefaults().
- * At least don't let the result be negative!
- */
- if (*widthPtr < 0) {
- *widthPtr = 0;
- }
+ /*
+ * Quite dubious about the above (why would borderWidth play a role?)
+ * and about how indicatorDimensions[1] is obtained in SetDefaults().
+ * At least don't let the result be negative!
+ */
+ if (*widthPtr < 0) {
+ *widthPtr = 0;
+ }
}
}
@@ -1639,12 +1639,12 @@ GetMenuAccelGeometry(
{
*heightPtr = fmPtr->linespace;
if (mePtr->type == CASCADE_ENTRY) {
- /*
- * Cascade entries have no accelerator but do show an arrow. Set
- * this field width to the width of the OBM_MNARROW system bitmap
- * used to display the arrow. I couldn't find how to query the
- * system for this value, therefore I resort to hardcoding.
- */
+ /*
+ * Cascade entries have no accelerator but do show an arrow. Set
+ * this field width to the width of the OBM_MNARROW system bitmap
+ * used to display the arrow. I couldn't find how to query the
+ * system for this value, therefore I resort to hardcoding.
+ */
*widthPtr = CASCADE_ARROW_WIDTH;
} else if ((menuPtr->menuType != MENUBAR) && (mePtr->accelPtr != NULL)) {
const char *accel = Tcl_GetString(mePtr->accelPtr);
@@ -1908,7 +1908,7 @@ DrawMenuEntryAccelerator(
const char *accel;
if (menuPtr->menuType == MENUBAR) {
- return;
+ return;
}
if (mePtr->accelPtr != NULL) {
@@ -1991,8 +1991,8 @@ DrawMenuEntryArrow(
*/
if ((mePtr->childMenuRefPtr == NULL)
- || (mePtr->childMenuRefPtr->menuPtr == NULL)) {
- return;
+ || (mePtr->childMenuRefPtr->menuPtr == NULL)) {
+ return;
}
oldFgColor = gc->foreground;
@@ -2949,8 +2949,8 @@ DrawMenuEntryBackground(
Tk_Fill3DRectangle(menuPtr->tkwin, d, bgBorder, x, y, width, height,
activeBorderWidth, relief);
} else {
- Tk_Fill3DRectangle(menuPtr->tkwin, d, bgBorder, x, y, width, height, 0,
- TK_RELIEF_FLAT);
+ Tk_Fill3DRectangle(menuPtr->tkwin, d, bgBorder, x, y, width, height, 0,
+ TK_RELIEF_FLAT);
}
}
diff --git a/win/tkWinPointer.c b/win/tkWinPointer.c
index b895a96..5ccd862 100644
--- a/win/tkWinPointer.c
+++ b/win/tkWinPointer.c
@@ -377,8 +377,8 @@ void TkSetCursorPos(
* requested position is off the primary screen.
*/
if ( x < 0 || x > xscreen || y < 0 || y > yscreen ) {
- SetCursorPos(x, y);
- return;
+ SetCursorPos(x, y);
+ return;
}
input.type = INPUT_MOUSE;
@@ -394,7 +394,7 @@ void TkSetCursorPos(
* See ticket [69b48f427e].
*/
if (input.mi.dx == 0 && input.mi.dy == 0) {
- input.mi.dx = 1;
+ input.mi.dx = 1;
}
input.mi.mouseData = 0;
diff --git a/win/tkWinScrlbr.c b/win/tkWinScrlbr.c
index 457b82f..a54deeb 100644
--- a/win/tkWinScrlbr.c
+++ b/win/tkWinScrlbr.c
@@ -394,10 +394,6 @@ TkpComputeScrollbarGeometry(
* basic sanity checks to appease backwards compatibility.
*/
- if (scrollPtr->highlightWidth < 0) {
- scrollPtr->highlightWidth = 0;
- }
-
if (scrollPtr->vertical) {
scrollPtr->arrowLength = vArrowHeight;
fieldLength = Tk_Height(scrollPtr->tkwin);
diff --git a/win/tkWinSendCom.h b/win/tkWinSendCom.h
index d20b48c..73f326b 100644
--- a/win/tkWinSendCom.h
+++ b/win/tkWinSendCom.h
@@ -46,11 +46,11 @@ typedef struct {
*/
MODULE_SCOPE HRESULT TkWinSendCom_CreateInstance(Tcl_Interp *interp,
- REFIID riid, void **ppv);
+ REFIID riid, void **ppv);
MODULE_SCOPE int TkWinSend_QueueCommand(Tcl_Interp *interp,
- Tcl_Obj *cmdPtr);
+ Tcl_Obj *cmdPtr);
MODULE_SCOPE void TkWinSend_SetExcepInfo(Tcl_Interp *interp,
- EXCEPINFO *pExcepInfo);
+ EXCEPINFO *pExcepInfo);
#endif /* _tkWinSendCom_h_INCLUDE */
diff --git a/win/tkWinSysTray.c b/win/tkWinSysTray.c
index 6c8893e..a710ee6 100644
--- a/win/tkWinSysTray.c
+++ b/win/tkWinSysTray.c
@@ -36,11 +36,11 @@
typedef struct IcoInfo {
HICON hIcon; /* icon handle returned by LoadIcon. */
unsigned id; /* Identifier for command; used to
- * cancel it. */
+ * cancel it. */
Tcl_Obj *taskbar_txt; /* text to display in the taskbar */
Tcl_Interp *interp; /* interp which created the icon */
Tcl_Obj *taskbar_command; /* command to eval if events in the taskbar
- * arrive */
+ * arrive */
int taskbar_flags; /* taskbar related flags*/
HWND hwndFocus;
struct IcoInfo *nextPtr;
@@ -102,9 +102,9 @@ DrawXORMask(
/* Sanity checks */
if (lpIcon == NULL)
- return FALSE;
+ return FALSE;
if (lpIcon->lpBits == NULL)
- return FALSE;
+ return FALSE;
/* Account for height*2 thing */
lpIcon->lpbi->bmiHeader.biHeight /= 2;
@@ -115,10 +115,10 @@ DrawXORMask(
/* Blast it to the screen */
SetDIBitsToDevice(hDC, x, y,
- lpIcon->lpbi->bmiHeader.biWidth,
- lpIcon->lpbi->bmiHeader.biHeight,
- 0, 0, 0, lpIcon->lpbi->bmiHeader.biHeight,
- lpIcon->lpXOR, lpIcon->lpbi, DIB_RGB_COLORS);
+ lpIcon->lpbi->bmiHeader.biWidth,
+ lpIcon->lpbi->bmiHeader.biHeight,
+ 0, 0, 0, lpIcon->lpbi->bmiHeader.biHeight,
+ lpIcon->lpXOR, lpIcon->lpbi, DIB_RGB_COLORS);
/* UnAccount for height*2 thing */
lpIcon->lpbi->bmiHeader.biHeight *= 2;
@@ -153,9 +153,9 @@ DrawANDMask(
/* Sanity checks */
if (lpIcon == NULL)
- return FALSE;
+ return FALSE;
if (lpIcon->lpBits == NULL)
- return FALSE;
+ return FALSE;
/* Need a bitmap header for the mono mask */
lpbi = ckalloc(sizeof(BITMAPINFO) + (2 * sizeof(RGBQUAD)));
@@ -185,10 +185,10 @@ DrawANDMask(
/* Blast it to the screen */
SetDIBitsToDevice(hDC, x, y,
- lpbi->bmiHeader.biWidth,
- lpbi->bmiHeader.biHeight,
- 0, 0, 0, lpbi->bmiHeader.biHeight,
- lpIcon->lpAND, lpbi, DIB_RGB_COLORS);
+ lpbi->bmiHeader.biWidth,
+ lpbi->bmiHeader.biHeight,
+ 0, 0, 0, lpbi->bmiHeader.biHeight,
+ lpIcon->lpAND, lpbi, DIB_RGB_COLORS);
/* clean up */
ckfree(lpbi);
@@ -230,22 +230,22 @@ TaskbarOperation(
ni.hIcon = icoPtr->hIcon;
if (icoPtr->taskbar_txt != NULL) {
- Tcl_DString dst;
- Tcl_DStringInit(&dst);
- str = (WCHAR *)Tcl_UtfToWCharDString(Tcl_GetString(icoPtr->taskbar_txt), TCL_INDEX_NONE, &dst);
- wcsncpy(ni.szTip, str, (Tcl_DStringLength(&dst) + 2) / 2);
- Tcl_DStringFree(&dst);
+ Tcl_DString dst;
+ Tcl_DStringInit(&dst);
+ str = (WCHAR *)Tcl_UtfToWCharDString(Tcl_GetString(icoPtr->taskbar_txt), TCL_INDEX_NONE, &dst);
+ wcsncpy(ni.szTip, str, (Tcl_DStringLength(&dst) + 2) / 2);
+ Tcl_DStringFree(&dst);
} else {
- ni.szTip[0] = 0;
+ ni.szTip[0] = 0;
}
if (Shell_NotifyIconW(oper, &ni) == 1) {
- if (oper == NIM_ADD || oper == NIM_MODIFY) {
- icoPtr->taskbar_flags |= TASKBAR_ICON;
- }
- if (oper == NIM_DELETE) {
- icoPtr->taskbar_flags &= ~TASKBAR_ICON;
- }
+ if (oper == NIM_ADD || oper == NIM_MODIFY) {
+ icoPtr->taskbar_flags |= TASKBAR_ICON;
+ }
+ if (oper == NIM_DELETE) {
+ icoPtr->taskbar_flags &= ~TASKBAR_ICON;
+ }
}
/* Silently ignore error? */
return TCL_OK;
@@ -312,22 +312,22 @@ FreeIcoPtr(
{
IcoInfo *prevPtr;
if (icoInterpPtr->firstIcoPtr == icoPtr) {
- icoInterpPtr->firstIcoPtr = icoPtr->nextPtr;
+ icoInterpPtr->firstIcoPtr = icoPtr->nextPtr;
} else {
- for (prevPtr = icoInterpPtr->firstIcoPtr; prevPtr->nextPtr != icoPtr;
- prevPtr = prevPtr->nextPtr) {
- /* Empty loop body. */
- }
- prevPtr->nextPtr = icoPtr->nextPtr;
+ for (prevPtr = icoInterpPtr->firstIcoPtr; prevPtr->nextPtr != icoPtr;
+ prevPtr = prevPtr->nextPtr) {
+ /* Empty loop body. */
+ }
+ prevPtr->nextPtr = icoPtr->nextPtr;
}
if (icoPtr->taskbar_flags & TASKBAR_ICON) {
- TaskbarOperation(icoInterpPtr, icoPtr, NIM_DELETE);
+ TaskbarOperation(icoInterpPtr, icoPtr, NIM_DELETE);
}
if (icoPtr->taskbar_txt != NULL) {
- Tcl_DecrRefCount(icoPtr->taskbar_txt);
+ Tcl_DecrRefCount(icoPtr->taskbar_txt);
}
if (icoPtr->taskbar_command != NULL) {
- Tcl_DecrRefCount(icoPtr->taskbar_command);
+ Tcl_DecrRefCount(icoPtr->taskbar_command);
}
ckfree(icoPtr);
}
@@ -360,22 +360,22 @@ GetIcoPtr(
char *end;
if (strncmp(string, "ico#", 4) != 0) {
- goto notfound;
+ goto notfound;
}
start = string + 4;
id = strtoul(start, &end, 10);
if ((end == start) || (*end != 0)) {
- goto notfound;
+ goto notfound;
}
for (icoPtr = icoInterpPtr->firstIcoPtr; icoPtr != NULL; icoPtr = icoPtr->nextPtr) {
- if (icoPtr->id == id) {
- return icoPtr;
- }
+ if (icoPtr->id == id) {
+ return icoPtr;
+ }
}
notfound:
Tcl_AppendResult(interp, "icon \"", string,
- "\" doesn't exist", NULL);
+ "\" doesn't exist", NULL);
return NULL;
}
@@ -466,117 +466,117 @@ TaskbarExpandPercents(
char* dst;
dst = after;
while (*before) {
- const char *ptr = before;
- int len = 1;
- if(*before == '%') {
- switch(before[1]){
- case 'M':
- case 'm': {
- before++;
- len = strlen(msgstring);
- ptr = msgstring;
- break;
- }
- /* case 'W': {
- before++;
- len = (int)strlen(winstring);
- ptr = winstring;
- break;
- }
- */
- case 'i': {
- before++;
- snprintf(buffer, sizeof(buffer) - 1, "ico#%d", icoPtr->id);
- len = strlen(buffer);
- ptr = buffer;
- break;
- }
- case 'w': {
- before++;
- len = GetInt((long)wParam,buffer, sizeof(buffer));
- ptr = buffer;
- break;
- }
- case 'l': {
- before++;
- len = GetInt((long)lParam,buffer, sizeof(buffer));
- ptr = buffer;
- break;
- }
- case 't': {
- before++;
- len = GetInt((long)GetTickCount(), buffer, sizeof(buffer));
- ptr = buffer;
- break;
- }
- case 'x': {
- POINT pt;
- GetCursorPos(&pt);
- before++;
- len = GetIntDec((long)pt.x, buffer, sizeof(buffer));
- ptr = buffer;
- break;
- }
- case 'y': {
- POINT pt;
- GetCursorPos(&pt);
- before++;
- len = GetIntDec((long)pt.y,buffer, sizeof(buffer));
- ptr = buffer;
- break;
- }
- case 'X': {
- DWORD dw;
- dw = GetMessagePos();
- before++;
- len = GetIntDec((long)LOWORD(dw),buffer, sizeof(buffer));
- ptr = buffer;
- break;
- }
- case 'Y': {
- DWORD dw;
- dw = GetMessagePos();
- before++;
- len = GetIntDec((long)HIWORD(dw),buffer, sizeof(buffer));
- ptr = buffer;
- break;
- }
- case 'H': {
- before++;
- len = GetInt(PTR2INT(icoPtr->hwndFocus), buffer, sizeof(buffer));
- ptr = buffer;
- break;
- }
- case '%': {
- before++;
- len = 1;
- ptr = "%";
- break;
- }
- }
- }
- if (SPACELEFT < len) {
- char *newspace;
- ptrdiff_t dist = dst - after;
- int alloclen = ALLOCLEN;
- newspace = (char *)ckalloc(alloclen);
- if (dist>0)
- memcpy(newspace, after, dist);
- if (after && *aftersize) {
- ckfree(after);
- }
- *aftersize =alloclen;
- after = newspace;
- dst = after + dist;
- }
- if (len > 0) {
- memcpy(dst, ptr, len);
- }
- dst += len;
- if ((dst-after)>(*aftersize-1)) {
- printf("oops\n");
- }
- before++;
+ const char *ptr = before;
+ int len = 1;
+ if(*before == '%') {
+ switch(before[1]){
+ case 'M':
+ case 'm': {
+ before++;
+ len = strlen(msgstring);
+ ptr = msgstring;
+ break;
+ }
+ /* case 'W': {
+ before++;
+ len = (int)strlen(winstring);
+ ptr = winstring;
+ break;
+ }
+ */
+ case 'i': {
+ before++;
+ snprintf(buffer, sizeof(buffer) - 1, "ico#%d", icoPtr->id);
+ len = strlen(buffer);
+ ptr = buffer;
+ break;
+ }
+ case 'w': {
+ before++;
+ len = GetInt((long)wParam,buffer, sizeof(buffer));
+ ptr = buffer;
+ break;
+ }
+ case 'l': {
+ before++;
+ len = GetInt((long)lParam,buffer, sizeof(buffer));
+ ptr = buffer;
+ break;
+ }
+ case 't': {
+ before++;
+ len = GetInt((long)GetTickCount(), buffer, sizeof(buffer));
+ ptr = buffer;
+ break;
+ }
+ case 'x': {
+ POINT pt;
+ GetCursorPos(&pt);
+ before++;
+ len = GetIntDec((long)pt.x, buffer, sizeof(buffer));
+ ptr = buffer;
+ break;
+ }
+ case 'y': {
+ POINT pt;
+ GetCursorPos(&pt);
+ before++;
+ len = GetIntDec((long)pt.y,buffer, sizeof(buffer));
+ ptr = buffer;
+ break;
+ }
+ case 'X': {
+ DWORD dw;
+ dw = GetMessagePos();
+ before++;
+ len = GetIntDec((long)LOWORD(dw),buffer, sizeof(buffer));
+ ptr = buffer;
+ break;
+ }
+ case 'Y': {
+ DWORD dw;
+ dw = GetMessagePos();
+ before++;
+ len = GetIntDec((long)HIWORD(dw),buffer, sizeof(buffer));
+ ptr = buffer;
+ break;
+ }
+ case 'H': {
+ before++;
+ len = GetInt(PTR2INT(icoPtr->hwndFocus), buffer, sizeof(buffer));
+ ptr = buffer;
+ break;
+ }
+ case '%': {
+ before++;
+ len = 1;
+ ptr = "%";
+ break;
+ }
+ }
+ }
+ if (SPACELEFT < len) {
+ char *newspace;
+ ptrdiff_t dist = dst - after;
+ int alloclen = ALLOCLEN;
+ newspace = (char *)ckalloc(alloclen);
+ if (dist>0)
+ memcpy(newspace, after, dist);
+ if (after && *aftersize) {
+ ckfree(after);
+ }
+ *aftersize =alloclen;
+ after = newspace;
+ dst = after + dist;
+ }
+ if (len > 0) {
+ memcpy(dst, ptr, len);
+ }
+ dst += len;
+ if ((dst-after)>(*aftersize-1)) {
+ printf("oops\n");
+ }
+ before++;
}
*dst = 0;
return after;
@@ -612,87 +612,87 @@ TaskbarEval(
switch (lParam) {
case WM_MOUSEMOVE:
- msgstring = "WM_MOUSEMOVE";
- icoPtr->hwndFocus = GetFocus();
- break;
+ msgstring = "WM_MOUSEMOVE";
+ icoPtr->hwndFocus = GetFocus();
+ break;
case WM_LBUTTONDOWN:
- msgstring = "WM_LBUTTONDOWN";
- fixup = 1;
- break;
+ msgstring = "WM_LBUTTONDOWN";
+ fixup = 1;
+ break;
case WM_LBUTTONUP:
- msgstring = "WM_LBUTTONUP";
- fixup = 1;
- break;
+ msgstring = "WM_LBUTTONUP";
+ fixup = 1;
+ break;
case WM_LBUTTONDBLCLK:
- msgstring = "WM_LBUTTONDBLCLK";
- fixup = 1;
- break;
+ msgstring = "WM_LBUTTONDBLCLK";
+ fixup = 1;
+ break;
case WM_RBUTTONDOWN:
- msgstring = "WM_RBUTTONDOWN";
- fixup = 1;
- break;
+ msgstring = "WM_RBUTTONDOWN";
+ fixup = 1;
+ break;
case WM_RBUTTONUP:
- msgstring = "WM_RBUTTONUP";
- fixup = 1;
- break;
+ msgstring = "WM_RBUTTONUP";
+ fixup = 1;
+ break;
case WM_RBUTTONDBLCLK:
- msgstring = "WM_RBUTTONDBLCLK";
- fixup = 1;
- break;
+ msgstring = "WM_RBUTTONDBLCLK";
+ fixup = 1;
+ break;
case WM_MBUTTONDOWN:
- msgstring = "WM_MBUTTONDOWN";
- fixup = 1;
- break;
+ msgstring = "WM_MBUTTONDOWN";
+ fixup = 1;
+ break;
case WM_MBUTTONUP:
- msgstring = "WM_MBUTTONUP";
- fixup = 1;
- break;
+ msgstring = "WM_MBUTTONUP";
+ fixup = 1;
+ break;
case WM_MBUTTONDBLCLK:
- msgstring = "WM_MBUTTONDBLCLK";
- fixup = 1;
- break;
+ msgstring = "WM_MBUTTONDBLCLK";
+ fixup = 1;
+ break;
default:
- msgstring = "WM_NULL";
- fixup = 0;
+ msgstring = "WM_NULL";
+ fixup = 0;
}
expanded = TaskbarExpandPercents(icoPtr, msgstring, wParam, lParam,
- Tcl_GetString(icoPtr->taskbar_command), evalspace, &evalsize);
+ Tcl_GetString(icoPtr->taskbar_command), evalspace, &evalsize);
if (icoPtr->interp != NULL) {
- int result;
- HWND hwnd = NULL;
-
- /* See http://support.microsoft.com/kb/q135788/
- * Seems to have moved to https://www.betaarchive.com/wiki/index.php/Microsoft_KB_Archive/135788 */
- if (fixup) {
- if (icoPtr->hwndFocus != NULL && IsWindow(icoPtr->hwndFocus)) {
- hwnd = icoPtr->hwndFocus;
- } else {
- Tk_Window tkwin = Tk_MainWindow(icoPtr->interp);
- if (tkwin != NULL) {
- hwnd = Tk_GetHWND(Tk_WindowId(tkwin));
- }
- }
- if (hwnd != NULL) {
- SetForegroundWindow(hwnd);
- }
- }
-
- result = Tcl_GlobalEval(icoPtr->interp, expanded);
-
- if (hwnd != NULL) {
- /* See http://support.microsoft.com/kb/q135788/
- * Seems to have moved to https://www.betaarchive.com/wiki/index.php/Microsoft_KB_Archive/135788 */
- PostMessageW(hwnd, WM_NULL, 0, 0);
- }
- if (result != TCL_OK) {
- char buffer[100];
- snprintf(buffer, 100, "\n (command bound to taskbar-icon ico#%d)", icoPtr->id);
- Tcl_AddErrorInfo(icoPtr->interp, buffer);
- Tcl_BackgroundError(icoPtr->interp);
- }
+ int result;
+ HWND hwnd = NULL;
+
+ /* See http://support.microsoft.com/kb/q135788/
+ * Seems to have moved to https://www.betaarchive.com/wiki/index.php/Microsoft_KB_Archive/135788 */
+ if (fixup) {
+ if (icoPtr->hwndFocus != NULL && IsWindow(icoPtr->hwndFocus)) {
+ hwnd = icoPtr->hwndFocus;
+ } else {
+ Tk_Window tkwin = Tk_MainWindow(icoPtr->interp);
+ if (tkwin != NULL) {
+ hwnd = Tk_GetHWND(Tk_WindowId(tkwin));
+ }
+ }
+ if (hwnd != NULL) {
+ SetForegroundWindow(hwnd);
+ }
+ }
+
+ result = Tcl_GlobalEval(icoPtr->interp, expanded);
+
+ if (hwnd != NULL) {
+ /* See http://support.microsoft.com/kb/q135788/
+ * Seems to have moved to https://www.betaarchive.com/wiki/index.php/Microsoft_KB_Archive/135788 */
+ PostMessageW(hwnd, WM_NULL, 0, 0);
+ }
+ if (result != TCL_OK) {
+ char buffer[100];
+ snprintf(buffer, 100, "\n (command bound to taskbar-icon ico#%d)", icoPtr->id);
+ Tcl_AddErrorInfo(icoPtr->interp, buffer);
+ Tcl_BackgroundError(icoPtr->interp);
+ }
}
if (expanded != evalspace) {
- ckfree(expanded);
+ ckfree(expanded);
}
}
@@ -726,43 +726,43 @@ TaskbarHandlerProc(
switch (message) {
case WM_CREATE:
- msgTaskbarCreated = RegisterWindowMessage(TEXT("TaskbarCreated"));
- break;
+ msgTaskbarCreated = RegisterWindowMessage(TEXT("TaskbarCreated"));
+ break;
case ICON_MESSAGE:
- for (icoInterpPtr = firstIcoInterpPtr; icoInterpPtr != NULL; icoInterpPtr = icoInterpPtr->nextPtr) {
- if (icoInterpPtr->hwnd == hwnd) {
- for (icoPtr = icoInterpPtr->firstIcoPtr; icoPtr != NULL; icoPtr = icoPtr->nextPtr) {
- if (icoPtr->id == wParam) {
- if (icoPtr->taskbar_command != NULL) {
- TaskbarEval(icoPtr, wParam, lParam);
- }
- break;
- }
- }
- break;
- }
- }
- break;
+ for (icoInterpPtr = firstIcoInterpPtr; icoInterpPtr != NULL; icoInterpPtr = icoInterpPtr->nextPtr) {
+ if (icoInterpPtr->hwnd == hwnd) {
+ for (icoPtr = icoInterpPtr->firstIcoPtr; icoPtr != NULL; icoPtr = icoPtr->nextPtr) {
+ if (icoPtr->id == wParam) {
+ if (icoPtr->taskbar_command != NULL) {
+ TaskbarEval(icoPtr, wParam, lParam);
+ }
+ break;
+ }
+ }
+ break;
+ }
+ }
+ break;
default:
- /*
- * Check to see if explorer has been restarted and we need to
- * re-add our icons.
- */
- if (message == msgTaskbarCreated) {
- for (icoInterpPtr = firstIcoInterpPtr; icoInterpPtr != NULL; icoInterpPtr = icoInterpPtr->nextPtr) {
- if (icoInterpPtr->hwnd == hwnd) {
- for (icoPtr = icoInterpPtr->firstIcoPtr; icoPtr != NULL; icoPtr = icoPtr->nextPtr) {
- if (icoPtr->taskbar_flags & TASKBAR_ICON) {
- TaskbarOperation(icoInterpPtr, icoPtr, NIM_ADD);
- }
- }
- break;
- }
- }
- }
- return DefWindowProc(hwnd, message, wParam, lParam);
+ /*
+ * Check to see if explorer has been restarted and we need to
+ * re-add our icons.
+ */
+ if (message == msgTaskbarCreated) {
+ for (icoInterpPtr = firstIcoInterpPtr; icoInterpPtr != NULL; icoInterpPtr = icoInterpPtr->nextPtr) {
+ if (icoInterpPtr->hwnd == hwnd) {
+ for (icoPtr = icoInterpPtr->firstIcoPtr; icoPtr != NULL; icoPtr = icoPtr->nextPtr) {
+ if (icoPtr->taskbar_flags & TASKBAR_ICON) {
+ TaskbarOperation(icoInterpPtr, icoPtr, NIM_ADD);
+ }
+ }
+ break;
+ }
+ }
+ }
+ return DefWindowProc(hwnd, message, wParam, lParam);
}
return 0;
}
@@ -823,12 +823,12 @@ CreateTaskbarHandlerWindow(void) {
static int registered = 0;
HINSTANCE hInstance = GETHINSTANCE;
if (!registered) {
- if (!RegisterHandlerClass(hInstance))
- return 0;
- registered = 1;
+ if (!RegisterHandlerClass(hInstance))
+ return 0;
+ registered = 1;
}
return CreateWindow(HANDLER_CLASS, "", WS_OVERLAPPED, 0, 0,
- CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
+ CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
}
/*
@@ -860,23 +860,23 @@ WinIcoDestroy(
IcoInfo *nextPtr;
if (eventPtr->type != DestroyNotify) {
- return;
+ return;
}
if (firstIcoInterpPtr == icoInterpPtr) {
- firstIcoInterpPtr = icoInterpPtr->nextPtr;
+ firstIcoInterpPtr = icoInterpPtr->nextPtr;
} else {
- for (prevIcoInterpPtr = firstIcoInterpPtr; prevIcoInterpPtr->nextPtr != icoInterpPtr;
- prevIcoInterpPtr = prevIcoInterpPtr->nextPtr) {
- /* Empty loop body. */
- }
- prevIcoInterpPtr->nextPtr = icoInterpPtr->nextPtr;
+ for (prevIcoInterpPtr = firstIcoInterpPtr; prevIcoInterpPtr->nextPtr != icoInterpPtr;
+ prevIcoInterpPtr = prevIcoInterpPtr->nextPtr) {
+ /* Empty loop body. */
+ }
+ prevIcoInterpPtr->nextPtr = icoInterpPtr->nextPtr;
}
DestroyWindow(icoInterpPtr->hwnd);
for (icoPtr = icoInterpPtr->firstIcoPtr; icoPtr != NULL; icoPtr = nextPtr) {
- nextPtr = icoPtr->nextPtr;
- FreeIcoPtr(icoInterpPtr, icoPtr);
+ nextPtr = icoPtr->nextPtr;
+ FreeIcoPtr(icoInterpPtr, icoPtr);
}
ckfree(icoInterpPtr);
}
@@ -905,11 +905,11 @@ WinSystrayCmd(
Tcl_Obj *const objv[])
{
static const char *const cmdStrings[] = {
- "add", "delete", "modify", NULL
+ "add", "delete", "modify", NULL
};
enum { CMD_ADD, CMD_DELETE, CMD_MODIFY };
static const char *const optStrings[] = {
- "-callback", "-image", "-text", NULL
+ "-callback", "-image", "-text", NULL
};
enum { OPT_CALLBACK, OPT_IMAGE, OPT_TEXT };
int cmd, opt;
@@ -920,124 +920,124 @@ WinSystrayCmd(
IcoInfo *icoPtr = NULL;
if (objc < 2) {
- Tcl_WrongNumArgs(interp, 1, objv, "command ...");
- return TCL_ERROR;
+ Tcl_WrongNumArgs(interp, 1, objv, "command ...");
+ return TCL_ERROR;
}
if (Tcl_GetIndexFromObj(interp, objv[1], cmdStrings, "command",
- 0, &cmd) == TCL_ERROR) {
- return TCL_ERROR;
+ 0, &cmd) == TCL_ERROR) {
+ return TCL_ERROR;
}
switch (cmd) {
- case CMD_ADD:
- case CMD_MODIFY: {
- Tcl_Obj *imageObj = NULL, *textObj = NULL, *callbackObj = NULL;
- int optStart;
- int oper;
- if (cmd == CMD_ADD) {
- optStart = 2;
- oper = NIM_ADD;
- } else {
- optStart = 3;
- oper = NIM_MODIFY;
- if (objc != 5) {
- Tcl_WrongNumArgs(interp, 2, objv, "id option value");
- return TCL_ERROR;
- }
- icoPtr = GetIcoPtr(interp, icoInterpPtr, Tcl_GetString(objv[2]));
- if (icoPtr == NULL) {
- return TCL_ERROR;
- }
- }
- for (i = optStart; i < objc; i += 2) {
- if (Tcl_GetIndexFromObj(interp, objv[i], optStrings, "option",
- 0, &opt) == TCL_ERROR) {
- return TCL_ERROR;
- }
- if (i+1 >= objc) {
- Tcl_AppendResult(interp,
- "missing value for option \"", Tcl_GetString(objv[i]),
- "\"", NULL);
- return TCL_ERROR;
- }
- switch (opt) {
- case OPT_IMAGE:
- imageObj = objv[i+1];
- break;
- case OPT_TEXT:
- textObj = objv[i+1];
- break;
- case OPT_CALLBACK:
- callbackObj = objv[i+1];
- break;
- }
- }
- if (cmd == CMD_ADD && imageObj == NULL) {
- Tcl_SetObjResult(interp, Tcl_NewStringObj("missing required option \"-image\"", TCL_INDEX_NONE));
- return TCL_ERROR;
- }
- if (imageObj != NULL) {
- Tk_PhotoHandle photo;
- int width, height;
- Tk_PhotoImageBlock block;
-
- photo = Tk_FindPhoto(interp, Tcl_GetString(imageObj));
- if (photo == NULL) {
- Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "image \"%s\" doesn't exist", Tcl_GetString(imageObj)));
- return TCL_ERROR;
- }
- Tk_PhotoGetSize(photo, &width, &height);
- Tk_PhotoGetImage(photo, &block);
- hIcon = CreateIcoFromPhoto(width, height, block);
- if (hIcon == NULL) {
- Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "failed to create an iconphoto with image \"%s\"", Tcl_GetString(imageObj)));
- return TCL_ERROR;
- }
- }
- if (cmd == CMD_ADD) {
- icoPtr = NewIcon(interp, icoInterpPtr, hIcon);
- } else {
- if (imageObj != NULL) {
- DestroyIcon(icoPtr->hIcon);
- icoPtr->hIcon = hIcon;
- }
- }
- if (callbackObj != NULL) {
- if (icoPtr->taskbar_command != NULL) {
- Tcl_DecrRefCount(icoPtr->taskbar_command);
- }
- icoPtr->taskbar_command = callbackObj;
- Tcl_IncrRefCount(icoPtr->taskbar_command);
- }
- if (textObj != NULL) {
- if (icoPtr->taskbar_txt != NULL) {
- Tcl_DecrRefCount(icoPtr->taskbar_txt);
- }
- icoPtr->taskbar_txt = textObj;
- Tcl_IncrRefCount(icoPtr->taskbar_txt);
- }
- TaskbarOperation(icoInterpPtr, icoPtr, oper);
- if (cmd == CMD_ADD) {
- char buffer[5 + TCL_INTEGER_SPACE];
- int n;
- n = snprintf(buffer, sizeof(buffer) - 1, "ico#%d", icoPtr->id);
- buffer[n] = 0;
- Tcl_SetObjResult(interp, Tcl_NewStringObj(buffer, n));
- }
- return TCL_OK;
- }
- case CMD_DELETE:
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "id");
- return TCL_ERROR;
- }
- icoPtr = GetIcoPtr(interp, icoInterpPtr, Tcl_GetString(objv[2]));
- if (icoPtr == NULL) {
- return TCL_ERROR;
- }
- FreeIcoPtr(icoInterpPtr, icoPtr);
- return TCL_OK;
+ case CMD_ADD:
+ case CMD_MODIFY: {
+ Tcl_Obj *imageObj = NULL, *textObj = NULL, *callbackObj = NULL;
+ int optStart;
+ int oper;
+ if (cmd == CMD_ADD) {
+ optStart = 2;
+ oper = NIM_ADD;
+ } else {
+ optStart = 3;
+ oper = NIM_MODIFY;
+ if (objc != 5) {
+ Tcl_WrongNumArgs(interp, 2, objv, "id option value");
+ return TCL_ERROR;
+ }
+ icoPtr = GetIcoPtr(interp, icoInterpPtr, Tcl_GetString(objv[2]));
+ if (icoPtr == NULL) {
+ return TCL_ERROR;
+ }
+ }
+ for (i = optStart; i < objc; i += 2) {
+ if (Tcl_GetIndexFromObj(interp, objv[i], optStrings, "option",
+ 0, &opt) == TCL_ERROR) {
+ return TCL_ERROR;
+ }
+ if (i+1 >= objc) {
+ Tcl_AppendResult(interp,
+ "missing value for option \"", Tcl_GetString(objv[i]),
+ "\"", NULL);
+ return TCL_ERROR;
+ }
+ switch (opt) {
+ case OPT_IMAGE:
+ imageObj = objv[i+1];
+ break;
+ case OPT_TEXT:
+ textObj = objv[i+1];
+ break;
+ case OPT_CALLBACK:
+ callbackObj = objv[i+1];
+ break;
+ }
+ }
+ if (cmd == CMD_ADD && imageObj == NULL) {
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("missing required option \"-image\"", TCL_INDEX_NONE));
+ return TCL_ERROR;
+ }
+ if (imageObj != NULL) {
+ Tk_PhotoHandle photo;
+ int width, height;
+ Tk_PhotoImageBlock block;
+
+ photo = Tk_FindPhoto(interp, Tcl_GetString(imageObj));
+ if (photo == NULL) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "image \"%s\" doesn't exist", Tcl_GetString(imageObj)));
+ return TCL_ERROR;
+ }
+ Tk_PhotoGetSize(photo, &width, &height);
+ Tk_PhotoGetImage(photo, &block);
+ hIcon = CreateIcoFromPhoto(width, height, block);
+ if (hIcon == NULL) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "failed to create an iconphoto with image \"%s\"", Tcl_GetString(imageObj)));
+ return TCL_ERROR;
+ }
+ }
+ if (cmd == CMD_ADD) {
+ icoPtr = NewIcon(interp, icoInterpPtr, hIcon);
+ } else {
+ if (imageObj != NULL) {
+ DestroyIcon(icoPtr->hIcon);
+ icoPtr->hIcon = hIcon;
+ }
+ }
+ if (callbackObj != NULL) {
+ if (icoPtr->taskbar_command != NULL) {
+ Tcl_DecrRefCount(icoPtr->taskbar_command);
+ }
+ icoPtr->taskbar_command = callbackObj;
+ Tcl_IncrRefCount(icoPtr->taskbar_command);
+ }
+ if (textObj != NULL) {
+ if (icoPtr->taskbar_txt != NULL) {
+ Tcl_DecrRefCount(icoPtr->taskbar_txt);
+ }
+ icoPtr->taskbar_txt = textObj;
+ Tcl_IncrRefCount(icoPtr->taskbar_txt);
+ }
+ TaskbarOperation(icoInterpPtr, icoPtr, oper);
+ if (cmd == CMD_ADD) {
+ char buffer[5 + TCL_INTEGER_SPACE];
+ int n;
+ n = snprintf(buffer, sizeof(buffer) - 1, "ico#%d", icoPtr->id);
+ buffer[n] = 0;
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(buffer, n));
+ }
+ return TCL_OK;
+ }
+ case CMD_DELETE:
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "id");
+ return TCL_ERROR;
+ }
+ icoPtr = GetIcoPtr(interp, icoInterpPtr, Tcl_GetString(objv[2]));
+ if (icoPtr == NULL) {
+ return TCL_ERROR;
+ }
+ FreeIcoPtr(icoInterpPtr, icoPtr);
+ return TCL_OK;
}
return TCL_OK;
}
@@ -1074,22 +1074,22 @@ WinSysNotifyCmd(
char *msginfo;
if (objc < 2) {
- Tcl_WrongNumArgs(interp, 1, objv, "command ...");
- return TCL_ERROR;
+ Tcl_WrongNumArgs(interp, 1, objv, "command ...");
+ return TCL_ERROR;
}
if (strcmp(Tcl_GetString(objv[1]), "notify") != 0) {
- Tcl_AppendResult(interp, "unknown subcommand \"", Tcl_GetString(objv[1]),
- "\": must be notify", NULL);
- return TCL_ERROR;
+ Tcl_AppendResult(interp, "unknown subcommand \"", Tcl_GetString(objv[1]),
+ "\": must be notify", NULL);
+ return TCL_ERROR;
}
if (objc != 5) {
- Tcl_WrongNumArgs(interp, 2, objv, "id title detail");
- return TCL_ERROR;
+ Tcl_WrongNumArgs(interp, 2, objv, "id title detail");
+ return TCL_ERROR;
}
icoPtr = GetIcoPtr(interp, icoInterpPtr, Tcl_GetString(objv[2]));
if (icoPtr == NULL) {
- return TCL_ERROR;
+ return TCL_ERROR;
}
ni.cbSize = sizeof(NOTIFYICONDATAW);
@@ -1105,18 +1105,18 @@ WinSysNotifyCmd(
/* Balloon notification for system tray icon. */
if (msgtitle != NULL) {
- WCHAR *title;
- Tcl_DStringInit(&titledst);
- title = Tcl_UtfToWCharDString(msgtitle, TCL_INDEX_NONE, &titledst);
- wcsncpy(ni.szInfoTitle, title, (Tcl_DStringLength(&titledst) + 2) / 2);
- Tcl_DStringFree(&titledst);
+ WCHAR *title;
+ Tcl_DStringInit(&titledst);
+ title = Tcl_UtfToWCharDString(msgtitle, TCL_INDEX_NONE, &titledst);
+ wcsncpy(ni.szInfoTitle, title, (Tcl_DStringLength(&titledst) + 2) / 2);
+ Tcl_DStringFree(&titledst);
}
if (msginfo != NULL) {
- WCHAR *info;
- Tcl_DStringInit(&infodst);
- info = Tcl_UtfToWCharDString(msginfo, TCL_INDEX_NONE, &infodst);
- wcsncpy(ni.szInfo, info, (Tcl_DStringLength(&infodst) + 2) / 2);
- Tcl_DStringFree(&infodst);
+ WCHAR *info;
+ Tcl_DStringInit(&infodst);
+ info = Tcl_UtfToWCharDString(msginfo, TCL_INDEX_NONE, &infodst);
+ wcsncpy(ni.szInfo, info, (Tcl_DStringLength(&infodst) + 2) / 2);
+ Tcl_DStringFree(&infodst);
}
Shell_NotifyIconW(NIM_MODIFY, &ni);
@@ -1148,8 +1148,8 @@ WinIcoInit(
mainWindow = Tk_MainWindow(interp);
if (mainWindow == NULL) {
- Tcl_SetObjResult(interp, Tcl_NewStringObj("main window has been destroyed", TCL_INDEX_NONE));
- return TCL_ERROR;
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("main window has been destroyed", TCL_INDEX_NONE));
+ return TCL_ERROR;
}
icoInterpPtr = (IcoInterpInfo*) ckalloc(sizeof(IcoInterpInfo));
@@ -1159,12 +1159,12 @@ WinIcoInit(
icoInterpPtr->nextPtr = firstIcoInterpPtr;
firstIcoInterpPtr = icoInterpPtr;
Tcl_CreateObjCommand(interp, "::tk::systray::_systray", WinSystrayCmd,
- icoInterpPtr, NULL);
+ icoInterpPtr, NULL);
Tcl_CreateObjCommand(interp, "::tk::sysnotify::_sysnotify", WinSysNotifyCmd,
- icoInterpPtr, NULL);
+ icoInterpPtr, NULL);
Tk_CreateEventHandler(mainWindow, StructureNotifyMask,
- WinIcoDestroy, icoInterpPtr);
+ WinIcoDestroy, icoInterpPtr);
return TCL_OK;
}
diff --git a/win/tkWinTest.c b/win/tkWinTest.c
index 544f89c..4e993af 100644
--- a/win/tkWinTest.c
+++ b/win/tkWinTest.c
@@ -98,10 +98,10 @@ HWND TestFindControl(HWND root, int id)
fcs.control = GetDlgItem(root, id);
if (fcs.control == NULL) {
- /* Control is not a direct child. Look in descendents */
- fcs.id = id;
- fcs.control = NULL;
- EnumChildWindows(root, TestFindControlCallback, (LPARAM) &fcs);
+ /* Control is not a direct child. Look in descendents */
+ fcs.id = id;
+ fcs.control = NULL;
+ EnumChildWindows(root, TestFindControlCallback, (LPARAM) &fcs);
}
return fcs.control;
}
@@ -360,15 +360,15 @@ TestwineventObjCmd(
#if 0
GetDlgItemTextA(hwnd, id, buf, 256);
#else
- control = TestFindControl(hwnd, id);
- if (control == NULL) {
- Tcl_SetObjResult(interp,
- Tcl_ObjPrintf("Could not find control with id %d", id));
- return TCL_ERROR;
- }
- buf[0] = 0;
- SendMessageA(control, WM_GETTEXT, (WPARAM)sizeof(buf),
- (LPARAM) buf);
+ control = TestFindControl(hwnd, id);
+ if (control == NULL) {
+ Tcl_SetObjResult(interp,
+ Tcl_ObjPrintf("Could not find control with id %d", id));
+ return TCL_ERROR;
+ }
+ buf[0] = 0;
+ SendMessageA(control, WM_GETTEXT, (WPARAM)sizeof(buf),
+ (LPARAM) buf);
#endif
Tcl_AppendResult(interp, Tcl_ExternalToUtfDString(NULL, buf, TCL_INDEX_NONE, &ds), NULL);
Tcl_DStringFree(&ds);
@@ -443,8 +443,8 @@ TestfindwindowObjCmd(
Tcl_DStringInit(&titleString);
if (objc < 2 || objc > 3) {
- Tcl_WrongNumArgs(interp, 1, objv, "title ?class?");
- return TCL_ERROR;
+ Tcl_WrongNumArgs(interp, 1, objv, "title ?class?");
+ return TCL_ERROR;
}
Tcl_DStringInit(&titleString);
@@ -454,23 +454,23 @@ TestfindwindowObjCmd(
windowClass = Tcl_UtfToWCharDString(Tcl_GetString(objv[2]), TCL_INDEX_NONE, &classString);
}
if (title[0] == 0)
- title = NULL;
+ title = NULL;
/* We want find a window the belongs to us and not some other process */
hwnd = NULL;
myPid = GetCurrentProcessId();
while (1) {
- DWORD pid, tid;
- hwnd = FindWindowExW(NULL, hwnd, windowClass, title);
- if (hwnd == NULL)
- break;
- tid = GetWindowThreadProcessId(hwnd, &pid);
- if (tid == 0) {
- /* Window has gone */
- hwnd = NULL;
- break;
- }
- if (pid == myPid)
- break; /* Found it */
+ DWORD pid, tid;
+ hwnd = FindWindowExW(NULL, hwnd, windowClass, title);
+ if (hwnd == NULL)
+ break;
+ tid = GetWindowThreadProcessId(hwnd, &pid);
+ if (tid == 0) {
+ /* Window has gone */
+ hwnd = NULL;
+ break;
+ }
+ if (pid == myPid)
+ break; /* Found it */
}
if (hwnd == NULL) {
@@ -478,7 +478,7 @@ TestfindwindowObjCmd(
AppendSystemError(interp, GetLastError());
r = TCL_ERROR;
} else {
- Tcl_SetObjResult(interp, Tcl_NewWideIntObj(PTR2INT(hwnd)));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(PTR2INT(hwnd)));
}
Tcl_DStringFree(&titleString);
diff --git a/win/tkWinWm.c b/win/tkWinWm.c
index 4ad0056..ba52b32 100644
--- a/win/tkWinWm.c
+++ b/win/tkWinWm.c
@@ -1436,11 +1436,6 @@ ReadIconOrCursorFromFile(
Tcl_Close(NULL, channel);
return NULL;
}
- if (Tcl_SetChannelOption(interp, channel, "-encoding", "binary")
- != TCL_OK) {
- Tcl_Close(NULL, channel);
- return NULL;
- }
/*
* Allocate memory for the resource structure
diff --git a/win/tkWinX.c b/win/tkWinX.c
index 80407df..656e142 100644
--- a/win/tkWinX.c
+++ b/win/tkWinX.c
@@ -806,16 +806,16 @@ TkWinChildProc(
break;
case WM_UNICHAR:
- if (wParam == UNICODE_NOCHAR) {
+ if (wParam == UNICODE_NOCHAR) {
/* If wParam is UNICODE_NOCHAR and the application processes
* this message, then return TRUE. */
result = 1;
} else {
/* If the event was translated, we must return 0 */
- if (TkTranslateWinEvent(hwnd, message, wParam, lParam, &result)) {
- result = 0;
+ if (TkTranslateWinEvent(hwnd, message, wParam, lParam, &result)) {
+ result = 0;
} else {
- result = 1;
+ result = 1;
}
}
break;
@@ -872,20 +872,20 @@ TkTranslateWinEvent(
}
case WM_RENDERALLFORMATS: {
- TkWindow *winPtr = (TkWindow *) Tk_HWNDToWindow(hwnd);
-
- if (winPtr && OpenClipboard(hwnd)) {
- /*
- * Make sure that nobody had taken ownership of the clipboard
- * before we opened it.
- */
-
- if (GetClipboardOwner() == hwnd) {
- TkWinClipboardRender(winPtr->dispPtr, CF_TEXT);
- }
- CloseClipboard();
- }
- return 1;
+ TkWindow *winPtr = (TkWindow *) Tk_HWNDToWindow(hwnd);
+
+ if (winPtr && OpenClipboard(hwnd)) {
+ /*
+ * Make sure that nobody had taken ownership of the clipboard
+ * before we opened it.
+ */
+
+ if (GetClipboardOwner() == hwnd) {
+ TkWinClipboardRender(winPtr->dispPtr, CF_TEXT);
+ }
+ CloseClipboard();
+ }
+ return 1;
}
case WM_COMMAND:
@@ -1221,7 +1221,7 @@ GenerateXEvent(
event.x.xany.send_event = -1;
event.x.xkey.keycode = wParam;
GetTranslatedKey(&event.key, (message == WM_KEYDOWN) ? WM_CHAR :
- WM_SYSCHAR);
+ WM_SYSCHAR);
break;
case WM_SYSKEYUP:
@@ -1294,7 +1294,7 @@ GenerateXEvent(
MSG msg;
if ((PeekMessageW(&msg, NULL, WM_CHAR, WM_CHAR,
- PM_NOREMOVE) != 0)
+ PM_NOREMOVE) != 0)
&& (msg.message == WM_CHAR)) {
GetMessageW(&msg, NULL, WM_CHAR, WM_CHAR);
event.key.nbytes = 2;
diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c
index 463d60d..5b97fad 100644
--- a/win/ttkWinXPTheme.c
+++ b/win/ttkWinXPTheme.c
@@ -805,7 +805,7 @@ static void TabElementDraw(
return;
if (nbTabsStickBit == TTK_STICK_S) {
- if (state & TTK_STATE_USER1) {
+ if (state & TTK_STATE_FIRST) {
partId = TABP_TABITEMLEFTEDGE;
}