Commit bded54dd authored by Karl Heuer's avatar Karl Heuer
Browse files

(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.
parent ebfbe249
...@@ -97,6 +97,7 @@ struct backtrace ...@@ -97,6 +97,7 @@ struct backtrace
#ifdef MULTI_PERDISPLAY #ifdef MULTI_PERDISPLAY
PERDISPLAY *current_perdisplay; PERDISPLAY *current_perdisplay;
PERDISPLAY *all_perdisplays; PERDISPLAY *all_perdisplays;
int display_locked;
#else #else
PERDISPLAY the_only_perdisplay; PERDISPLAY the_only_perdisplay;
#endif #endif
...@@ -750,6 +751,7 @@ cmd_error (data) ...@@ -750,6 +751,7 @@ cmd_error (data)
Vinhibit_quit = Qnil; Vinhibit_quit = Qnil;
#ifdef MULTI_PERDISPLAY #ifdef MULTI_PERDISPLAY
current_perdisplay = 0; current_perdisplay = 0;
display_locked = 0;
#endif #endif
return make_number (0); return make_number (0);
...@@ -948,7 +950,9 @@ command_loop_1 () ...@@ -948,7 +950,9 @@ command_loop_1 ()
int no_direct; int no_direct;
int prev_modiff; int prev_modiff;
struct buffer *prev_buffer; struct buffer *prev_buffer;
PERDISPLAY *global_perdisplay = current_perdisplay; #ifdef MULTI_PERDISPLAY
PERDISPLAY *outer_perdisplay = current_perdisplay;
#endif
Vdeactivate_mark = Qnil; Vdeactivate_mark = Qnil;
waiting_for_input = 0; waiting_for_input = 0;
...@@ -1271,7 +1275,8 @@ command_loop_1 () ...@@ -1271,7 +1275,8 @@ command_loop_1 ()
finalize_kbd_macro_chars (); finalize_kbd_macro_chars ();
#ifdef MULTI_PERDISPLAY #ifdef MULTI_PERDISPLAY
current_perdisplay = global_perdisplay; current_perdisplay = outer_perdisplay;
display_locked = (current_perdisplay != 0);
#endif #endif
} }
} }
...@@ -1457,8 +1462,9 @@ Lisp_Object print_help (); ...@@ -1457,8 +1462,9 @@ Lisp_Object print_help ();
static Lisp_Object kbd_buffer_get_event (); static Lisp_Object kbd_buffer_get_event ();
static void record_char (); static void record_char ();
static PERDISPLAY *read_char_perdisplay; #ifdef MULTI_PERDISPLAY
static jmp_buf wrong_display_jmpbuf; static jmp_buf wrong_display_jmpbuf;
#endif
/* read a character from the keyboard; call the redisplay if needed */ /* read a character from the keyboard; call the redisplay if needed */
/* commandflag 0 means do not do auto-saving, but do do redisplay. /* commandflag 0 means do not do auto-saving, but do do redisplay.
...@@ -1720,25 +1726,19 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) ...@@ -1720,25 +1726,19 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu)
if (NILP (c)) if (NILP (c))
{ {
PERDISPLAY *perd; PERDISPLAY *perd;
/* Check for something on one of the side queues. If we're already /* Check for something on one of the side queues. Give priority to
locked to a particular display, just check that one; otherwise the current display, but if we're not locked, then check the other
check all of them, but give priority to the most recently used displays as well. */
display. */ if (current_perdisplay && CONSP (current_perdisplay->kbd_queue))
if (current_perdisplay) perd = current_perdisplay;
{ else if (!display_locked)
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
{ {
for (perd = all_perdisplays; perd; perd = perd->next_perdisplay) for (perd = all_perdisplays; perd; perd = perd->next_perdisplay)
if (CONSP (perd->kbd_queue)) if (CONSP (perd->kbd_queue))
break; break;
} }
else
perd = 0;
/* If we found something on a side queue, use that. /* If we found something on a side queue, use that.
Otherwise, read from the main queue, and if that gives us Otherwise, read from the main queue, and if that gives us
...@@ -1762,7 +1762,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) ...@@ -1762,7 +1762,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu)
redisplay (); redisplay ();
} }
} }
if (current_perdisplay && perd != current_perdisplay) if (display_locked && perd != current_perdisplay)
{ {
Lisp_Object *tailp = &perd->kbd_queue; Lisp_Object *tailp = &perd->kbd_queue;
while (CONSP (*tailp)) while (CONSP (*tailp))
...@@ -1773,17 +1773,19 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) ...@@ -1773,17 +1773,19 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu)
goto wrong_display; goto wrong_display;
} }
} }
if (!read_char_perdisplay) #ifdef MULTI_PERDISPLAY
read_char_perdisplay = perd; if (!current_perdisplay)
if (perd != read_char_perdisplay) current_perdisplay = perd;
if (perd != current_perdisplay)
{ {
/* We shouldn't get here if we were locked onto one display! */ /* We shouldn't get here if we were locked onto one display! */
if (current_perdisplay) if (display_locked)
abort (); abort ();
perd->kbd_queue = Fcons (c, perd->kbd_queue); perd->kbd_queue = Fcons (c, perd->kbd_queue);
read_char_perdisplay = perd; current_perdisplay = perd;
longjmp (wrong_display_jmpbuf, 1); longjmp (wrong_display_jmpbuf, 1);
} }
#endif
} }
/* Terminate Emacs in batch mode if at eof. */ /* Terminate Emacs in batch mode if at eof. */
if (noninteractive && INTEGERP (c) && XINT (c) < 0) if (noninteractive && INTEGERP (c) && XINT (c) < 0)
...@@ -4821,7 +4823,8 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last) ...@@ -4821,7 +4823,8 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last)
struct buffer *buf = current_buffer; struct buffer *buf = current_buffer;
{ {
PERDISPLAY *interrupted_perdisplay = read_char_perdisplay; #ifdef MULTI_PERDISPLAY
PERDISPLAY *interrupted_perdisplay = current_perdisplay;
if (setjmp (wrong_display_jmpbuf)) if (setjmp (wrong_display_jmpbuf))
{ {
while (t > 0) while (t > 0)
...@@ -4830,6 +4833,7 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last) ...@@ -4830,6 +4833,7 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last)
mock_input = 0; mock_input = 0;
goto replay_sequence; goto replay_sequence;
} }
#endif
key = read_char (NILP (prompt), nmaps, submaps, last_nonmenu_event, key = read_char (NILP (prompt), nmaps, submaps, last_nonmenu_event,
&used_mouse_menu); &used_mouse_menu);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment