summaryrefslogtreecommitdiff
path: root/src/xmenu.c
diff options
context:
space:
mode:
authorJan Djärv <jan.h.d@swipnet.se>2004-12-27 15:24:12 +0000
committerJan Djärv <jan.h.d@swipnet.se>2004-12-27 15:24:12 +0000
commit9f6fcdc51615be98d2a026c302868061045176ec (patch)
tree6eb484c1f70ce413f20d979a3adec8b5f6bcaa63 /src/xmenu.c
parente89f4e4bd8bb43ecd709695deeb1957a5b39fcb6 (diff)
downloademacs-9f6fcdc51615be98d2a026c302868061045176ec.tar.gz
* xmenu.c (popup_get_selection): Pop down on C-g.
(set_frame_menubar): Install translations for Lucid/Motif/Lesstif that pops down menu on C-g. (xdialog_show): If dialog popped down and no button in the dialog was pushed, call Fsignal to quit. (xmenu_show): In no toolkit version, if menu returns NO_SELECT call Fsignal to quit. * xfns.c (Fx_file_dialog): Motif/Lesstif version: Pop down on C-g. * gtkutil.c (xg_initialize): Install bindings for C-g so that dialogs and menus pop down.
Diffstat (limited to 'src/xmenu.c')
-rw-r--r--src/xmenu.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/xmenu.c b/src/xmenu.c
index ff012634b50..b20147417be 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -1243,6 +1243,11 @@ popup_get_selection (initial_event, dpyinfo, id, do_timers, down_on_keypress)
&& dpyinfo->display == event.xbutton.display)
{
KeySym keysym = XLookupKeysym (&event.xkey, 0);
+
+ /* Pop down on C-g. */
+ if (keysym == XK_g && (event.xkey.state & ControlMask) != 0)
+ popup_activated_flag = 0;
+
if (!IsModifierKey (keysym)
&& x_any_window_to_frame (dpyinfo, event.xany.window) != NULL)
popup_activated_flag = 0;
@@ -2226,6 +2231,9 @@ set_frame_menubar (f, first_time, deep_p)
}
else
{
+ char menuOverride[] = "Ctrl<KeyPress>g: MenuGadgetEscape()";
+ XtTranslations override = XtParseTranslationTable (menuOverride);
+
menubar_widget = lw_create_widget ("menubar", "menubar", id, first_wv,
f->output_data.x->column_widget,
0,
@@ -2234,6 +2242,9 @@ set_frame_menubar (f, first_time, deep_p)
popup_deactivate_callback,
menu_highlight_callback);
f->output_data.x->menubar_widget = menubar_widget;
+
+ /* Make menu pop down on C-g. */
+ XtOverrideTranslations (menubar_widget, override);
}
{
@@ -3155,6 +3166,9 @@ xdialog_show (f, keymaps, title, error)
}
}
}
+ else
+ /* Make "Cancel" equivalent to C-g. */
+ Fsignal (Qquit, Qnil);
return Qnil;
}
@@ -3500,7 +3514,13 @@ xmenu_show (f, x, y, for_click, keymaps, title, error)
case XM_FAILURE:
*error = "Can't activate menu";
case XM_IA_SELECT:
+ entry = Qnil;
+ break;
case XM_NO_SELECT:
+ /* Make "Cancel" equivalent to C-g unless this menu was popped up by
+ a mouse press. */
+ if (! for_click)
+ Fsignal (Qquit, Qnil);
entry = Qnil;
break;
}