summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2022-07-25 17:25:13 (GMT)
committerfvogel <fvogelnew1@free.fr>2022-07-25 17:25:13 (GMT)
commit83d71fc1223c8932fc9e7c60d40d69c89542547a (patch)
tree832bedf285ca37d75d820f3d90b4dc43874256a6
parent7accee52915d46a0545442572d54cf7617d7e40d (diff)
parent887d17ec286ccdec5fcd757986a4222429bfd040 (diff)
downloadtk-83d71fc1223c8932fc9e7c60d40d69c89542547a.zip
tk-83d71fc1223c8932fc9e7c60d40d69c89542547a.tar.gz
tk-83d71fc1223c8932fc9e7c60d40d69c89542547a.tar.bz2
merge 8.6
-rw-r--r--compat/stdlib.h23
-rw-r--r--compat/unistd.h12
-rw-r--r--doc/menubutton.n2
-rw-r--r--library/menu.tcl32
-rw-r--r--library/ttk/menubutton.tcl13
5 files changed, 36 insertions, 46 deletions
diff --git a/compat/stdlib.h b/compat/stdlib.h
index 2c64890..2f7eaf4 100644
--- a/compat/stdlib.h
+++ b/compat/stdlib.h
@@ -3,9 +3,9 @@
*
* Declares facilities exported by the "stdlib" portion of the C library.
* This file isn't complete in the ANSI-C sense; it only declares things
- * that are needed by Tk. This file is needed even on many systems with
+ * that are needed by Tcl. This file is needed even on many systems with
* their own stdlib.h (e.g. SunOS) because not all stdlib.h files declare
- * all the procedures needed here (such as strtod).
+ * all the procedures needed here (such as strtol/strtoul).
*
* Copyright (c) 1991 The Regents of the University of California.
* Copyright (c) 1994-1998 Sun Microsystems, Inc.
@@ -17,23 +17,22 @@
#ifndef _STDLIB
#define _STDLIB
-#ifndef _TCL
-# include <tcl.h>
-#endif
-
extern void abort(void);
extern double atof(const char *string);
extern int atoi(const char *string);
extern long atol(const char *string);
-extern char * calloc(unsigned int numElements, unsigned int size);
+extern void * calloc(unsigned long numElements, unsigned long size);
extern void exit(int status);
-extern int free(char *blockPtr);
+extern void free(void *blockPtr);
extern char * getenv(const char *name);
-extern char * malloc(unsigned int numBytes);
-extern void qsort(void *base, int n, int size, int (*compar)(
+extern void * malloc(unsigned long numBytes);
+extern void qsort(void *base, unsigned long n, unsigned long size, int (*compar)(
const void *element1, const void *element2));
-extern char * realloc(char *ptr, unsigned int numBytes);
-extern double strtod(const char *string, char **endPtr);
+extern void * realloc(void *ptr, unsigned long numBytes);
+extern char * realpath(const char *path, char *resolved_path);
+extern int mkstemps(char *templ, int suffixlen);
+extern int mkstemp(char *templ);
+extern char * mkdtemp(char *templ);
extern long strtol(const char *string, char **endPtr, int base);
extern unsigned long strtoul(const char *string, char **endPtr, int base);
diff --git a/compat/unistd.h b/compat/unistd.h
index be966cc..1725590 100644
--- a/compat/unistd.h
+++ b/compat/unistd.h
@@ -15,12 +15,9 @@
#define _UNISTD
#include <sys/types.h>
-#ifndef _TCL
-# include <tcl.h>
-#endif
#ifndef NULL
-#define NULL 0
+# define NULL 0
#endif
/*
@@ -38,9 +35,9 @@ extern int dup2(int oldfd, int newfd);
extern int execl(const char *path, ...);
extern int execle(const char *path, ...);
extern int execlp(const char *file, ...);
-extern int execv(const char *path, char **argv);
-extern int execve(const char *path, char **argv, char **envp);
-extern int execvp(const char *file, char **argv);
+extern int execv(const char *path, char *const argv[]);
+extern int execve(const char *path, char *const argv[], char *const *envp);
+extern int execvp(const char *file, char *const argv[]);
extern pid_t fork(void);
extern char * getcwd(char *buf, size_t size);
extern gid_t getegid(void);
@@ -77,4 +74,3 @@ extern int vfork(void);
#endif /* _POSIX_SOURCE */
#endif /* _UNISTD */
-
diff --git a/doc/menubutton.n b/doc/menubutton.n
index 1f596ce..5696794 100644
--- a/doc/menubutton.n
+++ b/doc/menubutton.n
@@ -24,7 +24,7 @@ menubutton \- Create and manipulate 'menubutton' pop-up menu indicator widgets
\-compound \-justify \-wraplength
.SE
.SH "WIDGET-SPECIFIC OPTIONS"
-.OP \-direction direction Height
+.OP \-direction direction Direction
Specifies where the menu is going to be popup up. \fBabove\fR tries to
pop the menu above the menubutton. \fBbelow\fR tries to pop the menu
below the menubutton. \fBleft\fR tries to pop the menu to the left of
diff --git a/library/menu.tcl b/library/menu.tcl
index 4fce551..deca485 100644
--- a/library/menu.tcl
+++ b/library/menu.tcl
@@ -285,7 +285,7 @@ proc ::tk::MbPost {w {x {}} {y {}}} {
GenerateMenuSelect $menu
update idletasks
- if {[catch {PostMenubuttonMenu $w $menu} msg opt]} {
+ if {[catch {PostMenubuttonMenu $w $menu $x $y} msg opt]} {
# Error posting menu (e.g. bogus -postcommand). Unpost it and
# reflect the error.
MenuUnpost {}
@@ -1138,7 +1138,7 @@ proc ::tk::MenuFindName {menu s} {
# side. On other platforms the entry is centered over the button.
if {[tk windowingsystem] eq "aqua"} {
- proc ::tk::PostMenubuttonMenu {button menu} {
+ proc ::tk::PostMenubuttonMenu {button menu cx cy} {
set entry ""
if {[$button cget -indicatoron]} {
set entry [MenuFindName $menu [$button cget -text]]
@@ -1163,14 +1163,14 @@ if {[tk windowingsystem] eq "aqua"} {
right {
incr x [winfo width $button]
}
- default {
+ default { # flush
incr x [expr {[winfo width $button] - [winfo reqwidth $menu] - 5}]
}
}
PostOverPoint $menu $x $y $entry
}
} else {
- proc ::tk::PostMenubuttonMenu {button menu} {
+ proc ::tk::PostMenubuttonMenu {button menu cx cy} {
set entry ""
if {[$button cget -indicatoron]} {
set entry [MenuFindName $menu [$button cget -text]]
@@ -1201,22 +1201,24 @@ if {[tk windowingsystem] eq "aqua"} {
set entry {}
}
left {
- # It is not clear why this is needed.
- if {[tk windowingsystem] eq "win32"} {
- incr x [expr {-4 - [winfo reqwidth $button] / 2}]
- }
incr x [expr {- [winfo reqwidth $menu]}]
}
right {
incr x [expr {[winfo width $button]}]
}
- default {
- if {[$button cget -indicatoron]} {
- incr x [expr {([winfo width $button] - \
- [winfo reqwidth $menu])/ 2}]
- } else {
- incr y [winfo height $button]
- }
+ default { # flush
+ if {[$button cget -indicatoron]} {
+ if {$cx ne ""} {
+ set x [expr {$cx - [winfo reqwidth $menu] / 2}]
+ set l [font metrics [$menu cget -font] -linespace]
+ set y [expr {$cy - $l/2 - 2}]
+ } else {
+ incr x [expr {([winfo width $button] - \
+ [winfo reqwidth $menu])/ 2}]
+ }
+ } else {
+ incr y [winfo height $button]
+ }
}
}
PostOverPoint $menu $x $y $entry
diff --git a/library/ttk/menubutton.tcl b/library/ttk/menubutton.tcl
index a0f70c9..fc0ea02 100644
--- a/library/ttk/menubutton.tcl
+++ b/library/ttk/menubutton.tcl
@@ -82,7 +82,6 @@ if {[tk windowingsystem] eq "aqua"} {
set bbh [expr {[winfo height $mb]} + $bevelPad]
set mw [winfo reqwidth $menu]
set bw [winfo width $mb]
- set dF [expr {[winfo width $mb] - [winfo reqwidth $menu] - $menuPad}]
set entry [::tk::MenuFindName $menu [$mb cget -text]]
if {$entry < 0} {
set entry 0
@@ -106,7 +105,7 @@ if {[tk windowingsystem] eq "aqua"} {
incr y $menuPad
incr x $bw
}
- default {
+ default { # flush
incr y $bbh
}
}
@@ -118,7 +117,6 @@ if {[tk windowingsystem] eq "aqua"} {
set bh [expr {[winfo height $mb]}]
set mw [expr {[winfo reqwidth $menu]}]
set bw [expr {[winfo width $mb]}]
- set dF [expr {[winfo width $mb] - [winfo reqwidth $menu]}]
if {[tk windowingsystem] eq "win32"} {
incr mh 6
incr mw 16
@@ -154,13 +152,8 @@ if {[tk windowingsystem] eq "aqua"} {
right {
incr x $bw
}
- default {
- if {[$mb cget -style] eq ""} {
- incr x [expr {([winfo width $mb] - \
- [winfo reqwidth $menu])/ 2}]
- } else {
- incr y $bh
- }
+ default { # flush
+ incr x [expr {([winfo width $mb] - [winfo reqwidth $menu])/ 2}]
}
}
return [list $x $y $entry]