# HG changeset patch # User Karl Heuer # Date 794641847 0 # Node ID dbf1aab47502f36aa1c8fac7660909f59e83ff77 # Parent ade108508c1e9ee720ae0176bd038875dd176cf4 (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. diff -r ade108508c1e -r dbf1aab47502 src/keyboard.c --- a/src/keyboard.c Wed Mar 08 05:50:24 1995 +0000 +++ b/src/keyboard.c Wed Mar 08 05:50:47 1995 +0000 @@ -755,8 +755,11 @@ unlock_display () { if (CONSP (Vunread_command_events)) - current_perdisplay->kbd_queue - = nconc2 (Vunread_command_events, current_perdisplay->kbd_queue); + { + current_perdisplay->kbd_queue + = nconc2 (Vunread_command_events, current_perdisplay->kbd_queue); + current_perdisplay->kbd_queue_has_data = 1; + } Vunread_command_events = Qnil; current_perdisplay = 0; display_locked = 0; @@ -1786,12 +1789,12 @@ /* Check for something on one of the side queues. Give priority to the current display, but if we're not locked, then check the other displays as well. */ - if (current_perdisplay && CONSP (current_perdisplay->kbd_queue)) + if (current_perdisplay && current_perdisplay->kbd_queue_has_data) perd = current_perdisplay; else if (!display_locked) { for (perd = all_perdisplays; perd; perd = perd->next_perdisplay) - if (CONSP (perd->kbd_queue)) + if (perd->kbd_queue_has_data) break; } else @@ -1803,8 +1806,12 @@ try again. */ if (perd) { + if (!CONSP (perd->kbd_queue)) + abort (); c = XCONS (perd->kbd_queue)->car; perd->kbd_queue = XCONS (perd->kbd_queue)->cdr; + if (NILP (perd->kbd_queue)) + perd->kbd_queue_has_data = 0; input_pending = readable_events (); #ifdef MULTI_FRAME if (EVENT_HAS_PARAMETERS (c) @@ -1834,18 +1841,18 @@ if (!NILP (*tailp)) abort (); *tailp = Fcons (c, Qnil); + perd->kbd_queue_has_data = 1; goto wrong_display; } } #ifdef MULTI_PERDISPLAY - if (!current_perdisplay) - current_perdisplay = perd; if (perd != current_perdisplay) { /* We shouldn't get here if we were locked onto one display! */ if (display_locked) abort (); perd->kbd_queue = Fcons (c, perd->kbd_queue); + perd->kbd_queue_has_data = 1; current_perdisplay = perd; longjmp (wrong_display_jmpbuf, 1); } @@ -2129,14 +2136,14 @@ #endif if (display_locked) { - if (CONSP (current_perdisplay->kbd_queue)) + if (current_perdisplay->kbd_queue_has_data) return 1; } else { PERDISPLAY *perd; for (perd = all_perdisplays; perd; perd = perd->next_perdisplay) - if (CONSP (perd->kbd_queue)) + if (perd->kbd_queue_has_data) return 1; } return 0; @@ -6357,6 +6364,7 @@ perd->prefix_sign = 1; perd->prefix_partial = 0; perd->kbd_queue = Qnil; + perd->kbd_queue_has_data = 0; perd->immediate_echo = 0; perd->echoptr = perd->echobuf; perd->echo_after_prompt = -1;