summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpatthoyts <patthoyts@users.sourceforge.net>2010-01-09 00:48:36 (GMT)
committerpatthoyts <patthoyts@users.sourceforge.net>2010-01-09 00:48:36 (GMT)
commit0d5ee63431a40ebbe9d3a895d1ca2a3bb9a30cd0 (patch)
treeb96c64e99d40e9797e3a01fd72f2950b78e67200
parent7540b82fe0542de05038049569f2b6656338dd18 (diff)
downloadtk-0d5ee63431a40ebbe9d3a895d1ca2a3bb9a30cd0.zip
tk-0d5ee63431a40ebbe9d3a895d1ca2a3bb9a30cd0.tar.gz
tk-0d5ee63431a40ebbe9d3a895d1ca2a3bb9a30cd0.tar.bz2
TIP 360: Remove special handling of .help menu on X11.
Tk is the only toolkit to continue the Motif scheme of anchoring a Help menu to the extreme right of the menubar. This patch disables the special handling of the .help menu so that the help menu will be grouped with the other menu items as is common with other toolkits. The old behaviour can be restored by setting the option *Menu.useMotifHelp to true or by calling 'tk::classic::restore menu'. Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
-rw-r--r--ChangeLog4
-rw-r--r--doc/menu.n14
-rw-r--r--library/obsolete.tcl3
-rw-r--r--unix/tkUnixMenu.c14
4 files changed, 28 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 77c388a..aae7b06 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2010-01-09 Pat Thoyts <patthoyts@users.sourceforge.net>
+ * doc/menu.n: [TIP 360]: Remove special handling of
+ * library/obsolete.tcl: the .help menu on X11.
+ * unix/tkUnixMenu.c:
+
* library/menu.tcl: [TIP 360] Make Tk menu activation
* library/obsolete.tcl: follow mouse movements.
diff --git a/doc/menu.n b/doc/menu.n
index 20a1059..6046f7c 100644
--- a/doc/menu.n
+++ b/doc/menu.n
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
-'\" RCS: @(#) $Id: menu.n,v 1.31 2009/10/18 16:25:51 dkf Exp $
+'\" RCS: @(#) $Id: menu.n,v 1.32 2010/01/09 00:48:36 patthoyts Exp $
'\"
.so man.macros
.TH menu n 4.1 Tk "Tk Built-In Commands"
@@ -233,7 +233,8 @@ to system restrictions.
Certain menus in a menubar will be treated specially. On the Macintosh,
access to the special Application, Window and Help menus is provided. On
Windows, access to the Windows System menu in each window is provided.
-On X Windows, a special right-justified help menu is provided. In all
+On X Windows, a special right-justified help menu may be provided if
+Motif menu compatibility is enabled. In all
cases, these menus must be created with the command name of the menubar
menu concatenated with the special name. So for a menubar named
\.menubar, on the Macintosh, the special menus would be .menubar.apple,
@@ -270,8 +271,11 @@ Alt+Spacebar. Due to limitations in the Windows API, any font changes,
colors, images, bitmaps, or tearoff images will not appear in the
system menu.
.PP
-When Tk see a Help menu on X Windows, the menu is moved to be last in
-the menubar and is right justified.
+When Tk sees a Help menu on X Windows and Motif menu compatibility is
+enabled the menu is moved to be last in the menubar and is right
+justified. Motif menu compatibility is enabled by setting the Tk option
+\fB*Menu.useMotifHelp\fR to true or by calling
+\fBtk::classic::restore menu\fR.
.SH "CLONES"
.PP
When a menu is set as a menubar for a toplevel window, or when a menu
@@ -281,7 +285,7 @@ configuration of the original are reflected in the
clone. Additionally, any cascades that are pointed to are also cloned
so that menu traversal will work right. Clones are destroyed when
either the tearoff or menubar goes away, or when the original menu is
-destroyed.
+destroyed.
.SH "WIDGET COMMAND"
.PP
The \fBmenu\fR command creates a new Tcl command whose
diff --git a/library/obsolete.tcl b/library/obsolete.tcl
index fe19367..64852d8 100644
--- a/library/obsolete.tcl
+++ b/library/obsolete.tcl
@@ -3,7 +3,7 @@
# This file contains obsolete procedures that people really shouldn't
# be using anymore, but which are kept around for backward compatibility.
#
-# RCS: @(#) $Id: obsolete.tcl,v 1.5 2010/01/09 00:43:46 patthoyts Exp $
+# RCS: @(#) $Id: obsolete.tcl,v 1.6 2010/01/09 00:48:36 patthoyts Exp $
#
# Copyright (c) 1994 The Regents of the University of California.
# Copyright (c) 1994 Sun Microsystems, Inc.
@@ -118,6 +118,7 @@ proc ::tk::classic::restore_menu {args} {
option add *Menu.activeBorderWidth 2 $prio; # 1
option add *Menu.borderWidth 2 $prio; # 1
option add *Menu.clickToFocus true $prio
+ option add *Menu.useMotifHelp true $prio
}
if {[tk windowingsystem] ne "aqua"} {
option add *Menu.font "TkDefaultFont" $prio; # "TkMenuFont"
diff --git a/unix/tkUnixMenu.c b/unix/tkUnixMenu.c
index 9becd73..f7611d2 100644
--- a/unix/tkUnixMenu.c
+++ b/unix/tkUnixMenu.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkUnixMenu.c,v 1.23 2009/01/28 20:47:49 nijtmans Exp $
+ * RCS: @(#) $Id: tkUnixMenu.c,v 1.24 2010/01/09 00:48:36 patthoyts Exp $
*/
#include "default.h"
@@ -1262,6 +1262,18 @@ SetHelpMenu(
TkMenu *menuPtr) /* The menu we are checking */
{
TkMenuEntry *cascadeEntryPtr;
+ int useMotifHelp = 0;
+ const char *option = NULL;
+ if (menuPtr->tkwin) {
+ option = Tk_GetOption(menuPtr->tkwin, "useMotifHelp", "UseMotifHelp");
+ if (option != NULL) {
+ Tcl_GetBoolean(NULL, option, &useMotifHelp);
+ }
+ }
+
+ if (!useMotifHelp) {
+ return;
+ }
for (cascadeEntryPtr = menuPtr->menuRefPtr->parentEntryPtr;
cascadeEntryPtr != NULL;