summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-01-28 11:07:35 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-01-28 11:07:35 (GMT)
commit9801d3f9faf234f0e6f8a9045dc1a8376696258b (patch)
tree6ad2cd763f02fefa9a93ec0ba7eb7df1fd0d5394 /generic
parent25fc9b01d247c1a32fc662dfb85bafe051ae167b (diff)
parented0a2a5b2bdcb0bacd90a00c5f95bc1c2d7b8b45 (diff)
downloadtk-9801d3f9faf234f0e6f8a9045dc1a8376696258b.zip
tk-9801d3f9faf234f0e6f8a9045dc1a8376696258b.tar.gz
tk-9801d3f9faf234f0e6f8a9045dc1a8376696258b.tar.bz2
Merge trunk
Diffstat (limited to 'generic')
-rw-r--r--generic/tkCanvText.c6
-rw-r--r--generic/tkCanvas.c23
-rw-r--r--generic/tkConfig.c15
-rw-r--r--generic/tkEntry.c6
-rw-r--r--generic/tkMain.c6
-rw-r--r--generic/tkMenu.h4
-rw-r--r--generic/tkText.c5
-rw-r--r--generic/ttk/ttkEntry.c8
-rw-r--r--generic/ttk/ttkTrack.c4
9 files changed, 43 insertions, 34 deletions
diff --git a/generic/tkCanvText.c b/generic/tkCanvText.c
index 6d7a91b..f260f8a 100644
--- a/generic/tkCanvText.c
+++ b/generic/tkCanvText.c
@@ -1383,9 +1383,9 @@ GetTextIndex(
TextItem *textPtr = (TextItem *) itemPtr;
TkSizeT length;
int c;
- TkCanvas *canvasPtr = (TkCanvas *) canvas;
Tk_CanvasTextInfo *textInfoPtr = textPtr->textInfoPtr;
const char *string = TkGetStringFromObj(obj, &length);
+ (void)canvas;
c = string[0];
@@ -1430,8 +1430,8 @@ GetTextIndex(
goto badIndex;
}
y = (int) ((tmp < 0) ? tmp - 0.5 : tmp + 0.5);
- x += canvasPtr->scrollX1 - (int) textPtr->drawOrigin[0];
- y += canvasPtr->scrollY1 - (int) textPtr->drawOrigin[1];
+ x -= (int) textPtr->drawOrigin[0];
+ y -= (int) textPtr->drawOrigin[1];
*indexPtr = Tk_PointToChar(textPtr->textLayout,
(int) (x*c - y*s), (int) (y*c + x*s));
} else if (Tcl_GetIntFromObj(NULL, obj, indexPtr) == TCL_OK) {
diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c
index 228803b..a153dd9 100644
--- a/generic/tkCanvas.c
+++ b/generic/tkCanvas.c
@@ -1459,9 +1459,22 @@ CanvasWidgetCmd(
FOR_EVERY_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto done) {
for (i = itemPtr->numTags-1; i >= 0; i--) {
if (itemPtr->tagPtr[i] == tag) {
- itemPtr->tagPtr[i] = itemPtr->tagPtr[itemPtr->numTags-1];
+
+ /*
+ * Don't shuffle the tags sequence: memmove the tags.
+ */
+
+ memmove((void *)(itemPtr->tagPtr + i),
+ itemPtr->tagPtr + i + 1,
+ (itemPtr->numTags - (i+1)) * sizeof(Tk_Uid));
itemPtr->numTags--;
- }
+
+ /*
+ * There must be no break here: all tags with the same name must
+ * be deleted.
+ */
+
+ }
}
}
break;
@@ -2582,7 +2595,7 @@ DrawCanvas(
TkCanvas *canvasPtr = (TkCanvas *)clientData;
Tk_Window tkwin;
Display *displayPtr;
- Tk_PhotoImageBlock blockPtr = {0};
+ Tk_PhotoImageBlock blockPtr = {0,0,0,0,0,0};
Window wid;
Tk_Item *itemPtr;
Pixmap pixmap = 0;
@@ -5301,7 +5314,9 @@ PickCurrentItem(
for (i = itemPtr->numTags-1; i >= 0; i--) {
if (itemPtr->tagPtr[i] == searchUids->currentUid)
/* then */ {
- itemPtr->tagPtr[i] = itemPtr->tagPtr[itemPtr->numTags-1];
+ memmove((void *)(itemPtr->tagPtr + i),
+ itemPtr->tagPtr + i + 1,
+ (itemPtr->numTags - (i+1)) * sizeof(Tk_Uid));
itemPtr->numTags--;
break;
}
diff --git a/generic/tkConfig.c b/generic/tkConfig.c
index e527eaa..457f388 100644
--- a/generic/tkConfig.c
+++ b/generic/tkConfig.c
@@ -677,11 +677,16 @@ DoObjConfig(
case TK_OPTION_STRING_TABLE: {
int newValue;
- if (Tcl_GetIndexFromObjStruct(interp, valuePtr,
- optionPtr->specPtr->clientData, sizeof(char *),
- optionPtr->specPtr->optionName+1, 0, &newValue) != TCL_OK) {
- return TCL_ERROR;
- }
+ if (nullOK && ObjectIsEmpty(valuePtr)) {
+ valuePtr = NULL;
+ newValue = -1;
+ } else {
+ if (Tcl_GetIndexFromObjStruct(interp, valuePtr,
+ optionPtr->specPtr->clientData, sizeof(char *),
+ optionPtr->specPtr->optionName+1, 0, &newValue) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ }
if (internalPtr != NULL) {
*((int *) oldInternalPtr) = *((int *) internalPtr);
*((int *) internalPtr) = newValue;
diff --git a/generic/tkEntry.c b/generic/tkEntry.c
index b36a163..23eb31d 100644
--- a/generic/tkEntry.c
+++ b/generic/tkEntry.c
@@ -3317,7 +3317,7 @@ EntryValidate(
* string). */
{
Tcl_Interp *interp = entryPtr->interp;
- int code, result;
+ int code, isOK;
code = Tcl_EvalEx(interp, cmd, -1, TCL_EVAL_GLOBAL | TCL_EVAL_DIRECT);
@@ -3339,7 +3339,7 @@ EntryValidate(
*/
if (Tcl_GetBooleanFromObj(interp, Tcl_GetObjResult(interp),
- &result) != TCL_OK) {
+ &isOK) != TCL_OK) {
Tcl_AddErrorInfo(interp,
"\n (invalid boolean result from validation command)");
Tcl_BackgroundException(interp, TCL_ERROR);
@@ -3348,7 +3348,7 @@ EntryValidate(
}
Tcl_ResetResult(interp);
- return (result ? TCL_OK : TCL_BREAK);
+ return (isOK ? TCL_OK : TCL_BREAK);
}
/*
diff --git a/generic/tkMain.c b/generic/tkMain.c
index 68b422a..e7600d3 100644
--- a/generic/tkMain.c
+++ b/generic/tkMain.c
@@ -55,12 +55,6 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr;
#include "tkMacOSXInt.h"
#endif
-/*
- * Further on, in UNICODE mode we just use Tcl_NewUnicodeObj, otherwise
- * NewNativeObj is needed (which provides proper conversion from native
- * encoding to UTF-8).
- */
-
static inline Tcl_Obj *
NewNativeObj(
TCHAR *string)
diff --git a/generic/tkMenu.h b/generic/tkMenu.h
index b759fb6..0b261e5 100644
--- a/generic/tkMenu.h
+++ b/generic/tkMenu.h
@@ -13,10 +13,6 @@
#ifndef _TKMENU
#define _TKMENU
-#ifndef _TK
-#include "tk.h"
-#endif
-
#ifndef _TKINT
#include "tkInt.h"
#endif
diff --git a/generic/tkText.c b/generic/tkText.c
index 0d7dcb1..807ea48 100644
--- a/generic/tkText.c
+++ b/generic/tkText.c
@@ -5401,11 +5401,6 @@ TextEditCmd(
* appending several thousand lines, we could attempt to pre-allocate a
* larger space).
*
- * Also the result is built up as a utf-8 string, but, if we knew we
- * wanted it as Unicode, we could potentially save a huge conversion by
- * building it up as Unicode directly. This could be as simple as
- * replacing Tcl_NewObj by Tcl_NewUnicodeObj.
- *
* Results:
* Tcl_Obj of string type containing the specified text. If the
* visibleOnly flag is set to 1, then only those characters which are not
diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c
index 72cf54e..9cc2821 100644
--- a/generic/ttk/ttkEntry.c
+++ b/generic/ttk/ttkEntry.c
@@ -677,8 +677,12 @@ static int EntryRevalidate(Tcl_Interp *dummy, Entry *entryPtr, VREASON reason)
static void EntryRevalidateBG(Entry *entryPtr, VREASON reason)
{
Tcl_Interp *interp = entryPtr->core.interp;
- if (EntryRevalidate(interp, entryPtr, reason) == TCL_ERROR) {
- Tcl_BackgroundException(interp, TCL_ERROR);
+ VMODE vmode = entryPtr->entry.validate;
+
+ if (EntryNeedsValidation(vmode, reason)) {
+ if (EntryRevalidate(interp, entryPtr, reason) == TCL_ERROR) {
+ Tcl_BackgroundException(interp, TCL_ERROR);
+ }
}
}
diff --git a/generic/ttk/ttkTrack.c b/generic/ttk/ttkTrack.c
index 6cedfd2..b9aa776 100644
--- a/generic/ttk/ttkTrack.c
+++ b/generic/ttk/ttkTrack.c
@@ -16,11 +16,11 @@
* and is normally set to the ACTIVE state unless another element
* is currently being pressed.
*
- * The active element becomes "pressed" on <ButtonPress> events,
+ * The active element becomes "pressed" on <Button> events,
* and remains "active" and "pressed" until the corresponding
* <ButtonRelease> event.
*
- * TODO: Handle "chords" properly (e.g., <B1-ButtonPress-2>)
+ * TODO: Handle "chords" properly (e.g., <B1-Button-2>)
*/
#include "tkInt.h"