Commit 9f6fcdc5 authored by Jan Djärv's avatar Jan Djärv
Browse files

* 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.
parent e89f4e4b
2004-12-27 Jan Dj,Ad(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,Ad(Brv <jan.h.d@swipnet.se>
 
* gtkutil.c (update_frame_tool_bar): Make the value of
......
......@@ -3578,6 +3578,8 @@ free_frame_tool_bar (f)
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 =
......@@ -3600,6 +3602,17 @@ xg_initialize ()
"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 */
......
......@@ -5243,6 +5243,16 @@ or directory must exist. ONLY-DIR-P is ignored." */)
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));
}
......
......@@ -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;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment