diff options
| author | Karl Heuer | 1995-03-08 05:50:47 +0000 |
|---|---|---|
| committer | Karl Heuer | 1995-03-08 05:50:47 +0000 |
| commit | 4524b161f647963fe827f886d0947d28bbe6bb36 (patch) | |
| tree | 15c95fff0f0bcb21fcc2899bc984ac293fd2737e /src | |
| parent | 6c9f24d9013736268600192b264b0f3b0163f5cb (diff) | |
| download | emacs-4524b161f647963fe827f886d0947d28bbe6bb36.tar.gz emacs-4524b161f647963fe827f886d0947d28bbe6bb36.zip | |
(unlock_display): If adding to kbd_queue, set kbd_queue_has_data.
(read_char): Set and clear kbd_queue_has_data appropriately, but
leave it unset when we push back an incomplete sequence.
(read_char): Take the longjmp even if current_perdisplay was null.
(readable_events): Check kbd_queue_has_data instead of kbd_queue.
(init_perdisplay): Initialize kbd_queue_has_data.
Diffstat (limited to 'src')
| -rw-r--r-- | src/keyboard.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/keyboard.c b/src/keyboard.c index 8e1d3390a49..fb6ab2d5c8b 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -755,8 +755,11 @@ static void | |||
| 755 | unlock_display () | 755 | unlock_display () |
| 756 | { | 756 | { |
| 757 | if (CONSP (Vunread_command_events)) | 757 | if (CONSP (Vunread_command_events)) |
| 758 | current_perdisplay->kbd_queue | 758 | { |
| 759 | = nconc2 (Vunread_command_events, current_perdisplay->kbd_queue); | 759 | current_perdisplay->kbd_queue |
| 760 | = nconc2 (Vunread_command_events, current_perdisplay->kbd_queue); | ||
| 761 | current_perdisplay->kbd_queue_has_data = 1; | ||
| 762 | } | ||
| 760 | Vunread_command_events = Qnil; | 763 | Vunread_command_events = Qnil; |
| 761 | current_perdisplay = 0; | 764 | current_perdisplay = 0; |
| 762 | display_locked = 0; | 765 | display_locked = 0; |
| @@ -1786,12 +1789,12 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) | |||
| 1786 | /* Check for something on one of the side queues. Give priority to | 1789 | /* Check for something on one of the side queues. Give priority to |
| 1787 | the current display, but if we're not locked, then check the other | 1790 | the current display, but if we're not locked, then check the other |
| 1788 | displays as well. */ | 1791 | displays as well. */ |
| 1789 | if (current_perdisplay && CONSP (current_perdisplay->kbd_queue)) | 1792 | if (current_perdisplay && current_perdisplay->kbd_queue_has_data) |
| 1790 | perd = current_perdisplay; | 1793 | perd = current_perdisplay; |
| 1791 | else if (!display_locked) | 1794 | else if (!display_locked) |
| 1792 | { | 1795 | { |
| 1793 | for (perd = all_perdisplays; perd; perd = perd->next_perdisplay) | 1796 | for (perd = all_perdisplays; perd; perd = perd->next_perdisplay) |
| 1794 | if (CONSP (perd->kbd_queue)) | 1797 | if (perd->kbd_queue_has_data) |
| 1795 | break; | 1798 | break; |
| 1796 | } | 1799 | } |
| 1797 | else | 1800 | else |
| @@ -1803,8 +1806,12 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) | |||
| 1803 | try again. */ | 1806 | try again. */ |
| 1804 | if (perd) | 1807 | if (perd) |
| 1805 | { | 1808 | { |
| 1809 | if (!CONSP (perd->kbd_queue)) | ||
| 1810 | abort (); | ||
| 1806 | c = XCONS (perd->kbd_queue)->car; | 1811 | c = XCONS (perd->kbd_queue)->car; |
| 1807 | perd->kbd_queue = XCONS (perd->kbd_queue)->cdr; | 1812 | perd->kbd_queue = XCONS (perd->kbd_queue)->cdr; |
| 1813 | if (NILP (perd->kbd_queue)) | ||
| 1814 | perd->kbd_queue_has_data = 0; | ||
| 1808 | input_pending = readable_events (); | 1815 | input_pending = readable_events (); |
| 1809 | #ifdef MULTI_FRAME | 1816 | #ifdef MULTI_FRAME |
| 1810 | if (EVENT_HAS_PARAMETERS (c) | 1817 | if (EVENT_HAS_PARAMETERS (c) |
| @@ -1834,18 +1841,18 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) | |||
| 1834 | if (!NILP (*tailp)) | 1841 | if (!NILP (*tailp)) |
| 1835 | abort (); | 1842 | abort (); |
| 1836 | *tailp = Fcons (c, Qnil); | 1843 | *tailp = Fcons (c, Qnil); |
| 1844 | perd->kbd_queue_has_data = 1; | ||
| 1837 | goto wrong_display; | 1845 | goto wrong_display; |
| 1838 | } | 1846 | } |
| 1839 | } | 1847 | } |
| 1840 | #ifdef MULTI_PERDISPLAY | 1848 | #ifdef MULTI_PERDISPLAY |
| 1841 | if (!current_perdisplay) | ||
| 1842 | current_perdisplay = perd; | ||
| 1843 | if (perd != current_perdisplay) | 1849 | if (perd != current_perdisplay) |
| 1844 | { | 1850 | { |
| 1845 | /* We shouldn't get here if we were locked onto one display! */ | 1851 | /* We shouldn't get here if we were locked onto one display! */ |
| 1846 | if (display_locked) | 1852 | if (display_locked) |
| 1847 | abort (); | 1853 | abort (); |
| 1848 | perd->kbd_queue = Fcons (c, perd->kbd_queue); | 1854 | perd->kbd_queue = Fcons (c, perd->kbd_queue); |
| 1855 | perd->kbd_queue_has_data = 1; | ||
| 1849 | current_perdisplay = perd; | 1856 | current_perdisplay = perd; |
| 1850 | longjmp (wrong_display_jmpbuf, 1); | 1857 | longjmp (wrong_display_jmpbuf, 1); |
| 1851 | } | 1858 | } |
| @@ -2129,14 +2136,14 @@ readable_events () | |||
| 2129 | #endif | 2136 | #endif |
| 2130 | if (display_locked) | 2137 | if (display_locked) |
| 2131 | { | 2138 | { |
| 2132 | if (CONSP (current_perdisplay->kbd_queue)) | 2139 | if (current_perdisplay->kbd_queue_has_data) |
| 2133 | return 1; | 2140 | return 1; |
| 2134 | } | 2141 | } |
| 2135 | else | 2142 | else |
| 2136 | { | 2143 | { |
| 2137 | PERDISPLAY *perd; | 2144 | PERDISPLAY *perd; |
| 2138 | for (perd = all_perdisplays; perd; perd = perd->next_perdisplay) | 2145 | for (perd = all_perdisplays; perd; perd = perd->next_perdisplay) |
| 2139 | if (CONSP (perd->kbd_queue)) | 2146 | if (perd->kbd_queue_has_data) |
| 2140 | return 1; | 2147 | return 1; |
| 2141 | } | 2148 | } |
| 2142 | return 0; | 2149 | return 0; |
| @@ -6357,6 +6364,7 @@ init_perdisplay (perd) | |||
| 6357 | perd->prefix_sign = 1; | 6364 | perd->prefix_sign = 1; |
| 6358 | perd->prefix_partial = 0; | 6365 | perd->prefix_partial = 0; |
| 6359 | perd->kbd_queue = Qnil; | 6366 | perd->kbd_queue = Qnil; |
| 6367 | perd->kbd_queue_has_data = 0; | ||
| 6360 | perd->immediate_echo = 0; | 6368 | perd->immediate_echo = 0; |
| 6361 | perd->echoptr = perd->echobuf; | 6369 | perd->echoptr = perd->echobuf; |
| 6362 | perd->echo_after_prompt = -1; | 6370 | perd->echo_after_prompt = -1; |