aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKarl Heuer1995-03-15 01:55:24 +0000
committerKarl Heuer1995-03-15 01:55:24 +0000
commitc5fdd3830135bf6a61af6a95611cc0bb28386e9e (patch)
treec22212b482f451817c15a7d3928cfd8c39c85781 /src
parent29b38361ea18507b7f381d8f79b9f0348e25f720 (diff)
downloademacs-c5fdd3830135bf6a61af6a95611cc0bb28386e9e.tar.gz
emacs-c5fdd3830135bf6a61af6a95611cc0bb28386e9e.zip
(unlock_kboard): Renamed from unlock_display.
(wrong_kboard_jmpbuf): Renamed from wrong_display_jmpbuf. (event_to_kboard): Renamed from event_to_perdisplay. (kbd_buffer_get_event): If no associated kboard, store current_kboard rather than the first kboard in the global list. (init_kboard): Renamed from init_perdisplay. Initialize reference count. (wipe_kboard): Renamed from wipe_perdisplay.
Diffstat (limited to 'src')
-rw-r--r--src/keyboard.c325
1 files changed, 163 insertions, 162 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index df18f352d3f..2388482e8a3 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -94,12 +94,13 @@ struct backtrace
94 char evalargs; 94 char evalargs;
95 }; 95 };
96 96
97#ifdef MULTI_PERDISPLAY 97#ifdef MULTI_KBOARD
98PERDISPLAY *current_perdisplay; 98KBOARD *initial_kboard;
99PERDISPLAY *all_perdisplays; 99KBOARD *current_kboard;
100int display_locked; 100KBOARD *all_kboards;
101int kboard_locked;
101#else 102#else
102PERDISPLAY the_only_perdisplay; 103KBOARD the_only_kboard;
103#endif 104#endif
104 105
105/* Non-nil disable property on a command means 106/* Non-nil disable property on a command means
@@ -516,11 +517,11 @@ echo_prompt (str)
516 517
517 if (len > ECHOBUFSIZE - 4) 518 if (len > ECHOBUFSIZE - 4)
518 len = ECHOBUFSIZE - 4; 519 len = ECHOBUFSIZE - 4;
519 bcopy (str, current_perdisplay->echobuf, len); 520 bcopy (str, current_kboard->echobuf, len);
520 current_perdisplay->echoptr = current_perdisplay->echobuf + len; 521 current_kboard->echoptr = current_kboard->echobuf + len;
521 *current_perdisplay->echoptr = '\0'; 522 *current_kboard->echoptr = '\0';
522 523
523 current_perdisplay->echo_after_prompt = len; 524 current_kboard->echo_after_prompt = len;
524 525
525 echo (); 526 echo ();
526} 527}
@@ -534,11 +535,11 @@ echo_char (c)
534{ 535{
535 extern char *push_key_description (); 536 extern char *push_key_description ();
536 537
537 if (current_perdisplay->immediate_echo) 538 if (current_kboard->immediate_echo)
538 { 539 {
539 char *ptr = current_perdisplay->echoptr; 540 char *ptr = current_kboard->echoptr;
540 541
541 if (ptr != current_perdisplay->echobuf) 542 if (ptr != current_kboard->echobuf)
542 *ptr++ = ' '; 543 *ptr++ = ' ';
543 544
544 /* If someone has passed us a composite event, use its head symbol. */ 545 /* If someone has passed us a composite event, use its head symbol. */
@@ -546,7 +547,7 @@ echo_char (c)
546 547
547 if (INTEGERP (c)) 548 if (INTEGERP (c))
548 { 549 {
549 if (ptr - current_perdisplay->echobuf > ECHOBUFSIZE - 6) 550 if (ptr - current_kboard->echobuf > ECHOBUFSIZE - 6)
550 return; 551 return;
551 552
552 ptr = push_key_description (XINT (c), ptr); 553 ptr = push_key_description (XINT (c), ptr);
@@ -554,14 +555,13 @@ echo_char (c)
554 else if (SYMBOLP (c)) 555 else if (SYMBOLP (c))
555 { 556 {
556 struct Lisp_String *name = XSYMBOL (c)->name; 557 struct Lisp_String *name = XSYMBOL (c)->name;
557 if (((ptr - current_perdisplay->echobuf) + name->size + 4) 558 if ((ptr - current_kboard->echobuf) + name->size + 4 > ECHOBUFSIZE)
558 > ECHOBUFSIZE)
559 return; 559 return;
560 bcopy (name->data, ptr, name->size); 560 bcopy (name->data, ptr, name->size);
561 ptr += name->size; 561 ptr += name->size;
562 } 562 }
563 563
564 if (current_perdisplay->echoptr == current_perdisplay->echobuf 564 if (current_kboard->echoptr == current_kboard->echobuf
565 && EQ (c, Vhelp_char)) 565 && EQ (c, Vhelp_char))
566 { 566 {
567 strcpy (ptr, " (Type ? for further options)"); 567 strcpy (ptr, " (Type ? for further options)");
@@ -569,7 +569,7 @@ echo_char (c)
569 } 569 }
570 570
571 *ptr = 0; 571 *ptr = 0;
572 current_perdisplay->echoptr = ptr; 572 current_kboard->echoptr = ptr;
573 573
574 echo (); 574 echo ();
575 } 575 }
@@ -580,21 +580,21 @@ echo_char (c)
580 580
581echo_dash () 581echo_dash ()
582{ 582{
583 if (!current_perdisplay->immediate_echo 583 if (!current_kboard->immediate_echo
584 && current_perdisplay->echoptr == current_perdisplay->echobuf) 584 && current_kboard->echoptr == current_kboard->echobuf)
585 return; 585 return;
586 /* Do nothing if we just printed a prompt. */ 586 /* Do nothing if we just printed a prompt. */
587 if (current_perdisplay->echo_after_prompt 587 if (current_kboard->echo_after_prompt
588 == current_perdisplay->echoptr - current_perdisplay->echobuf) 588 == current_kboard->echoptr - current_kboard->echobuf)
589 return; 589 return;
590 /* Do nothing if not echoing at all. */ 590 /* Do nothing if not echoing at all. */
591 if (current_perdisplay->echoptr == 0) 591 if (current_kboard->echoptr == 0)
592 return; 592 return;
593 593
594 /* Put a dash at the end of the buffer temporarily, 594 /* Put a dash at the end of the buffer temporarily,
595 but make it go away when the next character is added. */ 595 but make it go away when the next character is added. */
596 current_perdisplay->echoptr[0] = '-'; 596 current_kboard->echoptr[0] = '-';
597 current_perdisplay->echoptr[1] = 0; 597 current_kboard->echoptr[1] = 0;
598 598
599 echo (); 599 echo ();
600} 600}
@@ -604,10 +604,10 @@ echo_dash ()
604 604
605echo () 605echo ()
606{ 606{
607 if (!current_perdisplay->immediate_echo) 607 if (!current_kboard->immediate_echo)
608 { 608 {
609 int i; 609 int i;
610 current_perdisplay->immediate_echo = 1; 610 current_kboard->immediate_echo = 1;
611 611
612 for (i = 0; i < this_command_key_count; i++) 612 for (i = 0; i < this_command_key_count; i++)
613 { 613 {
@@ -621,7 +621,7 @@ echo ()
621 } 621 }
622 622
623 echoing = 1; 623 echoing = 1;
624 message1_nolog (current_perdisplay->echobuf); 624 message1_nolog (current_kboard->echobuf);
625 echoing = 0; 625 echoing = 0;
626 626
627 if (waiting_for_input && !NILP (Vquit_flag)) 627 if (waiting_for_input && !NILP (Vquit_flag))
@@ -632,9 +632,9 @@ echo ()
632 632
633cancel_echoing () 633cancel_echoing ()
634{ 634{
635 current_perdisplay->immediate_echo = 0; 635 current_kboard->immediate_echo = 0;
636 current_perdisplay->echoptr = current_perdisplay->echobuf; 636 current_kboard->echoptr = current_kboard->echobuf;
637 current_perdisplay->echo_after_prompt = -1; 637 current_kboard->echo_after_prompt = -1;
638} 638}
639 639
640/* Return the length of the current echo string. */ 640/* Return the length of the current echo string. */
@@ -642,7 +642,7 @@ cancel_echoing ()
642static int 642static int
643echo_length () 643echo_length ()
644{ 644{
645 return current_perdisplay->echoptr - current_perdisplay->echobuf; 645 return current_kboard->echoptr - current_kboard->echobuf;
646} 646}
647 647
648/* Truncate the current echo message to its first LEN chars. 648/* Truncate the current echo message to its first LEN chars.
@@ -653,8 +653,8 @@ static void
653echo_truncate (len) 653echo_truncate (len)
654 int len; 654 int len;
655{ 655{
656 current_perdisplay->echobuf[len] = '\0'; 656 current_kboard->echobuf[len] = '\0';
657 current_perdisplay->echoptr = current_perdisplay->echobuf + len; 657 current_kboard->echoptr = current_kboard->echobuf + len;
658 truncate_echo_area (len); 658 truncate_echo_area (len);
659} 659}
660 660
@@ -751,18 +751,18 @@ recursive_edit_unwind (buffer)
751 return Qnil; 751 return Qnil;
752} 752}
753 753
754#ifdef MULTI_PERDISPLAY 754#ifdef MULTI_KBOARD
755static void 755static void
756unlock_display () 756unlock_kboard ()
757{ 757{
758 if (CONSP (Vunread_command_events)) 758 if (CONSP (Vunread_command_events))
759 { 759 {
760 current_perdisplay->kbd_queue 760 current_kboard->kbd_queue
761 = nconc2 (Vunread_command_events, current_perdisplay->kbd_queue); 761 = nconc2 (Vunread_command_events, current_kboard->kbd_queue);
762 current_perdisplay->kbd_queue_has_data = 1; 762 current_kboard->kbd_queue_has_data = 1;
763 } 763 }
764 Vunread_command_events = Qnil; 764 Vunread_command_events = Qnil;
765 display_locked = 0; 765 kboard_locked = 0;
766} 766}
767#endif 767#endif
768 768
@@ -790,8 +790,8 @@ cmd_error (data)
790 Vquit_flag = Qnil; 790 Vquit_flag = Qnil;
791 791
792 Vinhibit_quit = Qnil; 792 Vinhibit_quit = Qnil;
793#ifdef MULTI_PERDISPLAY 793#ifdef MULTI_KBOARD
794 unlock_display (); 794 unlock_kboard ();
795#endif 795#endif
796 796
797 return make_number (0); 797 return make_number (0);
@@ -990,8 +990,8 @@ command_loop_1 ()
990 int no_direct; 990 int no_direct;
991 int prev_modiff; 991 int prev_modiff;
992 struct buffer *prev_buffer; 992 struct buffer *prev_buffer;
993#ifdef MULTI_PERDISPLAY 993#ifdef MULTI_KBOARD
994 int was_locked = display_locked; 994 int was_locked = kboard_locked;
995#endif 995#endif
996 996
997 Vdeactivate_mark = Qnil; 997 Vdeactivate_mark = Qnil;
@@ -1125,10 +1125,10 @@ command_loop_1 ()
1125 XSETBUFFER (last_point_position_buffer, prev_buffer); 1125 XSETBUFFER (last_point_position_buffer, prev_buffer);
1126 1126
1127 /* If we're building a prefix argument, override minus and digits. */ 1127 /* If we're building a prefix argument, override minus and digits. */
1128 if (current_perdisplay->prefix_partial && i == 1 && NATNUMP (keybuf[0])) 1128 if (current_kboard->prefix_partial && i == 1 && NATNUMP (keybuf[0]))
1129 { 1129 {
1130 if (XFASTINT (keybuf[0]) == '-' 1130 if (XFASTINT (keybuf[0]) == '-'
1131 && NILP (current_perdisplay->prefix_value)) 1131 && NILP (current_kboard->prefix_value))
1132 cmd = Qnegative_argument; 1132 cmd = Qnegative_argument;
1133 else if (XFASTINT (keybuf[0]) >= '0' && XFASTINT (keybuf[0]) <= '9') 1133 else if (XFASTINT (keybuf[0]) >= '0' && XFASTINT (keybuf[0]) <= '9')
1134 cmd = Qdigit_argument; 1134 cmd = Qdigit_argument;
@@ -1146,14 +1146,14 @@ command_loop_1 ()
1146 { 1146 {
1147 /* nil means key is undefined. */ 1147 /* nil means key is undefined. */
1148 bitch_at_user (); 1148 bitch_at_user ();
1149 current_perdisplay->defining_kbd_macro = Qnil; 1149 current_kboard->defining_kbd_macro = Qnil;
1150 update_mode_lines = 1; 1150 update_mode_lines = 1;
1151 clear_prefix_arg (); 1151 clear_prefix_arg ();
1152 } 1152 }
1153 else 1153 else
1154 { 1154 {
1155 current_prefix_partial = current_perdisplay->prefix_partial; 1155 current_prefix_partial = current_kboard->prefix_partial;
1156 if (current_perdisplay->prefix_partial) 1156 if (current_kboard->prefix_partial)
1157 finalize_prefix_arg (); 1157 finalize_prefix_arg ();
1158 1158
1159 if (NILP (Vprefix_arg) && ! no_direct) 1159 if (NILP (Vprefix_arg) && ! no_direct)
@@ -1303,7 +1303,7 @@ command_loop_1 ()
1303 3) we want to leave this_command_key_count non-zero, so that 1303 3) we want to leave this_command_key_count non-zero, so that
1304 read_char will realize that it is re-reading a character, and 1304 read_char will realize that it is re-reading a character, and
1305 not echo it a second time. */ 1305 not echo it a second time. */
1306 if (NILP (Vprefix_arg) && !current_perdisplay->prefix_partial) 1306 if (NILP (Vprefix_arg) && !current_kboard->prefix_partial)
1307 { 1307 {
1308 last_command = this_command; 1308 last_command = this_command;
1309 cancel_echoing (); 1309 cancel_echoing ();
@@ -1324,13 +1324,13 @@ command_loop_1 ()
1324 finalize: 1324 finalize:
1325 /* Install chars successfully executed in kbd macro. */ 1325 /* Install chars successfully executed in kbd macro. */
1326 1326
1327 if (!NILP (current_perdisplay->defining_kbd_macro) && NILP (Vprefix_arg) 1327 if (!NILP (current_kboard->defining_kbd_macro) && NILP (Vprefix_arg)
1328 && !current_perdisplay->prefix_partial) 1328 && !current_kboard->prefix_partial)
1329 finalize_kbd_macro_chars (); 1329 finalize_kbd_macro_chars ();
1330 1330
1331#ifdef MULTI_PERDISPLAY 1331#ifdef MULTI_KBOARD
1332 if (!was_locked) 1332 if (!was_locked)
1333 unlock_display (); 1333 unlock_kboard ();
1334#endif 1334#endif
1335 } 1335 }
1336} 1336}
@@ -1517,8 +1517,8 @@ Lisp_Object print_help ();
1517static Lisp_Object kbd_buffer_get_event (); 1517static Lisp_Object kbd_buffer_get_event ();
1518static void record_char (); 1518static void record_char ();
1519 1519
1520#ifdef MULTI_PERDISPLAY 1520#ifdef MULTI_KBOARD
1521static jmp_buf wrong_display_jmpbuf; 1521static jmp_buf wrong_kboard_jmpbuf;
1522#endif 1522#endif
1523 1523
1524/* read a character from the keyboard; call the redisplay if needed */ 1524/* read a character from the keyboard; call the redisplay if needed */
@@ -1647,23 +1647,23 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu)
1647 if (!NILP (Vinhibit_quit)) 1647 if (!NILP (Vinhibit_quit))
1648 Vquit_flag = Qnil; 1648 Vquit_flag = Qnil;
1649 1649
1650#ifdef MULTI_PERDISPLAY 1650#ifdef MULTI_KBOARD
1651 { 1651 {
1652 PERDISPLAY *perd = get_perdisplay (selected_frame); 1652 KBOARD *kb = FRAME_KBOARD (selected_frame);
1653 if (perd != current_perdisplay) 1653 if (kb != current_kboard)
1654 { 1654 {
1655 Lisp_Object *tailp = &perd->kbd_queue; 1655 Lisp_Object *tailp = &kb->kbd_queue;
1656 /* We shouldn't get here if we were locked onto one display! */ 1656 /* We shouldn't get here if we were locked onto one kboard! */
1657 if (display_locked) 1657 if (kboard_locked)
1658 abort (); 1658 abort ();
1659 while (CONSP (*tailp)) 1659 while (CONSP (*tailp))
1660 tailp = &XCONS (*tailp)->cdr; 1660 tailp = &XCONS (*tailp)->cdr;
1661 if (!NILP (*tailp)) 1661 if (!NILP (*tailp))
1662 abort (); 1662 abort ();
1663 *tailp = Fcons (c, Qnil); 1663 *tailp = Fcons (c, Qnil);
1664 perd->kbd_queue_has_data = 1; 1664 kb->kbd_queue_has_data = 1;
1665 current_perdisplay = perd; 1665 current_kboard = kb;
1666 longjmp (wrong_display_jmpbuf, 1); 1666 longjmp (wrong_kboard_jmpbuf, 1);
1667 } 1667 }
1668 } 1668 }
1669#endif 1669#endif
@@ -1672,7 +1672,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu)
1672 1672
1673 /* Message turns off echoing unless more keystrokes turn it on again. */ 1673 /* Message turns off echoing unless more keystrokes turn it on again. */
1674 if (echo_area_glyphs && *echo_area_glyphs 1674 if (echo_area_glyphs && *echo_area_glyphs
1675 && echo_area_glyphs != current_perdisplay->echobuf) 1675 && echo_area_glyphs != current_kboard->echobuf)
1676 cancel_echoing (); 1676 cancel_echoing ();
1677 else 1677 else
1678 /* If already echoing, continue. */ 1678 /* If already echoing, continue. */
@@ -1701,7 +1701,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu)
1701 1701
1702 /* If in middle of key sequence and minibuffer not active, 1702 /* If in middle of key sequence and minibuffer not active,
1703 start echoing if enough time elapses. */ 1703 start echoing if enough time elapses. */
1704 if (minibuf_level == 0 && !current_perdisplay->immediate_echo 1704 if (minibuf_level == 0 && !current_kboard->immediate_echo
1705 && this_command_key_count > 0 1705 && this_command_key_count > 0
1706 && ! noninteractive 1706 && ! noninteractive
1707 && echo_keystrokes > 0 1707 && echo_keystrokes > 0
@@ -1795,20 +1795,20 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu)
1795 1795
1796 if (NILP (c)) 1796 if (NILP (c))
1797 { 1797 {
1798 /* Primary consideration goes to current_perdisplay's side queue. 1798 /* Primary consideration goes to current_kboard's side queue.
1799 If that's empty, then we check the other side queues and throw 1799 If that's empty, then we check the other side queues and throw
1800 if we find something there. Finally, we read from the main queue, 1800 if we find something there. Finally, we read from the main queue,
1801 and if that gives us something we can't use yet, we put it on the 1801 and if that gives us something we can't use yet, we put it on the
1802 appropriate side queue and try again. */ 1802 appropriate side queue and try again. */
1803 if (current_perdisplay->kbd_queue_has_data) 1803 if (current_kboard->kbd_queue_has_data)
1804 { 1804 {
1805 if (!CONSP (current_perdisplay->kbd_queue)) 1805 if (!CONSP (current_kboard->kbd_queue))
1806 abort (); 1806 abort ();
1807 c = XCONS (current_perdisplay->kbd_queue)->car; 1807 c = XCONS (current_kboard->kbd_queue)->car;
1808 current_perdisplay->kbd_queue 1808 current_kboard->kbd_queue
1809 = XCONS (current_perdisplay->kbd_queue)->cdr; 1809 = XCONS (current_kboard->kbd_queue)->cdr;
1810 if (NILP (current_perdisplay->kbd_queue)) 1810 if (NILP (current_kboard->kbd_queue))
1811 current_perdisplay->kbd_queue_has_data = 0; 1811 current_kboard->kbd_queue_has_data = 0;
1812 input_pending = readable_events (); 1812 input_pending = readable_events ();
1813#ifdef MULTI_FRAME 1813#ifdef MULTI_FRAME
1814 if (EVENT_HAS_PARAMETERS (c) 1814 if (EVENT_HAS_PARAMETERS (c)
@@ -1819,22 +1819,22 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu)
1819 } 1819 }
1820 else 1820 else
1821 { 1821 {
1822 PERDISPLAY *perd; 1822 KBOARD *kb;
1823#ifdef MULTI_PERDISPLAY 1823#ifdef MULTI_KBOARD
1824 if (!display_locked) 1824 if (!kboard_locked)
1825 { 1825 {
1826 for (perd = all_perdisplays; perd; perd = perd->next_perdisplay) 1826 for (kb = all_kboards; kb; kb = kb->next_kboard)
1827 if (perd->kbd_queue_has_data) 1827 if (kb->kbd_queue_has_data)
1828 { 1828 {
1829 current_perdisplay = perd; 1829 current_kboard = kb;
1830 longjmp (wrong_display_jmpbuf, 1); 1830 longjmp (wrong_kboard_jmpbuf, 1);
1831 } 1831 }
1832 } 1832 }
1833#endif 1833#endif
1834 1834
1835 wrong_display: 1835 wrong_kboard:
1836 /* Actually read a character, waiting if necessary. */ 1836 /* Actually read a character, waiting if necessary. */
1837 while (c = kbd_buffer_get_event (&perd), NILP (c)) 1837 while (c = kbd_buffer_get_event (&kb), NILP (c))
1838 { 1838 {
1839 if (commandflag >= 0 1839 if (commandflag >= 0
1840 && !input_pending && !detect_input_pending ()) 1840 && !input_pending && !detect_input_pending ())
@@ -1843,20 +1843,20 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu)
1843 redisplay (); 1843 redisplay ();
1844 } 1844 }
1845 } 1845 }
1846#ifdef MULTI_PERDISPLAY 1846#ifdef MULTI_KBOARD
1847 if (perd != current_perdisplay) 1847 if (kb != current_kboard)
1848 { 1848 {
1849 Lisp_Object *tailp = &perd->kbd_queue; 1849 Lisp_Object *tailp = &kb->kbd_queue;
1850 while (CONSP (*tailp)) 1850 while (CONSP (*tailp))
1851 tailp = &XCONS (*tailp)->cdr; 1851 tailp = &XCONS (*tailp)->cdr;
1852 if (!NILP (*tailp)) 1852 if (!NILP (*tailp))
1853 abort (); 1853 abort ();
1854 *tailp = Fcons (c, Qnil); 1854 *tailp = Fcons (c, Qnil);
1855 perd->kbd_queue_has_data = 1; 1855 kb->kbd_queue_has_data = 1;
1856 if (display_locked) 1856 if (kboard_locked)
1857 goto wrong_display; 1857 goto wrong_kboard;
1858 current_perdisplay = perd; 1858 current_kboard = kb;
1859 longjmp (wrong_display_jmpbuf, 1); 1859 longjmp (wrong_kboard_jmpbuf, 1);
1860 } 1860 }
1861#endif 1861#endif
1862 } 1862 }
@@ -2137,16 +2137,16 @@ readable_events ()
2137 if (FRAMEP (do_mouse_tracking) && mouse_moved) 2137 if (FRAMEP (do_mouse_tracking) && mouse_moved)
2138 return 1; 2138 return 1;
2139#endif 2139#endif
2140 if (display_locked) 2140 if (kboard_locked)
2141 { 2141 {
2142 if (current_perdisplay->kbd_queue_has_data) 2142 if (current_kboard->kbd_queue_has_data)
2143 return 1; 2143 return 1;
2144 } 2144 }
2145 else 2145 else
2146 { 2146 {
2147 PERDISPLAY *perd; 2147 KBOARD *kb;
2148 for (perd = all_perdisplays; perd; perd = perd->next_perdisplay) 2148 for (kb = all_kboards; kb; kb = kb->next_kboard)
2149 if (perd->kbd_queue_has_data) 2149 if (kb->kbd_queue_has_data)
2150 return 1; 2150 return 1;
2151 } 2151 }
2152 return 0; 2152 return 0;
@@ -2155,9 +2155,9 @@ readable_events ()
2155/* Set this for debugging, to have a way to get out */ 2155/* Set this for debugging, to have a way to get out */
2156int stop_character; 2156int stop_character;
2157 2157
2158#ifdef MULTI_PERDISPLAY 2158#ifdef MULTI_KBOARD
2159static PERDISPLAY * 2159static KBOARD *
2160event_to_perdisplay (event) 2160event_to_kboard (event)
2161 struct input_event *event; 2161 struct input_event *event;
2162{ 2162{
2163 Lisp_Object frame; 2163 Lisp_Object frame;
@@ -2172,7 +2172,7 @@ event_to_perdisplay (event)
2172 if (!FRAMEP (frame)) 2172 if (!FRAMEP (frame))
2173 return 0; 2173 return 0;
2174 else 2174 else
2175 return get_perdisplay (XFRAME (frame)); 2175 return FRAME_KBOARD (XFRAME (frame));
2176} 2176}
2177#endif 2177#endif
2178 2178
@@ -2199,24 +2199,24 @@ kbd_buffer_store_event (event)
2199 if (c == quit_char) 2199 if (c == quit_char)
2200 { 2200 {
2201 extern SIGTYPE interrupt_signal (); 2201 extern SIGTYPE interrupt_signal ();
2202#ifdef MULTI_PERDISPLAY 2202#ifdef MULTI_KBOARD
2203 PERDISPLAY *perd; 2203 KBOARD *kb;
2204 struct input_event *sp; 2204 struct input_event *sp;
2205 2205
2206 if (display_locked 2206 if (kboard_locked
2207 && (perd = get_perdisplay (XFRAME (event->frame_or_window)), 2207 && (kb = FRAME_KBOARD (XFRAME (event->frame_or_window)),
2208 perd != current_perdisplay)) 2208 kb != current_kboard))
2209 { 2209 {
2210 perd->kbd_queue 2210 kb->kbd_queue
2211 = Fcons (make_lispy_switch_frame (event->frame_or_window), 2211 = Fcons (make_lispy_switch_frame (event->frame_or_window),
2212 Fcons (make_number (c), Qnil)); 2212 Fcons (make_number (c), Qnil));
2213 perd->kbd_queue_has_data = 1; 2213 kb->kbd_queue_has_data = 1;
2214 for (sp = kbd_fetch_ptr; sp != kbd_store_ptr; sp++) 2214 for (sp = kbd_fetch_ptr; sp != kbd_store_ptr; sp++)
2215 { 2215 {
2216 if (sp == kbd_buffer + KBD_BUFFER_SIZE) 2216 if (sp == kbd_buffer + KBD_BUFFER_SIZE)
2217 sp = kbd_buffer; 2217 sp = kbd_buffer;
2218 2218
2219 if (event_to_perdisplay (sp) == perd) 2219 if (event_to_kboard (sp) == kb)
2220 { 2220 {
2221 sp->kind = no_event; 2221 sp->kind = no_event;
2222 sp->frame_or_window = Qnil; 2222 sp->frame_or_window = Qnil;
@@ -2297,7 +2297,7 @@ kbd_buffer_store_event (event)
2297 We always read and discard one event. */ 2297 We always read and discard one event. */
2298 2298
2299static Lisp_Object 2299static Lisp_Object
2300kbd_buffer_get_event (PERDISPLAY **perdp) 2300kbd_buffer_get_event (KBOARD **kbp)
2301{ 2301{
2302 register int c; 2302 register int c;
2303 Lisp_Object obj; 2303 Lisp_Object obj;
@@ -2306,7 +2306,7 @@ kbd_buffer_get_event (PERDISPLAY **perdp)
2306 { 2306 {
2307 c = getchar (); 2307 c = getchar ();
2308 XSETINT (obj, c); 2308 XSETINT (obj, c);
2309 *perdp = all_perdisplays; /* There'd better be exactly one! */ 2309 *kbp = all_kboards; /* There'd better be exactly one! */
2310 return obj; 2310 return obj;
2311 } 2311 }
2312 2312
@@ -2367,12 +2367,12 @@ kbd_buffer_get_event (PERDISPLAY **perdp)
2367 2367
2368 last_event_timestamp = event->timestamp; 2368 last_event_timestamp = event->timestamp;
2369 2369
2370#ifdef MULTI_PERDISPLAY 2370#ifdef MULTI_KBOARD
2371 *perdp = event_to_perdisplay (event); 2371 *kbp = event_to_kboard (event);
2372 if (*perdp == 0) 2372 if (*kbp == 0)
2373 *perdp = all_perdisplays; /* Better than returning null ptr? */ 2373 *kbp = current_kboard; /* Better than returning null ptr? */
2374#else 2374#else
2375 *perdp = &the_only_perdisplay; 2375 *kbp = &the_only_kboard;
2376#endif 2376#endif
2377 2377
2378 obj = Qnil; 2378 obj = Qnil;
@@ -2445,11 +2445,11 @@ kbd_buffer_get_event (PERDISPLAY **perdp)
2445 kbd_fetch_ptr = event + 1; 2445 kbd_fetch_ptr = event + 1;
2446 } 2446 }
2447 /* Just discard these, by returning nil. 2447 /* Just discard these, by returning nil.
2448 With MULTI_PERDISPLAY, these events are used as placeholders 2448 With MULTI_KBOARD, these events are used as placeholders
2449 when we need to randomly delete events from the queue. 2449 when we need to randomly delete events from the queue.
2450 (They shouldn't otherwise be found in the buffer, 2450 (They shouldn't otherwise be found in the buffer,
2451 but on some machines it appears they do show up 2451 but on some machines it appears they do show up
2452 even without MULTI_PERDISPLAY.) */ 2452 even without MULTI_KBOARD.) */
2453 else if (event->kind == no_event) 2453 else if (event->kind == no_event)
2454 kbd_fetch_ptr = event + 1; 2454 kbd_fetch_ptr = event + 1;
2455 2455
@@ -2500,7 +2500,7 @@ kbd_buffer_get_event (PERDISPLAY **perdp)
2500 Lisp_Object x, y; 2500 Lisp_Object x, y;
2501 unsigned long time; 2501 unsigned long time;
2502 2502
2503 *perdp = current_perdisplay; 2503 *kbp = current_kboard;
2504 /* Note that this uses F to determine which display to look at. 2504 /* Note that this uses F to determine which display to look at.
2505 If there is no valid info, it does not store anything 2505 If there is no valid info, it does not store anything
2506 so x remains nil. */ 2506 so x remains nil. */
@@ -4700,12 +4700,12 @@ read_char_minibuf_menu_prompt (commandflag, nmaps, maps)
4700 is pressed. Help characters are not recorded because menu prompting 4700 is pressed. Help characters are not recorded because menu prompting
4701 is not used on replay. 4701 is not used on replay.
4702 */ 4702 */
4703 orig_defn_macro = current_perdisplay->defining_kbd_macro; 4703 orig_defn_macro = current_kboard->defining_kbd_macro;
4704 current_perdisplay->defining_kbd_macro = Qnil; 4704 current_kboard->defining_kbd_macro = Qnil;
4705 do 4705 do
4706 obj = read_char (commandflag, 0, 0, Qnil, 0); 4706 obj = read_char (commandflag, 0, 0, Qnil, 0);
4707 while (BUFFERP (obj)); 4707 while (BUFFERP (obj));
4708 current_perdisplay->defining_kbd_macro = orig_defn_macro; 4708 current_kboard->defining_kbd_macro = orig_defn_macro;
4709 4709
4710 if (!INTEGERP (obj)) 4710 if (!INTEGERP (obj))
4711 return obj; 4711 return obj;
@@ -4716,7 +4716,7 @@ read_char_minibuf_menu_prompt (commandflag, nmaps, maps)
4716 && (!INTEGERP (menu_prompt_more_char) 4716 && (!INTEGERP (menu_prompt_more_char)
4717 || ! EQ (obj, make_number (Ctl (XINT (menu_prompt_more_char)))))) 4717 || ! EQ (obj, make_number (Ctl (XINT (menu_prompt_more_char))))))
4718 { 4718 {
4719 if (!NILP (current_perdisplay->defining_kbd_macro)) 4719 if (!NILP (current_kboard->defining_kbd_macro))
4720 store_kbd_macro_char (obj); 4720 store_kbd_macro_char (obj);
4721 return obj; 4721 return obj;
4722 } 4722 }
@@ -5097,35 +5097,35 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
5097 struct buffer *buf = current_buffer; 5097 struct buffer *buf = current_buffer;
5098 5098
5099 { 5099 {
5100#ifdef MULTI_PERDISPLAY 5100#ifdef MULTI_KBOARD
5101 PERDISPLAY *interrupted_perdisplay = current_perdisplay; 5101 KBOARD *interrupted_kboard = current_kboard;
5102 struct frame *interrupted_frame = selected_frame; 5102 struct frame *interrupted_frame = selected_frame;
5103 if (setjmp (wrong_display_jmpbuf)) 5103 if (setjmp (wrong_kboard_jmpbuf))
5104 { 5104 {
5105 if (!NILP (delayed_switch_frame)) 5105 if (!NILP (delayed_switch_frame))
5106 { 5106 {
5107 interrupted_perdisplay->kbd_queue 5107 interrupted_kboard->kbd_queue
5108 = Fcons (delayed_switch_frame, 5108 = Fcons (delayed_switch_frame,
5109 interrupted_perdisplay->kbd_queue); 5109 interrupted_kboard->kbd_queue);
5110 delayed_switch_frame = Qnil; 5110 delayed_switch_frame = Qnil;
5111 } 5111 }
5112 while (t > 0) 5112 while (t > 0)
5113 interrupted_perdisplay->kbd_queue 5113 interrupted_kboard->kbd_queue
5114 = Fcons (keybuf[--t], interrupted_perdisplay->kbd_queue); 5114 = Fcons (keybuf[--t], interrupted_kboard->kbd_queue);
5115 5115
5116 /* If the side queue is non-empty, ensure it begins with a 5116 /* If the side queue is non-empty, ensure it begins with a
5117 switch-frame, so we'll replay it in the right context. */ 5117 switch-frame, so we'll replay it in the right context. */
5118 if (CONSP (interrupted_perdisplay->kbd_queue) 5118 if (CONSP (interrupted_kboard->kbd_queue)
5119 && (key = XCONS (interrupted_perdisplay->kbd_queue)->car, 5119 && (key = XCONS (interrupted_kboard->kbd_queue)->car,
5120 !(EVENT_HAS_PARAMETERS (key) 5120 !(EVENT_HAS_PARAMETERS (key)
5121 && EQ (EVENT_HEAD_KIND (EVENT_HEAD (key)), 5121 && EQ (EVENT_HEAD_KIND (EVENT_HEAD (key)),
5122 Qswitch_frame)))) 5122 Qswitch_frame))))
5123 { 5123 {
5124 Lisp_Object frame; 5124 Lisp_Object frame;
5125 XSETFRAME (frame, interrupted_frame); 5125 XSETFRAME (frame, interrupted_frame);
5126 interrupted_perdisplay->kbd_queue 5126 interrupted_kboard->kbd_queue
5127 = Fcons (make_lispy_switch_frame (frame), 5127 = Fcons (make_lispy_switch_frame (frame),
5128 interrupted_perdisplay->kbd_queue); 5128 interrupted_kboard->kbd_queue);
5129 } 5129 }
5130 mock_input = 0; 5130 mock_input = 0;
5131 orig_local_map = get_local_map (PT, current_buffer); 5131 orig_local_map = get_local_map (PT, current_buffer);
@@ -6088,7 +6088,7 @@ DEFUN ("discard-input", Fdiscard_input, Sdiscard_input, 0, 0, 0,
6088Also cancel any kbd macro being defined.") 6088Also cancel any kbd macro being defined.")
6089 () 6089 ()
6090{ 6090{
6091 current_perdisplay->defining_kbd_macro = Qnil; 6091 current_kboard->defining_kbd_macro = Qnil;
6092 update_mode_lines++; 6092 update_mode_lines++;
6093 6093
6094 Vunread_command_events = Qnil; 6094 Vunread_command_events = Qnil;
@@ -6186,7 +6186,7 @@ stuff_buffered_input (stuffstring)
6186 } 6186 }
6187 /* Anything we have read ahead, put back for the shell to read. */ 6187 /* Anything we have read ahead, put back for the shell to read. */
6188 /* ?? What should this do when we have multiple keyboards?? 6188 /* ?? What should this do when we have multiple keyboards??
6189 Should we ignore anything that was typed in at the "wrong" display? */ 6189 Should we ignore anything that was typed in at the "wrong" kboard? */
6190 for (; kbd_fetch_ptr != kbd_store_ptr; kbd_fetch_ptr++) 6190 for (; kbd_fetch_ptr != kbd_store_ptr; kbd_fetch_ptr++)
6191 { 6191 {
6192 if (kbd_fetch_ptr == kbd_buffer + KBD_BUFFER_SIZE) 6192 if (kbd_fetch_ptr == kbd_buffer + KBD_BUFFER_SIZE)
@@ -6458,38 +6458,39 @@ The elements of this list correspond to the arguments of\n\
6458 6458
6459 6459
6460/* 6460/*
6461 * Set up a perdisplay object with reasonable initial values. 6461 * Set up a new kboard object with reasonable initial values.
6462 */ 6462 */
6463void 6463void
6464init_perdisplay (perd) 6464init_kboard (kb)
6465 PERDISPLAY *perd; 6465 KBOARD *kb;
6466{ 6466{
6467 perd->prefix_factor = Qnil; 6467 kb->prefix_factor = Qnil;
6468 perd->prefix_value = Qnil; 6468 kb->prefix_value = Qnil;
6469 perd->prefix_sign = 1; 6469 kb->prefix_sign = 1;
6470 perd->prefix_partial = 0; 6470 kb->prefix_partial = 0;
6471 perd->kbd_queue = Qnil; 6471 kb->kbd_queue = Qnil;
6472 perd->kbd_queue_has_data = 0; 6472 kb->kbd_queue_has_data = 0;
6473 perd->immediate_echo = 0; 6473 kb->immediate_echo = 0;
6474 perd->echoptr = perd->echobuf; 6474 kb->echoptr = kb->echobuf;
6475 perd->echo_after_prompt = -1; 6475 kb->echo_after_prompt = -1;
6476 perd->kbd_macro_buffer = 0; 6476 kb->kbd_macro_buffer = 0;
6477 perd->kbd_macro_bufsize = 0; 6477 kb->kbd_macro_bufsize = 0;
6478 perd->defining_kbd_macro = Qnil; 6478 kb->defining_kbd_macro = Qnil;
6479 perd->Vlast_kbd_macro = Qnil; 6479 kb->Vlast_kbd_macro = Qnil;
6480 kb->reference_count = 0;
6480} 6481}
6481 6482
6482/* 6483/*
6483 * Destroy the contents of a perdisplay object, but not the object itself. 6484 * Destroy the contents of a kboard object, but not the object itself.
6484 * We use this just before deleteing it, or if we're going to initialize 6485 * We use this just before deleteing it, or if we're going to initialize
6485 * it a second time. 6486 * it a second time.
6486 */ 6487 */
6487void 6488void
6488wipe_perdisplay (perd) 6489wipe_kboard (kb)
6489 PERDISPLAY *perd; 6490 KBOARD *kb;
6490{ 6491{
6491 if (perd->kbd_macro_buffer) 6492 if (kb->kbd_macro_buffer)
6492 xfree (perd->kbd_macro_buffer); 6493 xfree (kb->kbd_macro_buffer);
6493} 6494}
6494 6495
6495init_keyboard () 6496init_keyboard ()
@@ -6520,15 +6521,15 @@ init_keyboard ()
6520 6521
6521 if (!initialized) 6522 if (!initialized)
6522 { 6523 {
6523#ifdef MULTI_PERDISPLAY 6524#ifdef MULTI_KBOARD
6524 current_perdisplay = (PERDISPLAY *)xmalloc (sizeof (PERDISPLAY)); 6525 current_kboard = (KBOARD *)xmalloc (sizeof (KBOARD));
6525 all_perdisplays = current_perdisplay; 6526 all_kboards = current_kboard;
6526#endif 6527#endif
6527 current_perdisplay->next_perdisplay = 0; 6528 current_kboard->next_kboard = 0;
6528 } 6529 }
6529 if (initialized) 6530 if (initialized)
6530 wipe_perdisplay (current_perdisplay); 6531 wipe_kboard (current_kboard);
6531 init_perdisplay (current_perdisplay); 6532 init_kboard (current_kboard);
6532 6533
6533 if (initialized) 6534 if (initialized)
6534 Ffillarray (kbd_buffer_frame_or_window, Qnil); 6535 Ffillarray (kbd_buffer_frame_or_window, Qnil);