diff options
| author | Richard M. Stallman | 1998-05-16 18:30:52 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1998-05-16 18:30:52 +0000 |
| commit | adc1d5c873a44b7fd1f241922948ff4a630b8d0e (patch) | |
| tree | 463af7c0bd6591cbbcb9e6dddffe7aef77c0ff19 /src | |
| parent | 00a9a93524237a78dd6996614cc3c7140cae6f30 (diff) | |
| download | emacs-adc1d5c873a44b7fd1f241922948ff4a630b8d0e.tar.gz emacs-adc1d5c873a44b7fd1f241922948ff4a630b8d0e.zip | |
(read_char): If redisplay is preempted,
try swallow_events; if that clears input_pending,
finish the redisplay.
(parse_menu_item): Removed unnecessary gcproing.
Fix a test of inmenubar.
Diffstat (limited to 'src')
| -rw-r--r-- | src/keyboard.c | 95 |
1 files changed, 42 insertions, 53 deletions
diff --git a/src/keyboard.c b/src/keyboard.c index a154776891c..b5a74bebf29 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -1836,14 +1836,29 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) | |||
| 1836 | goto reread_first; | 1836 | goto reread_first; |
| 1837 | } | 1837 | } |
| 1838 | 1838 | ||
| 1839 | /* if redisplay was requested */ | ||
| 1839 | if (commandflag >= 0) | 1840 | if (commandflag >= 0) |
| 1840 | { | 1841 | { |
| 1842 | /* If there is pending input, process any events which are not | ||
| 1843 | user-visible, such as X selection_request events. */ | ||
| 1841 | if (input_pending | 1844 | if (input_pending |
| 1842 | || detect_input_pending_run_timers (0)) | 1845 | || detect_input_pending_run_timers (0)) |
| 1843 | swallow_events (0); | 1846 | swallow_events (0); /* may clear input_pending */ |
| 1844 | 1847 | ||
| 1845 | if (!input_pending) | 1848 | /* Redisplay if no pending input. */ |
| 1846 | redisplay (); | 1849 | while (!input_pending) |
| 1850 | { | ||
| 1851 | redisplay (); | ||
| 1852 | |||
| 1853 | if (!input_pending) | ||
| 1854 | /* Normal case: no input arrived during redisplay. */ | ||
| 1855 | break; | ||
| 1856 | |||
| 1857 | /* Input arrived and pre-empted redisplay. | ||
| 1858 | Process any events which are not user-visible. */ | ||
| 1859 | swallow_events (0); | ||
| 1860 | /* If that cleared input_pending, try again to redisplay. */ | ||
| 1861 | } | ||
| 1847 | } | 1862 | } |
| 1848 | 1863 | ||
| 1849 | /* Message turns off echoing unless more keystrokes turn it on again. */ | 1864 | /* Message turns off echoing unless more keystrokes turn it on again. */ |
| @@ -5636,32 +5651,16 @@ parse_menu_item (item, notreal, inmenubar) | |||
| 5636 | Lisp_Object item; | 5651 | Lisp_Object item; |
| 5637 | int notreal, inmenubar; | 5652 | int notreal, inmenubar; |
| 5638 | { | 5653 | { |
| 5639 | Lisp_Object def, tem, item_string, start, type; | 5654 | Lisp_Object def, tem, item_string, start; |
| 5640 | 5655 | Lisp_Object cachelist = Qnil; | |
| 5641 | Lisp_Object cachelist; | 5656 | Lisp_Object filter = Qnil; |
| 5642 | Lisp_Object filter; | 5657 | Lisp_Object keyhint = Qnil; |
| 5643 | Lisp_Object keyhint; | ||
| 5644 | int i; | 5658 | int i; |
| 5645 | struct gcpro gcpro1, gcpro2, gcpro3; | ||
| 5646 | int newcache = 0; | 5659 | int newcache = 0; |
| 5647 | 5660 | ||
| 5648 | cachelist = Qnil; | ||
| 5649 | filter = Qnil; | ||
| 5650 | keyhint = Qnil; | ||
| 5651 | |||
| 5652 | #define RET0 \ | ||
| 5653 | if (1) \ | ||
| 5654 | { \ | ||
| 5655 | UNGCPRO; \ | ||
| 5656 | return 0; \ | ||
| 5657 | } \ | ||
| 5658 | else | ||
| 5659 | |||
| 5660 | if (!CONSP (item)) | 5661 | if (!CONSP (item)) |
| 5661 | return 0; | 5662 | return 0; |
| 5662 | 5663 | ||
| 5663 | GCPRO1 (item); | ||
| 5664 | |||
| 5665 | /* Create item_properties vector if necessary. */ | 5664 | /* Create item_properties vector if necessary. */ |
| 5666 | if (NILP (item_properties)) | 5665 | if (NILP (item_properties)) |
| 5667 | item_properties | 5666 | item_properties |
| @@ -5748,7 +5747,7 @@ parse_menu_item (item, notreal, inmenubar) | |||
| 5748 | then ignore this item. */ | 5747 | then ignore this item. */ |
| 5749 | tem = menu_item_eval_property (XCONS (item)->car); | 5748 | tem = menu_item_eval_property (XCONS (item)->car); |
| 5750 | if (NILP (tem)) | 5749 | if (NILP (tem)) |
| 5751 | RET0; | 5750 | return 0; |
| 5752 | } | 5751 | } |
| 5753 | else if (EQ (tem, QChelp)) | 5752 | else if (EQ (tem, QChelp)) |
| 5754 | XVECTOR (item_properties)->contents[ITEM_PROPERTY_HELP] | 5753 | XVECTOR (item_properties)->contents[ITEM_PROPERTY_HELP] |
| @@ -5787,10 +5786,10 @@ parse_menu_item (item, notreal, inmenubar) | |||
| 5787 | } | 5786 | } |
| 5788 | } | 5787 | } |
| 5789 | else if (inmenubar || !NILP (start)) | 5788 | else if (inmenubar || !NILP (start)) |
| 5790 | RET0; | 5789 | return 0; |
| 5791 | } | 5790 | } |
| 5792 | else | 5791 | else |
| 5793 | RET0; | 5792 | return 0; /* not a menu item */ |
| 5794 | 5793 | ||
| 5795 | /* If item string is not a string, evaluate it to get string. | 5794 | /* If item string is not a string, evaluate it to get string. |
| 5796 | If we don't get a string, skip this item. */ | 5795 | If we don't get a string, skip this item. */ |
| @@ -5799,7 +5798,7 @@ parse_menu_item (item, notreal, inmenubar) | |||
| 5799 | { | 5798 | { |
| 5800 | item_string = menu_item_eval_property (item_string); | 5799 | item_string = menu_item_eval_property (item_string); |
| 5801 | if (!STRINGP (item_string)) | 5800 | if (!STRINGP (item_string)) |
| 5802 | RET0; | 5801 | return 0; |
| 5803 | XVECTOR (item_properties)->contents[ITEM_PROPERTY_NAME] = item_string; | 5802 | XVECTOR (item_properties)->contents[ITEM_PROPERTY_NAME] = item_string; |
| 5804 | } | 5803 | } |
| 5805 | 5804 | ||
| @@ -5814,12 +5813,8 @@ parse_menu_item (item, notreal, inmenubar) | |||
| 5814 | 5813 | ||
| 5815 | /* If we got no definition, this item is just unselectable text which | 5814 | /* If we got no definition, this item is just unselectable text which |
| 5816 | is OK in a submenu but not in the menubar. */ | 5815 | is OK in a submenu but not in the menubar. */ |
| 5817 | item_string = XVECTOR (item_properties)->contents[ITEM_PROPERTY_NAME]; | ||
| 5818 | if (NILP (def)) | 5816 | if (NILP (def)) |
| 5819 | { | 5817 | return (inmenubar ? 0 : 1); |
| 5820 | UNGCPRO; | ||
| 5821 | return (inmenubar ? 0 : 1); | ||
| 5822 | } | ||
| 5823 | 5818 | ||
| 5824 | /* Enable or disable selection of item. */ | 5819 | /* Enable or disable selection of item. */ |
| 5825 | tem = XVECTOR (item_properties)->contents[ITEM_PROPERTY_ENABLE]; | 5820 | tem = XVECTOR (item_properties)->contents[ITEM_PROPERTY_ENABLE]; |
| @@ -5830,7 +5825,7 @@ parse_menu_item (item, notreal, inmenubar) | |||
| 5830 | else | 5825 | else |
| 5831 | tem = menu_item_eval_property (tem); | 5826 | tem = menu_item_eval_property (tem); |
| 5832 | if (inmenubar && NILP (tem)) | 5827 | if (inmenubar && NILP (tem)) |
| 5833 | RET0; /* Ignore disabled items in menu bar. */ | 5828 | return 0; /* Ignore disabled items in menu bar. */ |
| 5834 | XVECTOR (item_properties)->contents[ITEM_PROPERTY_ENABLE] = tem; | 5829 | XVECTOR (item_properties)->contents[ITEM_PROPERTY_ENABLE] = tem; |
| 5835 | } | 5830 | } |
| 5836 | 5831 | ||
| @@ -5841,11 +5836,10 @@ parse_menu_item (item, notreal, inmenubar) | |||
| 5841 | { | 5836 | { |
| 5842 | XVECTOR (item_properties)->contents[ITEM_PROPERTY_MAP] = tem; | 5837 | XVECTOR (item_properties)->contents[ITEM_PROPERTY_MAP] = tem; |
| 5843 | XVECTOR (item_properties)->contents[ITEM_PROPERTY_DEF] = tem; | 5838 | XVECTOR (item_properties)->contents[ITEM_PROPERTY_DEF] = tem; |
| 5844 | UNGCPRO; | ||
| 5845 | return 1; | 5839 | return 1; |
| 5846 | } | 5840 | } |
| 5847 | else if (inmenubar) | 5841 | else if (inmenubar > 0) |
| 5848 | RET0; /* Entries in menu bar must be submenus. */ | 5842 | return 0; /* Entries in menu bar must be submenus. */ |
| 5849 | 5843 | ||
| 5850 | /* This is a command. See if there is an equivalent key binding. */ | 5844 | /* This is a command. See if there is an equivalent key binding. */ |
| 5851 | if (NILP (cachelist)) | 5845 | if (NILP (cachelist)) |
| @@ -5956,24 +5950,20 @@ parse_menu_item (item, notreal, inmenubar) | |||
| 5956 | 5950 | ||
| 5957 | /* If we only want to precompute equivalent key bindings, stop here. */ | 5951 | /* If we only want to precompute equivalent key bindings, stop here. */ |
| 5958 | if (notreal) | 5952 | if (notreal) |
| 5959 | { | 5953 | return 1; |
| 5960 | UNGCPRO; | ||
| 5961 | return 1; | ||
| 5962 | } | ||
| 5963 | 5954 | ||
| 5964 | /* If we have an equivalent key binding, use that. */ | 5955 | /* If we have an equivalent key binding, use that. */ |
| 5965 | XVECTOR (item_properties)->contents[ITEM_PROPERTY_KEYEQ] | 5956 | XVECTOR (item_properties)->contents[ITEM_PROPERTY_KEYEQ] = tem; |
| 5966 | = XCONS (cachelist)->cdr; | 5957 | |
| 5967 | 5958 | /* Include this when menu help is implemented. | |
| 5968 | /* Include this when menu help is implemented. | 5959 | tem = XVECTOR (item_properties)->contents[ITEM_PROPERTY_HELP]; |
| 5969 | tem = XVECTOR (item_properties)->contents[ITEM_PROPERTY_HELP]; | 5960 | if (!(NILP (tem) || STRINGP (tem))) |
| 5970 | if (!(NILP (tem) || STRINGP (tem))) | 5961 | { |
| 5971 | { | 5962 | tem = menu_item_eval_property (tem); |
| 5972 | tem = menu_item_eval_property (tem); | 5963 | if (!STRINGP (tem)) |
| 5973 | if (!STRINGP (tem)) | 5964 | tem = Qnil; |
| 5974 | tem = Qnil; | 5965 | XVECTOR (item_properties)->contents[ITEM_PROPERTY_HELP] = tem; |
| 5975 | XVECTOR (item_properties)->contents[ITEM_PROPERTY_HELP] = tem; | 5966 | } |
| 5976 | } | ||
| 5977 | */ | 5967 | */ |
| 5978 | 5968 | ||
| 5979 | /* Handle radio buttons or toggle boxes. */ | 5969 | /* Handle radio buttons or toggle boxes. */ |
| @@ -5982,7 +5972,6 @@ parse_menu_item (item, notreal, inmenubar) | |||
| 5982 | XVECTOR (item_properties)->contents[ITEM_PROPERTY_SELECTED] | 5972 | XVECTOR (item_properties)->contents[ITEM_PROPERTY_SELECTED] |
| 5983 | = menu_item_eval_property (tem); | 5973 | = menu_item_eval_property (tem); |
| 5984 | 5974 | ||
| 5985 | UNGCPRO; | ||
| 5986 | return 1; | 5975 | return 1; |
| 5987 | } | 5976 | } |
| 5988 | 5977 | ||