From owner-freebsd-ports Wed Sep 3 11:58:25 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id LAA29977 for ports-outgoing; Wed, 3 Sep 1997 11:58:25 -0700 (PDT) Received: from pahtoh.cwu.edu (root@pahtoh.cwu.edu [198.104.65.27]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id LAA29972 for ; Wed, 3 Sep 1997 11:58:18 -0700 (PDT) Received: from opus.cts.cwu.edu (skynyrd@opus.cts.cwu.edu [198.104.92.71]) by pahtoh.cwu.edu (8.8.5/8.8.5) with ESMTP id LAA18817 for ; Wed, 3 Sep 1997 11:58:16 -0700 (PDT) Received: from localhost (skynyrd@localhost) by opus.cts.cwu.edu (8.8.7/8.8.5) with SMTP id LAA20269 for ; Wed, 3 Sep 1997 11:58:16 -0700 (PDT) Date: Wed, 3 Sep 1997 11:58:16 -0700 (PDT) From: Chris Timmons To: freebsd-ports@freebsd.org Subject: Tk8.0 patch Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-ports@freebsd.org X-Loop: FreeBSD.org Precedence: bulk I discovered this morning that tkined doesn't work under Tk8.0 because of a couple of buglets that made it into the Tk8.0 release. Here is a patch for Tk8.0 that I found while researching the problem - I'm going to test it here to make sure that it fixes tkined. Comments? If it works and doesn't obviously break something else should I update our port? -Chris [begin patch from comp.lang.tcl] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Patch for menu problems in Tk8.0 final ---------------------------------------------------------------------------- >From icepick@Eng.Sun.COM (Syd Polk) Organization Sun Microsystems Inc., Mountain View, CA Date 2 Sep 1997 18:44:35 GMT Newsgroups comp.lang.tcl Message-ID <5uhmqj$jkk$1@engnews2.Eng.Sun.COM> ---------------------------------------------------------------------------- Here is a patch for two problems with menus in the Tk 8.0 release: - tk_popup was putting up an error message saying "unknown command tk_menuSetFocus($menu)". - On Unix, cascade menus underneath menubars were broken. Actually, what happened is the overrideredirect flag is now being set incorrectly. The person who changed this is on vacation. However, I decided just to remove all dependencies on the overrideredirect flag from this file. Tk8.0 has explicit types for menus, so this flag is not needed to distinguish a tearoff from a non-tearoff. Syd Polk Menu Meister Sun Microsystems Laboratories *** /proj/tcl/dist/tk8.0/library/menu.tcl Wed Aug 13 11:19:53 1997 --- /home/icepick/projects/tk8.0/library/menu.tcl Tue Aug 26 14:29:47 1997 *************** *** 4,10 **** # It also implements keyboard traversal of menus and implements a few # other utility procedures related to menus. # ! # SCCS: @(#) menu.tcl 1.97 97/08/13 10:58:34 # # Copyright (c) 1992-1994 The Regents of the University of California. # Copyright (c) 1994-1997 Sun Microsystems, Inc. --- 4,10 ---- # It also implements keyboard traversal of menus and implements a few # other utility procedures related to menus. # ! # SCCS: @(#) menu.tcl 1.100 97/08/26 14:29:47 # # Copyright (c) 1992-1994 The Regents of the University of California. # Copyright (c) 1994-1997 Sun Microsystems, Inc. *************** *** 53,71 **** #------------------------------------------------------------------------- # Overall note: ! # This file is tricky because there are four different ways that menus # can be used: # ! # 1. As a pulldown from a menubutton. This is the most common usage. ! # In this style, the variable tkPriv(postedMb) identifies the posted ! # menubutton. # 2. As a torn-off menu copied from some other menu. In this style ! # tkPriv(postedMb) is empty, and the top-level menu is no ! # override-redirect. ! # 3. As an option menu, triggered from an option menubutton. In thi # style tkPriv(postedMb) identifies the posted menubutton. # 4. As a popup menu. In this style tkPriv(postedMb) is empty and ! # the top-level menu is override-redirect. # # The various binding procedures use the state described above to # distinguish the various cases and take different actions in each --- 53,71 ---- #------------------------------------------------------------------------- # Overall note: ! # This file is tricky because there are five different ways that menus # can be used: # ! # 1. As a pulldown from a menubutton. In this style, the variable ! # tkPriv(postedMb) identifies the posted menubutton. # 2. As a torn-off menu copied from some other menu. In this style ! # tkPriv(postedMb) is empty, and menu's type is "tearoff". ! # 3. As an option menu, triggered from an option menubutton. In this # style tkPriv(postedMb) identifies the posted menubutton. # 4. As a popup menu. In this style tkPriv(postedMb) is empty and ! # the top-level menu's type is "normal". ! # 5. As a pulldown from a menubar. The variable tkPriv(menubar) has ! # the owning menubar, and the menu itself is of type "normal". # # The various binding procedures use the state described above to # distinguish the various cases and take different actions in each *************** *** 391,398 **** $tkPriv(popup) unpost set tkPriv(popup) {} } elseif {(!([$menu cget -type] == "menubar") ! && !([$menu cget -type] == "tearoff")) ! || [wm overrideredirect $menu]} { # We're in a cascaded sub-menu from a torn-off menu or popup. # Unpost all the menus up to the toplevel one (but not # including the top-level torn-off one) and deactivate the --- 391,397 ---- $tkPriv(popup) unpost set tkPriv(popup) {} } elseif {(!([$menu cget -type] == "menubar") ! && !([$menu cget -type] == "tearoff"))} { # We're in a cascaded sub-menu from a torn-off menu or popup. # Unpost all the menus up to the toplevel one (but not # including the top-level torn-off one) and deactivate the *************** *** 407,414 **** $parent activate none $parent postcascade none event generate $parent <> ! if {([$parent cget -type] == "menubar") ! || ![wm overrideredirect $parent]} { break } set menu $parent --- 406,413 ---- $parent activate none $parent postcascade none event generate $parent <> ! set type [$parent cget -type] ! if {($type == "menubar")|| ($type == "tearoff")} { break } set menu $parent *************** *** 551,558 **** if {$tkPriv(postedMb) != ""} { grab -global $tkPriv(postedMb) } else { ! while {(([$menu cget -type] != "menubar") ! && [wm overrideredirect $menu]) && ([winfo class [winfo parent $menu]] == "Menu") && [winfo ismapped [winfo parent $menu]]} { set menu [winfo parent $menu] --- 550,556 ---- if {$tkPriv(postedMb) != ""} { grab -global $tkPriv(postedMb) } else { ! while {([$menu cget -type] == "normal") && ([winfo class [winfo parent $menu]] == "Menu") && [winfo ismapped [winfo parent $menu]]} { set menu [winfo parent $menu] *************** *** 1187,1192 **** tkSaveGrabInfo $menu grab -global $menu set tkPriv(popup) $menu ! tk_menuSetFocus($menu); } } --- 1185,1190 ---- tkSaveGrabInfo $menu grab -global $menu set tkPriv(popup) $menu ! tk_menuSetFocus $menu } } -- Syd Polk - syd.polk@eng.sun.com Sun Microsystems Laboratories