summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2019-11-01 20:57:15 (GMT)
committerfvogel <fvogelnew1@free.fr>2019-11-01 20:57:15 (GMT)
commitff9f71c974f69fc7957ea48b687ed49aa1d2548e (patch)
tree99f60aef70044656a3d18326129839bb63514d53
parent7843d440f23b0627f128c63a083f12c77211442f (diff)
parentc8a03246258dcb64fa73c5692e8fcfbcfef60b36 (diff)
downloadtk-ff9f71c974f69fc7957ea48b687ed49aa1d2548e.zip
tk-ff9f71c974f69fc7957ea48b687ed49aa1d2548e.tar.gz
tk-ff9f71c974f69fc7957ea48b687ed49aa1d2548e.tar.bz2
merge core-8-6-branch, in particular, push a different fix for the 'Column ... out of range' error reported in [caacf1f082], this time without any regression...
-rw-r--r--library/ttk/treeview.tcl15
-rw-r--r--macosx/tkMacOSXKeyEvent.c6
-rw-r--r--macosx/tkMacOSXKeyboard.c2
-rw-r--r--unix/tkUnixFont.c2
-rw-r--r--unix/tkUnixKey.c2
-rw-r--r--win/tkWinFont.c2
-rw-r--r--win/tkWinKey.c2
-rw-r--r--xlib/X11/Xlib.h4
8 files changed, 21 insertions, 14 deletions
diff --git a/library/ttk/treeview.tcl b/library/ttk/treeview.tcl
index 3230755..ebf1451 100644
--- a/library/ttk/treeview.tcl
+++ b/library/ttk/treeview.tcl
@@ -120,9 +120,18 @@ proc ttk::treeview::ActivateHeading {w heading} {
variable State
if {$w != $State(activeWidget) || $heading != $State(activeHeading)} {
- if {[winfo exists $State(activeWidget)] && $State(activeHeading) != {}
- && $State(activeHeading) in [$State(activeWidget) cget -displaycolumns]} {
- $State(activeWidget) heading $State(activeHeading) state !active
+ if {[winfo exists $State(activeWidget)] && $State(activeHeading) != {}} {
+ # It may happen that $State(activeHeading) no longer corresponds
+ # to an existing display column. This happens for instance when
+ # changing -displaycolumns in a bound script when this change
+ # triggers a <Leave> event. A proc checking if the display column
+ # $State(activeHeading) is really still present or not could be
+ # written but it would need to check several special cases:
+ # a. -displaycolumns "#all" or being an explicit columns list
+ # b. column #0 display is not governed by the -displaycolumn
+ # list but by the value of the -show option
+ # --> Let's rather catch the following line.
+ catch {$State(activeWidget) heading $State(activeHeading) state !active}
}
if {$heading != {}} {
$w heading $heading state active
diff --git a/macosx/tkMacOSXKeyEvent.c b/macosx/tkMacOSXKeyEvent.c
index fd9e122..b3c1041 100644
--- a/macosx/tkMacOSXKeyEvent.c
+++ b/macosx/tkMacOSXKeyEvent.c
@@ -603,17 +603,15 @@ setupXEvent(XEvent *xEvent, NSWindow *w, unsigned int state)
memset(xEvent, 0, sizeof(XEvent));
xEvent->xany.serial = LastKnownRequestProcessed(Tk_Display(tkwin));
- xEvent->xany.send_event = false;
xEvent->xany.display = Tk_Display(tkwin);
xEvent->xany.window = Tk_WindowId(tkwin);
xEvent->xkey.root = XRootWindow(Tk_Display(tkwin), 0);
- xEvent->xkey.subwindow = None;
xEvent->xkey.time = TkpGetMS();
xEvent->xkey.state = state;
xEvent->xkey.same_screen = true;
- xEvent->xkey.trans_chars[0] = 0;
- xEvent->xkey.nbytes = 0;
+ /* No need to initialize other fields implicitly here,
+ * because of the memset() above. */
}
#pragma mark -
diff --git a/macosx/tkMacOSXKeyboard.c b/macosx/tkMacOSXKeyboard.c
index 1b44b21..e91dfe2 100644
--- a/macosx/tkMacOSXKeyboard.c
+++ b/macosx/tkMacOSXKeyboard.c
@@ -720,7 +720,7 @@ TkpSetKeycodeAndState(
}
if (keysym <= LATIN1_MAX) {
- int done = Tcl_UniCharToUtf(keysym, eventPtr->xkey.trans_chars);
+ int done = TkUniCharToUtf(keysym, eventPtr->xkey.trans_chars);
eventPtr->xkey.trans_chars[done] = 0;
} else {
diff --git a/unix/tkUnixFont.c b/unix/tkUnixFont.c
index 3c1ce65..d352c16 100644
--- a/unix/tkUnixFont.c
+++ b/unix/tkUnixFont.c
@@ -520,7 +520,7 @@ Ucs2beToUtfProc(
* UCS-2BE. We know this is an LE->BE swap.
*/
- dst += Tcl_UniCharToUtf(htons(*((short *)src)), dst);
+ dst += TkUniCharToUtf(htons(*((short *)src)), dst);
src += 2 /* sizeof(UCS-2) */;
}
diff --git a/unix/tkUnixKey.c b/unix/tkUnixKey.c
index cbba7bb..fa93edc 100644
--- a/unix/tkUnixKey.c
+++ b/unix/tkUnixKey.c
@@ -208,7 +208,7 @@ TkpGetString(
Tcl_DStringValue(&buf)[len] = '\0';
if (len == 1) {
- len = Tcl_UniCharToUtf((unsigned char) Tcl_DStringValue(&buf)[0],
+ len = TkUniCharToUtf((unsigned char) Tcl_DStringValue(&buf)[0],
Tcl_DStringValue(dsPtr));
Tcl_DStringSetLength(dsPtr, len);
} else {
diff --git a/win/tkWinFont.c b/win/tkWinFont.c
index 11385ed..e4f0624 100644
--- a/win/tkWinFont.c
+++ b/win/tkWinFont.c
@@ -2232,7 +2232,7 @@ FontMapLoadPage(
end = (row + 1) << FONTMAP_SHIFT;
for (i = row << FONTMAP_SHIFT; i < end; i++) {
if (Tcl_UtfToExternal(NULL, encoding, src,
- Tcl_UniCharToUtf(i, src), TCL_ENCODING_STOPONERROR, NULL,
+ TkUniCharToUtf(i, src), TCL_ENCODING_STOPONERROR, NULL,
buf, sizeof(buf), NULL, NULL, NULL) != TCL_OK) {
continue;
}
diff --git a/win/tkWinKey.c b/win/tkWinKey.c
index c3816bf..8a83874 100644
--- a/win/tkWinKey.c
+++ b/win/tkWinKey.c
@@ -124,7 +124,7 @@ TkpGetString(
if (((keysym != NoSymbol) && (keysym > 0) && (keysym < 256))
|| (keysym == XK_Return) || (keysym == XK_Tab)) {
- len = Tcl_UniCharToUtf(keysym & 255, buf);
+ len = TkUniCharToUtf(keysym & 255, buf);
Tcl_DStringAppend(dsPtr, buf, len);
}
}
diff --git a/xlib/X11/Xlib.h b/xlib/X11/Xlib.h
index e1ae7f1..44f556f 100644
--- a/xlib/X11/Xlib.h
+++ b/xlib/X11/Xlib.h
@@ -589,7 +589,7 @@ typedef struct _XDisplay {
#endif
#ifndef _XEVENT_
-#define XMaxTransChars 4
+#define XMaxTransChars 7
/*
* Definitions of specific events.
@@ -610,7 +610,7 @@ typedef struct {
Bool same_screen; /* same screen flag */
char trans_chars[XMaxTransChars];
/* translated characters */
- int nbytes;
+ unsigned char nbytes;
} XKeyEvent;
typedef XKeyEvent XKeyPressedEvent;
typedef XKeyEvent XKeyReleasedEvent;