diff options
| author | Dmitry Antipov | 2014-06-04 08:58:31 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2014-06-04 08:58:31 +0400 |
| commit | cfd794af4214ae0e5587ab8b1f4e5fcb355a0f12 (patch) | |
| tree | c45be02b5b568e7534eb91e03ba46899dc42dff5 /src/w32menu.c | |
| parent | 39ec03147e88bb7a12d2e42edfa0206f6b7d546b (diff) | |
| download | emacs-cfd794af4214ae0e5587ab8b1f4e5fcb355a0f12.tar.gz emacs-cfd794af4214ae0e5587ab8b1f4e5fcb355a0f12.zip | |
Use terminal-specific hooks to display menus.
* termhooks.h (struct terminal): New field menu_show_hook.
* menu.h (<anonymous enum>): Bit flags for menu hooks.
(x_menu_show, w32_menu_show, ns_menu_show, tty_menu_show):
Adjust prototypes.
* menu.c (Fx_popup_menu): Use bit flags and menu_show_hook.
* nsmenu.m (ns_menu_show):
* w32menu.c (w32_menu_show):
* xmenu.c (x_menu_show):
* term.c (tty_menu_show): Adjust to use bit flags.
(set_tty_hooks): Set menu_show_hook.
* xterm.c (x_create_terminal):
* nsterm.m (ns_create_terminal):
* msdos.c (initialize_msdos_display):
* w32term.c (w32_create_terminal): Likewise.
Diffstat (limited to 'src/w32menu.c')
| -rw-r--r-- | src/w32menu.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/w32menu.c b/src/w32menu.c index 467eb7a5710..6276c840fc6 100644 --- a/src/w32menu.c +++ b/src/w32menu.c | |||
| @@ -549,8 +549,9 @@ free_frame_menubar (struct frame *f) | |||
| 549 | /* F is the frame the menu is for. | 549 | /* F is the frame the menu is for. |
| 550 | X and Y are the frame-relative specified position, | 550 | X and Y are the frame-relative specified position, |
| 551 | relative to the inside upper left corner of the frame F. | 551 | relative to the inside upper left corner of the frame F. |
| 552 | FOR_CLICK is nonzero if this menu was invoked for a mouse click. | 552 | Bitfield MENUFLAGS bits are: |
| 553 | KEYMAPS is 1 if this menu was specified with keymaps; | 553 | MENU_FOR_CLICK is set if this menu was invoked for a mouse click. |
| 554 | MENU_KEYMAPS is set if this menu was specified with keymaps; | ||
| 554 | in that case, we return a list containing the chosen item's value | 555 | in that case, we return a list containing the chosen item's value |
| 555 | and perhaps also the pane's prefix. | 556 | and perhaps also the pane's prefix. |
| 556 | TITLE is the specified menu title. | 557 | TITLE is the specified menu title. |
| @@ -558,7 +559,7 @@ free_frame_menubar (struct frame *f) | |||
| 558 | (We return nil on failure, but the value doesn't actually matter.) */ | 559 | (We return nil on failure, but the value doesn't actually matter.) */ |
| 559 | 560 | ||
| 560 | Lisp_Object | 561 | Lisp_Object |
| 561 | w32_menu_show (struct frame *f, int x, int y, int for_click, int keymaps, | 562 | w32_menu_show (struct frame *f, int x, int y, int menuflags, |
| 562 | Lisp_Object title, const char **error) | 563 | Lisp_Object title, const char **error) |
| 563 | { | 564 | { |
| 564 | int i; | 565 | int i; |
| @@ -647,14 +648,14 @@ w32_menu_show (struct frame *f, int x, int y, int for_click, int keymaps, | |||
| 647 | /* If the pane has a meaningful name, | 648 | /* If the pane has a meaningful name, |
| 648 | make the pane a top-level menu item | 649 | make the pane a top-level menu item |
| 649 | with its items as a submenu beneath it. */ | 650 | with its items as a submenu beneath it. */ |
| 650 | if (!keymaps && strcmp (pane_string, "")) | 651 | if (!(menuflags & MENU_KEYMAPS) && strcmp (pane_string, "")) |
| 651 | { | 652 | { |
| 652 | wv = make_widget_value (pane_string, NULL, true, Qnil); | 653 | wv = make_widget_value (pane_string, NULL, true, Qnil); |
| 653 | if (save_wv) | 654 | if (save_wv) |
| 654 | save_wv->next = wv; | 655 | save_wv->next = wv; |
| 655 | else | 656 | else |
| 656 | first_wv->contents = wv; | 657 | first_wv->contents = wv; |
| 657 | if (keymaps && !NILP (prefix)) | 658 | if ((menuflags & MENU_KEYMAPS) && !NILP (prefix)) |
| 658 | wv->name++; | 659 | wv->name++; |
| 659 | wv->button_type = BUTTON_TYPE_NONE; | 660 | wv->button_type = BUTTON_TYPE_NONE; |
| 660 | save_wv = wv; | 661 | save_wv = wv; |
| @@ -811,10 +812,10 @@ w32_menu_show (struct frame *f, int x, int y, int for_click, int keymaps, | |||
| 811 | i += 1; | 812 | i += 1; |
| 812 | else | 813 | else |
| 813 | { | 814 | { |
| 814 | entry = AREF (menu_items, i + MENU_ITEMS_ITEM_VALUE); | 815 | entry = AREF (menu_items, i + MENU_ITEMS_ITEM_VALUE); |
| 815 | if (menu_item_selection == i) | 816 | if (menu_item_selection == i) |
| 816 | { | 817 | { |
| 817 | if (keymaps != 0) | 818 | if (menuflags & MENU_KEYMAPS) |
| 818 | { | 819 | { |
| 819 | int j; | 820 | int j; |
| 820 | 821 | ||
| @@ -832,7 +833,7 @@ w32_menu_show (struct frame *f, int x, int y, int for_click, int keymaps, | |||
| 832 | } | 833 | } |
| 833 | } | 834 | } |
| 834 | } | 835 | } |
| 835 | else if (!for_click) | 836 | else if (!(menuflags & MENU_FOR_CLICK)) |
| 836 | { | 837 | { |
| 837 | unblock_input (); | 838 | unblock_input (); |
| 838 | /* Make "Cancel" equivalent to C-g. */ | 839 | /* Make "Cancel" equivalent to C-g. */ |