comparison src/keyboard.c @ 10945:dbf1aab47502

(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.
author Karl Heuer <kwzh@gnu.org>
date Wed, 08 Mar 1995 05:50:47 +0000
parents d2971946a3d2
children 0409e4548077
comparison
equal deleted inserted replaced
10944:ade108508c1e 10945:dbf1aab47502
753 #ifdef MULTI_PERDISPLAY 753 #ifdef MULTI_PERDISPLAY
754 static void 754 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;
763 } 766 }
764 #endif 767 #endif
1784 { 1787 {
1785 PERDISPLAY *perd; 1788 PERDISPLAY *perd;
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
1798 perd = 0; 1801 perd = 0;
1799 1802
1801 Otherwise, read from the main queue, and if that gives us 1804 Otherwise, read from the main queue, and if that gives us
1802 something we can't use yet, put it on the side queue and 1805 something we can't use yet, put it on the side queue and
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)
1811 && EQ (EVENT_HEAD_KIND (EVENT_HEAD (c)), Qswitch_frame)) 1818 && EQ (EVENT_HEAD_KIND (EVENT_HEAD (c)), Qswitch_frame))
1812 internal_last_event_frame = XCONS (XCONS (c)->cdr)->car; 1819 internal_last_event_frame = XCONS (XCONS (c)->cdr)->car;
1832 while (CONSP (*tailp)) 1839 while (CONSP (*tailp))
1833 tailp = &XCONS (*tailp)->cdr; 1840 tailp = &XCONS (*tailp)->cdr;
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 }
1852 #endif 1859 #endif
1853 } 1860 }
2127 if (FRAMEP (do_mouse_tracking) && mouse_moved) 2134 if (FRAMEP (do_mouse_tracking) && mouse_moved)
2128 return 1; 2135 return 1;
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;
2143 } 2150 }
2144 2151
6355 perd->prefix_factor = Qnil; 6362 perd->prefix_factor = Qnil;
6356 perd->prefix_value = Qnil; 6363 perd->prefix_value = Qnil;
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;
6363 perd->kbd_macro_buffer = 0; 6371 perd->kbd_macro_buffer = 0;
6364 perd->kbd_macro_bufsize = 0; 6372 perd->kbd_macro_bufsize = 0;