Mercurial > emacs
comparison src/xmenu.c @ 59912:ef2f9fc4fd42
* 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.
author | Jan Djärv <jan.h.d@swipnet.se> |
---|---|
date | Thu, 03 Feb 2005 19:49:43 +0000 |
parents | 72adb36e240f |
children | fdb9ecc63088 |
comparison
equal
deleted
inserted
replaced
59911:aafd8ed9cff2 | 59912:ef2f9fc4fd42 |
---|---|
1443 #endif | 1443 #endif |
1444 | 1444 |
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 |
1450 void | 1450 static void |
1451 find_and_call_menu_selection (f, menu_bar_items_used, vector, client_data) | 1451 find_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; |
1454 Lisp_Object vector; | 1454 Lisp_Object vector; |
1455 void *client_data; | 1455 void *client_data; |
1462 entry = Qnil; | 1462 entry = Qnil; |
1463 subprefix_stack = (Lisp_Object *) alloca (menu_bar_items_used * sizeof (Lisp_Object)); | 1463 subprefix_stack = (Lisp_Object *) alloca (menu_bar_items_used * sizeof (Lisp_Object)); |
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)) |
1470 { | 1472 { |
1471 subprefix_stack[submenu_depth++] = prefix; | 1473 subprefix_stack[submenu_depth++] = prefix; |
1551 if (xg_crazy_callback_abort) | 1553 if (xg_crazy_callback_abort) |
1552 return; | 1554 return; |
1553 | 1555 |
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; |
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; | |
1556 | 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, |
1560 cb_data->call_data); | 1573 cb_data->call_data); |