Mercurial > emacs
comparison src/xmenu.c @ 9236:583bb9211b2b
(popup_get_selection): Remove BLOCK_INPUT, UNBLOCK_INPUT since the
calls to popup_get_selection() provide the protection.
author | Paul Reilly <pmr@pajato.com> |
---|---|
date | Sun, 02 Oct 1994 21:23:53 +0000 |
parents | 746cc6b0d28f |
children | d5ffd9c9edb0 |
comparison
equal
deleted
inserted
replaced
9235:a55d058e5e1a | 9236:583bb9211b2b |
---|---|
151 | 151 |
152 /* Current depth within submenus. */ | 152 /* Current depth within submenus. */ |
153 static int menu_items_submenu_depth; | 153 static int menu_items_submenu_depth; |
154 | 154 |
155 /* Flag which when set indicates a dialog or menu has been posted by | 155 /* Flag which when set indicates a dialog or menu has been posted by |
156 Xt on behalf of one of the widget sets. */ | 156 Xt on behalf of one of the widget sets. */ |
157 static int popup_activated_flag; | 157 static int popup_activated_flag; |
158 | 158 |
159 | 159 |
160 /* Initialize the menu_items structure if we haven't already done so. | 160 /* Initialize the menu_items structure if we haven't already done so. |
161 Also mark it as currently empty. */ | 161 Also mark it as currently empty. */ |
335 def1 = Fkey_binding (savedkey, Qnil); | 335 def1 = Fkey_binding (savedkey, Qnil); |
336 /* If not, update it. */ | 336 /* If not, update it. */ |
337 if (! EQ (def1, def) | 337 if (! EQ (def1, def) |
338 /* If the command is an alias for another | 338 /* If the command is an alias for another |
339 (such as easymenu.el and lmenu.el set it up), | 339 (such as easymenu.el and lmenu.el set it up), |
340 check if the original command matches the cached command. */ | 340 check if the original command matches the cached command. */ |
341 && !(SYMBOLP (def) && SYMBOLP (XSYMBOL (def)->function) | 341 && !(SYMBOLP (def) && SYMBOLP (XSYMBOL (def)->function) |
342 && EQ (def1, XSYMBOL (def)->function)) | 342 && EQ (def1, XSYMBOL (def)->function)) |
343 /* If something had no key binding before, don't recheck it-- | 343 /* If something had no key binding before, don't recheck it-- |
344 doing that takes too much time and makes menus too slow. */ | 344 doing that takes too much time and makes menus too slow. */ |
345 && !(!NILP (cachelist) && NILP (savedkey))) | 345 && !(!NILP (cachelist) && NILP (savedkey))) |
999 } | 999 } |
1000 | 1000 |
1001 #ifdef USE_X_TOOLKIT | 1001 #ifdef USE_X_TOOLKIT |
1002 | 1002 |
1003 /* Loop in Xt until the menu pulldown or dialog popup has been | 1003 /* Loop in Xt until the menu pulldown or dialog popup has been |
1004 popped down (deactivated). */ | 1004 popped down (deactivated). |
1005 | |
1006 NOTE: All calls to popup_get_selection() should be protected | |
1007 with BLOCK_INPUT, UNBLOCK_INPUT wrappers. */ | |
1005 void | 1008 void |
1006 popup_get_selection (initial_event) | 1009 popup_get_selection (initial_event) |
1007 XEvent *initial_event; | 1010 XEvent *initial_event; |
1008 { | 1011 { |
1009 XEvent event; | 1012 XEvent event; |
1013 else | 1016 else |
1014 XtAppNextEvent (Xt_app_con, &event); | 1017 XtAppNextEvent (Xt_app_con, &event); |
1015 | 1018 |
1016 while (1) | 1019 while (1) |
1017 { | 1020 { |
1018 BLOCK_INPUT; | |
1019 XtDispatchEvent (&event); | 1021 XtDispatchEvent (&event); |
1020 UNBLOCK_INPUT; | |
1021 if (!popup_activated()) | 1022 if (!popup_activated()) |
1022 break; | 1023 break; |
1023 XtAppNextEvent (Xt_app_con, &event); | 1024 XtAppNextEvent (Xt_app_con, &event); |
1024 } | 1025 } |
1025 } | 1026 } |
1026 | 1027 |
1027 /* Detect if a dialog or menu has been posted. */ | 1028 /* Detect if a dialog or menu has been posted. */ |
1028 int | 1029 int |
1029 popup_activated () | 1030 popup_activated () |
1030 { | 1031 { |
1031 return popup_activated_flag; | 1032 return popup_activated_flag; |
1032 } | 1033 } |
1127 } | 1128 } |
1128 } | 1129 } |
1129 } | 1130 } |
1130 | 1131 |
1131 /* This callback is invoked when a dialog or menu is finished being | 1132 /* This callback is invoked when a dialog or menu is finished being |
1132 used and has been unposted. */ | 1133 used and has been unposted. */ |
1133 | 1134 |
1134 static void | 1135 static void |
1135 popup_deactivate_callback (widget, id, client_data) | 1136 popup_deactivate_callback (widget, id, client_data) |
1136 Widget widget; | 1137 Widget widget; |
1137 LWLIB_ID id; | 1138 LWLIB_ID id; |
1355 XtManageChild (x->menubar_widget); | 1356 XtManageChild (x->menubar_widget); |
1356 XtMapWidget (x->menubar_widget); | 1357 XtMapWidget (x->menubar_widget); |
1357 XtVaSetValues (x->menubar_widget, XtNmappedWhenManaged, 1, 0); | 1358 XtVaSetValues (x->menubar_widget, XtNmappedWhenManaged, 1, 0); |
1358 } | 1359 } |
1359 | 1360 |
1360 /* Re-manage the text-area widget, and then thrash the sizes. */ | 1361 /* Re-manage the text-area widget, and then thrash the sizes. */ |
1361 XtManageChild (x->edit_widget); | 1362 XtManageChild (x->edit_widget); |
1362 lw_refigure_widget (x->column_widget, True); | 1363 lw_refigure_widget (x->column_widget, True); |
1363 | 1364 |
1364 /* Force the pane widget to resize itself with the right values. */ | 1365 /* Force the pane widget to resize itself with the right values. */ |
1365 EmacsFrameSetCharSize (x->edit_widget, columns, rows); | 1366 EmacsFrameSetCharSize (x->edit_widget, columns, rows); |
1423 | 1424 |
1424 /* The third arg is DEEP_P, which says to consider the entire | 1425 /* The third arg is DEEP_P, which says to consider the entire |
1425 menu trees we supply, rather than just the menu bar item names. */ | 1426 menu trees we supply, rather than just the menu bar item names. */ |
1426 lw_modify_all_widgets (id, first_wv, 1); | 1427 lw_modify_all_widgets (id, first_wv, 1); |
1427 | 1428 |
1428 /* Re-enable the edit widget to resize. */ | 1429 /* Re-enable the edit widget to resize. */ |
1429 lw_allow_resizing (f->display.x->widget, True); | 1430 lw_allow_resizing (f->display.x->widget, True); |
1430 } | 1431 } |
1431 else | 1432 else |
1432 { | 1433 { |
1433 menubar_widget = lw_create_widget ("menubar", "menubar", | 1434 menubar_widget = lw_create_widget ("menubar", "menubar", |
1743 | 1744 |
1744 i += MENU_ITEMS_ITEM_LENGTH; | 1745 i += MENU_ITEMS_ITEM_LENGTH; |
1745 } | 1746 } |
1746 } | 1747 } |
1747 | 1748 |
1748 /* Deal with the title, if it is non-nil. */ | 1749 /* Deal with the title, if it is non-nil. */ |
1749 if (!NILP (title)) | 1750 if (!NILP (title)) |
1750 { | 1751 { |
1751 widget_value *wv_title = malloc_widget_value (); | 1752 widget_value *wv_title = malloc_widget_value (); |
1752 widget_value *wv_sep1 = malloc_widget_value (); | 1753 widget_value *wv_sep1 = malloc_widget_value (); |
1753 widget_value *wv_sep2 = malloc_widget_value (); | 1754 widget_value *wv_sep2 = malloc_widget_value (); |