To: [email protected]
Subject: patch 5.4o.5
Fcc: outbox
From: Bram Moolenaar <[email protected]>
------------

Patch 5.4o.5
Problem:    Motif version with Lesstif: When removing the menubar and then
           using a menu shortcut key, Vim would crash. (raf)
Solution:   Disable the menu mnemonics when the menu bar is removed.
Files:      src/gui_motif.c


*** ../vim-5.4o/src/gui_motif.c Sun Jul 11 20:10:52 1999
--- src/gui_motif.c     Tue Jul 13 16:59:50 1999
***************
*** 222,235 ****
--- 222,251 ----
 static void gui_mch_compute_menu_height __ARGS((Widget));
 static void gui_mch_submenu_colors __ARGS((VimMenu *mp));

+ static void do_set_mnemonics __ARGS((int enable));
+ static int mnemonics_enabled = TRUE;
+ static int menu_enabled = TRUE;
+
     void
 gui_mch_enable_menu(flag)
     int           flag;
 {
+     menu_enabled = flag;
+
+     /*
+      * Must disable menu mnemonics when the menu bar is disabled, Lesstif
+      * crashes when using a mnemonic then.
+      */
     if (flag)
+     {
       XtManageChild(menuBar);
+       do_set_mnemonics(mnemonics_enabled);
+     }
     else
+     {
       XtUnmanageChild(menuBar);
+       do_set_mnemonics(FALSE);
+     }
 }

 /* ARGSUSED */
***************
*** 252,257 ****
--- 268,287 ----
  */
     void
 gui_motif_set_mnemonics(enable)
+     int               enable;
+ {
+     mnemonics_enabled = enable;
+     /*
+      * Don't enable menu mnemonics when the menu bar is disabled, Lesstif
+      * crashes when using a mnemonic then.
+      */
+     if (!menu_enabled)
+       enable = FALSE;
+     do_set_mnemonics(enable);
+ }
+
+     static void
+ do_set_mnemonics(enable)
     int               enable;
 {
     VimMenu   *menu;

--
hundred-and-one symptoms of being an internet addict:
81. At social functions you introduce your husband as "my domain server."

--/-/---- Bram Moolenaar ---- [email protected] ---- [email protected] ---\-\--
 \ \    www.vim.org/iccf      www.moolenaar.net       www.vim.org    / /