aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJan Djärv2005-02-03 19:49:43 +0000
committerJan Djärv2005-02-03 19:49:43 +0000
commit81f098775c8dad4293a137c0f6f52ce3743a6cde (patch)
treede5f6a1c7fd201d8abe116e9c6cd3ad15bc68c62 /src
parent0e95095bfb71948bc9f076578e31c434aba94e8a (diff)
downloademacs-81f098775c8dad4293a137c0f6f52ce3743a6cde.tar.gz
emacs-81f098775c8dad4293a137c0f6f52ce3743a6cde.zip
* xmenu.c (menubar_selection_callback): Force out GTK buffered
events so the menu event comes after them. This is to prevent sit-for from exiting on buffered events directly after a menu selection, lisp code for Help => About Emacs uses sit-for.
Diffstat (limited to 'src')
-rw-r--r--src/xmenu.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/xmenu.c b/src/xmenu.c
index 57f184e121f..af26e291187 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -1445,9 +1445,9 @@ menu_highlight_callback (widget, id, call_data)
1445/* Find the menu selection and store it in the keyboard buffer. 1445/* Find the menu selection and store it in the keyboard buffer.
1446 F is the frame the menu is on. 1446 F is the frame the menu is on.
1447 MENU_BAR_ITEMS_USED is the length of VECTOR. 1447 MENU_BAR_ITEMS_USED is the length of VECTOR.
1448 VECTOR is an array of menu events for the whole menu. 1448 VECTOR is an array of menu events for the whole menu. */
1449 */ 1449
1450void 1450static void
1451find_and_call_menu_selection (f, menu_bar_items_used, vector, client_data) 1451find_and_call_menu_selection (f, menu_bar_items_used, vector, client_data)
1452 FRAME_PTR f; 1452 FRAME_PTR f;
1453 int menu_bar_items_used; 1453 int menu_bar_items_used;
@@ -1464,6 +1464,8 @@ find_and_call_menu_selection (f, menu_bar_items_used, vector, client_data)
1464 prefix = Qnil; 1464 prefix = Qnil;
1465 i = 0; 1465 i = 0;
1466 1466
1467 while (gtk_events_pending ())
1468 gtk_main_iteration ();
1467 while (i < menu_bar_items_used) 1469 while (i < menu_bar_items_used)
1468 { 1470 {
1469 if (EQ (XVECTOR (vector)->contents[i], Qnil)) 1471 if (EQ (XVECTOR (vector)->contents[i], Qnil))
@@ -1554,6 +1556,17 @@ menubar_selection_callback (widget, client_data)
1554 if (! cb_data || ! cb_data->cl_data || ! cb_data->cl_data->f) 1556 if (! cb_data || ! cb_data->cl_data || ! cb_data->cl_data->f)
1555 return; 1557 return;
1556 1558
1559 /* When a menu is popped down, X generates a focus event (i.e. focus
1560 goes back to the frame below the menu). Since GTK buffers events,
1561 we force it out here before the menu selection event. Otherwise
1562 sit-for will exit at once if the focus event follows the menu selection
1563 event. */
1564
1565 BLOCK_INPUT;
1566 while (gtk_events_pending ())
1567 gtk_main_iteration ();
1568 UNBLOCK_INPUT;
1569
1557 find_and_call_menu_selection (cb_data->cl_data->f, 1570 find_and_call_menu_selection (cb_data->cl_data->f,
1558 cb_data->cl_data->menu_bar_items_used, 1571 cb_data->cl_data->menu_bar_items_used,
1559 cb_data->cl_data->menu_bar_vector, 1572 cb_data->cl_data->menu_bar_vector,