diff options
Diffstat (limited to 'src/macmenu.c')
| -rw-r--r-- | src/macmenu.c | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/src/macmenu.c b/src/macmenu.c index 3ea09412650..82322515c31 100644 --- a/src/macmenu.c +++ b/src/macmenu.c | |||
| @@ -2012,9 +2012,8 @@ mac_menu_show (f, x, y, for_click, keymaps, title, error) | |||
| 2012 | char **error; | 2012 | char **error; |
| 2013 | { | 2013 | { |
| 2014 | int i; | 2014 | int i; |
| 2015 | UInt32 refcon; | ||
| 2016 | int menu_item_choice; | 2015 | int menu_item_choice; |
| 2017 | int menu_item_selection; | 2016 | UInt32 menu_item_selection; |
| 2018 | MenuHandle menu; | 2017 | MenuHandle menu; |
| 2019 | Point pos; | 2018 | Point pos; |
| 2020 | widget_value *wv, *save_wv = 0, *first_wv = 0, *prev_wv = 0; | 2019 | widget_value *wv, *save_wv = 0, *first_wv = 0, *prev_wv = 0; |
| @@ -2229,7 +2228,6 @@ mac_menu_show (f, x, y, for_click, keymaps, title, error) | |||
| 2229 | LocalToGlobal (&pos); | 2228 | LocalToGlobal (&pos); |
| 2230 | 2229 | ||
| 2231 | /* No selection has been chosen yet. */ | 2230 | /* No selection has been chosen yet. */ |
| 2232 | menu_item_choice = 0; | ||
| 2233 | menu_item_selection = 0; | 2231 | menu_item_selection = 0; |
| 2234 | 2232 | ||
| 2235 | record_unwind_protect (pop_down_menu, make_save_value (f, 0)); | 2233 | record_unwind_protect (pop_down_menu, make_save_value (f, 0)); |
| @@ -2240,20 +2238,18 @@ mac_menu_show (f, x, y, for_click, keymaps, title, error) | |||
| 2240 | 2238 | ||
| 2241 | /* Display the menu. */ | 2239 | /* Display the menu. */ |
| 2242 | menu_item_choice = PopUpMenuSelect (menu, pos.v, pos.h, 0); | 2240 | menu_item_choice = PopUpMenuSelect (menu, pos.v, pos.h, 0); |
| 2243 | menu_item_selection = LoWord (menu_item_choice); | ||
| 2244 | 2241 | ||
| 2245 | /* Get the refcon to find the correct item */ | 2242 | /* Get the refcon to find the correct item */ |
| 2246 | if (menu_item_selection) | 2243 | if (menu_item_choice) |
| 2247 | { | 2244 | { |
| 2248 | MenuHandle sel_menu = GetMenuHandle (HiWord (menu_item_choice)); | 2245 | MenuHandle sel_menu = GetMenuHandle (HiWord (menu_item_choice)); |
| 2249 | if (sel_menu) { | 2246 | |
| 2250 | GetMenuItemRefCon (sel_menu, menu_item_selection, &refcon); | 2247 | if (sel_menu) |
| 2251 | } | 2248 | GetMenuItemRefCon (sel_menu, LoWord (menu_item_choice), |
| 2249 | &menu_item_selection); | ||
| 2252 | } | 2250 | } |
| 2253 | else if (! for_click) | 2251 | |
| 2254 | /* Make "Cancel" equivalent to C-g unless this menu was popped up by | 2252 | unbind_to (specpdl_count, Qnil); |
| 2255 | a mouse press. */ | ||
| 2256 | Fsignal (Qquit, Qnil); | ||
| 2257 | 2253 | ||
| 2258 | /* Find the selected item, and its pane, to return | 2254 | /* Find the selected item, and its pane, to return |
| 2259 | the proper value. */ | 2255 | the proper value. */ |
| @@ -2290,7 +2286,7 @@ mac_menu_show (f, x, y, for_click, keymaps, title, error) | |||
| 2290 | { | 2286 | { |
| 2291 | entry | 2287 | entry |
| 2292 | = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_VALUE]; | 2288 | = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_VALUE]; |
| 2293 | if ((int) (EMACS_INT) refcon == i) | 2289 | if (menu_item_selection == i) |
| 2294 | { | 2290 | { |
| 2295 | if (keymaps != 0) | 2291 | if (keymaps != 0) |
| 2296 | { | 2292 | { |
| @@ -2313,8 +2309,6 @@ mac_menu_show (f, x, y, for_click, keymaps, title, error) | |||
| 2313 | /* Make "Cancel" equivalent to C-g. */ | 2309 | /* Make "Cancel" equivalent to C-g. */ |
| 2314 | Fsignal (Qquit, Qnil); | 2310 | Fsignal (Qquit, Qnil); |
| 2315 | 2311 | ||
| 2316 | unbind_to (specpdl_count, Qnil); | ||
| 2317 | |||
| 2318 | return Qnil; | 2312 | return Qnil; |
| 2319 | } | 2313 | } |
| 2320 | 2314 | ||
| @@ -2386,10 +2380,12 @@ mac_handle_dialog_event (next_handler, event, data) | |||
| 2386 | typeUInt32, NULL, sizeof (UInt32), | 2380 | typeUInt32, NULL, sizeof (UInt32), |
| 2387 | NULL, &key_code); | 2381 | NULL, &key_code); |
| 2388 | if (err == noErr) | 2382 | if (err == noErr) |
| 2389 | if (mac_quit_char_key_p (modifiers, key_code)) | 2383 | { |
| 2390 | err = QuitAppModalLoopForWindow (window); | 2384 | if (mac_quit_char_key_p (modifiers, key_code)) |
| 2391 | else | 2385 | err = QuitAppModalLoopForWindow (window); |
| 2392 | err = eventNotHandledErr; | 2386 | else |
| 2387 | err = eventNotHandledErr; | ||
| 2388 | } | ||
| 2393 | } | 2389 | } |
| 2394 | break; | 2390 | break; |
| 2395 | } | 2391 | } |