To: vim-dev@vim.org Subject: Patch 5.4n.15 Fcc: outbox From: Bram Moolenaar ------------ Patch 5.4n.15 Problem: GTK: When using Alt-Key to use a menu, the key was also sent to Vim. Mostly this would cause a beep. Solution: Implement the use of 'winaltkeys' for GTK. Except for "no". Files: src/gui_gtk_x11.c, src/menu.c *** ../vim-5.4n/src/gui_gtk_x11.c Sun Jul 4 20:35:52 1999 --- src/gui_gtk_x11.c Wed Jul 7 20:24:40 1999 *************** *** 2380,2389 **** for (i = 0; i < len; ++i) string[i] = event->string[i]; - if (key_sym == GDK_space) string[0] = ' '; /* Otherwise Ctrl-Space doesn't work */ /* Check for Alt/Meta key (Mod1Mask) */ if (len == 1 && (event->state & GDK_MOD1_MASK) && !(key_sym == GDK_BackSpace || key_sym == GDK_Delete)) { --- 2388,2408 ---- for (i = 0; i < len; ++i) string[i] = event->string[i]; if (key_sym == GDK_space) string[0] = ' '; /* Otherwise Ctrl-Space doesn't work */ + #ifdef WANT_MENU + /* If there is a menu and 'wak' is "yes", or 'wak' is "menu" and the key + * is a menu shortcut, we ignore everything with the ALT modifier. */ + if ((event->state & GDK_MOD1_MASK) + && gui.menu_is_active + && (*p_wak == 'y' + || (*p_wak == 'm' + && len == 1 + && gui_is_menu_shortcut(string[0])))) + return TRUE; + #endif + /* Check for Alt/Meta key (Mod1Mask) */ if (len == 1 && (event->state & GDK_MOD1_MASK) && !(key_sym == GDK_BackSpace || key_sym == GDK_Delete)) { *** ../vim-5.4n/src/menu.c Sun Jul 4 20:35:55 1999 --- src/menu.c Wed Jul 7 19:48:15 1999 *************** *** 1316,1322 **** } } ! #if defined(USE_GUI_MSWIN) || defined(USE_GUI_MOTIF) || defined(PROTO) /* * Check if a key is used as a mnemonic for a toplevel menu. * Case of the key is ignored. --- 1316,1323 ---- } } ! #if defined(USE_GUI_MSWIN) || defined(USE_GUI_MOTIF) || defined(USE_GUI_GTK) \ ! || defined(PROTO) /* * Check if a key is used as a mnemonic for a toplevel menu. * Case of the key is ignored. -- TERRY GILLIAM PLAYED: PATSY (ARTHUR'S TRUSTY STEED), THE GREEN KNIGHT SOOTHSAYER, BRIDGEKEEPER, SIR GAWAIN (THE FIRST TO BE KILLED BY THE RABBIT) "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD --/-/---- Bram Moolenaar ---- Bram@moolenaar.net ---- Bram@vim.org ---\-\-- \ \ www.vim.org/iccf www.moolenaar.net www.vim.org / / .