changeset 10820:5bef43a53c01

(display_locked): New var to indicate when we're in the run state. current_perdisplay is now meaningful in the wait state as well. (cmd_error): Clear display_locked in addition to current_perdisplay. (command_loop_1): outer_perdisplay renamed from global_perdisplay. Restore display_locked as well as current_perdisplay. (read_char): read_char_perdisplay merged with current_perdisplay. (read_key_sequence): Likewise.
author Karl Heuer <kwzh@gnu.org>
date Fri, 24 Feb 1995 02:41:55 +0000
parents 4768cffd88e5
children 1ff0ed96a4c0
files src/keyboard.c
diffstat 1 files changed, 28 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/src/keyboard.c	Fri Feb 24 02:30:23 1995 +0000
+++ b/src/keyboard.c	Fri Feb 24 02:41:55 1995 +0000
@@ -97,6 +97,7 @@
 #ifdef MULTI_PERDISPLAY
 PERDISPLAY *current_perdisplay;
 PERDISPLAY *all_perdisplays;
+int display_locked;
 #else
 PERDISPLAY the_only_perdisplay;
 #endif
@@ -750,6 +751,7 @@
   Vinhibit_quit = Qnil;
 #ifdef MULTI_PERDISPLAY
   current_perdisplay = 0;
+  display_locked = 0;
 #endif
 
   return make_number (0);
@@ -948,7 +950,9 @@
   int no_direct;
   int prev_modiff;
   struct buffer *prev_buffer;
-  PERDISPLAY *global_perdisplay = current_perdisplay;
+#ifdef MULTI_PERDISPLAY
+  PERDISPLAY *outer_perdisplay = current_perdisplay;
+#endif
 
   Vdeactivate_mark = Qnil;
   waiting_for_input = 0;
@@ -1271,7 +1275,8 @@
 	finalize_kbd_macro_chars ();
 
 #ifdef MULTI_PERDISPLAY
-      current_perdisplay = global_perdisplay;
+      current_perdisplay = outer_perdisplay;
+      display_locked = (current_perdisplay != 0);
 #endif
     }
 }
@@ -1457,8 +1462,9 @@
 static Lisp_Object kbd_buffer_get_event ();
 static void record_char ();
 
-static PERDISPLAY *read_char_perdisplay;
+#ifdef MULTI_PERDISPLAY
 static jmp_buf wrong_display_jmpbuf;
+#endif
 
 /* read a character from the keyboard; call the redisplay if needed */
 /* commandflag 0 means do not do auto-saving, but do do redisplay.
@@ -1720,25 +1726,19 @@
   if (NILP (c))
     {
       PERDISPLAY *perd;
-      /* Check for something on one of the side queues.  If we're already
-	 locked to a particular display, just check that one; otherwise
-	 check all of them, but give priority to the most recently used
-	 display.  */
-      if (current_perdisplay)
-	{
-	  if (CONSP (current_perdisplay->kbd_queue))
-	    perd = current_perdisplay;
-	  else
-	    perd = 0;
-	}
-      else if (read_char_perdisplay && CONSP (read_char_perdisplay->kbd_queue))
-	perd = read_char_perdisplay;
-      else
+      /* 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))
+	perd = current_perdisplay;
+      else if (!display_locked)
 	{
 	  for (perd = all_perdisplays; perd; perd = perd->next_perdisplay)
 	    if (CONSP (perd->kbd_queue))
 	      break;
 	}
+      else
+	perd = 0;
 
       /* If we found something on a side queue, use that.
 	 Otherwise, read from the main queue, and if that gives us
@@ -1762,7 +1762,7 @@
 		  redisplay ();
 		}
 	    }
-	  if (current_perdisplay && perd != current_perdisplay)
+	  if (display_locked && perd != current_perdisplay)
 	    {
 	      Lisp_Object *tailp = &perd->kbd_queue;
 	      while (CONSP (*tailp))
@@ -1773,17 +1773,19 @@
 	      goto wrong_display;
 	    }
 	}
-      if (!read_char_perdisplay)
-	read_char_perdisplay = perd;
-      if (perd != read_char_perdisplay)
+#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 (current_perdisplay)
+	  if (display_locked)
 	    abort ();
 	  perd->kbd_queue = Fcons (c, perd->kbd_queue);
-	  read_char_perdisplay = perd;
+	  current_perdisplay = perd;
 	  longjmp (wrong_display_jmpbuf, 1);
 	}
+#endif
     }
   /* Terminate Emacs in batch mode if at eof.  */
   if (noninteractive && INTEGERP (c) && XINT (c) < 0)
@@ -4821,7 +4823,8 @@
 	  struct buffer *buf = current_buffer;
 
 	  {
-	    PERDISPLAY *interrupted_perdisplay = read_char_perdisplay;
+#ifdef MULTI_PERDISPLAY
+	    PERDISPLAY *interrupted_perdisplay = current_perdisplay;
 	    if (setjmp (wrong_display_jmpbuf))
 	      {
 		while (t > 0)
@@ -4830,6 +4833,7 @@
 		mock_input = 0;
 		goto replay_sequence;
 	      }
+#endif
 	    key = read_char (NILP (prompt), nmaps, submaps, last_nonmenu_event,
 			     &used_mouse_menu);
 	  }