summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsimonbachmann <simonbachmann@bluewin.ch>2017-04-29 06:44:18 (GMT)
committersimonbachmann <simonbachmann@bluewin.ch>2017-04-29 06:44:18 (GMT)
commit3eb5d7fcb43574fca107cd8d29ccb37fd5276618 (patch)
tree9c1a18f3f0cff622c8bb48e78456ac16570f876c
parent73ff727f2c72d26737eed09892846d5f4ff2f7b2 (diff)
parent677efb49e66dded5f3db56da9137d51531e1f1a2 (diff)
downloadtk-3eb5d7fcb43574fca107cd8d29ccb37fd5276618.zip
tk-3eb5d7fcb43574fca107cd8d29ccb37fd5276618.tar.gz
tk-3eb5d7fcb43574fca107cd8d29ccb37fd5276618.tar.bz2
merge core-8-6-branchbug_22ace0d494
-rw-r--r--doc/ttk_button.n1
-rw-r--r--doc/ttk_frame.n6
-rw-r--r--doc/ttk_image.n20
-rw-r--r--doc/ttk_label.n10
-rw-r--r--doc/ttk_labelframe.n6
-rw-r--r--doc/ttk_notebook.n3
-rw-r--r--doc/ttk_treeview.n5
-rw-r--r--doc/ttk_vsapi.n7
-rw-r--r--doc/ttk_widget.n47
-rw-r--r--generic/tkTextBTree.c6
-rw-r--r--macosx/tkMacOSXScrlbr.c81
-rw-r--r--macosx/tkMacOSXWm.c5
-rw-r--r--macosx/tkMacOSXWm.h4
-rw-r--r--xlib/xgc.c2
14 files changed, 122 insertions, 81 deletions
diff --git a/doc/ttk_button.n b/doc/ttk_button.n
index 62ebe47..b84ca48 100644
--- a/doc/ttk_button.n
+++ b/doc/ttk_button.n
@@ -51,7 +51,6 @@ in the style.
.\" .OP \-foreground foreground Foreground
.\" .OP \-font font Font
.\" .OP \-anchor anchor Anchor
-.\" .OP \-padding padding Padding
.\" .OP \-relief relief Relief
.SH "WIDGET COMMAND"
.PP
diff --git a/doc/ttk_frame.n b/doc/ttk_frame.n
index b54ce96..d2bd745 100644
--- a/doc/ttk_frame.n
+++ b/doc/ttk_frame.n
@@ -17,8 +17,8 @@ ttk::frame \- Simple container widget
A \fBttk::frame\fR widget is a container, used to group other widgets
together.
.SO ttk_widget
-\-class \-cursor \-takefocus
-\-style
+\-class \-cursor \-padding \-style
+\-takefocus
.SE
.SH "WIDGET-SPECIFIC OPTIONS"
.OP \-borderwidth borderWidth BorderWidth
@@ -28,8 +28,6 @@ One of the standard Tk border styles:
\fBflat\fR, \fBgroove\fR, \fBraised\fR, \fBridge\fR,
\fBsolid\fR, or \fBsunken\fR.
Defaults to \fBflat\fR.
-.OP \-padding padding Padding
-Additional padding to include inside the border.
.OP \-width width Width
If specified, the widget's requested width in pixels.
.OP \-height height Height
diff --git a/doc/ttk_image.n b/doc/ttk_image.n
index 4985c20..bc1dd3f 100644
--- a/doc/ttk_image.n
+++ b/doc/ttk_image.n
@@ -29,6 +29,13 @@ Valid \fIoptions\fR are:
\fB\-border\fR \fIpadding\fR
\fIpadding\fR is a list of up to four integers, specifying
the left, top, right, and bottom borders, respectively.
+If fewer than four elements are specified,
+\fIbottom\fR defaults to \fItop\fR,
+\fIright\fR defaults to \fIleft\fR, and
+\fItop\fR defaults to \fIleft\fR.
+In other words, a list of three numbers specify the left, vertical, and right border;
+a list of two numbers specify the horizontal and the vertical border;
+a single number specifies the same border all the way around the element.
See \fBIMAGE STRETCHING\fR, below.
.TP
\fB\-height \fIheight\fR
@@ -36,8 +43,17 @@ Specifies a minimum height for the element.
If less than zero, the base image's height is used as a default.
.TP
\fB\-padding\fR \fIpadding\fR
-Specifies the element's interior padding. Defaults to
-\fB\-border\fR if not specified.
+Specifies the element's interior padding.
+The padding is a list of up to four length specifications
+\fIleft top right bottom\fR.
+If fewer than four elements are specified,
+\fIbottom\fR defaults to \fItop\fR,
+\fIright\fR defaults to \fIleft\fR, and
+\fItop\fR defaults to \fIleft\fR.
+In other words, a list of three numbers specify the left, vertical, and right padding;
+a list of two numbers specify the horizontal and the vertical padding;
+a single number specifies the same padding all the way around the widget.
+Defaults to \fB\-border\fR if not specified.
.TP
\fB\-sticky\fR \fIspec\fR
Specifies how the image is placed within the final parcel.
diff --git a/doc/ttk_label.n b/doc/ttk_label.n
index 6781b47..9c28d7c 100644
--- a/doc/ttk_label.n
+++ b/doc/ttk_label.n
@@ -19,7 +19,7 @@ The label may be linked to a Tcl variable
to automatically change the displayed text.
.SO ttk_widget
\-class \-compound \-cursor
-\-image \-style \-takefocus
+\-image \-padding \-style \-takefocus
\-text \-textvariable \-underline
\-width
.SE
@@ -43,14 +43,6 @@ If there are multiple lines of text, specifies how
the lines are laid out relative to one another.
One of \fBleft\fR, \fBcenter\fR, or \fBright\fR.
See also \fB\-anchor\fR.
-.OP \-padding padding Padding
-Specifies the amount of extra space to allocate for the widget.
-The padding is a list of up to four length specifications
-\fIleft top right bottom\fR.
-If fewer than four elements are specified,
-\fIbottom\fR defaults to \fItop\fR,
-\fIright\fR defaults to \fIleft\fR, and
-\fItop\fR defaults to \fIleft\fR.
.OP \-relief relief Relief
.\" Rewrite this:
Specifies the 3-D effect desired for the widget border.
diff --git a/doc/ttk_labelframe.n b/doc/ttk_labelframe.n
index 64edf6a..4c2c8d5 100644
--- a/doc/ttk_labelframe.n
+++ b/doc/ttk_labelframe.n
@@ -18,8 +18,8 @@ A \fBttk::labelframe\fR widget is a container used to group other widgets
together. It has an optional label, which may be a plain text string or
another widget.
.SO ttk_widget
-\-class \-cursor \-takefocus
-\-style
+\-class \-cursor \-padding \-style
+\-takefocus
.SE
.SH "WIDGET-SPECIFIC OPTIONS"
.\" XXX: Currently included, but may go away:
@@ -48,8 +48,6 @@ underline in the text string.
The underlined character is used for mnemonic activation.
Mnemonic activation for a \fBttk::labelframe\fR
sets the keyboard focus to the first child of the \fBttk::labelframe\fR widget.
-.OP \-padding padding Padding
-Additional padding to include inside the border.
.OP \-labelwidget labelWidget LabelWidget
The name of a widget to use for the label.
If set, overrides the \fB\-text\fR option.
diff --git a/doc/ttk_notebook.n b/doc/ttk_notebook.n
index 290a0c7..e2ae137 100644
--- a/doc/ttk_notebook.n
+++ b/doc/ttk_notebook.n
@@ -41,6 +41,9 @@ If fewer than four elements are specified,
\fIbottom\fR defaults to \fItop\fR,
\fIright\fR defaults to \fIleft\fR, and
\fItop\fR defaults to \fIleft\fR.
+In other words, a list of three numbers specify the left, vertical, and right padding;
+a list of two numbers specify the horizontal and the vertical padding;
+a single number specifies the same padding all the way around the widget.
.OP \-width width Width
If present and greater than zero,
specifies the desired width of the pane area
diff --git a/doc/ttk_treeview.n b/doc/ttk_treeview.n
index 660b076..8399a09 100644
--- a/doc/ttk_treeview.n
+++ b/doc/ttk_treeview.n
@@ -45,6 +45,7 @@ and [\fBxy\fR]\fBview\fR widget commands.
.SO ttk_widget
\-class \-cursor \-takefocus
\-style \-xscrollcommand \-yscrollcommand
+\-padding
.SE
.SH "WIDGET-SPECIFIC OPTIONS"
.OP \-columns columns Columns
@@ -63,10 +64,6 @@ all columns are shown in the order given.
Specifies the number of rows which should be visible.
Note:
the requested width is determined from the sum of the column widths.
-.OP \-padding padding Padding
-Specifies the internal padding for the widget.
-The padding is a list of up to four length specifications;
-see \fBTtk_GetPaddingFromObj()\fR for details.
.OP \-selectmode selectMode SelectMode
Controls how the built-in class bindings manage the selection.
One of \fBextended\fR, \fBbrowse\fR, or \fBnone\fR.
diff --git a/doc/ttk_vsapi.n b/doc/ttk_vsapi.n
index 4d5c3eb..af63c39 100644
--- a/doc/ttk_vsapi.n
+++ b/doc/ttk_vsapi.n
@@ -34,6 +34,13 @@ Valid \fIoptions\fR are:
Specify the element's interior padding.
\fIpadding\fR is a list of up to four integers specifying
the left, top, right and bottom padding quantities respectively.
+If fewer than four elements are specified,
+\fIbottom\fR defaults to \fItop\fR,
+\fIright\fR defaults to \fIleft\fR, and
+\fItop\fR defaults to \fIleft\fR.
+In other words, a list of three numbers specify the left, vertical, and right padding;
+a list of two numbers specify the horizontal and the vertical padding;
+a single number specifies the same padding all the way around the widget.
This option may not be mixed with any other options.
.TP
\fB\-margins \fIpadding\fR
diff --git a/doc/ttk_widget.n b/doc/ttk_widget.n
index 2ecc29f..d362bba 100644
--- a/doc/ttk_widget.n
+++ b/doc/ttk_widget.n
@@ -71,24 +71,6 @@ See the description of \fB\-xscrollcommand\fR above for details.
.SH "LABEL OPTIONS"
The following options are supported by labels, buttons,
and other button-like widgets:
-.OP \-text text Text
-Specifies a text string to be displayed inside the widget
-(unless overridden by \fB\-textvariable\fR).
-.OP \-textvariable textVariable Variable
-Specifies the name of a global variable whose value will be used
-in place of the \fB\-text\fR resource.
-.OP \-underline underline Underline
-If set, specifies the integer index (0-based) of a character to underline
-in the text string.
-The underlined character is used for mnemonic activation.
-.OP \-image image Image
-Specifies an image to display.
-This is a list of 1 or more elements.
-The first element is the default image name.
-The rest of the list is a sequence of \fIstatespec / value\fR pairs
-as per \fBstyle map\fR, specifying different images to use when
-the widget is in a particular state or combination of states.
-All images in the list should have the same size.
.OP \-compound compound Compound
Specifies how to display the image relative to the text,
in the case both \fB\-text\fR and \fB\-image\fR are present.
@@ -108,6 +90,35 @@ Display image above, below, left of, or right of the text, respectively.
.IP none
The default; display the image if present, otherwise the text.
.RE
+.OP \-image image Image
+Specifies an image to display.
+This is a list of 1 or more elements.
+The first element is the default image name.
+The rest of the list is a sequence of \fIstatespec / value\fR pairs
+as per \fBstyle map\fR, specifying different images to use when
+the widget is in a particular state or combination of states.
+All images in the list should have the same size.
+.OP \-padding padding Padding
+Specifies the internal padding for the widget.
+The padding is a list of up to four length specifications
+\fIleft top right bottom\fR.
+If fewer than four elements are specified,
+\fIbottom\fR defaults to \fItop\fR,
+\fIright\fR defaults to \fIleft\fR, and
+\fItop\fR defaults to \fIleft\fR.
+In other words, a list of three numbers specify the left, vertical, and right padding;
+a list of two numbers specify the horizontal and the vertical padding;
+a single number specifies the same padding all the way around the widget.
+.OP \-text text Text
+Specifies a text string to be displayed inside the widget
+(unless overridden by \fB\-textvariable\fR).
+.OP \-textvariable textVariable Variable
+Specifies the name of a global variable whose value will be used
+in place of the \fB\-text\fR resource.
+.OP \-underline underline Underline
+If set, specifies the integer index (0-based) of a character to underline
+in the text string.
+The underlined character is used for mnemonic activation.
.OP \-width width Width
If greater than zero, specifies how much space, in character widths,
to allocate for the text label.
diff --git a/generic/tkTextBTree.c b/generic/tkTextBTree.c
index db0d71a..c20c546 100644
--- a/generic/tkTextBTree.c
+++ b/generic/tkTextBTree.c
@@ -1439,7 +1439,7 @@ TkBTreeDeleteIndexRange(
prevNodePtr->nextPtr = curNodePtr->nextPtr;
}
parentPtr->numChildren--;
- ckfree(curNodePtr->numPixels);
+ ckfree(curNodePtr->numPixels);
ckfree(curNodePtr);
curNodePtr = parentPtr;
}
@@ -4186,7 +4186,7 @@ Rebalance(
treePtr->rootPtr = nodePtr->children.nodePtr;
treePtr->rootPtr->parentPtr = NULL;
DeleteSummaries(nodePtr->summaryPtr);
- ckfree(nodePtr->numPixels);
+ ckfree(nodePtr->numPixels);
ckfree(nodePtr);
}
return;
@@ -4276,7 +4276,7 @@ Rebalance(
nodePtr->nextPtr = otherPtr->nextPtr;
nodePtr->parentPtr->numChildren--;
DeleteSummaries(otherPtr->summaryPtr);
- ckfree(otherPtr->numPixels);
+ ckfree(otherPtr->numPixels);
ckfree(otherPtr);
continue;
}
diff --git a/macosx/tkMacOSXScrlbr.c b/macosx/tkMacOSXScrlbr.c
index 91cf112..6253fff 100644
--- a/macosx/tkMacOSXScrlbr.c
+++ b/macosx/tkMacOSXScrlbr.c
@@ -19,6 +19,13 @@
#define MIN_SCROLLBAR_VALUE 0
+/*
+ * Minimum slider length, in pixels (designed to make sure that the slider is
+ * always easy to grab with the mouse).
+ */
+
+#define MIN_SLIDER_LENGTH 5
+
/*Borrowed from ttkMacOSXTheme.c to provide appropriate scaling of scrollbar values.*/
#ifdef __LP64__
#define RangeToFactor(maximum) (((double) (INT_MAX >> 1)) / (maximum))
@@ -60,16 +67,14 @@ typedef struct ScrollbarMetrics {
} ScrollbarMetrics;
static ScrollbarMetrics metrics[2] = {
- {15, 54, 26, 14, 14, NSRegularControlSize}, /* kThemeScrollBarMedium */
- {11, 40, 20, 10, 10, NSSmallControlSize}, /* kThemeScrollBarSmall */
+ {15, 54, 26, 14, 14, kControlSizeNormal}, /* kThemeScrollBarMedium */
+ {11, 40, 20, 10, 10, kControlSizeSmall}, /* kThemeScrollBarSmall */
};
-
HIThemeTrackDrawInfo info = {
.version = 0,
.min = 0.0,
.max = 100.0,
.attributes = kThemeTrackShowThumb,
- .kind = kThemeScrollBarMedium,
};
@@ -107,7 +112,7 @@ TkpCreateScrollbar(
scrollPtr->troughGC = None;
scrollPtr->copyGC = None;
- Tk_CreateEventHandler(tkwin,ExposureMask|StructureNotifyMask|FocusChangeMask|ButtonPressMask|VisibilityChangeMask, ScrollbarEventProc, scrollPtr);
+ Tk_CreateEventHandler(tkwin,ExposureMask|StructureNotifyMask|FocusChangeMask|ButtonPressMask|ButtonReleaseMask|EnterWindowMask|LeaveWindowMask|VisibilityChangeMask, ScrollbarEventProc, scrollPtr);
return (TkScrollbar *) scrollPtr;
}
@@ -212,7 +217,8 @@ TkpDisplayScrollbar(
*----------------------------------------------------------------------
*/
-extern void
+
+ extern void
TkpComputeScrollbarGeometry(
register TkScrollbar *scrollPtr)
/* Scrollbar whose geometry may have
@@ -259,14 +265,12 @@ TkpComputeScrollbarGeometry(
if (scrollPtr->sliderLast > fieldLength) {
scrollPtr->sliderLast = fieldLength;
}
- if (!(MOUNTAIN_LION_STYLE)) {
- scrollPtr->sliderFirst += scrollPtr->inset +
- metrics[variant].topArrowHeight;
- scrollPtr->sliderLast += scrollPtr->inset +
- metrics[variant].bottomArrowHeight;
- }
- /*
- * Register the desired geometry for the window (leave enough space
+
+ scrollPtr->sliderFirst += scrollPtr->arrowLength + scrollPtr->inset;
+ scrollPtr->sliderLast += scrollPtr->arrowLength + scrollPtr->inset;
+
+
+ /* Register the desired geometry for the window (leave enough space
* for the two arrows plus a minimum-size slider, plus border around
* the whole window, if any). Then arrange for the window to be
* redisplayed.
@@ -281,6 +285,9 @@ TkpComputeScrollbarGeometry(
}
+
+
+
/*
*----------------------------------------------------------------------
*
@@ -376,21 +383,22 @@ TkpScrollbarPosition(
register const int arrowSize = scrollPtr->arrowLength + inset;
if (scrollPtr->vertical) {
- length = Tk_Height(scrollPtr->tkwin);
- fieldlength = length - 2 * arrowSize;
- width = Tk_Width(scrollPtr->tkwin);
+ length = Tk_Height(scrollPtr->tkwin);
+ fieldlength = length - 2 * arrowSize;
+ width = Tk_Width(scrollPtr->tkwin);
} else {
- tmp = x;
- x = y;
- y = tmp;
- length = Tk_Width(scrollPtr->tkwin);
- fieldlength = length - 2 * arrowSize;
- width = Tk_Height(scrollPtr->tkwin);
+ tmp = x;
+ x = y;
+ y = tmp;
+ length = Tk_Width(scrollPtr->tkwin);
+ fieldlength = length - 2 * arrowSize;
+ width = Tk_Height(scrollPtr->tkwin);
}
+
fieldlength = fieldlength < 0 ? 0 : fieldlength;
if (x<inset || x>=width-inset || y<inset || y>=length-inset) {
- return OUTSIDE;
+ return OUTSIDE;
}
/*
@@ -399,18 +407,19 @@ TkpScrollbarPosition(
*/
if (y < scrollPtr->sliderFirst) {
- return TOP_GAP;
+ return TOP_GAP;
}
if (y < scrollPtr->sliderLast) {
- return SLIDER;
+ return SLIDER;
}
if (y < fieldlength){
- return BOTTOM_GAP;
+ return BOTTOM_GAP;
}
if (y < fieldlength + arrowSize) {
- return TOP_ARROW;
+ return TOP_ARROW;
}
return BOTTOM_ARROW;
+
}
/*
@@ -458,7 +467,7 @@ UpdateControlValues(
width = contrlRect.size.width;
height = contrlRect.size.height;
- variant = contrlRect.size.width < metrics[0].width ? 1 : 0;
+ variant = contrlRect.size.width < metrics[0].width ? 1 : 0;
/*
* Ensure we set scrollbar control bounds only once all size adjustments
@@ -514,8 +523,8 @@ UpdateControlValues(
*
* ScrollbarPress --
*
- * This procedure is invoked in response to <ButtonPress> events.
- * Enters a modal loop to handle scrollbar interactions.
+ * This procedure is invoked in response to <ButtonPress>, <ButtonRelease>,
+ * <EnterNotify>, and <LeaveNotify> events. Scrollbar appearance is modified.
*
*--------------------------------------------------------------
*/
@@ -526,6 +535,13 @@ ScrollbarPress(TkScrollbar *scrollPtr, XEvent *eventPtr)
if (eventPtr->type == ButtonPress) {
UpdateControlValues(scrollPtr);
+ info.trackInfo.scrollbar.pressState = 1;
+ }
+ if (eventPtr->type == EnterNotify) {
+ info.trackInfo.scrollbar.pressState = 1;
+ }
+ if (eventPtr->type == ButtonRelease || eventPtr->type == LeaveNotify) {
+ info.trackInfo.scrollbar.pressState = 0;
}
return TCL_OK;
}
@@ -566,6 +582,9 @@ ScrollbarEventProc(
TkScrollbarEventuallyRedraw(scrollPtr);
break;
case ButtonPress:
+ case ButtonRelease:
+ case EnterNotify:
+ case LeaveNotify:
ScrollbarPress(clientData, eventPtr);
break;
default:
diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c
index 39990e6..75473bf 100644
--- a/macosx/tkMacOSXWm.c
+++ b/macosx/tkMacOSXWm.c
@@ -2893,17 +2893,20 @@ WmProtocolCmd(
} else {
prevPtr->nextPtr = protPtr->nextPtr;
}
+ if (protPtr->command)
+ ckfree(protPtr->command);
Tcl_EventuallyFree(protPtr, TCL_DYNAMIC);
break;
}
}
cmd = Tcl_GetStringFromObj(objv[4], &cmdLength);
if (cmdLength > 0) {
- protPtr = ckalloc(HANDLER_SIZE(cmdLength));
+ protPtr = ckalloc(sizeof(ProtocolHandler));
protPtr->protocol = protocol;
protPtr->nextPtr = wmPtr->protPtr;
wmPtr->protPtr = protPtr;
protPtr->interp = interp;
+ protPtr->command = ckalloc(cmdLength+1);
strcpy(protPtr->command, cmd);
}
return TCL_OK;
diff --git a/macosx/tkMacOSXWm.h b/macosx/tkMacOSXWm.h
index 0a128ef..e904f50 100644
--- a/macosx/tkMacOSXWm.h
+++ b/macosx/tkMacOSXWm.h
@@ -29,15 +29,13 @@ typedef struct ProtocolHandler {
* same top-level window, or NULL for end of
* list. */
Tcl_Interp *interp; /* Interpreter in which to invoke command. */
- char command[]; /* Tcl command to invoke when a client message
+ char* command; /* Tcl command to invoke when a client message
* for this protocol arrives. The actual size
* of the structure varies to accommodate the
* needs of the actual command. THIS MUST BE
* THE LAST FIELD OF THE STRUCTURE. */
} ProtocolHandler;
-#define HANDLER_SIZE(cmdLength) \
-((unsigned) (sizeof(ProtocolHandler) + cmdLength + 1))
/*
* A data structure of the following type holds window-manager-related
diff --git a/xlib/xgc.c b/xlib/xgc.c
index 78c7501..984c949 100644
--- a/xlib/xgc.c
+++ b/xlib/xgc.c
@@ -560,7 +560,7 @@ XDrawSegments(
XSegment *segments,
int nsegments)
{
- return Success;
+ return BadDrawable;
}
#endif