aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/keyboard.c52
1 files changed, 28 insertions, 24 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index f256c825f35..56800409d6b 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -97,6 +97,7 @@ struct backtrace
97#ifdef MULTI_PERDISPLAY 97#ifdef MULTI_PERDISPLAY
98PERDISPLAY *current_perdisplay; 98PERDISPLAY *current_perdisplay;
99PERDISPLAY *all_perdisplays; 99PERDISPLAY *all_perdisplays;
100int display_locked;
100#else 101#else
101PERDISPLAY the_only_perdisplay; 102PERDISPLAY the_only_perdisplay;
102#endif 103#endif
@@ -750,6 +751,7 @@ cmd_error (data)
750 Vinhibit_quit = Qnil; 751 Vinhibit_quit = Qnil;
751#ifdef MULTI_PERDISPLAY 752#ifdef MULTI_PERDISPLAY
752 current_perdisplay = 0; 753 current_perdisplay = 0;
754 display_locked = 0;
753#endif 755#endif
754 756
755 return make_number (0); 757 return make_number (0);
@@ -948,7 +950,9 @@ command_loop_1 ()
948 int no_direct; 950 int no_direct;
949 int prev_modiff; 951 int prev_modiff;
950 struct buffer *prev_buffer; 952 struct buffer *prev_buffer;
951 PERDISPLAY *global_perdisplay = current_perdisplay; 953#ifdef MULTI_PERDISPLAY
954 PERDISPLAY *outer_perdisplay = current_perdisplay;
955#endif
952 956
953 Vdeactivate_mark = Qnil; 957 Vdeactivate_mark = Qnil;
954 waiting_for_input = 0; 958 waiting_for_input = 0;
@@ -1271,7 +1275,8 @@ command_loop_1 ()
1271 finalize_kbd_macro_chars (); 1275 finalize_kbd_macro_chars ();
1272 1276
1273#ifdef MULTI_PERDISPLAY 1277#ifdef MULTI_PERDISPLAY
1274 current_perdisplay = global_perdisplay; 1278 current_perdisplay = outer_perdisplay;
1279 display_locked = (current_perdisplay != 0);
1275#endif 1280#endif
1276 } 1281 }
1277} 1282}
@@ -1457,8 +1462,9 @@ Lisp_Object print_help ();
1457static Lisp_Object kbd_buffer_get_event (); 1462static Lisp_Object kbd_buffer_get_event ();
1458static void record_char (); 1463static void record_char ();
1459 1464
1460static PERDISPLAY *read_char_perdisplay; 1465#ifdef MULTI_PERDISPLAY
1461static jmp_buf wrong_display_jmpbuf; 1466static jmp_buf wrong_display_jmpbuf;
1467#endif
1462 1468
1463/* read a character from the keyboard; call the redisplay if needed */ 1469/* read a character from the keyboard; call the redisplay if needed */
1464/* commandflag 0 means do not do auto-saving, but do do redisplay. 1470/* 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 if (NILP (c)) 1726 if (NILP (c))
1721 { 1727 {
1722 PERDISPLAY *perd; 1728 PERDISPLAY *perd;
1723 /* Check for something on one of the side queues. If we're already 1729 /* Check for something on one of the side queues. Give priority to
1724 locked to a particular display, just check that one; otherwise 1730 the current display, but if we're not locked, then check the other
1725 check all of them, but give priority to the most recently used 1731 displays as well. */
1726 display. */ 1732 if (current_perdisplay && CONSP (current_perdisplay->kbd_queue))
1727 if (current_perdisplay) 1733 perd = current_perdisplay;
1728 { 1734 else if (!display_locked)
1729 if (CONSP (current_perdisplay->kbd_queue))
1730 perd = current_perdisplay;
1731 else
1732 perd = 0;
1733 }
1734 else if (read_char_perdisplay && CONSP (read_char_perdisplay->kbd_queue))
1735 perd = read_char_perdisplay;
1736 else
1737 { 1735 {
1738 for (perd = all_perdisplays; perd; perd = perd->next_perdisplay) 1736 for (perd = all_perdisplays; perd; perd = perd->next_perdisplay)
1739 if (CONSP (perd->kbd_queue)) 1737 if (CONSP (perd->kbd_queue))
1740 break; 1738 break;
1741 } 1739 }
1740 else
1741 perd = 0;
1742 1742
1743 /* If we found something on a side queue, use that. 1743 /* If we found something on a side queue, use that.
1744 Otherwise, read from the main queue, and if that gives us 1744 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 redisplay (); 1762 redisplay ();
1763 } 1763 }
1764 } 1764 }
1765 if (current_perdisplay && perd != current_perdisplay) 1765 if (display_locked && perd != current_perdisplay)
1766 { 1766 {
1767 Lisp_Object *tailp = &perd->kbd_queue; 1767 Lisp_Object *tailp = &perd->kbd_queue;
1768 while (CONSP (*tailp)) 1768 while (CONSP (*tailp))
@@ -1773,17 +1773,19 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu)
1773 goto wrong_display; 1773 goto wrong_display;
1774 } 1774 }
1775 } 1775 }
1776 if (!read_char_perdisplay) 1776#ifdef MULTI_PERDISPLAY
1777 read_char_perdisplay = perd; 1777 if (!current_perdisplay)
1778 if (perd != read_char_perdisplay) 1778 current_perdisplay = perd;
1779 if (perd != current_perdisplay)
1779 { 1780 {
1780 /* We shouldn't get here if we were locked onto one display! */ 1781 /* We shouldn't get here if we were locked onto one display! */
1781 if (current_perdisplay) 1782 if (display_locked)
1782 abort (); 1783 abort ();
1783 perd->kbd_queue = Fcons (c, perd->kbd_queue); 1784 perd->kbd_queue = Fcons (c, perd->kbd_queue);
1784 read_char_perdisplay = perd; 1785 current_perdisplay = perd;
1785 longjmp (wrong_display_jmpbuf, 1); 1786 longjmp (wrong_display_jmpbuf, 1);
1786 } 1787 }
1788#endif
1787 } 1789 }
1788 /* Terminate Emacs in batch mode if at eof. */ 1790 /* Terminate Emacs in batch mode if at eof. */
1789 if (noninteractive && INTEGERP (c) && XINT (c) < 0) 1791 if (noninteractive && INTEGERP (c) && XINT (c) < 0)
@@ -4821,7 +4823,8 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last)
4821 struct buffer *buf = current_buffer; 4823 struct buffer *buf = current_buffer;
4822 4824
4823 { 4825 {
4824 PERDISPLAY *interrupted_perdisplay = read_char_perdisplay; 4826#ifdef MULTI_PERDISPLAY
4827 PERDISPLAY *interrupted_perdisplay = current_perdisplay;
4825 if (setjmp (wrong_display_jmpbuf)) 4828 if (setjmp (wrong_display_jmpbuf))
4826 { 4829 {
4827 while (t > 0) 4830 while (t > 0)
@@ -4830,6 +4833,7 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last)
4830 mock_input = 0; 4833 mock_input = 0;
4831 goto replay_sequence; 4834 goto replay_sequence;
4832 } 4835 }
4836#endif
4833 key = read_char (NILP (prompt), nmaps, submaps, last_nonmenu_event, 4837 key = read_char (NILP (prompt), nmaps, submaps, last_nonmenu_event,
4834 &used_mouse_menu); 4838 &used_mouse_menu);
4835 } 4839 }