+2004-12-27 Jan Dj\e,Ad\e(Brv <jan.h.d@swipnet.se>
+
+ * 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.
+
2004-12-25 Jan Dj\e,Ad\e(Brv <jan.h.d@swipnet.se>
* gtkutil.c (update_frame_tool_bar): Make the value of
void
xg_initialize ()
{
+ GtkBindingSet *binding_set;
+
xg_ignore_gtk_scrollbar = 0;
xg_detached_menus = 0;
xg_menu_cb_list.prev = xg_menu_cb_list.next =
"gtk-key-theme-name",
"Emacs",
EMACS_CLASS);
+
+ /* Make dialogs close on C-g. Since file dialog inherits from
+ dialog, this works for them also. */
+ binding_set = gtk_binding_set_by_class (gtk_type_class (GTK_TYPE_DIALOG));
+ gtk_binding_entry_add_signal (binding_set, GDK_g, GDK_CONTROL_MASK,
+ "close", 0);
+
+ /* Make menus close on C-g. */
+ binding_set = gtk_binding_set_by_class (gtk_type_class (GTK_TYPE_MENU_SHELL));
+ gtk_binding_entry_add_signal (binding_set, GDK_g, GDK_CONTROL_MASK,
+ "cancel", 0);
}
#endif /* USE_GTK */
XEvent event;
x_menu_wait_for_event (0);
XtAppNextEvent (Xt_app_con, &event);
+ if (event.type == KeyPress
+ && FRAME_X_DISPLAY (f) == event.xkey.display)
+ {
+ KeySym keysym = XLookupKeysym (&event.xkey, 0);
+
+ /* Pop down on C-g. */
+ if (keysym == XK_g && (event.xkey.state & ControlMask) != 0)
+ XtUnmanageChild (dialog);
+ }
+
(void) x_dispatch_event (&event, FRAME_X_DISPLAY (f));
}
&& 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;
}
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,
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);
}
{
}
}
}
+ else
+ /* Make "Cancel" equivalent to C-g. */
+ Fsignal (Qquit, Qnil);
return Qnil;
}
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;
}