From 14f741723a3016c1d616acf22f253a0d6aecc03b Mon Sep 17 00:00:00 2001 From: patthoyts Date: Sat, 9 Jan 2010 00:54:06 +0000 Subject: TIP 360: Remove special handling of the .help menu on X11. --- ChangeLog | 4 ++++ doc/menu.n | 30 +++++++++++++++++------------- library/obsolete.tcl | 3 ++- unix/tkUnixMenu.c | 14 +++++++++++++- 4 files changed, 36 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index f97127c..ec407ff 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2010-01-09 Pat Thoyts + * 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 70a4c99..b253089 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.23.2.2 2009/01/11 11:27:10 patthoyts Exp $ +'\" RCS: @(#) $Id: menu.n,v 1.23.2.3 2010/01/09 00:54:06 patthoyts Exp $ '\" .so man.macros .TH menu n 4.1 Tk "Tk Built-In Commands" @@ -230,15 +230,16 @@ menubars, they may not be drawn with indicators on some platforms, due to system restrictions. .SS "SPECIAL MENUS IN MENUBARS" .PP -Certain menus in a menubar will be treated specially. On the Macintosh, -access to the special Application 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 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 and .menubar.help; on Windows, -the special menu would be .menubar.system; on X Windows, the help -menu would be .menubar.help. +Certain menus in a menubar will be treated specially. On the +Macintosh, access to the special Application 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 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 and +.menubar.help; on Windows, the special menu would be .menubar.system; +on X Windows, the help menu would be .menubar.help. .PP When Tk sees a .menubar.apple menu on the Macintosh, that menu's contents make up the first items of the Application menu whenever the window @@ -258,8 +259,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 @@ -269,7 +273,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 b6cdc53..395d1b0 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.4.2.1 2010/01/09 00:51:38 patthoyts Exp $ +# RCS: @(#) $Id: obsolete.tcl,v 1.4.2.2 2010/01/09 00:54:06 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 0fcadb6..4529200 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.19 2007/12/13 15:28:50 dgp Exp $ + * RCS: @(#) $Id: tkUnixMenu.c,v 1.19.2.1 2010/01/09 00:54:06 patthoyts Exp $ */ #include "default.h" @@ -1264,6 +1264,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; -- cgit v0.12