aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKaroly Lorentey2005-07-11 00:05:55 +0000
committerKaroly Lorentey2005-07-11 00:05:55 +0000
commit7e59217d2639c9913c2c76cd9d9825dabe78251a (patch)
treed4aca783b45c0625c242482c499074a1f39fa2b8 /src
parenta4c6993d4a0ac128dcee76fe1e87f6cade1be410 (diff)
downloademacs-7e59217d2639c9913c2c76cd9d9825dabe78251a.tar.gz
emacs-7e59217d2639c9913c2c76cd9d9825dabe78251a.zip
Rename `struct display' to `struct device'. Update function, parameter and variable names accordingly.
* src/termhooks.h (struct device): Rename to `struct device'. Rename member `next_display' to `next_device'. Rename member `delete_display_hook' to `delete_device_hook'. (FRAME_DISPLAY): Rename to FRAME_DEVICE. (DISPLAY_ACTIVE_P): Rename to DEVICE_ACTIVE_P. (DISPLAY_TERMINAL_CODING): Rename to DEVICE_TERMINAL_CODING. (DISPLAY_KEYBOARD_CODING): Rename to DEVICE_KEYBOARD_CODING. * src/frame.h (stuct frame): Rename `display' member to `device'. * src/xterm.h (x_display_info): Rename member `frame_display' to `device'. * src/termchar.h (struct tty_display_info): Rename `display' member to `device'. * src/keyboard.c (push_display_kboard): Rename to push_device_kboard. * lisp/frame.el (make-frame): Rename frame parameter `display-id' to `device'. * src/frame.c (Fmake_terminal_frame): Ditto. * src/xfns.c (Fx_create_frame): Ditto. * src/term.c (display_list): Rename to device_list. * src/term.c (initial_display): Rename to initial_device. * src/term.c (next_display_id): Rename to next_device_id. * src/term.c (get_display): Rename to get_device. * src/term.c (get_tty_display): Rename to get_tty_device. * src/term.c (get_named_tty_display): Rename to get_named_tty. * src/term.c (init_initial_display): Rename to init_initial_device. * src/term.c (delete_initial_display): Rename to delete_initial_device. * src/term.c (create_display): Rename to create_device. * src/term.c (delete_display): Rename to delete_device. * src/xfns.c (check_x_display_info): Document that the function allows display ids as well. * src/xterm.c (x_delete_frame_display): Rename to x_delete_device. * src/xterm.c (x_create_frame_display): Rename to x_create_device. * src/coding.c: Update. * src/dispextern.h: Update. * src/data.c: Update. * src/dispnew.c: Update. * src/frame.c: Update. * src/frame.h: Update. * src/keyboard.c: Update. * src/keyboard.h: Update. * src/lisp.h: Update. * src/sysdep.c: Update. * src/term.c: Update. * src/xdisp.c: Update. * src/xselect.c: Update. * src/xterm.c: Update. * src/prefix-args.c: Include stdlib.h for exit. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-382
Diffstat (limited to 'src')
-rw-r--r--src/coding.c33
-rw-r--r--src/data.c31
-rw-r--r--src/dispextern.h14
-rw-r--r--src/dispnew.c12
-rw-r--r--src/frame.c74
-rw-r--r--src/frame.h24
-rw-r--r--src/keyboard.c56
-rw-r--r--src/keyboard.h4
-rw-r--r--src/lisp.h2
-rw-r--r--src/prefix-args.c1
-rw-r--r--src/sysdep.c4
-rw-r--r--src/term.c547
-rw-r--r--src/termchar.h4
-rw-r--r--src/termhooks.h82
-rw-r--r--src/xdisp.c32
-rw-r--r--src/xfns.c225
-rw-r--r--src/xselect.c2
-rw-r--r--src/xterm.c132
-rw-r--r--src/xterm.h2
19 files changed, 640 insertions, 641 deletions
diff --git a/src/coding.c b/src/coding.c
index 79b1c93cb3a..808f1e7d9c2 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -7307,11 +7307,11 @@ Return the corresponding character code in Big5. */)
7307DEFUN ("set-terminal-coding-system-internal", Fset_terminal_coding_system_internal, 7307DEFUN ("set-terminal-coding-system-internal", Fset_terminal_coding_system_internal,
7308 Sset_terminal_coding_system_internal, 1, 2, 0, 7308 Sset_terminal_coding_system_internal, 1, 2, 0,
7309 doc: /* Internal use only. */) 7309 doc: /* Internal use only. */)
7310 (coding_system, display) 7310 (coding_system, device)
7311 Lisp_Object coding_system; 7311 Lisp_Object coding_system;
7312 Lisp_Object display; 7312 Lisp_Object device;
7313{ 7313{
7314 struct coding_system *terminal_coding = DISPLAY_TERMINAL_CODING (get_display (display, 1)); 7314 struct coding_system *terminal_coding = DEVICE_TERMINAL_CODING (get_device (device, 1));
7315 CHECK_SYMBOL (coding_system); 7315 CHECK_SYMBOL (coding_system);
7316 setup_coding_system (Fcheck_coding_system (coding_system), terminal_coding); 7316 setup_coding_system (Fcheck_coding_system (coding_system), terminal_coding);
7317 /* We had better not send unsafe characters to terminal. */ 7317 /* We had better not send unsafe characters to terminal. */
@@ -7345,38 +7345,39 @@ DEFUN ("set-safe-terminal-coding-system-internal", Fset_safe_terminal_coding_sys
7345 7345
7346DEFUN ("terminal-coding-system", Fterminal_coding_system, 7346DEFUN ("terminal-coding-system", Fterminal_coding_system,
7347 Sterminal_coding_system, 0, 1, 0, 7347 Sterminal_coding_system, 0, 1, 0,
7348 doc: /* Return coding system specified for terminal output on the given display. 7348 doc: /* Return coding system specified for terminal output on the given device.
7349DISPLAY may be a display id, a frame, or nil for the selected frame's display. */) 7349DEVICE may be a display device id, a frame, or nil for the selected
7350 (display) 7350frame's display device. */)
7351 Lisp_Object display; 7351 (device)
7352 Lisp_Object device;
7352{ 7353{
7353 return DISPLAY_TERMINAL_CODING (get_display (display, 1))->symbol; 7354 return DEVICE_TERMINAL_CODING (get_device (device, 1))->symbol;
7354} 7355}
7355 7356
7356DEFUN ("set-keyboard-coding-system-internal", Fset_keyboard_coding_system_internal, 7357DEFUN ("set-keyboard-coding-system-internal", Fset_keyboard_coding_system_internal,
7357 Sset_keyboard_coding_system_internal, 1, 2, 0, 7358 Sset_keyboard_coding_system_internal, 1, 2, 0,
7358 doc: /* Internal use only. */) 7359 doc: /* Internal use only. */)
7359 (coding_system, display) 7360 (coding_system, device)
7360 Lisp_Object coding_system; 7361 Lisp_Object coding_system;
7361 Lisp_Object display; 7362 Lisp_Object device;
7362{ 7363{
7363 struct display *d = get_display (display, 1); 7364 struct device *d = get_device (device, 1);
7364 CHECK_SYMBOL (coding_system); 7365 CHECK_SYMBOL (coding_system);
7365 7366
7366 setup_coding_system (Fcheck_coding_system (coding_system), 7367 setup_coding_system (Fcheck_coding_system (coding_system),
7367 DISPLAY_KEYBOARD_CODING (d)); 7368 DEVICE_KEYBOARD_CODING (d));
7368 /* Character composition should be disabled. */ 7369 /* Character composition should be disabled. */
7369 DISPLAY_KEYBOARD_CODING (d)->composing = COMPOSITION_DISABLED; 7370 DEVICE_KEYBOARD_CODING (d)->composing = COMPOSITION_DISABLED;
7370 return Qnil; 7371 return Qnil;
7371} 7372}
7372 7373
7373DEFUN ("keyboard-coding-system", Fkeyboard_coding_system, 7374DEFUN ("keyboard-coding-system", Fkeyboard_coding_system,
7374 Skeyboard_coding_system, 0, 1, 0, 7375 Skeyboard_coding_system, 0, 1, 0,
7375 doc: /* Return coding system specified for decoding keyboard input. */) 7376 doc: /* Return coding system specified for decoding keyboard input. */)
7376 (display) 7377 (device)
7377 Lisp_Object display; 7378 Lisp_Object device;
7378{ 7379{
7379 return DISPLAY_KEYBOARD_CODING (get_display (display, 1))->symbol; 7380 return DEVICE_KEYBOARD_CODING (get_device (device, 1))->symbol;
7380} 7381}
7381 7382
7382 7383
diff --git a/src/data.c b/src/data.c
index 4102af809ca..09cb6c8b40a 100644
--- a/src/data.c
+++ b/src/data.c
@@ -1876,39 +1876,42 @@ If the current binding is global (the default), the value is nil. */)
1876 return Qnil; 1876 return Qnil;
1877} 1877}
1878 1878
1879extern struct display *get_display P_ ((Lisp_Object display, int)); 1879extern struct device *get_device P_ ((Lisp_Object display, int));
1880 1880
1881DEFUN ("terminal-local-value", Fterminal_local_value, Sterminal_local_value, 2, 2, 0, 1881DEFUN ("terminal-local-value", Fterminal_local_value, Sterminal_local_value, 2, 2, 0,
1882 doc: /* Return the terminal-local value of SYMBOL on DISPLAY. 1882 doc: /* Return the terminal-local value of SYMBOL on DEVICE.
1883If SYMBOL is not a terminal-local variable, then return its normal 1883If SYMBOL is not a terminal-local variable, then return its normal
1884value, like `symbol-value'. 1884value, like `symbol-value'.
1885 1885
1886DISPLAY may be a display, a frame, or nil (meaning the selected 1886DEVICE may be a display device id, a frame, or nil (meaning the
1887frame's display). */) 1887selected frame's display device). */)
1888 (symbol, display) 1888 (symbol, device)
1889 Lisp_Object symbol; 1889 Lisp_Object symbol;
1890 Lisp_Object display; 1890 Lisp_Object device;
1891{ 1891{
1892 Lisp_Object result; 1892 Lisp_Object result;
1893 struct display *d = get_display (display, 1); 1893 struct device *d = get_device (device, 1);
1894 push_display_kboard (d); 1894 push_device_kboard (d);
1895 result = Fsymbol_value (symbol); 1895 result = Fsymbol_value (symbol);
1896 pop_frame_kboard (); 1896 pop_frame_kboard ();
1897 return result; 1897 return result;
1898} 1898}
1899 1899
1900DEFUN ("set-terminal-local-value", Fset_terminal_local_value, Sset_terminal_local_value, 3, 3, 0, 1900DEFUN ("set-terminal-local-value", Fset_terminal_local_value, Sset_terminal_local_value, 3, 3, 0,
1901 doc: /* Set the terminal-local binding of SYMBOL on DISPLAY to VALUE. 1901 doc: /* Set the terminal-local binding of SYMBOL on DEVICE to VALUE.
1902If VARIABLE is not a terminal-local variable, then set its normal 1902If VARIABLE is not a terminal-local variable, then set its normal
1903binding, like `set'. */) 1903binding, like `set'.
1904 (symbol, display, value) 1904
1905DEVICE may be a display device id, a frame, or nil (meaning the
1906selected frame's display device). */)
1907 (symbol, device, value)
1905 Lisp_Object symbol; 1908 Lisp_Object symbol;
1906 Lisp_Object display; 1909 Lisp_Object device;
1907 Lisp_Object value; 1910 Lisp_Object value;
1908{ 1911{
1909 Lisp_Object result; 1912 Lisp_Object result;
1910 struct display *d = get_display (display, 1); 1913 struct device *d = get_device (device, 1);
1911 push_display_kboard (d); 1914 push_device_kboard (d);
1912 result = Fset (symbol, value); 1915 result = Fset (symbol, value);
1913 pop_frame_kboard (); 1916 pop_frame_kboard ();
1914 return result; 1917 return result;
diff --git a/src/dispextern.h b/src/dispextern.h
index a6960c03540..ac9c007bc4d 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -2929,17 +2929,17 @@ extern int per_line_cost P_ ((char *));
2929extern void calculate_costs P_ ((struct frame *)); 2929extern void calculate_costs P_ ((struct frame *));
2930extern void set_tty_color_mode P_ ((struct frame *, Lisp_Object)); 2930extern void set_tty_color_mode P_ ((struct frame *, Lisp_Object));
2931extern void tty_setup_colors P_ ((struct tty_display_info *, int)); 2931extern void tty_setup_colors P_ ((struct tty_display_info *, int));
2932extern struct display *get_display P_ ((Lisp_Object display, int)); 2932extern struct device *get_device P_ ((Lisp_Object display, int));
2933extern struct display *get_named_tty_display P_ ((char *)); 2933extern struct device *get_named_tty P_ ((char *));
2934EXFUN (Fdisplay_tty_type, 1); 2934EXFUN (Fdisplay_tty_type, 1);
2935extern struct display *init_initial_display P_ ((void)); 2935extern struct device *init_initial_device P_ ((void));
2936extern struct display *init_tty P_ ((char *, char *, int)); 2936extern struct device *init_tty P_ ((char *, char *, int));
2937extern void delete_tty P_ ((struct display *)); 2937extern void delete_tty P_ ((struct device *));
2938extern void fatal P_ ((/* char *, ... */)); 2938extern void fatal P_ ((/* char *, ... */));
2939extern void cursor_to P_ ((struct frame *, int, int)); 2939extern void cursor_to P_ ((struct frame *, int, int));
2940extern int tty_capable_p P_ ((struct tty_display_info *, unsigned, unsigned long, unsigned long)); 2940extern int tty_capable_p P_ ((struct tty_display_info *, unsigned, unsigned long, unsigned long));
2941extern void tty_set_terminal_modes P_ ((struct display *)); 2941extern void tty_set_terminal_modes P_ ((struct device *));
2942extern void tty_reset_terminal_modes P_ ((struct display *)); 2942extern void tty_reset_terminal_modes P_ ((struct device *));
2943extern void create_tty_output P_ ((struct frame *)); 2943extern void create_tty_output P_ ((struct frame *));
2944 2944
2945 2945
diff --git a/src/dispnew.c b/src/dispnew.c
index 1a71498bf3b..4924ce2217b 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -3343,7 +3343,7 @@ DEFUN ("redraw-frame", Fredraw_frame, Sredraw_frame, 1, 1, 0,
3343 update_begin (f); 3343 update_begin (f);
3344#ifdef MSDOS 3344#ifdef MSDOS
3345 if (FRAME_MSDOS_P (f)) 3345 if (FRAME_MSDOS_P (f))
3346 set_terminal_modes (FRAME_DISPLAY (f)); 3346 set_terminal_modes (FRAME_DEVICE (f));
3347#endif 3347#endif
3348 clear_frame (f); 3348 clear_frame (f);
3349 clear_current_matrices (f); 3349 clear_current_matrices (f);
@@ -6723,7 +6723,7 @@ For types not defined in VMS, use define emacs_term \"TYPE\".\n\
6723#endif /* VMS */ 6723#endif /* VMS */
6724 6724
6725 { 6725 {
6726 struct display *d; 6726 struct device *d;
6727 struct frame *f = XFRAME (selected_frame); 6727 struct frame *f = XFRAME (selected_frame);
6728 6728
6729 /* Open a display on the controlling tty. */ 6729 /* Open a display on the controlling tty. */
@@ -6733,16 +6733,16 @@ For types not defined in VMS, use define emacs_term \"TYPE\".\n\
6733 if (f->output_method != output_initial) 6733 if (f->output_method != output_initial)
6734 abort (); 6734 abort ();
6735 f->output_method = d->type; 6735 f->output_method = d->type;
6736 f->display = d; 6736 f->device = d;
6737 6737
6738 d->reference_count++; 6738 d->reference_count++;
6739 d->display_info.tty->top_frame = selected_frame; 6739 d->display_info.tty->top_frame = selected_frame;
6740 change_frame_size (XFRAME (selected_frame), FrameRows (d->display_info.tty), FrameCols (d->display_info.tty), 0, 0, 1); 6740 change_frame_size (XFRAME (selected_frame), FrameRows (d->display_info.tty), FrameCols (d->display_info.tty), 0, 0, 1);
6741 6741
6742 /* Delete the initial display. */ 6742 /* Delete the initial display. */
6743 if (--initial_display->reference_count == 0 6743 if (--initial_device->reference_count == 0
6744 && initial_display->delete_display_hook) 6744 && initial_device->delete_device_hook)
6745 (*initial_display->delete_display_hook) (initial_display); 6745 (*initial_device->delete_device_hook) (initial_device);
6746 6746
6747 /* Update frame parameters to reflect the new type. */ 6747 /* Update frame parameters to reflect the new type. */
6748 Fmodify_frame_parameters 6748 Fmodify_frame_parameters
diff --git a/src/frame.c b/src/frame.c
index 9f138390aca..864ec625c2c 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -76,7 +76,7 @@ Lisp_Object Qinhibit_default_face_x_resources;
76 76
77Lisp_Object Qx_frame_parameter; 77Lisp_Object Qx_frame_parameter;
78Lisp_Object Qx_resource_name; 78Lisp_Object Qx_resource_name;
79Lisp_Object Qdisplay_id; 79Lisp_Object Qdevice;
80Lisp_Object Qdisplay_live_p; 80Lisp_Object Qdisplay_live_p;
81 81
82/* Frame parameters (set or reported). */ 82/* Frame parameters (set or reported). */
@@ -422,7 +422,7 @@ make_frame_without_minibuffer (mini_window, kb, display)
422 422
423#ifdef MULTI_KBOARD 423#ifdef MULTI_KBOARD
424 if (!NILP (mini_window) 424 if (!NILP (mini_window)
425 && XFRAME (XWINDOW (mini_window)->frame)->display->kboard != kb) 425 && XFRAME (XWINDOW (mini_window)->frame)->device->kboard != kb)
426 error ("Frame and minibuffer must be on the same display"); 426 error ("Frame and minibuffer must be on the same display");
427#endif 427#endif
428 428
@@ -507,7 +507,7 @@ struct frame *
507make_initial_frame (void) 507make_initial_frame (void)
508{ 508{
509 struct frame *f; 509 struct frame *f;
510 struct display *display; 510 struct device *device;
511 Lisp_Object frame; 511 Lisp_Object frame;
512 512
513#ifdef MULTI_KBOARD 513#ifdef MULTI_KBOARD
@@ -525,7 +525,7 @@ make_initial_frame (void)
525 if (! (NILP (Vframe_list) || CONSP (Vframe_list))) 525 if (! (NILP (Vframe_list) || CONSP (Vframe_list)))
526 Vframe_list = Qnil; 526 Vframe_list = Qnil;
527 527
528 display = init_initial_display (); 528 device = init_initial_device ();
529 529
530 f = make_frame (1); 530 f = make_frame (1);
531 XSETFRAME (frame, f); 531 XSETFRAME (frame, f);
@@ -538,9 +538,9 @@ make_initial_frame (void)
538 f->visible = 1; 538 f->visible = 1;
539 f->async_visible = 1; 539 f->async_visible = 1;
540 540
541 f->output_method = display->type; 541 f->output_method = device->type;
542 f->display = display; 542 f->device = device;
543 f->display->reference_count++; 543 f->device->reference_count++;
544 f->output_data.nothing = 0; 544 f->output_data.nothing = 0;
545 545
546 FRAME_FOREGROUND_PIXEL (f) = FACE_TTY_DEFAULT_FG_COLOR; 546 FRAME_FOREGROUND_PIXEL (f) = FACE_TTY_DEFAULT_FG_COLOR;
@@ -554,7 +554,7 @@ make_initial_frame (void)
554 554
555 555
556struct frame * 556struct frame *
557make_terminal_frame (struct display *display) 557make_terminal_frame (struct device *device)
558{ 558{
559 register struct frame *f; 559 register struct frame *f;
560 Lisp_Object frame; 560 Lisp_Object frame;
@@ -605,8 +605,8 @@ make_terminal_frame (struct display *display)
605#else 605#else
606 { 606 {
607 f->output_method = output_termcap; 607 f->output_method = output_termcap;
608 f->display = display; 608 f->device = device;
609 f->display->reference_count++; 609 f->device->reference_count++;
610 create_tty_output (f); 610 create_tty_output (f);
611 611
612 FRAME_FOREGROUND_PIXEL (f) = FACE_TTY_DEFAULT_FG_COLOR; 612 FRAME_FOREGROUND_PIXEL (f) = FACE_TTY_DEFAULT_FG_COLOR;
@@ -658,7 +658,7 @@ affects all frames on the same terminal device. */)
658 Lisp_Object parms; 658 Lisp_Object parms;
659{ 659{
660 struct frame *f; 660 struct frame *f;
661 struct display *d = NULL; 661 struct device *d = NULL;
662 Lisp_Object frame, tem; 662 Lisp_Object frame, tem;
663 struct frame *sf = SELECTED_FRAME (); 663 struct frame *sf = SELECTED_FRAME ();
664 664
@@ -682,12 +682,12 @@ affects all frames on the same terminal device. */)
682 { 682 {
683 Lisp_Object display_device; 683 Lisp_Object display_device;
684 684
685 display_device = Fassq (Qdisplay_id, parms); 685 display_device = Fassq (Qdevice, parms);
686 if (!NILP (display_device)) 686 if (!NILP (display_device))
687 { 687 {
688 display_device = XCDR (display_device); 688 display_device = XCDR (display_device);
689 CHECK_NUMBER (display_device); 689 CHECK_NUMBER (display_device);
690 d = get_display (XINT (display_device), 1); 690 d = get_device (XINT (display_device), 1);
691 } 691 }
692 } 692 }
693 693
@@ -1053,14 +1053,14 @@ The display device is represented by its integer identifier. */)
1053 (frame) 1053 (frame)
1054 Lisp_Object frame; 1054 Lisp_Object frame;
1055{ 1055{
1056 struct display *d; 1056 struct device *d;
1057 1057
1058 if (NILP (frame)) 1058 if (NILP (frame))
1059 frame = selected_frame; 1059 frame = selected_frame;
1060 1060
1061 CHECK_LIVE_FRAME (frame); 1061 CHECK_LIVE_FRAME (frame);
1062 1062
1063 d = get_display (frame, 0); 1063 d = get_device (frame, 0);
1064 1064
1065 if (!d) 1065 if (!d)
1066 return Qnil; 1066 return Qnil;
@@ -1502,27 +1502,27 @@ The functions are run with one arg, the frame to be deleted. */)
1502 promise that the display of the frame must be valid until we have 1502 promise that the display of the frame must be valid until we have
1503 called the window-system-dependent frame destruction routine. */ 1503 called the window-system-dependent frame destruction routine. */
1504 1504
1505 if (FRAME_DISPLAY (f)->delete_frame_hook) 1505 if (FRAME_DEVICE (f)->delete_frame_hook)
1506 (*FRAME_DISPLAY (f)->delete_frame_hook) (f); 1506 (*FRAME_DEVICE (f)->delete_frame_hook) (f);
1507 1507
1508 { 1508 {
1509 struct display *display = FRAME_DISPLAY (f); 1509 struct device *device = FRAME_DEVICE (f);
1510 f->output_data.nothing = 0; 1510 f->output_data.nothing = 0;
1511 f->display = 0; /* Now the frame is dead. */ 1511 f->device = 0; /* Now the frame is dead. */
1512 1512
1513 /* If needed, delete the device that this frame was on. 1513 /* If needed, delete the device that this frame was on.
1514 (This must be done after the frame is killed.) */ 1514 (This must be done after the frame is killed.) */
1515 display->reference_count--; 1515 device->reference_count--;
1516 if (display->reference_count == 0) 1516 if (device->reference_count == 0)
1517 { 1517 {
1518 kb = NULL; 1518 kb = NULL;
1519 if (display->delete_display_hook) 1519 if (device->delete_device_hook)
1520 (*display->delete_display_hook) (display); 1520 (*device->delete_device_hook) (device);
1521 else 1521 else
1522 delete_display (display); 1522 delete_device (device);
1523 } 1523 }
1524 else 1524 else
1525 kb = display->kboard; 1525 kb = device->kboard;
1526 } 1526 }
1527 1527
1528 /* If we've deleted the last_nonminibuf_frame, then try to find 1528 /* If we've deleted the last_nonminibuf_frame, then try to find
@@ -1669,8 +1669,8 @@ and returns whatever that function returns. */)
1669 1669
1670#ifdef HAVE_MOUSE 1670#ifdef HAVE_MOUSE
1671 /* It's okay for the hook to refrain from storing anything. */ 1671 /* It's okay for the hook to refrain from storing anything. */
1672 if (FRAME_DISPLAY (f)->mouse_position_hook) 1672 if (FRAME_DEVICE (f)->mouse_position_hook)
1673 (*FRAME_DISPLAY (f)->mouse_position_hook) (&f, -1, 1673 (*FRAME_DEVICE (f)->mouse_position_hook) (&f, -1,
1674 &lispy_dummy, &party_dummy, 1674 &lispy_dummy, &party_dummy,
1675 &x, &y, 1675 &x, &y,
1676 &long_dummy); 1676 &long_dummy);
@@ -1712,8 +1712,8 @@ and nil for X and Y. */)
1712 1712
1713#ifdef HAVE_MOUSE 1713#ifdef HAVE_MOUSE
1714 /* It's okay for the hook to refrain from storing anything. */ 1714 /* It's okay for the hook to refrain from storing anything. */
1715 if (FRAME_DISPLAY (f)->mouse_position_hook) 1715 if (FRAME_DEVICE (f)->mouse_position_hook)
1716 (*FRAME_DISPLAY (f)->mouse_position_hook) (&f, -1, 1716 (*FRAME_DEVICE (f)->mouse_position_hook) (&f, -1,
1717 &lispy_dummy, &party_dummy, 1717 &lispy_dummy, &party_dummy,
1718 &x, &y, 1718 &x, &y,
1719 &long_dummy); 1719 &long_dummy);
@@ -1993,8 +1993,8 @@ doesn't support multiple overlapping frames, this function does nothing. */)
1993 /* Do like the documentation says. */ 1993 /* Do like the documentation says. */
1994 Fmake_frame_visible (frame); 1994 Fmake_frame_visible (frame);
1995 1995
1996 if (FRAME_DISPLAY (f)->frame_raise_lower_hook) 1996 if (FRAME_DEVICE (f)->frame_raise_lower_hook)
1997 (*FRAME_DISPLAY (f)->frame_raise_lower_hook) (f, 1); 1997 (*FRAME_DEVICE (f)->frame_raise_lower_hook) (f, 1);
1998 1998
1999 return Qnil; 1999 return Qnil;
2000} 2000}
@@ -2017,8 +2017,8 @@ doesn't support multiple overlapping frames, this function does nothing. */)
2017 2017
2018 f = XFRAME (frame); 2018 f = XFRAME (frame);
2019 2019
2020 if (FRAME_DISPLAY (f)->frame_raise_lower_hook) 2020 if (FRAME_DEVICE (f)->frame_raise_lower_hook)
2021 (*FRAME_DISPLAY (f)->frame_raise_lower_hook) (f, 0); 2021 (*FRAME_DEVICE (f)->frame_raise_lower_hook) (f, 0);
2022 2022
2023 return Qnil; 2023 return Qnil;
2024} 2024}
@@ -2066,8 +2066,8 @@ The redirection lasts until `redirect-frame-focus' is called to change it. */)
2066 2066
2067 f->focus_frame = focus_frame; 2067 f->focus_frame = focus_frame;
2068 2068
2069 if (FRAME_DISPLAY (f)->frame_rehighlight_hook) 2069 if (FRAME_DEVICE (f)->frame_rehighlight_hook)
2070 (*FRAME_DISPLAY (f)->frame_rehighlight_hook) (f); 2070 (*FRAME_DEVICE (f)->frame_rehighlight_hook) (f);
2071 2071
2072 return Qnil; 2072 return Qnil;
2073} 2073}
@@ -4223,8 +4223,8 @@ syms_of_frame ()
4223 Qx_frame_parameter = intern ("x-frame-parameter"); 4223 Qx_frame_parameter = intern ("x-frame-parameter");
4224 staticpro (&Qx_frame_parameter); 4224 staticpro (&Qx_frame_parameter);
4225 4225
4226 Qdisplay_id = intern ("display-id"); 4226 Qdevice = intern ("device");
4227 staticpro (&Qdisplay_id); 4227 staticpro (&Qdevice);
4228 Qdisplay_live_p = intern ("display-live-p"); 4228 Qdisplay_live_p = intern ("display-live-p");
4229 staticpro (&Qdisplay_live_p); 4229 staticpro (&Qdisplay_live_p);
4230 4230
diff --git a/src/frame.h b/src/frame.h
index 625f3ffa817..81d3477121e 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -69,7 +69,7 @@ enum text_cursor_kinds
69#define FRAME_FOREGROUND_PIXEL(f) ((f)->foreground_pixel) 69#define FRAME_FOREGROUND_PIXEL(f) ((f)->foreground_pixel)
70#define FRAME_BACKGROUND_PIXEL(f) ((f)->background_pixel) 70#define FRAME_BACKGROUND_PIXEL(f) ((f)->background_pixel)
71 71
72struct display; 72struct device;
73 73
74struct frame 74struct frame
75{ 75{
@@ -131,7 +131,7 @@ struct frame
131 Actually, we don't specify exactly what is stored here at all; the 131 Actually, we don't specify exactly what is stored here at all; the
132 scroll bar implementation code can use it to store anything it likes. 132 scroll bar implementation code can use it to store anything it likes.
133 This field is marked by the garbage collector. It is here 133 This field is marked by the garbage collector. It is here
134 instead of in the `display' structure so that the garbage 134 instead of in the `device' structure so that the garbage
135 collector doesn't need to look inside the window-system-dependent 135 collector doesn't need to look inside the window-system-dependent
136 structure. */ 136 structure. */
137 Lisp_Object scroll_bars; 137 Lisp_Object scroll_bars;
@@ -262,14 +262,14 @@ struct frame
262 262
263 /* The output method says how the contents of this frame are 263 /* The output method says how the contents of this frame are
264 displayed. It could be using termcap, or using an X window. 264 displayed. It could be using termcap, or using an X window.
265 This must be the same as the display->type. */ 265 This must be the same as the device->type. */
266 enum output_method output_method; 266 enum output_method output_method;
267 267
268 /* The display that this frame uses. If this is NULL, then the 268 /* The display device that this frame uses. If this is NULL, then
269 frame is deleted. */ 269 the frame has been deleted. */
270 struct display *display; 270 struct device *device;
271 271
272 /* Display-dependent, frame-local auxiliary data used for displaying 272 /* Device-dependent, frame-local auxiliary data used for displaying
273 the contents. When the frame is deleted, this data is deleted as 273 the contents. When the frame is deleted, this data is deleted as
274 well. */ 274 well. */
275 union output_data 275 union output_data
@@ -415,7 +415,7 @@ struct frame
415 /* The baud rate that was used to calculate costs for this frame. */ 415 /* The baud rate that was used to calculate costs for this frame. */
416 int cost_calculation_baud_rate; 416 int cost_calculation_baud_rate;
417 417
418 /* Nonzero if the mouse has moved on this display 418 /* Nonzero if the mouse has moved on this display device
419 since the last time we checked. */ 419 since the last time we checked. */
420 char mouse_moved; 420 char mouse_moved;
421 421
@@ -446,7 +446,7 @@ struct frame
446}; 446};
447 447
448#ifdef MULTI_KBOARD 448#ifdef MULTI_KBOARD
449#define FRAME_KBOARD(f) ((f)->display->kboard) 449#define FRAME_KBOARD(f) ((f)->device->kboard)
450#else 450#else
451#define FRAME_KBOARD(f) (&the_only_kboard) 451#define FRAME_KBOARD(f) (&the_only_kboard)
452#endif 452#endif
@@ -484,7 +484,7 @@ typedef struct frame *FRAME_PTR;
484#endif 484#endif
485 485
486/* Nonzero if frame F is still alive (not deleted). */ 486/* Nonzero if frame F is still alive (not deleted). */
487#define FRAME_LIVE_P(f) ((f)->display != 0) 487#define FRAME_LIVE_P(f) ((f)->device != 0)
488 488
489/* Nonzero if frame F is a minibuffer-only frame. */ 489/* Nonzero if frame F is a minibuffer-only frame. */
490#define FRAME_MINIBUF_ONLY_P(f) \ 490#define FRAME_MINIBUF_ONLY_P(f) \
@@ -768,12 +768,12 @@ typedef struct frame *FRAME_PTR;
768 768
769extern Lisp_Object Qframep, Qframe_live_p; 769extern Lisp_Object Qframep, Qframe_live_p;
770extern Lisp_Object Qtty, Qtty_type; 770extern Lisp_Object Qtty, Qtty_type;
771extern Lisp_Object Qdisplay_id, Qdisplay_live_p; 771extern Lisp_Object Qdevice, Qdisplay_live_p;
772 772
773extern struct frame *last_nonminibuf_frame; 773extern struct frame *last_nonminibuf_frame;
774 774
775extern struct frame *make_initial_frame P_ ((void)); 775extern struct frame *make_initial_frame P_ ((void));
776extern struct frame *make_terminal_frame P_ ((struct display *)); 776extern struct frame *make_terminal_frame P_ ((struct device *));
777extern struct frame *make_frame P_ ((int)); 777extern struct frame *make_frame P_ ((int));
778#ifdef HAVE_WINDOW_SYSTEM 778#ifdef HAVE_WINDOW_SYSTEM
779extern struct frame *make_minibuffer_frame P_ ((void)); 779extern struct frame *make_minibuffer_frame P_ ((void));
diff --git a/src/keyboard.c b/src/keyboard.c
index 599ab282619..7bdfa454636 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -1112,8 +1112,8 @@ struct kboard_stack
1112static struct kboard_stack *kboard_stack; 1112static struct kboard_stack *kboard_stack;
1113 1113
1114void 1114void
1115push_display_kboard (d) 1115push_device_kboard (d)
1116 struct display *d; 1116 struct device *d;
1117{ 1117{
1118#ifdef MULTI_KBOARD 1118#ifdef MULTI_KBOARD
1119 struct kboard_stack *p 1119 struct kboard_stack *p
@@ -4169,9 +4169,9 @@ kbd_buffer_get_event (kbp, used_mouse_menu)
4169 x = Qnil; 4169 x = Qnil;
4170 4170
4171 /* XXX Can f or mouse_position_hook be NULL here? */ 4171 /* XXX Can f or mouse_position_hook be NULL here? */
4172 if (f && FRAME_DISPLAY (f)->mouse_position_hook) 4172 if (f && FRAME_DEVICE (f)->mouse_position_hook)
4173 (*FRAME_DISPLAY (f)->mouse_position_hook) (&f, 0, &bar_window, 4173 (*FRAME_DEVICE (f)->mouse_position_hook) (&f, 0, &bar_window,
4174 &part, &x, &y, &time); 4174 &part, &x, &y, &time);
4175 4175
4176 obj = Qnil; 4176 obj = Qnil;
4177 4177
@@ -6670,13 +6670,13 @@ read_avail_input (expected)
6670{ 6670{
6671 int nread = 0; 6671 int nread = 0;
6672 int err = 0; 6672 int err = 0;
6673 struct display *d; 6673 struct device *d;
6674 6674
6675 /* Loop through the available displays, and call their input hooks. */ 6675 /* Loop through the available devices, and call their input hooks. */
6676 d = display_list; 6676 d = device_list;
6677 while (d) 6677 while (d)
6678 { 6678 {
6679 struct display *next = d->next_display; 6679 struct device *next = d->next_device;
6680 6680
6681 if (d->read_socket_hook) 6681 if (d->read_socket_hook)
6682 { 6682 {
@@ -6702,7 +6702,7 @@ read_avail_input (expected)
6702 /* The display device terminated; it should be closed. */ 6702 /* The display device terminated; it should be closed. */
6703 6703
6704 /* Kill Emacs if this was our last display. */ 6704 /* Kill Emacs if this was our last display. */
6705 if (! display_list->next_display) 6705 if (! device_list->next_device)
6706 /* Formerly simply reported no input, but that 6706 /* Formerly simply reported no input, but that
6707 sometimes led to a failure of Emacs to terminate. 6707 sometimes led to a failure of Emacs to terminate.
6708 SIGHUP seems appropriate if we can't reach the 6708 SIGHUP seems appropriate if we can't reach the
@@ -6713,11 +6713,11 @@ read_avail_input (expected)
6713 alone in its group. */ 6713 alone in its group. */
6714 kill (getpid (), SIGHUP); 6714 kill (getpid (), SIGHUP);
6715 6715
6716 /* XXX Is calling delete_display safe here? It calls Fdelete_frame. */ 6716 /* XXX Is calling delete_device safe here? It calls Fdelete_frame. */
6717 if (d->delete_display_hook) 6717 if (d->delete_device_hook)
6718 (*d->delete_display_hook) (d); 6718 (*d->delete_device_hook) (d);
6719 else 6719 else
6720 delete_display (d); 6720 delete_device (d);
6721 } 6721 }
6722 6722
6723 if (hold_quit.kind != NO_EVENT) 6723 if (hold_quit.kind != NO_EVENT)
@@ -6735,12 +6735,12 @@ read_avail_input (expected)
6735 6735
6736/* This is the tty way of reading available input. 6736/* This is the tty way of reading available input.
6737 6737
6738 Note that each terminal device has its own `struct display' object, 6738 Note that each terminal device has its own `struct device' object,
6739 and so this function is called once for each individual termcap 6739 and so this function is called once for each individual termcap
6740 display. The first parameter indicates which device to read from. */ 6740 display. The first parameter indicates which device to read from. */
6741 6741
6742int 6742int
6743tty_read_avail_input (struct display *display, 6743tty_read_avail_input (struct device *device,
6744 int expected, 6744 int expected,
6745 struct input_event *hold_quit) 6745 struct input_event *hold_quit)
6746{ 6746{
@@ -6749,10 +6749,10 @@ tty_read_avail_input (struct display *display,
6749 of characters on some systems when input is stuffed at us. */ 6749 of characters on some systems when input is stuffed at us. */
6750 unsigned char cbuf[KBD_BUFFER_SIZE - 1]; 6750 unsigned char cbuf[KBD_BUFFER_SIZE - 1];
6751 int n_to_read, i; 6751 int n_to_read, i;
6752 struct tty_display_info *tty = display->display_info.tty; 6752 struct tty_display_info *tty = device->display_info.tty;
6753 int nread = 0; 6753 int nread = 0;
6754 6754
6755 if (display->type != output_termcap) 6755 if (device->type != output_termcap)
6756 abort (); 6756 abort ();
6757 6757
6758 /* XXX I think the following code should be moved to separate hook 6758 /* XXX I think the following code should be moved to separate hook
@@ -6782,7 +6782,7 @@ tty_read_avail_input (struct display *display,
6782 if (ioctl (fileno (tty->input), FIONREAD, &n_to_read) < 0) 6782 if (ioctl (fileno (tty->input), FIONREAD, &n_to_read) < 0)
6783 { 6783 {
6784 if (! noninteractive) 6784 if (! noninteractive)
6785 return -2; /* Close this display. */ 6785 return -2; /* Close this device. */
6786 else 6786 else
6787 n_to_read = 0; 6787 n_to_read = 0;
6788 } 6788 }
@@ -6811,14 +6811,14 @@ tty_read_avail_input (struct display *display,
6811 when the control tty is taken away. 6811 when the control tty is taken away.
6812 Jeffrey Honig <jch@bsdi.com> says this is generally safe. */ 6812 Jeffrey Honig <jch@bsdi.com> says this is generally safe. */
6813 if (nread == -1 && errno == EIO) 6813 if (nread == -1 && errno == EIO)
6814 return -2; /* Close this display. */ 6814 return -2; /* Close this device. */
6815#if defined (AIX) && (! defined (aix386) && defined (_BSD)) 6815#if defined (AIX) && (! defined (aix386) && defined (_BSD))
6816 /* The kernel sometimes fails to deliver SIGHUP for ptys. 6816 /* The kernel sometimes fails to deliver SIGHUP for ptys.
6817 This looks incorrect, but it isn't, because _BSD causes 6817 This looks incorrect, but it isn't, because _BSD causes
6818 O_NDELAY to be defined in fcntl.h as O_NONBLOCK, 6818 O_NDELAY to be defined in fcntl.h as O_NONBLOCK,
6819 and that causes a value other than 0 when there is no input. */ 6819 and that causes a value other than 0 when there is no input. */
6820 if (nread == 0) 6820 if (nread == 0)
6821 return -2; /* Close this display. */ 6821 return -2; /* Close this device. */
6822#endif 6822#endif
6823 } 6823 }
6824 while ( 6824 while (
@@ -10365,7 +10365,7 @@ interrupt_signal (signalnum) /* If we don't have an argument, */
10365{ 10365{
10366 /* Must preserve main program's value of errno. */ 10366 /* Must preserve main program's value of errno. */
10367 int old_errno = errno; 10367 int old_errno = errno;
10368 struct display *display; 10368 struct device *device;
10369 10369
10370#if defined (USG) && !defined (POSIX_SIGNALS) 10370#if defined (USG) && !defined (POSIX_SIGNALS)
10371 /* USG systems forget handlers when they are used; 10371 /* USG systems forget handlers when they are used;
@@ -10377,8 +10377,8 @@ interrupt_signal (signalnum) /* If we don't have an argument, */
10377 SIGNAL_THREAD_CHECK (signalnum); 10377 SIGNAL_THREAD_CHECK (signalnum);
10378 10378
10379 /* See if we have an active display on our controlling terminal. */ 10379 /* See if we have an active display on our controlling terminal. */
10380 display = get_named_tty_display (NULL); 10380 device = get_named_tty (NULL);
10381 if (!display) 10381 if (!device)
10382 { 10382 {
10383 /* If there are no frames there, let's pretend that we are a 10383 /* If there are no frames there, let's pretend that we are a
10384 well-behaving UN*X program and quit. */ 10384 well-behaving UN*X program and quit. */
@@ -10392,7 +10392,7 @@ interrupt_signal (signalnum) /* If we don't have an argument, */
10392 controlling tty, if we have a frame there. We disable the 10392 controlling tty, if we have a frame there. We disable the
10393 interrupt key on secondary ttys, so the SIGINT must have come 10393 interrupt key on secondary ttys, so the SIGINT must have come
10394 from the controlling tty. */ 10394 from the controlling tty. */
10395 internal_last_event_frame = display->display_info.tty->top_frame; 10395 internal_last_event_frame = device->display_info.tty->top_frame;
10396 10396
10397 handle_interrupt (); 10397 handle_interrupt ();
10398 } 10398 }
@@ -10421,7 +10421,7 @@ handle_interrupt ()
10421 /* XXX This code needs to be revised for multi-tty support. */ 10421 /* XXX This code needs to be revised for multi-tty support. */
10422 if (!NILP (Vquit_flag) 10422 if (!NILP (Vquit_flag)
10423#ifndef MSDOS 10423#ifndef MSDOS
10424 && get_named_tty_display (NULL) 10424 && get_named_tty (NULL)
10425#endif 10425#endif
10426 ) 10426 )
10427 { 10427 {
@@ -10606,7 +10606,7 @@ See also `current-input-mode'. */)
10606 10606
10607#ifdef SIGIO 10607#ifdef SIGIO
10608/* Note SIGIO has been undef'd if FIONREAD is missing. */ 10608/* Note SIGIO has been undef'd if FIONREAD is missing. */
10609 if (FRAME_DISPLAY (SELECTED_FRAME ())->read_socket_hook) 10609 if (FRAME_DEVICE (SELECTED_FRAME ())->read_socket_hook)
10610 { 10610 {
10611 /* When using X, don't give the user a real choice, 10611 /* When using X, don't give the user a real choice,
10612 because we haven't implemented the mechanisms to support it. */ 10612 because we haven't implemented the mechanisms to support it. */
@@ -10819,7 +10819,7 @@ delete_kboard (kb)
10819 && FRAMEP (selected_frame) 10819 && FRAMEP (selected_frame)
10820 && FRAME_LIVE_P (XFRAME (selected_frame))) 10820 && FRAME_LIVE_P (XFRAME (selected_frame)))
10821 { 10821 {
10822 current_kboard = XFRAME (selected_frame)->display->kboard; 10822 current_kboard = XFRAME (selected_frame)->device->kboard;
10823 if (current_kboard == kb) 10823 if (current_kboard == kb)
10824 abort (); 10824 abort ();
10825 } 10825 }
diff --git a/src/keyboard.h b/src/keyboard.h
index b95482762e7..7710838c6e3 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -315,7 +315,7 @@ extern void init_kboard P_ ((KBOARD *));
315extern void delete_kboard P_ ((KBOARD *)); 315extern void delete_kboard P_ ((KBOARD *));
316extern void single_kboard_state P_ ((void)); 316extern void single_kboard_state P_ ((void));
317extern void not_single_kboard_state P_ ((KBOARD *)); 317extern void not_single_kboard_state P_ ((KBOARD *));
318extern void push_display_kboard P_ ((struct display *)); 318extern void push_device_kboard P_ ((struct device *));
319extern void push_frame_kboard P_ ((struct frame *)); 319extern void push_frame_kboard P_ ((struct frame *));
320extern void pop_frame_kboard P_ ((void)); 320extern void pop_frame_kboard P_ ((void));
321extern void record_asynch_buffer_change P_ ((void)); 321extern void record_asynch_buffer_change P_ ((void));
@@ -350,7 +350,7 @@ extern void kbd_buffer_store_help_event P_ ((Lisp_Object, Lisp_Object));
350extern Lisp_Object menu_item_eval_property P_ ((Lisp_Object)); 350extern Lisp_Object menu_item_eval_property P_ ((Lisp_Object));
351extern int kbd_buffer_events_waiting P_ ((int)); 351extern int kbd_buffer_events_waiting P_ ((int));
352 352
353extern int tty_read_avail_input P_ ((struct display *, int, 353extern int tty_read_avail_input P_ ((struct device *, int,
354 struct input_event *)); 354 struct input_event *));
355 355
356/* arch-tag: 769cbade-1ba9-4950-b886-db265b061aa3 356/* arch-tag: 769cbade-1ba9-4950-b886-db265b061aa3
diff --git a/src/lisp.h b/src/lisp.h
index b51d535f025..5c0e9b561ad 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3108,7 +3108,7 @@ extern void syms_of_xmenu P_ ((void));
3108struct tty_display_info; 3108struct tty_display_info;
3109 3109
3110/* defined in termhooks.h */ 3110/* defined in termhooks.h */
3111struct display; 3111struct device;
3112 3112
3113/* defined in sysdep.c */ 3113/* defined in sysdep.c */
3114extern void stuff_char P_ ((char c)); 3114extern void stuff_char P_ ((char c));
diff --git a/src/prefix-args.c b/src/prefix-args.c
index 5cfe6e4a095..8c4043f83cb 100644
--- a/src/prefix-args.c
+++ b/src/prefix-args.c
@@ -44,6 +44,7 @@ Boston, MA 02110-1301, USA. */
44 I'm quitting and taking up gardening. */ 44 I'm quitting and taking up gardening. */
45 45
46#include <stdio.h> 46#include <stdio.h>
47#include <stdlib.h>
47 48
48int 49int
49main (argc, argv) 50main (argc, argv)
diff --git a/src/sysdep.c b/src/sysdep.c
index 06adc855f7c..7f0c363f7c4 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -1709,7 +1709,7 @@ nil means don't delete them until `list-processes' is run. */);
1709 setbuf (tty_out->output, (char *) _sobuf); 1709 setbuf (tty_out->output, (char *) _sobuf);
1710#endif 1710#endif
1711 1711
1712 tty_set_terminal_modes (tty_out->display); 1712 tty_set_terminal_modes (tty_out->device);
1713 1713
1714 if (!tty_out->term_initted) 1714 if (!tty_out->term_initted)
1715 { 1715 {
@@ -1921,7 +1921,7 @@ reset_sys_modes (tty_out)
1921 } 1921 }
1922#endif 1922#endif
1923 1923
1924 tty_reset_terminal_modes (tty_out->display); 1924 tty_reset_terminal_modes (tty_out->device);
1925 1925
1926#ifdef BSD_SYSTEM 1926#ifdef BSD_SYSTEM
1927#ifndef BSD4_1 1927#ifndef BSD4_1
diff --git a/src/term.c b/src/term.c
index 94b848b520a..b2cba6a2665 100644
--- a/src/term.c
+++ b/src/term.c
@@ -85,9 +85,9 @@ static void turn_off_face P_ ((struct frame *, int face_id));
85static void tty_show_cursor P_ ((struct tty_display_info *)); 85static void tty_show_cursor P_ ((struct tty_display_info *));
86static void tty_hide_cursor P_ ((struct tty_display_info *)); 86static void tty_hide_cursor P_ ((struct tty_display_info *));
87 87
88static struct display *get_tty_display (Lisp_Object display); 88static struct device *get_tty_device (Lisp_Object device);
89 89
90void delete_initial_display P_ ((struct display *)); 90void delete_initial_device P_ ((struct device *));
91void create_tty_output P_ ((struct frame *)); 91void create_tty_output P_ ((struct frame *));
92void delete_tty_output P_ ((struct frame *)); 92void delete_tty_output P_ ((struct frame *));
93 93
@@ -126,10 +126,10 @@ Lisp_Object Vsuspend_tty_functions;
126Lisp_Object Vresume_tty_functions; 126Lisp_Object Vresume_tty_functions;
127 127
128/* Chain of all displays currently in use. */ 128/* Chain of all displays currently in use. */
129struct display *display_list; 129struct device *device_list;
130 130
131/* The initial display device, created by initial_term_init. */ 131/* The initial display device, created by initial_term_init. */
132struct display *initial_display; 132struct device *initial_device;
133 133
134/* Chain of all tty device parameters. */ 134/* Chain of all tty device parameters. */
135struct tty_display_info *tty_list; 135struct tty_display_info *tty_list;
@@ -172,7 +172,7 @@ int max_frame_lines;
172static int no_controlling_tty; 172static int no_controlling_tty;
173 173
174/* The first unallocated display id. */ 174/* The first unallocated display id. */
175static int next_display_id; 175static int next_device_id;
176 176
177/* Provided for lisp packages. */ 177/* Provided for lisp packages. */
178 178
@@ -216,8 +216,8 @@ ring_bell (struct frame *f)
216 216
217 Vring_bell_function = function; 217 Vring_bell_function = function;
218 } 218 }
219 else if (FRAME_DISPLAY (f)->ring_bell_hook) 219 else if (FRAME_DEVICE (f)->ring_bell_hook)
220 (*FRAME_DISPLAY (f)->ring_bell_hook) (f); 220 (*FRAME_DEVICE (f)->ring_bell_hook) (f);
221} 221}
222 222
223/* Ring the bell on a tty. */ 223/* Ring the bell on a tty. */
@@ -239,7 +239,7 @@ tty_ring_bell (struct frame *f)
239/* Set up termcap modes for Emacs. */ 239/* Set up termcap modes for Emacs. */
240 240
241void 241void
242tty_set_terminal_modes (struct display *display) 242tty_set_terminal_modes (struct device *display)
243{ 243{
244 struct tty_display_info *tty = display->display_info.tty; 244 struct tty_display_info *tty = display->display_info.tty;
245 245
@@ -256,7 +256,7 @@ tty_set_terminal_modes (struct display *display)
256/* Reset termcap modes before exiting Emacs. */ 256/* Reset termcap modes before exiting Emacs. */
257 257
258void 258void
259tty_reset_terminal_modes (struct display *display) 259tty_reset_terminal_modes (struct device *display)
260{ 260{
261 struct tty_display_info *tty = display->display_info.tty; 261 struct tty_display_info *tty = display->display_info.tty;
262 262
@@ -278,15 +278,15 @@ tty_reset_terminal_modes (struct display *display)
278void 278void
279update_begin (struct frame *f) 279update_begin (struct frame *f)
280{ 280{
281 if (FRAME_DISPLAY (f)->update_begin_hook) 281 if (FRAME_DEVICE (f)->update_begin_hook)
282 (*FRAME_DISPLAY (f)->update_begin_hook) (f); 282 (*FRAME_DEVICE (f)->update_begin_hook) (f);
283} 283}
284 284
285void 285void
286update_end (struct frame *f) 286update_end (struct frame *f)
287{ 287{
288 if (FRAME_DISPLAY (f)->update_end_hook) 288 if (FRAME_DEVICE (f)->update_end_hook)
289 (*FRAME_DISPLAY (f)->update_end_hook) (f); 289 (*FRAME_DEVICE (f)->update_end_hook) (f);
290} 290}
291 291
292/* Flag the end of a display update on a termcap display. */ 292/* Flag the end of a display update on a termcap display. */
@@ -310,8 +310,8 @@ tty_update_end (struct frame *f)
310void 310void
311set_terminal_window (struct frame *f, int size) 311set_terminal_window (struct frame *f, int size)
312{ 312{
313 if (FRAME_DISPLAY (f)->set_terminal_window_hook) 313 if (FRAME_DEVICE (f)->set_terminal_window_hook)
314 (*FRAME_DISPLAY (f)->set_terminal_window_hook) (f, size); 314 (*FRAME_DEVICE (f)->set_terminal_window_hook) (f, size);
315} 315}
316 316
317/* The implementation of set_terminal_window for termcap frames. */ 317/* The implementation of set_terminal_window for termcap frames. */
@@ -450,8 +450,8 @@ highlight_if_desired (struct tty_display_info *tty)
450void 450void
451cursor_to (struct frame *f, int vpos, int hpos) 451cursor_to (struct frame *f, int vpos, int hpos)
452{ 452{
453 if (FRAME_DISPLAY (f)->cursor_to_hook) 453 if (FRAME_DEVICE (f)->cursor_to_hook)
454 (*FRAME_DISPLAY (f)->cursor_to_hook) (f, vpos, hpos); 454 (*FRAME_DEVICE (f)->cursor_to_hook) (f, vpos, hpos);
455} 455}
456 456
457void 457void
@@ -479,8 +479,8 @@ tty_cursor_to (struct frame *f, int vpos, int hpos)
479void 479void
480raw_cursor_to (struct frame *f, int row, int col) 480raw_cursor_to (struct frame *f, int row, int col)
481{ 481{
482 if (FRAME_DISPLAY (f)->raw_cursor_to_hook) 482 if (FRAME_DEVICE (f)->raw_cursor_to_hook)
483 (*FRAME_DISPLAY (f)->raw_cursor_to_hook) (f, row, col); 483 (*FRAME_DEVICE (f)->raw_cursor_to_hook) (f, row, col);
484} 484}
485 485
486void 486void
@@ -504,8 +504,8 @@ tty_raw_cursor_to (struct frame *f, int row, int col)
504void 504void
505clear_to_end (struct frame *f) 505clear_to_end (struct frame *f)
506{ 506{
507 if (FRAME_DISPLAY (f)->clear_to_end_hook) 507 if (FRAME_DEVICE (f)->clear_to_end_hook)
508 (*FRAME_DISPLAY (f)->clear_to_end_hook) (f); 508 (*FRAME_DEVICE (f)->clear_to_end_hook) (f);
509} 509}
510 510
511/* Clear from cursor to end of frame on a termcap device. */ 511/* Clear from cursor to end of frame on a termcap device. */
@@ -536,8 +536,8 @@ tty_clear_to_end (struct frame *f)
536void 536void
537clear_frame (struct frame *f) 537clear_frame (struct frame *f)
538{ 538{
539 if (FRAME_DISPLAY (f)->clear_frame_hook) 539 if (FRAME_DEVICE (f)->clear_frame_hook)
540 (*FRAME_DISPLAY (f)->clear_frame_hook) (f); 540 (*FRAME_DEVICE (f)->clear_frame_hook) (f);
541} 541}
542 542
543/* Clear an entire termcap frame. */ 543/* Clear an entire termcap frame. */
@@ -568,8 +568,8 @@ tty_clear_frame (struct frame *f)
568void 568void
569clear_end_of_line (struct frame *f, int first_unused_hpos) 569clear_end_of_line (struct frame *f, int first_unused_hpos)
570{ 570{
571 if (FRAME_DISPLAY (f)->clear_end_of_line_hook) 571 if (FRAME_DEVICE (f)->clear_end_of_line_hook)
572 (*FRAME_DISPLAY (f)->clear_end_of_line_hook) (f, first_unused_hpos); 572 (*FRAME_DEVICE (f)->clear_end_of_line_hook) (f, first_unused_hpos);
573} 573}
574 574
575/* An implementation of clear_end_of_line for termcap frames. 575/* An implementation of clear_end_of_line for termcap frames.
@@ -739,8 +739,8 @@ encode_terminal_code (src, src_len, coding)
739void 739void
740write_glyphs (struct frame *f, struct glyph *string, int len) 740write_glyphs (struct frame *f, struct glyph *string, int len)
741{ 741{
742 if (FRAME_DISPLAY (f)->write_glyphs_hook) 742 if (FRAME_DEVICE (f)->write_glyphs_hook)
743 (*FRAME_DISPLAY (f)->write_glyphs_hook) (f, string, len); 743 (*FRAME_DEVICE (f)->write_glyphs_hook) (f, string, len);
744} 744}
745 745
746/* An implementation of write_glyphs for termcap frames. */ 746/* An implementation of write_glyphs for termcap frames. */
@@ -824,8 +824,8 @@ insert_glyphs (struct frame *f, struct glyph *start, int len)
824 if (len <= 0) 824 if (len <= 0)
825 return; 825 return;
826 826
827 if (FRAME_DISPLAY (f)->insert_glyphs_hook) 827 if (FRAME_DEVICE (f)->insert_glyphs_hook)
828 (*FRAME_DISPLAY (f)->insert_glyphs_hook) (f, start, len); 828 (*FRAME_DEVICE (f)->insert_glyphs_hook) (f, start, len);
829} 829}
830 830
831/* An implementation of insert_glyphs for termcap frames. */ 831/* An implementation of insert_glyphs for termcap frames. */
@@ -920,8 +920,8 @@ tty_insert_glyphs (struct frame *f, struct glyph *start, int len)
920void 920void
921delete_glyphs (struct frame *f, int n) 921delete_glyphs (struct frame *f, int n)
922{ 922{
923 if (FRAME_DISPLAY (f)->delete_glyphs_hook) 923 if (FRAME_DEVICE (f)->delete_glyphs_hook)
924 (*FRAME_DISPLAY (f)->delete_glyphs_hook) (f, n); 924 (*FRAME_DEVICE (f)->delete_glyphs_hook) (f, n);
925} 925}
926 926
927/* An implementation of delete_glyphs for termcap frames. */ 927/* An implementation of delete_glyphs for termcap frames. */
@@ -962,8 +962,8 @@ tty_delete_glyphs (struct frame *f, int n)
962void 962void
963ins_del_lines (struct frame *f, int vpos, int n) 963ins_del_lines (struct frame *f, int vpos, int n)
964{ 964{
965 if (FRAME_DISPLAY (f)->ins_del_lines_hook) 965 if (FRAME_DEVICE (f)->ins_del_lines_hook)
966 (*FRAME_DISPLAY (f)->ins_del_lines_hook) (f, vpos, n); 966 (*FRAME_DEVICE (f)->ins_del_lines_hook) (f, vpos, n);
967} 967}
968 968
969/* An implementation of ins_del_lines for termcap frames. */ 969/* An implementation of ins_del_lines for termcap frames. */
@@ -1953,11 +1953,12 @@ tty_capable_p (tty, caps, fg, bg)
1953 1953
1954DEFUN ("tty-display-color-p", Ftty_display_color_p, Stty_display_color_p, 1954DEFUN ("tty-display-color-p", Ftty_display_color_p, Stty_display_color_p,
1955 0, 1, 0, 1955 0, 1, 0,
1956 doc: /* Return non-nil if the tty device that DISPLAY uses can display colors. */) 1956 doc: /* Return non-nil if the display device DEVICE can display colors.
1957 (display) 1957DEVICE must be a tty device. */)
1958 Lisp_Object display; 1958 (device)
1959 Lisp_Object device;
1959{ 1960{
1960 struct display *d = get_tty_display (display); 1961 struct device *d = get_tty_device (device);
1961 if (!d) 1962 if (!d)
1962 return Qnil; 1963 return Qnil;
1963 else 1964 else
@@ -1967,11 +1968,11 @@ DEFUN ("tty-display-color-p", Ftty_display_color_p, Stty_display_color_p,
1967/* Return the number of supported colors. */ 1968/* Return the number of supported colors. */
1968DEFUN ("tty-display-color-cells", Ftty_display_color_cells, 1969DEFUN ("tty-display-color-cells", Ftty_display_color_cells,
1969 Stty_display_color_cells, 0, 1, 0, 1970 Stty_display_color_cells, 0, 1, 0,
1970 doc: /* Return the number of colors supported by the tty device that DISPLAY uses. */) 1971 doc: /* Return the number of colors supported by the tty device DEVICE. */)
1971 (display) 1972 (device)
1972 Lisp_Object display; 1973 Lisp_Object device;
1973{ 1974{
1974 struct display *d = get_tty_display (display); 1975 struct device *d = get_tty_device (device);
1975 if (!d) 1976 if (!d)
1976 return make_number (0); 1977 return make_number (0);
1977 else 1978 else
@@ -2117,86 +2118,79 @@ set_tty_color_mode (f, val)
2117 2118
2118 2119
2119 2120
2120/* Return the display object specified by DISPLAY. DISPLAY may be a 2121/* Return the display object specified by DEVICE. DEVICE may be a
2121 display id, a frame, or nil for the display device of the current 2122 display id, a frame, or nil for the display device of the current
2122 frame. If THROW is zero, return NULL for failure, otherwise throw 2123 frame. If THROW is zero, return NULL for failure, otherwise throw
2123 an error. */ 2124 an error. */
2124 2125
2125struct display * 2126struct device *
2126get_display (Lisp_Object display, int throw) 2127get_device (Lisp_Object device, int throw)
2127{ 2128{
2128 struct display *result = NULL; 2129 struct device *result = NULL;
2129 2130
2130 if (NILP (display)) 2131 if (NILP (device))
2131 display = selected_frame; 2132 device = selected_frame;
2132 2133
2133 if (INTEGERP (display)) 2134 if (INTEGERP (device))
2134 { 2135 {
2135 struct display *d; 2136 struct device *d;
2136 2137
2137 for (d = display_list; d; d = d->next_display) 2138 for (d = device_list; d; d = d->next_device)
2138 { 2139 {
2139 if (d->id == XINT (display)) 2140 if (d->id == XINT (device))
2140 { 2141 {
2141 result = d; 2142 result = d;
2142 break; 2143 break;
2143 } 2144 }
2144 } 2145 }
2145 } 2146 }
2146 else if (FRAMEP (display)) 2147 else if (FRAMEP (device))
2147 { 2148 {
2148 result = FRAME_DISPLAY (XFRAME (display)); 2149 result = FRAME_DEVICE (XFRAME (device));
2149 } 2150 }
2150 2151
2151 if (result == NULL && throw) 2152 if (result == NULL && throw)
2152 wrong_type_argument (Qdisplay_live_p, display); 2153 wrong_type_argument (Qdisplay_live_p, device);
2153 2154
2154 return result; 2155 return result;
2155} 2156}
2156 2157
2157/* Return the tty display object specified by DISPLAY. */ 2158/* Return the tty display object specified by DEVICE. */
2158 2159
2159static struct display * 2160static struct device *
2160get_tty_display (Lisp_Object display) 2161get_tty_device (Lisp_Object device)
2161{ 2162{
2162 struct display *d = get_display (display, 0); 2163 struct device *d = get_device (device, 0);
2163 2164
2164 if (d && d->type == output_initial) 2165 if (d && d->type == output_initial)
2165 d = NULL; 2166 d = NULL;
2166 2167
2167 if (d && d->type != output_termcap) 2168 if (d && d->type != output_termcap)
2168 { 2169 error ("Device %d is not a termcap display device", d->id);
2169#if 0 /* XXX We need a predicate as the first argument; find one. */
2170 wrong_type_argument ("Not a termcap display", display);
2171#else /* Until we fix the wrong_type_argument call above, simply throw
2172 a dumb error. */
2173 error ("DISPLAY is not a termcap display");
2174#endif
2175 }
2176 2170
2177 return d; 2171 return d;
2178} 2172}
2179 2173
2180/* Return the active termcap display that uses the tty device with the 2174/* Return the active termcap device that uses the tty device with the
2181 given name. If NAME is NULL, return the display corresponding to 2175 given name. If NAME is NULL, return the device corresponding to
2182 our controlling terminal. 2176 our controlling terminal.
2183 2177
2184 This function ignores suspended displays. 2178 This function ignores suspended devices.
2185 2179
2186 Returns NULL if the named terminal device is not opened. */ 2180 Returns NULL if the named terminal device is not opened. */
2187 2181
2188struct display * 2182struct device *
2189get_named_tty_display (name) 2183get_named_tty (name)
2190 char *name; 2184 char *name;
2191{ 2185{
2192 struct display *d; 2186 struct device *d;
2193 2187
2194 for (d = display_list; d; d = d->next_display) { 2188 for (d = device_list; d; d = d->next_device) {
2195 if (d->type == output_termcap 2189 if (d->type == output_termcap
2196 && ((d->display_info.tty->name == 0 && name == 0) 2190 && ((d->display_info.tty->name == 0 && name == 0)
2197 || (name && d->display_info.tty->name 2191 || (name && d->display_info.tty->name
2198 && !strcmp (d->display_info.tty->name, name))) 2192 && !strcmp (d->display_info.tty->name, name)))
2199 && DISPLAY_ACTIVE_P (d)) 2193 && DEVICE_ACTIVE_P (d))
2200 return d; 2194 return d;
2201 }; 2195 };
2202 2196
@@ -2206,15 +2200,15 @@ get_named_tty_display (name)
2206 2200
2207 2201
2208DEFUN ("display-name", Fdisplay_name, Sdisplay_name, 0, 1, 0, 2202DEFUN ("display-name", Fdisplay_name, Sdisplay_name, 0, 1, 0,
2209 doc: /* Return the name of the device that DISPLAY uses. 2203 doc: /* Return the name of the display device DEVICE.
2210It is not guaranteed that the returned value is unique among opened displays. 2204It is not guaranteed that the returned value is unique among opened devices.
2211 2205
2212DISPLAY may be a display, a frame, or nil (meaning the selected 2206DEVICE may be a display device id, a frame, or nil (meaning the
2213frame's display). */) 2207selected frame's display device). */)
2214 (display) 2208 (device)
2215 Lisp_Object display; 2209 Lisp_Object device;
2216{ 2210{
2217 struct display *d = get_display (display, 1); 2211 struct device *d = get_device (device, 1);
2218 2212
2219 if (d->name) 2213 if (d->name)
2220 return build_string (d->name); 2214 return build_string (d->name);
@@ -2223,14 +2217,14 @@ frame's display). */)
2223} 2217}
2224 2218
2225DEFUN ("display-tty-type", Fdisplay_tty_type, Sdisplay_tty_type, 0, 1, 0, 2219DEFUN ("display-tty-type", Fdisplay_tty_type, Sdisplay_tty_type, 0, 1, 0,
2226 doc: /* Return the type of the TTY device that DISPLAY uses. 2220 doc: /* Return the type of the tty device that DEVICE uses.
2227 2221
2228DISPLAY may be a display, a frame, or nil (meaning the selected 2222DEVICE may be a display device id, a frame, or nil (meaning the
2229frame's display). */) 2223selected frame's display device). */)
2230 (display) 2224 (device)
2231 Lisp_Object display; 2225 Lisp_Object device;
2232{ 2226{
2233 struct display *d = get_display (display, 1); 2227 struct device *d = get_device (device, 1);
2234 2228
2235 if (d->type != output_termcap) 2229 if (d->type != output_termcap)
2236 error ("Display %d is not a termcap display", d->id); 2230 error ("Display %d is not a termcap display", d->id);
@@ -2242,14 +2236,14 @@ frame's display). */)
2242} 2236}
2243 2237
2244DEFUN ("display-controlling-tty-p", Fdisplay_controlling_tty_p, Sdisplay_controlling_tty_p, 0, 1, 0, 2238DEFUN ("display-controlling-tty-p", Fdisplay_controlling_tty_p, Sdisplay_controlling_tty_p, 0, 1, 0,
2245 doc: /* Return non-nil if DISPLAY is on the controlling tty of the Emacs process. 2239 doc: /* Return non-nil if DEVICE is on the controlling tty of the Emacs process.
2246 2240
2247DISPLAY may be a display, a frame, or nil (meaning the selected 2241DEVICE may be a display device id, a frame, or nil (meaning the
2248frame's display). */) 2242selected frame's display device). */)
2249 (display) 2243 (device)
2250 Lisp_Object display; 2244 Lisp_Object device;
2251{ 2245{
2252 struct display *d = get_display (display, 1); 2246 struct device *d = get_device (device, 1);
2253 2247
2254 if (d->type != output_termcap || d->display_info.tty->name) 2248 if (d->type != output_termcap || d->display_info.tty->name)
2255 return Qnil; 2249 return Qnil;
@@ -2258,17 +2252,17 @@ frame's display). */)
2258} 2252}
2259 2253
2260DEFUN ("tty-no-underline", Ftty_no_underline, Stty_no_underline, 0, 1, 0, 2254DEFUN ("tty-no-underline", Ftty_no_underline, Stty_no_underline, 0, 1, 0,
2261 doc: /* Declare that the tty used by DISPLAY does not handle underlining. 2255 doc: /* Declare that the tty used by DEVICE does not handle underlining.
2262This is used to override the terminfo data, for certain terminals that 2256This is used to override the terminfo data, for certain terminals that
2263do not really do underlining, but say that they do. This function has 2257do not really do underlining, but say that they do. This function has
2264no effect if used on a non-tty display. 2258no effect if used on a non-tty display.
2265 2259
2266DISPLAY may be a display, a frame, or nil (meaning the selected 2260DEVICE may be a display device id, a frame, or nil (meaning the
2267frame's display). */) 2261selected frame's display device). */)
2268 (display) 2262 (device)
2269 Lisp_Object display; 2263 Lisp_Object device;
2270{ 2264{
2271 struct display *d = get_display (display, 1); 2265 struct device *d = get_device (device, 1);
2272 2266
2273 if (d->type == output_termcap) 2267 if (d->type == output_termcap)
2274 d->display_info.tty->TS_enter_underline_mode = 0; 2268 d->display_info.tty->TS_enter_underline_mode = 0;
@@ -2282,36 +2276,36 @@ frame's display). */)
2282 ***********************************************************************/ 2276 ***********************************************************************/
2283 2277
2284/* Create the bootstrap display device for the initial frame. 2278/* Create the bootstrap display device for the initial frame.
2285 Returns a display of type output_initial. */ 2279 Returns a device of type output_initial. */
2286 2280
2287struct display * 2281struct device *
2288init_initial_display (void) 2282init_initial_device (void)
2289{ 2283{
2290 if (initialized || display_list || tty_list) 2284 if (initialized || device_list || tty_list)
2291 abort (); 2285 abort ();
2292 2286
2293 initial_display = create_display (); 2287 initial_device = create_device ();
2294 initial_display->type = output_initial; 2288 initial_device->type = output_initial;
2295 initial_display->name = xstrdup ("initial_display"); 2289 initial_device->name = xstrdup ("initial_device");
2296 initial_display->kboard = initial_kboard; 2290 initial_device->kboard = initial_kboard;
2297 2291
2298 initial_display->delete_display_hook = &delete_initial_display; 2292 initial_device->delete_device_hook = &delete_initial_device;
2299 /* All other hooks are NULL. */ 2293 /* All other hooks are NULL. */
2300 2294
2301 return initial_display; 2295 return initial_device;
2302} 2296}
2303 2297
2304/* Deletes the bootstrap display device. 2298/* Deletes the bootstrap display device.
2305 Called through delete_display_hook. */ 2299 Called through delete_device_hook. */
2306 2300
2307void 2301void
2308delete_initial_display (struct display *display) 2302delete_initial_device (struct device *device)
2309{ 2303{
2310 if (display != initial_display) 2304 if (device != initial_device)
2311 abort (); 2305 abort ();
2312 2306
2313 delete_display (display); 2307 delete_device (device);
2314 initial_display = NULL; 2308 initial_device = NULL;
2315} 2309}
2316 2310
2317/* Drop the controlling terminal if fd is the same device. */ 2311/* Drop the controlling terminal if fd is the same device. */
@@ -2357,7 +2351,7 @@ static void maybe_fatal();
2357 2351
2358 If MUST_SUCCEED is true, then all errors are fatal. */ 2352 If MUST_SUCCEED is true, then all errors are fatal. */
2359 2353
2360struct display * 2354struct device *
2361init_tty (char *name, char *terminal_type, int must_succeed) 2355init_tty (char *name, char *terminal_type, int must_succeed)
2362{ 2356{
2363 char *area; 2357 char *area;
@@ -2367,72 +2361,72 @@ init_tty (char *name, char *terminal_type, int must_succeed)
2367 register char *p; 2361 register char *p;
2368 int status; 2362 int status;
2369 struct tty_display_info *tty; 2363 struct tty_display_info *tty;
2370 struct display *display; 2364 struct device *device;
2371 2365
2372 if (!terminal_type) 2366 if (!terminal_type)
2373 maybe_fatal (must_succeed, 0, 0, 2367 maybe_fatal (must_succeed, 0, 0,
2374 "Unknown terminal type", 2368 "Unknown terminal type",
2375 "Unknown terminal type"); 2369 "Unknown terminal type");
2376 2370
2377 /* If we already have an active display on the given device, use that. 2371 /* If we already have a display on the given device, use that. If
2378 If all displays are suspended, create a new one instead. */ 2372 all such displays are suspended, create a new one instead. */
2379 /* XXX Perhaps this should be made explicit by having init_tty 2373 /* XXX Perhaps this should be made explicit by having init_tty
2380 always create a new display and separating display and frame 2374 always create a new display and separating device and frame
2381 creation on Lisp level. */ 2375 creation on Lisp level. */
2382 display = get_named_tty_display (name); 2376 device = get_named_tty (name);
2383 if (display) 2377 if (device)
2384 return display; 2378 return device;
2385 2379
2386 display = create_display (); 2380 device = create_device ();
2387 tty = (struct tty_display_info *) xmalloc (sizeof (struct tty_display_info)); 2381 tty = (struct tty_display_info *) xmalloc (sizeof (struct tty_display_info));
2388 bzero (tty, sizeof (struct tty_display_info)); 2382 bzero (tty, sizeof (struct tty_display_info));
2389 tty->next = tty_list; 2383 tty->next = tty_list;
2390 tty_list = tty; 2384 tty_list = tty;
2391 2385
2392 display->type = output_termcap; 2386 device->type = output_termcap;
2393 display->display_info.tty = tty; 2387 device->display_info.tty = tty;
2394 tty->display = display; 2388 tty->device = device;
2395 2389
2396 tty->Wcm = (struct cm *) xmalloc (sizeof (struct cm)); 2390 tty->Wcm = (struct cm *) xmalloc (sizeof (struct cm));
2397 Wcm_clear (tty); 2391 Wcm_clear (tty);
2398 2392
2399 display->rif = 0; /* ttys don't support window-based redisplay. */ 2393 device->rif = 0; /* ttys don't support window-based redisplay. */
2400 2394
2401 display->cursor_to_hook = &tty_cursor_to; 2395 device->cursor_to_hook = &tty_cursor_to;
2402 display->raw_cursor_to_hook = &tty_raw_cursor_to; 2396 device->raw_cursor_to_hook = &tty_raw_cursor_to;
2403 2397
2404 display->clear_to_end_hook = &tty_clear_to_end; 2398 device->clear_to_end_hook = &tty_clear_to_end;
2405 display->clear_frame_hook = &tty_clear_frame; 2399 device->clear_frame_hook = &tty_clear_frame;
2406 display->clear_end_of_line_hook = &tty_clear_end_of_line; 2400 device->clear_end_of_line_hook = &tty_clear_end_of_line;
2407 2401
2408 display->ins_del_lines_hook = &tty_ins_del_lines; 2402 device->ins_del_lines_hook = &tty_ins_del_lines;
2409 2403
2410 display->insert_glyphs_hook = &tty_insert_glyphs; 2404 device->insert_glyphs_hook = &tty_insert_glyphs;
2411 display->write_glyphs_hook = &tty_write_glyphs; 2405 device->write_glyphs_hook = &tty_write_glyphs;
2412 display->delete_glyphs_hook = &tty_delete_glyphs; 2406 device->delete_glyphs_hook = &tty_delete_glyphs;
2413 2407
2414 display->ring_bell_hook = &tty_ring_bell; 2408 device->ring_bell_hook = &tty_ring_bell;
2415 2409
2416 display->reset_terminal_modes_hook = &tty_reset_terminal_modes; 2410 device->reset_terminal_modes_hook = &tty_reset_terminal_modes;
2417 display->set_terminal_modes_hook = &tty_set_terminal_modes; 2411 device->set_terminal_modes_hook = &tty_set_terminal_modes;
2418 display->update_begin_hook = 0; /* Not needed. */ 2412 device->update_begin_hook = 0; /* Not needed. */
2419 display->update_end_hook = &tty_update_end; 2413 device->update_end_hook = &tty_update_end;
2420 display->set_terminal_window_hook = &tty_set_terminal_window; 2414 device->set_terminal_window_hook = &tty_set_terminal_window;
2421 2415
2422 display->mouse_position_hook = 0; /* Not needed. */ 2416 device->mouse_position_hook = 0; /* Not needed. */
2423 display->frame_rehighlight_hook = 0; /* Not needed. */ 2417 device->frame_rehighlight_hook = 0; /* Not needed. */
2424 display->frame_raise_lower_hook = 0; /* Not needed. */ 2418 device->frame_raise_lower_hook = 0; /* Not needed. */
2425 2419
2426 display->set_vertical_scroll_bar_hook = 0; /* Not needed. */ 2420 device->set_vertical_scroll_bar_hook = 0; /* Not needed. */
2427 display->condemn_scroll_bars_hook = 0; /* Not needed. */ 2421 device->condemn_scroll_bars_hook = 0; /* Not needed. */
2428 display->redeem_scroll_bar_hook = 0; /* Not needed. */ 2422 device->redeem_scroll_bar_hook = 0; /* Not needed. */
2429 display->judge_scroll_bars_hook = 0; /* Not needed. */ 2423 device->judge_scroll_bars_hook = 0; /* Not needed. */
2430 2424
2431 display->read_socket_hook = &tty_read_avail_input; /* keyboard.c */ 2425 device->read_socket_hook = &tty_read_avail_input; /* keyboard.c */
2432 display->frame_up_to_date_hook = 0; /* Not needed. */ 2426 device->frame_up_to_date_hook = 0; /* Not needed. */
2433 2427
2434 display->delete_frame_hook = &delete_tty_output; 2428 device->delete_frame_hook = &delete_tty_output;
2435 display->delete_display_hook = &delete_tty; 2429 device->delete_device_hook = &delete_tty;
2436 2430
2437 if (name) 2431 if (name)
2438 { 2432 {
@@ -2456,7 +2450,7 @@ init_tty (char *name, char *terminal_type, int must_succeed)
2456 2450
2457 if (fd < 0) 2451 if (fd < 0)
2458 { 2452 {
2459 delete_tty (display); 2453 delete_tty (device);
2460 error ("Could not open file: %s", name); 2454 error ("Could not open file: %s", name);
2461 } 2455 }
2462 if (!isatty (fd)) 2456 if (!isatty (fd))
@@ -2469,7 +2463,7 @@ init_tty (char *name, char *terminal_type, int must_succeed)
2469 2463
2470 file = fdopen (fd, "w+"); 2464 file = fdopen (fd, "w+");
2471 tty->name = xstrdup (name); 2465 tty->name = xstrdup (name);
2472 display->name = xstrdup (name); 2466 device->name = xstrdup (name);
2473 tty->input = file; 2467 tty->input = file;
2474 tty->output = file; 2468 tty->output = file;
2475 } 2469 }
@@ -2482,7 +2476,7 @@ init_tty (char *name, char *terminal_type, int must_succeed)
2482 error ("There is no controlling terminal any more"); 2476 error ("There is no controlling terminal any more");
2483 } 2477 }
2484 tty->name = 0; 2478 tty->name = 0;
2485 display->name = xstrdup (ttyname (0)); 2479 device->name = xstrdup (ttyname (0));
2486 tty->input = stdin; 2480 tty->input = stdin;
2487 tty->output = stdout; 2481 tty->output = stdout;
2488 } 2482 }
@@ -2504,17 +2498,16 @@ init_tty (char *name, char *terminal_type, int must_succeed)
2504 FrameCols (tty) = FRAME_COLS (f); /* XXX */ 2498 FrameCols (tty) = FRAME_COLS (f); /* XXX */
2505 tty->specified_window = FRAME_LINES (f); /* XXX */ 2499 tty->specified_window = FRAME_LINES (f); /* XXX */
2506 2500
2507 tty->display->delete_in_insert_mode = 1; 2501 tty->device->delete_in_insert_mode = 1;
2508 2502
2509 UseTabs (tty) = 0; 2503 UseTabs (tty) = 0;
2510 display->scroll_region_ok = 0; 2504 device->scroll_region_ok = 0;
2511 2505
2512 /* Seems to insert lines when it's not supposed to, messing 2506 /* Seems to insert lines when it's not supposed to, messing up the
2513 up the display. In doing a trace, it didn't seem to be 2507 device. In doing a trace, it didn't seem to be called much, so I
2514 called much, so I don't think we're losing anything by 2508 don't think we're losing anything by turning it off. */
2515 turning it off. */ 2509 device->line_ins_del_ok = 0;
2516 display->line_ins_del_ok = 0; 2510 device->char_ins_del_ok = 1;
2517 display->char_ins_del_ok = 1;
2518 2511
2519 baud_rate = 19200; 2512 baud_rate = 19200;
2520 2513
@@ -2522,7 +2515,7 @@ init_tty (char *name, char *terminal_type, int must_succeed)
2522 FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none; /* XXX */ 2515 FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none; /* XXX */
2523 TN_max_colors = 16; /* Required to be non-zero for tty-display-color-p */ 2516 TN_max_colors = 16; /* Required to be non-zero for tty-display-color-p */
2524 2517
2525 return display; 2518 return device;
2526#else /* not WINDOWSNT */ 2519#else /* not WINDOWSNT */
2527 2520
2528 Wcm_clear (tty); 2521 Wcm_clear (tty);
@@ -2538,11 +2531,11 @@ init_tty (char *name, char *terminal_type, int must_succeed)
2538 if (status < 0) 2531 if (status < 0)
2539 { 2532 {
2540#ifdef TERMINFO 2533#ifdef TERMINFO
2541 maybe_fatal (must_succeed, buffer, display, 2534 maybe_fatal (must_succeed, buffer, device,
2542 "Cannot open terminfo database file", 2535 "Cannot open terminfo database file",
2543 "Cannot open terminfo database file"); 2536 "Cannot open terminfo database file");
2544#else 2537#else
2545 maybe_fatal (must_succeed, buffer, display, 2538 maybe_fatal (must_succeed, buffer, device,
2546 "Cannot open termcap database file", 2539 "Cannot open termcap database file",
2547 "Cannot open termcap database file"); 2540 "Cannot open termcap database file");
2548#endif 2541#endif
@@ -2550,7 +2543,7 @@ init_tty (char *name, char *terminal_type, int must_succeed)
2550 if (status == 0) 2543 if (status == 0)
2551 { 2544 {
2552#ifdef TERMINFO 2545#ifdef TERMINFO
2553 maybe_fatal (must_succeed, buffer, display, 2546 maybe_fatal (must_succeed, buffer, device,
2554 "Terminal type %s is not defined", 2547 "Terminal type %s is not defined",
2555 "Terminal type %s is not defined.\n\ 2548 "Terminal type %s is not defined.\n\
2556If that is not the actual type of terminal you have,\n\ 2549If that is not the actual type of terminal you have,\n\
@@ -2559,7 +2552,7 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
2559to do `unset TERMINFO' (C-shell: `unsetenv TERMINFO') as well.", 2552to do `unset TERMINFO' (C-shell: `unsetenv TERMINFO') as well.",
2560 terminal_type); 2553 terminal_type);
2561#else 2554#else
2562 maybe_fatal (must_succeed, buffer, display, 2555 maybe_fatal (must_succeed, buffer, device,
2563 "Terminal type %s is not defined", 2556 "Terminal type %s is not defined",
2564 "Terminal type %s is not defined.\n\ 2557 "Terminal type %s is not defined.\n\
2565If that is not the actual type of terminal you have,\n\ 2558If that is not the actual type of terminal you have,\n\
@@ -2681,9 +2674,9 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
2681 /* Since we make MagicWrap terminals look like AutoWrap, we need to have 2674 /* Since we make MagicWrap terminals look like AutoWrap, we need to have
2682 the former flag imply the latter. */ 2675 the former flag imply the latter. */
2683 AutoWrap (tty) = MagicWrap (tty) || tgetflag ("am"); 2676 AutoWrap (tty) = MagicWrap (tty) || tgetflag ("am");
2684 display->memory_below_frame = tgetflag ("db"); 2677 device->memory_below_frame = tgetflag ("db");
2685 tty->TF_hazeltine = tgetflag ("hz"); 2678 tty->TF_hazeltine = tgetflag ("hz");
2686 display->must_write_spaces = tgetflag ("in"); 2679 device->must_write_spaces = tgetflag ("in");
2687 tty->meta_key = tgetflag ("km") || tgetflag ("MT"); 2680 tty->meta_key = tgetflag ("km") || tgetflag ("MT");
2688 tty->TF_insmode_motion = tgetflag ("mi"); 2681 tty->TF_insmode_motion = tgetflag ("mi");
2689 tty->TF_standout_motion = tgetflag ("ms"); 2682 tty->TF_standout_motion = tgetflag ("ms");
@@ -2691,19 +2684,19 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
2691 tty->TF_teleray = tgetflag ("xt"); 2684 tty->TF_teleray = tgetflag ("xt");
2692 2685
2693#ifdef MULTI_KBOARD 2686#ifdef MULTI_KBOARD
2694 display->kboard = (KBOARD *) xmalloc (sizeof (KBOARD)); 2687 device->kboard = (KBOARD *) xmalloc (sizeof (KBOARD));
2695 init_kboard (display->kboard); 2688 init_kboard (device->kboard);
2696 display->kboard->next_kboard = all_kboards; 2689 device->kboard->next_kboard = all_kboards;
2697 all_kboards = display->kboard; 2690 all_kboards = device->kboard;
2698 display->kboard->reference_count++; 2691 device->kboard->reference_count++;
2699 /* Don't let the initial kboard remain current longer than necessary. 2692 /* Don't let the initial kboard remain current longer than necessary.
2700 That would cause problems if a file loaded on startup tries to 2693 That would cause problems if a file loaded on startup tries to
2701 prompt in the mini-buffer. */ 2694 prompt in the mini-buffer. */
2702 if (current_kboard == initial_kboard) 2695 if (current_kboard == initial_kboard)
2703 current_kboard = display->kboard; 2696 current_kboard = device->kboard;
2704#endif 2697#endif
2705 2698
2706 term_get_fkeys (address, display->kboard); 2699 term_get_fkeys (address, device->kboard);
2707 2700
2708 /* Get frame size from system, or else from termcap. */ 2701 /* Get frame size from system, or else from termcap. */
2709 { 2702 {
@@ -2719,13 +2712,13 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
2719 FrameRows (tty) = tgetnum ("li"); 2712 FrameRows (tty) = tgetnum ("li");
2720 2713
2721 if (FrameRows (tty) < 3 || FrameCols (tty) < 3) 2714 if (FrameRows (tty) < 3 || FrameCols (tty) < 3)
2722 maybe_fatal (must_succeed, NULL, display, 2715 maybe_fatal (must_succeed, NULL, device,
2723 "Screen size %dx%d is too small" 2716 "Screen size %dx%d is too small"
2724 "Screen size %dx%d is too small", 2717 "Screen size %dx%d is too small",
2725 FrameCols (tty), FrameRows (tty)); 2718 FrameCols (tty), FrameRows (tty));
2726 2719
2727#if 0 /* This is not used anywhere. */ 2720#if 0 /* This is not used anywhere. */
2728 tty->display->min_padding_speed = tgetnum ("pb"); 2721 tty->device->min_padding_speed = tgetnum ("pb");
2729#endif 2722#endif
2730 2723
2731 TabWidth (tty) = tgetnum ("tw"); 2724 TabWidth (tty) = tgetnum ("tw");
@@ -2803,7 +2796,7 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
2803 2796
2804 if (!strcmp (terminal_type, "supdup")) 2797 if (!strcmp (terminal_type, "supdup"))
2805 { 2798 {
2806 display->memory_below_frame = 1; 2799 device->memory_below_frame = 1;
2807 tty->Wcm->cm_losewrap = 1; 2800 tty->Wcm->cm_losewrap = 1;
2808 } 2801 }
2809 if (!strncmp (terminal_type, "c10", 3) 2802 if (!strncmp (terminal_type, "c10", 3)
@@ -2830,7 +2823,7 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
2830 tty->TS_set_window = "\033v%C %C %C %C "; 2823 tty->TS_set_window = "\033v%C %C %C %C ";
2831 } 2824 }
2832 /* Termcap entry often fails to have :in: flag */ 2825 /* Termcap entry often fails to have :in: flag */
2833 display->must_write_spaces = 1; 2826 device->must_write_spaces = 1;
2834 /* :ti string typically fails to have \E^G! in it */ 2827 /* :ti string typically fails to have \E^G! in it */
2835 /* This limits scope of insert-char to one line. */ 2828 /* This limits scope of insert-char to one line. */
2836 strcpy (area, tty->TS_termcap_modes); 2829 strcpy (area, tty->TS_termcap_modes);
@@ -2852,7 +2845,7 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
2852 2845
2853 if (Wcm_init (tty) == -1) /* can't do cursor motion */ 2846 if (Wcm_init (tty) == -1) /* can't do cursor motion */
2854 { 2847 {
2855 maybe_fatal (must_succeed, NULL, display, 2848 maybe_fatal (must_succeed, NULL, device,
2856 "Terminal type \"%s\" is not powerful enough to run Emacs", 2849 "Terminal type \"%s\" is not powerful enough to run Emacs",
2857#ifdef VMS 2850#ifdef VMS
2858 "Terminal type \"%s\" is not powerful enough to run Emacs.\n\ 2851 "Terminal type \"%s\" is not powerful enough to run Emacs.\n\
@@ -2881,7 +2874,7 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
2881 } 2874 }
2882 2875
2883 if (FrameRows (tty) <= 0 || FrameCols (tty) <= 0) 2876 if (FrameRows (tty) <= 0 || FrameCols (tty) <= 0)
2884 maybe_fatal (must_succeed, NULL, display, 2877 maybe_fatal (must_succeed, NULL, device,
2885 "Could not determine the frame size", 2878 "Could not determine the frame size",
2886 "Could not determine the frame size"); 2879 "Could not determine the frame size");
2887 2880
@@ -2895,30 +2888,30 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
2895 2888
2896 UseTabs (tty) = tabs_safe_p (fileno (tty->input)) && TabWidth (tty) == 8; 2889 UseTabs (tty) = tabs_safe_p (fileno (tty->input)) && TabWidth (tty) == 8;
2897 2890
2898 display->scroll_region_ok 2891 device->scroll_region_ok
2899 = (tty->Wcm->cm_abs 2892 = (tty->Wcm->cm_abs
2900 && (tty->TS_set_window || tty->TS_set_scroll_region || tty->TS_set_scroll_region_1)); 2893 && (tty->TS_set_window || tty->TS_set_scroll_region || tty->TS_set_scroll_region_1));
2901 2894
2902 display->line_ins_del_ok 2895 device->line_ins_del_ok
2903 = (((tty->TS_ins_line || tty->TS_ins_multi_lines) 2896 = (((tty->TS_ins_line || tty->TS_ins_multi_lines)
2904 && (tty->TS_del_line || tty->TS_del_multi_lines)) 2897 && (tty->TS_del_line || tty->TS_del_multi_lines))
2905 || (display->scroll_region_ok 2898 || (device->scroll_region_ok
2906 && tty->TS_fwd_scroll && tty->TS_rev_scroll)); 2899 && tty->TS_fwd_scroll && tty->TS_rev_scroll));
2907 2900
2908 display->char_ins_del_ok 2901 device->char_ins_del_ok
2909 = ((tty->TS_ins_char || tty->TS_insert_mode 2902 = ((tty->TS_ins_char || tty->TS_insert_mode
2910 || tty->TS_pad_inserted_char || tty->TS_ins_multi_chars) 2903 || tty->TS_pad_inserted_char || tty->TS_ins_multi_chars)
2911 && (tty->TS_del_char || tty->TS_del_multi_chars)); 2904 && (tty->TS_del_char || tty->TS_del_multi_chars));
2912 2905
2913 display->fast_clear_end_of_line = tty->TS_clr_line != 0; 2906 device->fast_clear_end_of_line = tty->TS_clr_line != 0;
2914 2907
2915 init_baud_rate (fileno (tty->input)); 2908 init_baud_rate (fileno (tty->input));
2916 2909
2917#ifdef AIXHFT 2910#ifdef AIXHFT
2918 /* The HFT system on AIX doesn't optimize for scrolling, so it's 2911 /* The HFT system on AIX doesn't optimize for scrolling, so it's
2919 really ugly at times. */ 2912 really ugly at times. */
2920 display->line_ins_del_ok = 0; 2913 device->line_ins_del_ok = 0;
2921 display->char_ins_del_ok = 0; 2914 device->char_ins_del_ok = 0;
2922#endif 2915#endif
2923 2916
2924 /* Don't do this. I think termcap may still need the buffer. */ 2917 /* Don't do this. I think termcap may still need the buffer. */
@@ -2927,26 +2920,26 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
2927 /* Init system terminal modes (RAW or CBREAK, etc.). */ 2920 /* Init system terminal modes (RAW or CBREAK, etc.). */
2928 init_sys_modes (tty); 2921 init_sys_modes (tty);
2929 2922
2930 return display; 2923 return device;
2931#endif /* not WINDOWSNT */ 2924#endif /* not WINDOWSNT */
2932} 2925}
2933 2926
2934/* Auxiliary error-handling function for init_tty. 2927/* Auxiliary error-handling function for init_tty.
2935 Free BUFFER and delete DISPLAY, then call error or fatal 2928 Free BUFFER and delete DEVICE, then call error or fatal
2936 with str1 or str2, respectively, according to MUST_SUCCEED. */ 2929 with str1 or str2, respectively, according to MUST_SUCCEED. */
2937 2930
2938static void 2931static void
2939maybe_fatal (must_succeed, buffer, display, str1, str2, arg1, arg2) 2932maybe_fatal (must_succeed, buffer, device, str1, str2, arg1, arg2)
2940 int must_succeed; 2933 int must_succeed;
2941 char *buffer; 2934 char *buffer;
2942 struct display *display; 2935 struct device *device;
2943 char *str1, *str2, *arg1, *arg2; 2936 char *str1, *str2, *arg1, *arg2;
2944{ 2937{
2945 if (buffer) 2938 if (buffer)
2946 xfree (buffer); 2939 xfree (buffer);
2947 2940
2948 if (display) 2941 if (device)
2949 delete_tty (display); 2942 delete_tty (device);
2950 2943
2951 if (must_succeed) 2944 if (must_succeed)
2952 fatal (str2, arg1, arg2); 2945 fatal (str2, arg1, arg2);
@@ -2976,35 +2969,35 @@ static int deleting_tty = 0;
2976/* Delete the given terminal device, closing all frames on it. */ 2969/* Delete the given terminal device, closing all frames on it. */
2977 2970
2978void 2971void
2979delete_tty (struct display *display) 2972delete_tty (struct device *device)
2980{ 2973{
2981 struct tty_display_info *tty; 2974 struct tty_display_info *tty;
2982 Lisp_Object tail, frame; 2975 Lisp_Object tail, frame;
2983 char *tty_name; 2976 char *tty_name;
2984 int last_display; 2977 int last_device;
2985 2978
2986 if (deleting_tty) 2979 if (deleting_tty)
2987 /* We get a recursive call when we delete the last frame on this 2980 /* We get a recursive call when we delete the last frame on this
2988 display. */ 2981 device. */
2989 return; 2982 return;
2990 2983
2991 if (display->type != output_termcap) 2984 if (device->type != output_termcap)
2992 abort (); 2985 abort ();
2993 2986
2994 tty = display->display_info.tty; 2987 tty = device->display_info.tty;
2995 2988
2996 last_display = 1; 2989 last_device = 1;
2997 FOR_EACH_FRAME (tail, frame) 2990 FOR_EACH_FRAME (tail, frame)
2998 { 2991 {
2999 struct frame *f = XFRAME (frame); 2992 struct frame *f = XFRAME (frame);
3000 if (FRAME_LIVE_P (f) && (!FRAME_TERMCAP_P (f) || FRAME_TTY (f) != tty)) 2993 if (FRAME_LIVE_P (f) && (!FRAME_TERMCAP_P (f) || FRAME_TTY (f) != tty))
3001 { 2994 {
3002 last_display = 0; 2995 last_device = 0;
3003 break; 2996 break;
3004 } 2997 }
3005 } 2998 }
3006 if (last_display) 2999 if (last_device)
3007 error ("Attempt to delete the sole display with live frames"); 3000 error ("Attempt to delete the sole display device with live frames");
3008 3001
3009 if (tty == tty_list) 3002 if (tty == tty_list)
3010 tty_list = tty->next; 3003 tty_list = tty->next;
@@ -3033,11 +3026,11 @@ delete_tty (struct display *display)
3033 } 3026 }
3034 } 3027 }
3035 3028
3036 /* reset_sys_modes needs a valid display, so this call needs to be 3029 /* reset_sys_modes needs a valid device, so this call needs to be
3037 before delete_display. */ 3030 before delete_device. */
3038 reset_sys_modes (tty); 3031 reset_sys_modes (tty);
3039 3032
3040 delete_display (display); 3033 delete_device (device);
3041 3034
3042 tty_name = tty->name; 3035 tty_name = tty->name;
3043 if (tty->type) 3036 if (tty->type)
@@ -3068,7 +3061,7 @@ delete_tty (struct display *display)
3068 3061
3069 3062
3070/* Initialize the tty-dependent part of frame F. The frame must 3063/* Initialize the tty-dependent part of frame F. The frame must
3071 already have its display initialized. */ 3064 already have its device initialized. */
3072 3065
3073void 3066void
3074create_tty_output (struct frame *f) 3067create_tty_output (struct frame *f)
@@ -3081,7 +3074,7 @@ create_tty_output (struct frame *f)
3081 t = xmalloc (sizeof (struct tty_output)); 3074 t = xmalloc (sizeof (struct tty_output));
3082 bzero (t, sizeof (struct tty_output)); 3075 bzero (t, sizeof (struct tty_output));
3083 3076
3084 t->display_info = FRAME_DISPLAY (f)->display_info.tty; 3077 t->display_info = FRAME_DEVICE (f)->display_info.tty;
3085 3078
3086 f->output_data.tty = t; 3079 f->output_data.tty = t;
3087} 3080}
@@ -3117,119 +3110,119 @@ mark_ttys ()
3117 3110
3118 3111
3119 3112
3120/* Create a new display object and add it to the display list. */ 3113/* Create a new device object and add it to the device list. */
3121 3114
3122struct display * 3115struct device *
3123create_display (void) 3116create_device (void)
3124{ 3117{
3125 struct display *display = (struct display *) xmalloc (sizeof (struct display)); 3118 struct device *device = (struct device *) xmalloc (sizeof (struct device));
3126 3119
3127 bzero (display, sizeof (struct display)); 3120 bzero (device, sizeof (struct device));
3128 display->next_display = display_list; 3121 device->next_device = device_list;
3129 display_list = display; 3122 device_list = device;
3130 3123
3131 display->id = next_display_id++; 3124 device->id = next_device_id++;
3132 3125
3133 display->keyboard_coding = 3126 device->keyboard_coding =
3134 (struct coding_system *) xmalloc (sizeof (struct coding_system)); 3127 (struct coding_system *) xmalloc (sizeof (struct coding_system));
3135 display->terminal_coding = 3128 device->terminal_coding =
3136 (struct coding_system *) xmalloc (sizeof (struct coding_system)); 3129 (struct coding_system *) xmalloc (sizeof (struct coding_system));
3137 3130
3138 setup_coding_system (Qnil, display->keyboard_coding); 3131 setup_coding_system (Qnil, device->keyboard_coding);
3139 setup_coding_system (Qnil, display->terminal_coding); 3132 setup_coding_system (Qnil, device->terminal_coding);
3140 3133
3141 return display; 3134 return device;
3142} 3135}
3143 3136
3144/* Remove a display from the display list and free its memory. */ 3137/* Remove a device from the device list and free its memory. */
3145 3138
3146void 3139void
3147delete_display (struct display *display) 3140delete_device (struct device *device)
3148{ 3141{
3149 struct display **dp; 3142 struct device **dp;
3150 Lisp_Object tail, frame; 3143 Lisp_Object tail, frame;
3151 3144
3152 /* Check for and close live frames that are still on this 3145 /* Check for and close live frames that are still on this
3153 display. */ 3146 device. */
3154 FOR_EACH_FRAME (tail, frame) 3147 FOR_EACH_FRAME (tail, frame)
3155 { 3148 {
3156 struct frame *f = XFRAME (frame); 3149 struct frame *f = XFRAME (frame);
3157 if (FRAME_LIVE_P (f) && f->display == display) 3150 if (FRAME_LIVE_P (f) && f->device == device)
3158 { 3151 {
3159 Fdelete_frame (frame, Qt); 3152 Fdelete_frame (frame, Qt);
3160 } 3153 }
3161 } 3154 }
3162 3155
3163 for (dp = &display_list; *dp != display; dp = &(*dp)->next_display) 3156 for (dp = &device_list; *dp != device; dp = &(*dp)->next_device)
3164 if (! *dp) 3157 if (! *dp)
3165 abort (); 3158 abort ();
3166 *dp = display->next_display; 3159 *dp = device->next_device;
3167 3160
3168 if (display->keyboard_coding) 3161 if (device->keyboard_coding)
3169 xfree (display->keyboard_coding); 3162 xfree (device->keyboard_coding);
3170 if (display->terminal_coding) 3163 if (device->terminal_coding)
3171 xfree (display->terminal_coding); 3164 xfree (device->terminal_coding);
3172 if (display->name) 3165 if (device->name)
3173 xfree (display->name); 3166 xfree (device->name);
3174 3167
3175#ifdef MULTI_KBOARD 3168#ifdef MULTI_KBOARD
3176 if (display->kboard && --display->kboard->reference_count == 0) 3169 if (device->kboard && --device->kboard->reference_count == 0)
3177 delete_kboard (display->kboard); 3170 delete_kboard (device->kboard);
3178#endif 3171#endif
3179 3172
3180 bzero (display, sizeof (struct display)); 3173 bzero (device, sizeof (struct device));
3181 xfree (display); 3174 xfree (device);
3182} 3175}
3183 3176
3184DEFUN ("delete-display", Fdelete_display, Sdelete_display, 0, 2, 0, 3177DEFUN ("delete-display", Fdelete_display, Sdelete_display, 0, 2, 0,
3185 doc: /* Delete DISPLAY by deleting all frames on it and closing the device. 3178 doc: /* Delete DEVICE by deleting all frames on it and closing the device.
3186DISPLAY may be a display id, a frame, or nil for the display 3179DEVICE may be a display device id, a frame, or nil (meaning the
3187device of the current frame. 3180selected frame's display device).
3188 3181
3189Normally, you may not delete a display if all other displays are suspended, 3182Normally, you may not delete a display if all other displays are suspended,
3190but if the second argument FORCE is non-nil, you may do so. */) 3183but if the second argument FORCE is non-nil, you may do so. */)
3191 (display, force) 3184 (device, force)
3192 Lisp_Object display, force; 3185 Lisp_Object device, force;
3193{ 3186{
3194 struct display *d, *p; 3187 struct device *d, *p;
3195 3188
3196 d = get_display (display, 0); 3189 d = get_device (device, 0);
3197 3190
3198 if (!d) 3191 if (!d)
3199 return Qnil; 3192 return Qnil;
3200 3193
3201 p = display_list; 3194 p = device_list;
3202 while (p && (p == d || !DISPLAY_ACTIVE_P (p))) 3195 while (p && (p == d || !DEVICE_ACTIVE_P (p)))
3203 p = p->next_display; 3196 p = p->next_device;
3204 3197
3205 if (NILP (force) && !p) 3198 if (NILP (force) && !p)
3206 error ("Attempt to delete the sole active display"); 3199 error ("Attempt to delete the sole active display device");
3207 3200
3208 if (d->delete_display_hook) 3201 if (d->delete_device_hook)
3209 (*d->delete_display_hook) (d); 3202 (*d->delete_device_hook) (d);
3210 else 3203 else
3211 delete_display (d); 3204 delete_device (d);
3212 3205
3213 return Qnil; 3206 return Qnil;
3214} 3207}
3215 3208
3216DEFUN ("display-live-p", Fdisplay_live_p, Sdisplay_live_p, 1, 1, 0, 3209DEFUN ("display-live-p", Fdisplay_live_p, Sdisplay_live_p, 1, 1, 0,
3217 doc: /* Return non-nil if OBJECT is a display which has not been deleted. 3210 doc: /* Return non-nil if OBJECT is a device which has not been deleted.
3218Value is nil if OBJECT is not a live display. 3211Value is nil if OBJECT is not a live display device.
3219If object is a live display, the return value indicates what sort of 3212If object is a live display device, the return value indicates what
3220output device it uses. See the documentation of `framep' for possible 3213sort of output device it uses. See the documentation of `framep' for
3221return values. 3214possible return values.
3222 3215
3223Displays are represented by their integer identifiers. */) 3216Display devices are represented by their integer identifiers. */)
3224 (object) 3217 (object)
3225 Lisp_Object object; 3218 Lisp_Object object;
3226{ 3219{
3227 struct display *d; 3220 struct device *d;
3228 3221
3229 if (!INTEGERP (object)) 3222 if (!INTEGERP (object))
3230 return Qnil; 3223 return Qnil;
3231 3224
3232 d = get_display (object, 0); 3225 d = get_device (object, 0);
3233 3226
3234 if (!d) 3227 if (!d)
3235 return Qnil; 3228 return Qnil;
@@ -3253,17 +3246,17 @@ Displays are represented by their integer identifiers. */)
3253} 3246}
3254 3247
3255DEFUN ("display-list", Fdisplay_list, Sdisplay_list, 0, 0, 0, 3248DEFUN ("display-list", Fdisplay_list, Sdisplay_list, 0, 0, 0,
3256 doc: /* Return a list of all displays. 3249 doc: /* Return a list of all display devices.
3257Displays are represented by their integer identifiers. */) 3250Display devices are represented by their integer identifiers. */)
3258 () 3251 ()
3259{ 3252{
3260 Lisp_Object displays = Qnil; 3253 Lisp_Object devices = Qnil;
3261 struct display *d; 3254 struct device *d;
3262 3255
3263 for (d = display_list; d; d = d->next_display) 3256 for (d = device_list; d; d = d->next_device)
3264 displays = Fcons (make_number (d->id), displays); 3257 devices = Fcons (make_number (d->id), devices);
3265 3258
3266 return displays; 3259 return devices;
3267} 3260}
3268 3261
3269 3262
@@ -3291,7 +3284,7 @@ it. */)
3291 (tty) 3284 (tty)
3292 Lisp_Object tty; 3285 Lisp_Object tty;
3293{ 3286{
3294 struct display *d = get_tty_display (tty); 3287 struct device *d = get_tty_device (tty);
3295 FILE *f; 3288 FILE *f;
3296 3289
3297 if (!d) 3290 if (!d)
@@ -3349,7 +3342,7 @@ currently selected frame. */)
3349 (tty) 3342 (tty)
3350 Lisp_Object tty; 3343 Lisp_Object tty;
3351{ 3344{
3352 struct display *d = get_tty_display (tty); 3345 struct device *d = get_tty_device (tty);
3353 int fd; 3346 int fd;
3354 3347
3355 if (!d) 3348 if (!d)
@@ -3357,7 +3350,7 @@ currently selected frame. */)
3357 3350
3358 if (!d->display_info.tty->input) 3351 if (!d->display_info.tty->input)
3359 { 3352 {
3360 if (get_named_tty_display (d->display_info.tty->name)) 3353 if (get_named_tty (d->display_info.tty->name))
3361 error ("Cannot resume display while another display is active on the same device"); 3354 error ("Cannot resume display while another display is active on the same device");
3362 3355
3363 fd = emacs_open (d->display_info.tty->name, O_RDWR | O_NOCTTY, 0); 3356 fd = emacs_open (d->display_info.tty->name, O_RDWR | O_NOCTTY, 0);
diff --git a/src/termchar.h b/src/termchar.h
index ad7104ac89c..1f6580b91f3 100644
--- a/src/termchar.h
+++ b/src/termchar.h
@@ -57,7 +57,7 @@ struct tty_display_info
57 57
58 int reference_count; /* Number of frames that are on this display. */ 58 int reference_count; /* Number of frames that are on this display. */
59 59
60 struct display *display; /* Points back to the generic display 60 struct device *device; /* Points back to the generic display device
61 structure. This is sometimes handy. */ 61 structure. This is sometimes handy. */
62 62
63 /* Info on cursor positioning. */ 63 /* Info on cursor positioning. */
@@ -193,7 +193,7 @@ extern struct tty_display_info *tty_list;
193 193
194#define FRAME_TTY(f) \ 194#define FRAME_TTY(f) \
195 ((f)->output_method == output_termcap \ 195 ((f)->output_method == output_termcap \
196 ? (f)->display->display_info.tty \ 196 ? (f)->device->display_info.tty \
197 : (abort(), (struct tty_display_info *) 0)) 197 : (abort(), (struct tty_display_info *) 0))
198 198
199#define CURTTY() FRAME_TTY (SELECTED_FRAME()) 199#define CURTTY() FRAME_TTY (SELECTED_FRAME())
diff --git a/src/termhooks.h b/src/termhooks.h
index cce8f37f99e..5b411c6ab78 100644
--- a/src/termhooks.h
+++ b/src/termhooks.h
@@ -277,22 +277,22 @@ enum {
277#endif /* CONSP */ 277#endif /* CONSP */
278 278
279 279
280/* Display-local parameters. */ 280/* Device-local parameters. */
281struct display 281struct device
282{ 282{
283 /* Chain of all displays. */ 283 /* Chain of all display devices. */
284 struct display *next_display; 284 struct device *next_device;
285 285
286 /* Unique id for this display. */ 286 /* Unique id for this display device. */
287 int id; 287 int id;
288 288
289 /* The number of frames that are on this display. */ 289 /* The number of frames that are on this device. */
290 int reference_count; 290 int reference_count;
291 291
292 /* The type of the display. */ 292 /* The type of the display device. */
293 enum output_method type; 293 enum output_method type;
294 294
295 /* The name of the display device. Do not use this to identify the display. */ 295 /* The name of the display device. Do not use this to identify the device. */
296 char *name; 296 char *name;
297 297
298#ifdef MULTI_KBOARD 298#ifdef MULTI_KBOARD
@@ -300,7 +300,7 @@ struct display
300 struct kboard *kboard; 300 struct kboard *kboard;
301#endif 301#endif
302 302
303 /* Display-type dependent data shared amongst all frames on this display. */ 303 /* Device-type dependent data shared amongst all frames on this display. */
304 union display_info 304 union display_info
305 { 305 {
306 struct tty_display_info *tty; /* termchar.h */ 306 struct tty_display_info *tty; /* termchar.h */
@@ -367,8 +367,8 @@ struct display
367 367
368 void (*ring_bell_hook) P_ ((struct frame *f)); 368 void (*ring_bell_hook) P_ ((struct frame *f));
369 369
370 void (*reset_terminal_modes_hook) P_ ((struct display *)); 370 void (*reset_terminal_modes_hook) P_ ((struct device *));
371 void (*set_terminal_modes_hook) P_ ((struct display *)); 371 void (*set_terminal_modes_hook) P_ ((struct device *));
372 372
373 void (*update_begin_hook) P_ ((struct frame *)); 373 void (*update_begin_hook) P_ ((struct frame *));
374 void (*update_end_hook) P_ ((struct frame *)); 374 void (*update_end_hook) P_ ((struct frame *));
@@ -498,7 +498,7 @@ struct display
498 498
499 /* Called to read input events. 499 /* Called to read input events.
500 500
501 DISPLAY indicates which display to read from. Input events 501 DEVICE indicates which display device to read from. Input events
502 should be read into BUF, the size of which is given in SIZE. 502 should be read into BUF, the size of which is given in SIZE.
503 EXPECTED is non-zero if the caller suspects that new input is 503 EXPECTED is non-zero if the caller suspects that new input is
504 available. 504 available.
@@ -507,7 +507,7 @@ struct display
507 where read into BUF. 507 where read into BUF.
508 Zero means no events were immediately available. 508 Zero means no events were immediately available.
509 A value of -1 means a transient read error, while -2 indicates 509 A value of -1 means a transient read error, while -2 indicates
510 that the display was closed (hangup), and it should be deleted. 510 that the device was closed (hangup), and it should be deleted.
511 511
512 XXX Please note that a non-zero value of EXPECTED only means that 512 XXX Please note that a non-zero value of EXPECTED only means that
513 there is available input on at least one of the currently opened 513 there is available input on at least one of the currently opened
@@ -515,7 +515,7 @@ struct display
515 Therefore, in most cases EXPECTED should be simply ignored. 515 Therefore, in most cases EXPECTED should be simply ignored.
516 516
517 XXX This documentation needs to be updated. */ 517 XXX This documentation needs to be updated. */
518 int (*read_socket_hook) P_ ((struct display *display, 518 int (*read_socket_hook) P_ ((struct device *device,
519 int expected, 519 int expected,
520 struct input_event *hold_quit)); 520 struct input_event *hold_quit));
521 521
@@ -524,43 +524,43 @@ struct display
524 524
525 525
526 /* Called to delete the device-specific portions of a frame that is 526 /* Called to delete the device-specific portions of a frame that is
527 on this display. */ 527 on this display device. */
528 void (*delete_frame_hook) P_ ((struct frame *)); 528 void (*delete_frame_hook) P_ ((struct frame *));
529 529
530 /* Called after the last frame on this display is deleted, or when 530 /* Called after the last frame on this device is deleted, or when
531 the display device was closed (hangup). 531 the display device was closed (hangup).
532 532
533 If this is NULL, then the generic delete_display is called 533 If this is NULL, then the generic delete_device is called
534 instead. Otherwise the hook must call delete_display itself. 534 instead. Otherwise the hook must call delete_device itself.
535 535
536 The hook must check for and close any live frames that are still 536 The hook must check for and close any live frames that are still
537 on the display. Fdelete_frame ensures that there are no live 537 on the device. Fdelete_frame ensures that there are no live
538 frames on the display when it calls this hook, so infinite 538 frames on the device when it calls this hook, so infinite
539 recursion is prevented. */ 539 recursion is prevented. */
540 void (*delete_display_hook) P_ ((struct display *)); 540 void (*delete_device_hook) P_ ((struct device *));
541}; 541};
542 542
543 543
544/* Chain of all displays currently in use. */ 544/* Chain of all display devices currently in use. */
545extern struct display *display_list; 545extern struct device *device_list;
546 546
547#define FRAME_MUST_WRITE_SPACES(f) ((f)->display->must_write_spaces) 547#define FRAME_MUST_WRITE_SPACES(f) ((f)->device->must_write_spaces)
548#define FRAME_FAST_CLEAR_END_OF_LINE(f) ((f)->display->fast_clear_end_of_line) 548#define FRAME_FAST_CLEAR_END_OF_LINE(f) ((f)->device->fast_clear_end_of_line)
549#define FRAME_LINE_INS_DEL_OK(f) ((f)->display->line_ins_del_ok) 549#define FRAME_LINE_INS_DEL_OK(f) ((f)->device->line_ins_del_ok)
550#define FRAME_CHAR_INS_DEL_OK(f) ((f)->display->char_ins_del_ok) 550#define FRAME_CHAR_INS_DEL_OK(f) ((f)->device->char_ins_del_ok)
551#define FRAME_SCROLL_REGION_OK(f) ((f)->display->scroll_region_ok) 551#define FRAME_SCROLL_REGION_OK(f) ((f)->device->scroll_region_ok)
552#define FRAME_SCROLL_REGION_COST(f) ((f)->display->scroll_region_cost) 552#define FRAME_SCROLL_REGION_COST(f) ((f)->device->scroll_region_cost)
553#define FRAME_MEMORY_BELOW_FRAME(f) ((f)->display->memory_below_frame) 553#define FRAME_MEMORY_BELOW_FRAME(f) ((f)->device->memory_below_frame)
554 554
555#define FRAME_TERMINAL_CODING(f) ((f)->display->terminal_coding) 555#define FRAME_TERMINAL_CODING(f) ((f)->device->terminal_coding)
556#define FRAME_KEYBOARD_CODING(f) ((f)->display->keyboard_coding) 556#define FRAME_KEYBOARD_CODING(f) ((f)->device->keyboard_coding)
557 557
558#define DISPLAY_TERMINAL_CODING(d) ((d)->terminal_coding) 558#define DEVICE_TERMINAL_CODING(d) ((d)->terminal_coding)
559#define DISPLAY_KEYBOARD_CODING(d) ((d)->keyboard_coding) 559#define DEVICE_KEYBOARD_CODING(d) ((d)->keyboard_coding)
560 560
561#define FRAME_RIF(f) ((f)->display->rif) 561#define FRAME_RIF(f) ((f)->device->rif)
562 562
563#define FRAME_DISPLAY(f) ((f)->display) 563#define FRAME_DEVICE(f) ((f)->device)
564 564
565/* FRAME_WINDOW_P tests whether the frame is a window, and is 565/* FRAME_WINDOW_P tests whether the frame is a window, and is
566 defined to be the predicate for the window system being used. */ 566 defined to be the predicate for the window system being used. */
@@ -578,14 +578,14 @@ extern struct display *display_list;
578#define FRAME_WINDOW_P(f) (0) 578#define FRAME_WINDOW_P(f) (0)
579#endif 579#endif
580 580
581/* Return true if the display is not suspended. */ 581/* Return true if the display device is not suspended. */
582#define DISPLAY_ACTIVE_P(d) ((d)->type != output_termcap || (d)->display_info.tty->input) 582#define DEVICE_ACTIVE_P(d) ((d)->type != output_termcap || (d)->display_info.tty->input)
583 583
584extern struct display *create_display P_ ((void)); 584extern struct device *create_device P_ ((void));
585extern void delete_display P_ ((struct display *)); 585extern void delete_device P_ ((struct device *));
586 586
587/* The initial display device, created by initial_term_init. */ 587/* The initial display device, created by initial_term_init. */
588extern struct display *initial_display; 588extern struct device *initial_device;
589 589
590/* arch-tag: 33a00ecc-52b5-4186-a410-8801ac9f087d 590/* arch-tag: 33a00ecc-52b5-4186-a410-8801ac9f087d
591 (do not change this comment) */ 591 (do not change this comment) */
diff --git a/src/xdisp.c b/src/xdisp.c
index c2091729821..d5320bd6129 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -6958,8 +6958,8 @@ message2_nolog (m, nbytes, multibyte)
6958 do_pending_window_change (0); 6958 do_pending_window_change (0);
6959 echo_area_display (1); 6959 echo_area_display (1);
6960 do_pending_window_change (0); 6960 do_pending_window_change (0);
6961 if (FRAME_DISPLAY (f)->frame_up_to_date_hook != 0 && ! gc_in_progress) 6961 if (FRAME_DEVICE (f)->frame_up_to_date_hook != 0 && ! gc_in_progress)
6962 (*FRAME_DISPLAY (f)->frame_up_to_date_hook) (f); 6962 (*FRAME_DEVICE (f)->frame_up_to_date_hook) (f);
6963 } 6963 }
6964} 6964}
6965 6965
@@ -7051,8 +7051,8 @@ message3_nolog (m, nbytes, multibyte)
7051 do_pending_window_change (0); 7051 do_pending_window_change (0);
7052 echo_area_display (1); 7052 echo_area_display (1);
7053 do_pending_window_change (0); 7053 do_pending_window_change (0);
7054 if (FRAME_DISPLAY (f)->frame_up_to_date_hook != 0 && ! gc_in_progress) 7054 if (FRAME_DEVICE (f)->frame_up_to_date_hook != 0 && ! gc_in_progress)
7055 (*FRAME_DISPLAY (f)->frame_up_to_date_hook) (f); 7055 (*FRAME_DEVICE (f)->frame_up_to_date_hook) (f);
7056 } 7056 }
7057} 7057}
7058 7058
@@ -10549,16 +10549,16 @@ redisplay_internal (preserve_echo_area)
10549 10549
10550 /* Mark all the scroll bars to be removed; we'll redeem 10550 /* Mark all the scroll bars to be removed; we'll redeem
10551 the ones we want when we redisplay their windows. */ 10551 the ones we want when we redisplay their windows. */
10552 if (FRAME_DISPLAY (f)->condemn_scroll_bars_hook) 10552 if (FRAME_DEVICE (f)->condemn_scroll_bars_hook)
10553 FRAME_DISPLAY (f)->condemn_scroll_bars_hook (f); 10553 FRAME_DEVICE (f)->condemn_scroll_bars_hook (f);
10554 10554
10555 if (FRAME_VISIBLE_P (f) && !FRAME_OBSCURED_P (f)) 10555 if (FRAME_VISIBLE_P (f) && !FRAME_OBSCURED_P (f))
10556 redisplay_windows (FRAME_ROOT_WINDOW (f)); 10556 redisplay_windows (FRAME_ROOT_WINDOW (f));
10557 10557
10558 /* Any scroll bars which redisplay_windows should have 10558 /* Any scroll bars which redisplay_windows should have
10559 nuked should now go away. */ 10559 nuked should now go away. */
10560 if (FRAME_DISPLAY (f)->judge_scroll_bars_hook) 10560 if (FRAME_DEVICE (f)->judge_scroll_bars_hook)
10561 FRAME_DISPLAY (f)->judge_scroll_bars_hook (f); 10561 FRAME_DEVICE (f)->judge_scroll_bars_hook (f);
10562 10562
10563 /* If fonts changed, display again. */ 10563 /* If fonts changed, display again. */
10564 /* ??? rms: I suspect it is a mistake to jump all the way 10564 /* ??? rms: I suspect it is a mistake to jump all the way
@@ -10610,8 +10610,8 @@ redisplay_internal (preserve_echo_area)
10610 { 10610 {
10611 struct frame *f = updated[i]; 10611 struct frame *f = updated[i];
10612 mark_window_display_accurate (f->root_window, 1); 10612 mark_window_display_accurate (f->root_window, 1);
10613 if (FRAME_DISPLAY (f)->frame_up_to_date_hook) 10613 if (FRAME_DEVICE (f)->frame_up_to_date_hook)
10614 FRAME_DISPLAY (f)->frame_up_to_date_hook (f); 10614 FRAME_DEVICE (f)->frame_up_to_date_hook (f);
10615 } 10615 }
10616 } 10616 }
10617 } 10617 }
@@ -10696,8 +10696,8 @@ redisplay_internal (preserve_echo_area)
10696 /* Say overlay arrows are up to date. */ 10696 /* Say overlay arrows are up to date. */
10697 update_overlay_arrows (1); 10697 update_overlay_arrows (1);
10698 10698
10699 if (FRAME_DISPLAY (sf)->frame_up_to_date_hook != 0) 10699 if (FRAME_DEVICE (sf)->frame_up_to_date_hook != 0)
10700 FRAME_DISPLAY (sf)->frame_up_to_date_hook (sf); 10700 FRAME_DEVICE (sf)->frame_up_to_date_hook (sf);
10701 } 10701 }
10702 10702
10703 update_mode_lines = 0; 10703 update_mode_lines = 0;
@@ -11949,8 +11949,8 @@ set_vertical_scroll_bar (w)
11949 start = end = whole = 0; 11949 start = end = whole = 0;
11950 11950
11951 /* Indicate what this scroll bar ought to be displaying now. */ 11951 /* Indicate what this scroll bar ought to be displaying now. */
11952 if (FRAME_DISPLAY (XFRAME (w->frame))->set_vertical_scroll_bar_hook) 11952 if (FRAME_DEVICE (XFRAME (w->frame))->set_vertical_scroll_bar_hook)
11953 (*FRAME_DISPLAY (XFRAME (w->frame))->set_vertical_scroll_bar_hook) 11953 (*FRAME_DEVICE (XFRAME (w->frame))->set_vertical_scroll_bar_hook)
11954 (w, end - start, whole, start); 11954 (w, end - start, whole, start);
11955} 11955}
11956 11956
@@ -12690,8 +12690,8 @@ redisplay_window (window, just_this_one_p)
12690 12690
12691 /* Note that we actually used the scroll bar attached to this 12691 /* Note that we actually used the scroll bar attached to this
12692 window, so it shouldn't be deleted at the end of redisplay. */ 12692 window, so it shouldn't be deleted at the end of redisplay. */
12693 if (FRAME_DISPLAY (f)->redeem_scroll_bar_hook) 12693 if (FRAME_DEVICE (f)->redeem_scroll_bar_hook)
12694 (*FRAME_DISPLAY (f)->redeem_scroll_bar_hook) (w); 12694 (*FRAME_DEVICE (f)->redeem_scroll_bar_hook) (w);
12695 } 12695 }
12696 12696
12697 /* Restore current_buffer and value of point in it. */ 12697 /* Restore current_buffer and value of point in it. */
diff --git a/src/xfns.c b/src/xfns.c
index 9623ea13eeb..f629ee31aef 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -239,17 +239,18 @@ check_x_frame (frame)
239 return f; 239 return f;
240} 240}
241 241
242/* Let the user specify an X display with a frame. 242/* Let the user specify an X display with a Lisp object.
243 OBJECT may be nil, a frame or a device id.
243 nil stands for the selected frame--or, if that is not an X frame, 244 nil stands for the selected frame--or, if that is not an X frame,
244 the first X display on the list. */ 245 the first X display on the list. */
245 246
246struct x_display_info * 247struct x_display_info *
247check_x_display_info (frame) 248check_x_display_info (object)
248 Lisp_Object frame; 249 Lisp_Object object;
249{ 250{
250 struct x_display_info *dpyinfo = NULL; 251 struct x_display_info *dpyinfo = NULL;
251 252
252 if (NILP (frame)) 253 if (NILP (object))
253 { 254 {
254 struct frame *sf = XFRAME (selected_frame); 255 struct frame *sf = XFRAME (selected_frame);
255 256
@@ -260,20 +261,20 @@ check_x_display_info (frame)
260 else 261 else
261 error ("X windows are not in use or not initialized"); 262 error ("X windows are not in use or not initialized");
262 } 263 }
263 else if (INTEGERP (frame)) 264 else if (INTEGERP (object))
264 { 265 {
265 struct display *d = get_display (XINT (frame), 1); 266 struct device *d = get_device (XINT (object), 1);
266 267
267 if (d->type != output_x_window) 268 if (d->type != output_x_window)
268 error ("Display %d is not an X display", XINT (frame)); 269 error ("Display %d is not an X display", XINT (object));
269 270
270 dpyinfo = d->display_info.x; 271 dpyinfo = d->display_info.x;
271 } 272 }
272 else if (STRINGP (frame)) 273 else if (STRINGP (object))
273 dpyinfo = x_display_info_for_name (frame); 274 dpyinfo = x_display_info_for_name (object);
274 else 275 else
275 { 276 {
276 FRAME_PTR f = check_x_frame (frame); 277 FRAME_PTR f = check_x_frame (object);
277 dpyinfo = FRAME_X_DISPLAY_INFO (f); 278 dpyinfo = FRAME_X_DISPLAY_INFO (f);
278 } 279 }
279 280
@@ -1444,10 +1445,10 @@ x_set_scroll_bar_foreground (f, value, oldval)
1444 if (FRAME_X_WINDOW (f) && FRAME_VISIBLE_P (f)) 1445 if (FRAME_X_WINDOW (f) && FRAME_VISIBLE_P (f))
1445 { 1446 {
1446 /* Remove all scroll bars because they have wrong colors. */ 1447 /* Remove all scroll bars because they have wrong colors. */
1447 if (FRAME_DISPLAY (f)->condemn_scroll_bars_hook) 1448 if (FRAME_DEVICE (f)->condemn_scroll_bars_hook)
1448 (*FRAME_DISPLAY (f)->condemn_scroll_bars_hook) (f); 1449 (*FRAME_DEVICE (f)->condemn_scroll_bars_hook) (f);
1449 if (FRAME_DISPLAY (f)->judge_scroll_bars_hook) 1450 if (FRAME_DEVICE (f)->judge_scroll_bars_hook)
1450 (*FRAME_DISPLAY (f)->judge_scroll_bars_hook) (f); 1451 (*FRAME_DEVICE (f)->judge_scroll_bars_hook) (f);
1451 1452
1452 update_face_from_frame_parameter (f, Qscroll_bar_foreground, value); 1453 update_face_from_frame_parameter (f, Qscroll_bar_foreground, value);
1453 redraw_frame (f); 1454 redraw_frame (f);
@@ -1493,10 +1494,10 @@ x_set_scroll_bar_background (f, value, oldval)
1493 if (FRAME_X_WINDOW (f) && FRAME_VISIBLE_P (f)) 1494 if (FRAME_X_WINDOW (f) && FRAME_VISIBLE_P (f))
1494 { 1495 {
1495 /* Remove all scroll bars because they have wrong colors. */ 1496 /* Remove all scroll bars because they have wrong colors. */
1496 if (FRAME_DISPLAY (f)->condemn_scroll_bars_hook) 1497 if (FRAME_DEVICE (f)->condemn_scroll_bars_hook)
1497 (*FRAME_DISPLAY (f)->condemn_scroll_bars_hook) (f); 1498 (*FRAME_DEVICE (f)->condemn_scroll_bars_hook) (f);
1498 if (FRAME_DISPLAY (f)->judge_scroll_bars_hook) 1499 if (FRAME_DEVICE (f)->judge_scroll_bars_hook)
1499 (*FRAME_DISPLAY (f)->judge_scroll_bars_hook) (f); 1500 (*FRAME_DEVICE (f)->judge_scroll_bars_hook) (f);
1500 1501
1501 update_face_from_frame_parameter (f, Qscroll_bar_background, value); 1502 update_face_from_frame_parameter (f, Qscroll_bar_background, value);
1502 redraw_frame (f); 1503 redraw_frame (f);
@@ -3007,14 +3008,14 @@ This function is an internal primitive--use `make-frame' instead. */)
3007 until we know if this frame has a specified name. */ 3008 until we know if this frame has a specified name. */
3008 Vx_resource_name = Vinvocation_name; 3009 Vx_resource_name = Vinvocation_name;
3009 3010
3010 display = x_get_arg (dpyinfo, parms, Qdisplay_id, 0, 0, RES_TYPE_NUMBER); 3011 display = x_get_arg (dpyinfo, parms, Qdevice, 0, 0, RES_TYPE_NUMBER);
3011 if (EQ (display, Qunbound)) 3012 if (EQ (display, Qunbound))
3012 display = x_get_arg (dpyinfo, parms, Qdisplay, 0, 0, RES_TYPE_STRING); 3013 display = x_get_arg (dpyinfo, parms, Qdisplay, 0, 0, RES_TYPE_STRING);
3013 if (EQ (display, Qunbound)) 3014 if (EQ (display, Qunbound))
3014 display = Qnil; 3015 display = Qnil;
3015 dpyinfo = check_x_display_info (display); 3016 dpyinfo = check_x_display_info (display);
3016#ifdef MULTI_KBOARD 3017#ifdef MULTI_KBOARD
3017 kb = dpyinfo->frame_display->kboard; 3018 kb = dpyinfo->device->kboard;
3018#else 3019#else
3019 kb = &the_only_kboard; 3020 kb = &the_only_kboard;
3020#endif 3021#endif
@@ -3059,8 +3060,8 @@ This function is an internal primitive--use `make-frame' instead. */)
3059 /* Note that X Windows does support scroll bars. */ 3060 /* Note that X Windows does support scroll bars. */
3060 FRAME_CAN_HAVE_SCROLL_BARS (f) = 1; 3061 FRAME_CAN_HAVE_SCROLL_BARS (f) = 1;
3061 3062
3062 f->display = dpyinfo->frame_display; 3063 f->device = dpyinfo->device;
3063 f->display->reference_count++; 3064 f->device->reference_count++;
3064 3065
3065 f->output_method = output_x_window; 3066 f->output_method = output_x_window;
3066 f->output_data.x = (struct x_output *) xmalloc (sizeof (struct x_output)); 3067 f->output_data.x = (struct x_output *) xmalloc (sizeof (struct x_output));
@@ -3475,10 +3476,10 @@ DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0,
3475 3476
3476DEFUN ("xw-display-color-p", Fxw_display_color_p, Sxw_display_color_p, 0, 1, 0, 3477DEFUN ("xw-display-color-p", Fxw_display_color_p, Sxw_display_color_p, 0, 1, 0,
3477 doc: /* Internal function called by `display-color-p', which see. */) 3478 doc: /* Internal function called by `display-color-p', which see. */)
3478 (display) 3479 (device)
3479 Lisp_Object display; 3480 Lisp_Object device;
3480{ 3481{
3481 struct x_display_info *dpyinfo = check_x_display_info (display); 3482 struct x_display_info *dpyinfo = check_x_display_info (device);
3482 3483
3483 if (dpyinfo->n_planes <= 2) 3484 if (dpyinfo->n_planes <= 2)
3484 return Qnil; 3485 return Qnil;
@@ -3500,13 +3501,13 @@ DEFUN ("x-display-grayscale-p", Fx_display_grayscale_p, Sx_display_grayscale_p,
3500 0, 1, 0, 3501 0, 1, 0,
3501 doc: /* Return t if the X display supports shades of gray. 3502 doc: /* Return t if the X display supports shades of gray.
3502Note that color displays do support shades of gray. 3503Note that color displays do support shades of gray.
3503The optional argument DISPLAY specifies which display to ask about. 3504The optional argument DEVICE specifies which display to ask about.
3504DISPLAY should be either a frame or a display name (a string). 3505DEVICE should be a device id, a frame or a display name (a string).
3505If omitted or nil, that stands for the selected frame's display. */) 3506If omitted or nil, that stands for the selected frame's display device. */)
3506 (display) 3507 (device)
3507 Lisp_Object display; 3508 Lisp_Object device;
3508{ 3509{
3509 struct x_display_info *dpyinfo = check_x_display_info (display); 3510 struct x_display_info *dpyinfo = check_x_display_info (device);
3510 3511
3511 if (dpyinfo->n_planes <= 1) 3512 if (dpyinfo->n_planes <= 1)
3512 return Qnil; 3513 return Qnil;
@@ -3528,56 +3529,56 @@ If omitted or nil, that stands for the selected frame's display. */)
3528 3529
3529DEFUN ("x-display-pixel-width", Fx_display_pixel_width, Sx_display_pixel_width, 3530DEFUN ("x-display-pixel-width", Fx_display_pixel_width, Sx_display_pixel_width,
3530 0, 1, 0, 3531 0, 1, 0,
3531 doc: /* Returns the width in pixels of the X display DISPLAY. 3532 doc: /* Returns the width in pixels of the X display DEVICE.
3532The optional argument DISPLAY specifies which display to ask about. 3533The optional argument DEVICE specifies which display to ask about.
3533DISPLAY should be either a frame or a display name (a string). 3534DEVICE should be a device id, a frame or a display name (a string).
3534If omitted or nil, that stands for the selected frame's display. */) 3535If omitted or nil, that stands for the selected frame's display. */)
3535 (display) 3536 (device)
3536 Lisp_Object display; 3537 Lisp_Object device;
3537{ 3538{
3538 struct x_display_info *dpyinfo = check_x_display_info (display); 3539 struct x_display_info *dpyinfo = check_x_display_info (device);
3539 3540
3540 return make_number (dpyinfo->width); 3541 return make_number (dpyinfo->width);
3541} 3542}
3542 3543
3543DEFUN ("x-display-pixel-height", Fx_display_pixel_height, 3544DEFUN ("x-display-pixel-height", Fx_display_pixel_height,
3544 Sx_display_pixel_height, 0, 1, 0, 3545 Sx_display_pixel_height, 0, 1, 0,
3545 doc: /* Returns the height in pixels of the X display DISPLAY. 3546 doc: /* Returns the height in pixels of the X display DEVICE.
3546The optional argument DISPLAY specifies which display to ask about. 3547The optional argument DEVICE specifies which display to ask about.
3547DISPLAY should be either a frame or a display name (a string). 3548DEVICE should be a device id, a frame or a display name (a string).
3548If omitted or nil, that stands for the selected frame's display. */) 3549If omitted or nil, that stands for the selected frame's display. */)
3549 (display) 3550 (device)
3550 Lisp_Object display; 3551 Lisp_Object device;
3551{ 3552{
3552 struct x_display_info *dpyinfo = check_x_display_info (display); 3553 struct x_display_info *dpyinfo = check_x_display_info (device);
3553 3554
3554 return make_number (dpyinfo->height); 3555 return make_number (dpyinfo->height);
3555} 3556}
3556 3557
3557DEFUN ("x-display-planes", Fx_display_planes, Sx_display_planes, 3558DEFUN ("x-display-planes", Fx_display_planes, Sx_display_planes,
3558 0, 1, 0, 3559 0, 1, 0,
3559 doc: /* Returns the number of bitplanes of the X display DISPLAY. 3560 doc: /* Returns the number of bitplanes of the X display DEVICE.
3560The optional argument DISPLAY specifies which display to ask about. 3561The optional argument DEVICE specifies which display to ask about.
3561DISPLAY should be either a frame or a display name (a string). 3562DEVICE should be a device id, a frame or a display name (a string).
3562If omitted or nil, that stands for the selected frame's display. */) 3563If omitted or nil, that stands for the selected frame's display. */)
3563 (display) 3564 (device)
3564 Lisp_Object display; 3565 Lisp_Object device;
3565{ 3566{
3566 struct x_display_info *dpyinfo = check_x_display_info (display); 3567 struct x_display_info *dpyinfo = check_x_display_info (device);
3567 3568
3568 return make_number (dpyinfo->n_planes); 3569 return make_number (dpyinfo->n_planes);
3569} 3570}
3570 3571
3571DEFUN ("x-display-color-cells", Fx_display_color_cells, Sx_display_color_cells, 3572DEFUN ("x-display-color-cells", Fx_display_color_cells, Sx_display_color_cells,
3572 0, 1, 0, 3573 0, 1, 0,
3573 doc: /* Returns the number of color cells of the X display DISPLAY. 3574 doc: /* Returns the number of color cells of the X display DEVICE.
3574The optional argument DISPLAY specifies which display to ask about. 3575The optional argument DEVICE specifies which display to ask about.
3575DISPLAY should be either a frame or a display name (a string). 3576DEVICE should be a device id, a frame or a display name (a string).
3576If omitted or nil, that stands for the selected frame's display. */) 3577If omitted or nil, that stands for the selected frame's display. */)
3577 (display) 3578 (device)
3578 Lisp_Object display; 3579 Lisp_Object device;
3579{ 3580{
3580 struct x_display_info *dpyinfo = check_x_display_info (display); 3581 struct x_display_info *dpyinfo = check_x_display_info (device);
3581 3582
3582 int nr_planes = DisplayPlanes (dpyinfo->display, 3583 int nr_planes = DisplayPlanes (dpyinfo->display,
3583 XScreenNumberOfScreen (dpyinfo->screen)); 3584 XScreenNumberOfScreen (dpyinfo->screen));
@@ -3595,29 +3596,29 @@ If omitted or nil, that stands for the selected frame's display. */)
3595DEFUN ("x-server-max-request-size", Fx_server_max_request_size, 3596DEFUN ("x-server-max-request-size", Fx_server_max_request_size,
3596 Sx_server_max_request_size, 3597 Sx_server_max_request_size,
3597 0, 1, 0, 3598 0, 1, 0,
3598 doc: /* Returns the maximum request size of the X server of display DISPLAY. 3599 doc: /* Returns the maximum request size of the X server of display DEVICE.
3599The optional argument DISPLAY specifies which display to ask about. 3600The optional argument DEVICE specifies which display to ask about.
3600DISPLAY should be either a frame or a display name (a string). 3601DEVICE should be a device id, a frame or a display name (a string).
3601If omitted or nil, that stands for the selected frame's display. */) 3602If omitted or nil, that stands for the selected frame's display. */)
3602 (display) 3603 (device)
3603 Lisp_Object display; 3604 Lisp_Object device;
3604{ 3605{
3605 struct x_display_info *dpyinfo = check_x_display_info (display); 3606 struct x_display_info *dpyinfo = check_x_display_info (device);
3606 3607
3607 return make_number (MAXREQUEST (dpyinfo->display)); 3608 return make_number (MAXREQUEST (dpyinfo->display));
3608} 3609}
3609 3610
3610DEFUN ("x-server-vendor", Fx_server_vendor, Sx_server_vendor, 0, 1, 0, 3611DEFUN ("x-server-vendor", Fx_server_vendor, Sx_server_vendor, 0, 1, 0,
3611 doc: /* Returns the "vendor ID" string of the X server of display DISPLAY. 3612 doc: /* Returns the "vendor ID" string of the X server of display DEVICE.
3612\(Labelling every distributor as a "vendor" embodies the false assumption 3613\(Labelling every distributor as a "vendor" embodies the false assumption
3613that operating systems cannot be developed and distributed noncommercially.) 3614that operating systems cannot be developed and distributed noncommercially.)
3614The optional argument DISPLAY specifies which display to ask about. 3615The optional argument DEVICE specifies which display to ask about.
3615DISPLAY should be either a frame or a display name (a string). 3616DEVICE should be a device id, a frame or a display name (a string).
3616If omitted or nil, that stands for the selected frame's display. */) 3617If omitted or nil, that stands for the selected frame's display. */)
3617 (display) 3618 (device)
3618 Lisp_Object display; 3619 Lisp_Object device;
3619{ 3620{
3620 struct x_display_info *dpyinfo = check_x_display_info (display); 3621 struct x_display_info *dpyinfo = check_x_display_info (device);
3621 char *vendor = ServerVendor (dpyinfo->display); 3622 char *vendor = ServerVendor (dpyinfo->display);
3622 3623
3623 if (! vendor) vendor = ""; 3624 if (! vendor) vendor = "";
@@ -3625,18 +3626,18 @@ If omitted or nil, that stands for the selected frame's display. */)
3625} 3626}
3626 3627
3627DEFUN ("x-server-version", Fx_server_version, Sx_server_version, 0, 1, 0, 3628DEFUN ("x-server-version", Fx_server_version, Sx_server_version, 0, 1, 0,
3628 doc: /* Returns the version numbers of the X server of display DISPLAY. 3629 doc: /* Returns the version numbers of the X server of display DEVICE.
3629The value is a list of three integers: the major and minor 3630The value is a list of three integers: the major and minor
3630version numbers of the X Protocol in use, and the distributor-specific release 3631version numbers of the X Protocol in use, and the distributor-specific release
3631number. See also the function `x-server-vendor'. 3632number. See also the function `x-server-vendor'.
3632 3633
3633The optional argument DISPLAY specifies which display to ask about. 3634The optional argument DEVICE specifies which display to ask about.
3634DISPLAY should be either a frame or a display name (a string). 3635DEVICE should be a device id, a frame or a display name (a string).
3635If omitted or nil, that stands for the selected frame's display. */) 3636If omitted or nil, that stands for the selected frame's display. */)
3636 (display) 3637 (device)
3637 Lisp_Object display; 3638 Lisp_Object device;
3638{ 3639{
3639 struct x_display_info *dpyinfo = check_x_display_info (display); 3640 struct x_display_info *dpyinfo = check_x_display_info (device);
3640 Display *dpy = dpyinfo->display; 3641 Display *dpy = dpyinfo->display;
3641 3642
3642 return Fcons (make_number (ProtocolVersion (dpy)), 3643 return Fcons (make_number (ProtocolVersion (dpy)),
@@ -3645,55 +3646,55 @@ If omitted or nil, that stands for the selected frame's display. */)
3645} 3646}
3646 3647
3647DEFUN ("x-display-screens", Fx_display_screens, Sx_display_screens, 0, 1, 0, 3648DEFUN ("x-display-screens", Fx_display_screens, Sx_display_screens, 0, 1, 0,
3648 doc: /* Return the number of screens on the X server of display DISPLAY. 3649 doc: /* Return the number of screens on the X server of display DEVICE.
3649The optional argument DISPLAY specifies which display to ask about. 3650The optional argument DEVICE specifies which display to ask about.
3650DISPLAY should be either a frame or a display name (a string). 3651DEVICE should be a device id, a frame or a display name (a string).
3651If omitted or nil, that stands for the selected frame's display. */) 3652If omitted or nil, that stands for the selected frame's display. */)
3652 (display) 3653 (device)
3653 Lisp_Object display; 3654 Lisp_Object device;
3654{ 3655{
3655 struct x_display_info *dpyinfo = check_x_display_info (display); 3656 struct x_display_info *dpyinfo = check_x_display_info (device);
3656 3657
3657 return make_number (ScreenCount (dpyinfo->display)); 3658 return make_number (ScreenCount (dpyinfo->display));
3658} 3659}
3659 3660
3660DEFUN ("x-display-mm-height", Fx_display_mm_height, Sx_display_mm_height, 0, 1, 0, 3661DEFUN ("x-display-mm-height", Fx_display_mm_height, Sx_display_mm_height, 0, 1, 0,
3661 doc: /* Return the height in millimeters of the X display DISPLAY. 3662 doc: /* Return the height in millimeters of the X display DEVICE.
3662The optional argument DISPLAY specifies which display to ask about. 3663The optional argument DEVICE specifies which display to ask about.
3663DISPLAY should be either a frame or a display name (a string). 3664DEVICE should be a device id, a frame or a display name (a string).
3664If omitted or nil, that stands for the selected frame's display. */) 3665If omitted or nil, that stands for the selected frame's display. */)
3665 (display) 3666 (device)
3666 Lisp_Object display; 3667 Lisp_Object device;
3667{ 3668{
3668 struct x_display_info *dpyinfo = check_x_display_info (display); 3669 struct x_display_info *dpyinfo = check_x_display_info (device);
3669 3670
3670 return make_number (HeightMMOfScreen (dpyinfo->screen)); 3671 return make_number (HeightMMOfScreen (dpyinfo->screen));
3671} 3672}
3672 3673
3673DEFUN ("x-display-mm-width", Fx_display_mm_width, Sx_display_mm_width, 0, 1, 0, 3674DEFUN ("x-display-mm-width", Fx_display_mm_width, Sx_display_mm_width, 0, 1, 0,
3674 doc: /* Return the width in millimeters of the X display DISPLAY. 3675 doc: /* Return the width in millimeters of the X display DEVICE.
3675The optional argument DISPLAY specifies which display to ask about. 3676The optional argument DEVICE specifies which display to ask about.
3676DISPLAY should be either a frame or a display name (a string). 3677DEVICE should be a device id, a frame or a display name (a string).
3677If omitted or nil, that stands for the selected frame's display. */) 3678If omitted or nil, that stands for the selected frame's display. */)
3678 (display) 3679 (device)
3679 Lisp_Object display; 3680 Lisp_Object device;
3680{ 3681{
3681 struct x_display_info *dpyinfo = check_x_display_info (display); 3682 struct x_display_info *dpyinfo = check_x_display_info (device);
3682 3683
3683 return make_number (WidthMMOfScreen (dpyinfo->screen)); 3684 return make_number (WidthMMOfScreen (dpyinfo->screen));
3684} 3685}
3685 3686
3686DEFUN ("x-display-backing-store", Fx_display_backing_store, 3687DEFUN ("x-display-backing-store", Fx_display_backing_store,
3687 Sx_display_backing_store, 0, 1, 0, 3688 Sx_display_backing_store, 0, 1, 0,
3688 doc: /* Returns an indication of whether X display DISPLAY does backing store. 3689 doc: /* Returns an indication of whether X display DEVICE does backing store.
3689The value may be `always', `when-mapped', or `not-useful'. 3690The value may be `always', `when-mapped', or `not-useful'.
3690The optional argument DISPLAY specifies which display to ask about. 3691The optional argument DEVICE specifies which display to ask about.
3691DISPLAY should be either a frame or a display name (a string). 3692DEVICE should be a device id, a frame or a display name (a string).
3692If omitted or nil, that stands for the selected frame's display. */) 3693If omitted or nil, that stands for the selected frame's display. */)
3693 (display) 3694 (device)
3694 Lisp_Object display; 3695 Lisp_Object device;
3695{ 3696{
3696 struct x_display_info *dpyinfo = check_x_display_info (display); 3697 struct x_display_info *dpyinfo = check_x_display_info (device);
3697 Lisp_Object result; 3698 Lisp_Object result;
3698 3699
3699 switch (DoesBackingStore (dpyinfo->screen)) 3700 switch (DoesBackingStore (dpyinfo->screen))
@@ -3720,17 +3721,17 @@ If omitted or nil, that stands for the selected frame's display. */)
3720 3721
3721DEFUN ("x-display-visual-class", Fx_display_visual_class, 3722DEFUN ("x-display-visual-class", Fx_display_visual_class,
3722 Sx_display_visual_class, 0, 1, 0, 3723 Sx_display_visual_class, 0, 1, 0,
3723 doc: /* Return the visual class of the X display DISPLAY. 3724 doc: /* Return the visual class of the X display DEVICE.
3724The value is one of the symbols `static-gray', `gray-scale', 3725The value is one of the symbols `static-gray', `gray-scale',
3725`static-color', `pseudo-color', `true-color', or `direct-color'. 3726`static-color', `pseudo-color', `true-color', or `direct-color'.
3726 3727
3727The optional argument DISPLAY specifies which display to ask about. 3728The optional argument DEVICE specifies which display to ask about.
3728DISPLAY should be either a frame or a display name (a string). 3729DEVICE should a device id, a frame or a display name (a string).
3729If omitted or nil, that stands for the selected frame's display. */) 3730If omitted or nil, that stands for the selected frame's display. */)
3730 (display) 3731 (device)
3731 Lisp_Object display; 3732 Lisp_Object device;
3732{ 3733{
3733 struct x_display_info *dpyinfo = check_x_display_info (display); 3734 struct x_display_info *dpyinfo = check_x_display_info (device);
3734 Lisp_Object result; 3735 Lisp_Object result;
3735 3736
3736 switch (dpyinfo->visual->class) 3737 switch (dpyinfo->visual->class)
@@ -3763,14 +3764,14 @@ If omitted or nil, that stands for the selected frame's display. */)
3763 3764
3764DEFUN ("x-display-save-under", Fx_display_save_under, 3765DEFUN ("x-display-save-under", Fx_display_save_under,
3765 Sx_display_save_under, 0, 1, 0, 3766 Sx_display_save_under, 0, 1, 0,
3766 doc: /* Returns t if the X display DISPLAY supports the save-under feature. 3767 doc: /* Returns t if the X display DEVICE supports the save-under feature.
3767The optional argument DISPLAY specifies which display to ask about. 3768The optional argument DEVICE specifies which display to ask about.
3768DISPLAY should be either a frame or a display name (a string). 3769DEVICE should be a device id, a frame or a display name (a string).
3769If omitted or nil, that stands for the selected frame's display. */) 3770If omitted or nil, that stands for the selected frame's display. */)
3770 (display) 3771 (device)
3771 Lisp_Object display; 3772 Lisp_Object device;
3772{ 3773{
3773 struct x_display_info *dpyinfo = check_x_display_info (display); 3774 struct x_display_info *dpyinfo = check_x_display_info (device);
3774 3775
3775 if (DoesSaveUnders (dpyinfo->screen) == True) 3776 if (DoesSaveUnders (dpyinfo->screen) == True)
3776 return Qt; 3777 return Qt;
@@ -4050,7 +4051,7 @@ If DISPLAY is nil, that stands for the selected frame's display. */)
4050 if (dpyinfo->reference_count > 0) 4051 if (dpyinfo->reference_count > 0)
4051 error ("Display still has frames on it"); 4052 error ("Display still has frames on it");
4052 4053
4053 x_delete_frame_display (dpyinfo->frame_display); 4054 x_delete_device (dpyinfo->device);
4054 4055
4055 return Qnil; 4056 return Qnil;
4056} 4057}
@@ -4627,8 +4628,8 @@ x_create_tip_frame (dpyinfo, parms, text)
4627 FRAME_CAN_HAVE_SCROLL_BARS (f) = 0; 4628 FRAME_CAN_HAVE_SCROLL_BARS (f) = 0;
4628 record_unwind_protect (unwind_create_tip_frame, frame); 4629 record_unwind_protect (unwind_create_tip_frame, frame);
4629 4630
4630 f->display = dpyinfo->frame_display; 4631 f->device = dpyinfo->device;
4631 f->display->reference_count++; 4632 f->device->reference_count++;
4632 4633
4633 /* By setting the output method, we're essentially saying that 4634 /* By setting the output method, we're essentially saying that
4634 the frame is live, as per FRAME_LIVE_P. If we get a signal 4635 the frame is live, as per FRAME_LIVE_P. If we get a signal
diff --git a/src/xselect.c b/src/xselect.c
index 9d5bf568231..e7c6d57f870 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -1010,7 +1010,7 @@ x_handle_selection_clear (event)
1010 to see if this Emacs job now owns the selection 1010 to see if this Emacs job now owns the selection
1011 through that display. */ 1011 through that display. */
1012 for (t_dpyinfo = x_display_list; t_dpyinfo; t_dpyinfo = t_dpyinfo->next) 1012 for (t_dpyinfo = x_display_list; t_dpyinfo; t_dpyinfo = t_dpyinfo->next)
1013 if (t_dpyinfo->frame_display->kboard == dpyinfo->frame_display->kboard) 1013 if (t_dpyinfo->device->kboard == dpyinfo->device->kboard)
1014 { 1014 {
1015 Window owner_window 1015 Window owner_window
1016 = XGetSelectionOwner (t_dpyinfo->display, selection); 1016 = XGetSelectionOwner (t_dpyinfo->display, selection);
diff --git a/src/xterm.c b/src/xterm.c
index 57a09c8c496..4fa3a326590 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -337,15 +337,15 @@ void x_raise_frame P_ ((struct frame *));
337void x_set_window_size P_ ((struct frame *, int, int, int)); 337void x_set_window_size P_ ((struct frame *, int, int, int));
338void x_wm_set_window_state P_ ((struct frame *, int)); 338void x_wm_set_window_state P_ ((struct frame *, int));
339void x_wm_set_icon_pixmap P_ ((struct frame *, int)); 339void x_wm_set_icon_pixmap P_ ((struct frame *, int));
340struct display *x_create_frame_display P_ ((struct x_display_info *)); 340struct device *x_create_device P_ ((struct x_display_info *));
341void x_delete_frame_display P_ ((struct display *)); 341void x_delete_device P_ ((struct device *));
342void x_initialize P_ ((void)); 342void x_initialize P_ ((void));
343static void x_font_min_bounds P_ ((XFontStruct *, int *, int *)); 343static void x_font_min_bounds P_ ((XFontStruct *, int *, int *));
344static int x_compute_min_glyph_bounds P_ ((struct frame *)); 344static int x_compute_min_glyph_bounds P_ ((struct frame *));
345static void x_update_end P_ ((struct frame *)); 345static void x_update_end P_ ((struct frame *));
346static void XTframe_up_to_date P_ ((struct frame *)); 346static void XTframe_up_to_date P_ ((struct frame *));
347static void XTset_terminal_modes P_ ((struct display *)); 347static void XTset_terminal_modes P_ ((struct device *));
348static void XTreset_terminal_modes P_ ((struct display *)); 348static void XTreset_terminal_modes P_ ((struct device *));
349static void x_clear_frame P_ ((struct frame *)); 349static void x_clear_frame P_ ((struct frame *));
350static void frame_highlight P_ ((struct frame *)); 350static void frame_highlight P_ ((struct frame *));
351static void frame_unhighlight P_ ((struct frame *)); 351static void frame_unhighlight P_ ((struct frame *));
@@ -805,7 +805,7 @@ x_draw_fringe_bitmap (w, row, p)
805 rarely happens). */ 805 rarely happens). */
806 806
807static void 807static void
808XTset_terminal_modes (struct display *display) 808XTset_terminal_modes (struct device *device)
809{ 809{
810} 810}
811 811
@@ -813,7 +813,7 @@ XTset_terminal_modes (struct display *display)
813 the X-windows go away, and suspending requires no action. */ 813 the X-windows go away, and suspending requires no action. */
814 814
815static void 815static void
816XTreset_terminal_modes (struct display *display) 816XTreset_terminal_modes (struct device *device)
817{ 817{
818} 818}
819 819
@@ -6966,8 +6966,8 @@ x_dispatch_event (event, display)
6966 EXPECTED is nonzero if the caller knows input is available. */ 6966 EXPECTED is nonzero if the caller knows input is available. */
6967 6967
6968static int 6968static int
6969XTread_socket (display, expected, hold_quit) 6969XTread_socket (device, expected, hold_quit)
6970 struct display *display; 6970 struct device *device;
6971 int expected; 6971 int expected;
6972 struct input_event *hold_quit; 6972 struct input_event *hold_quit;
6973{ 6973{
@@ -7677,7 +7677,7 @@ x_connection_closed (dpy, error_message)
7677 /* Protect display from being closed when we delete the last 7677 /* Protect display from being closed when we delete the last
7678 frame on it. */ 7678 frame on it. */
7679 dpyinfo->reference_count++; 7679 dpyinfo->reference_count++;
7680 dpyinfo->frame_display->reference_count++; 7680 dpyinfo->device->reference_count++;
7681 } 7681 }
7682 7682
7683 /* First delete frames whose mini-buffers are on frames 7683 /* First delete frames whose mini-buffers are on frames
@@ -7745,7 +7745,7 @@ x_connection_closed (dpy, error_message)
7745 dpyinfo->display = 0; 7745 dpyinfo->display = 0;
7746 7746
7747 dpyinfo->reference_count--; 7747 dpyinfo->reference_count--;
7748 dpyinfo->frame_display->reference_count--; 7748 dpyinfo->device->reference_count--;
7749 if (dpyinfo->reference_count != 0) 7749 if (dpyinfo->reference_count != 0)
7750 /* We have just closed all frames on this display. */ 7750 /* We have just closed all frames on this display. */
7751 abort (); 7751 abort ();
@@ -7755,7 +7755,7 @@ x_connection_closed (dpy, error_message)
7755 7755
7756 x_uncatch_errors (dpy, count); 7756 x_uncatch_errors (dpy, count);
7757 7757
7758 if (display_list == 0) 7758 if (device_list == 0)
7759 { 7759 {
7760 fprintf (stderr, "%s\n", error_msg); 7760 fprintf (stderr, "%s\n", error_msg);
7761 shut_down_emacs (0, 0, Qnil); 7761 shut_down_emacs (0, 0, Qnil);
@@ -10136,7 +10136,7 @@ x_term_init (display_name, xrm_option, resource_name)
10136{ 10136{
10137 int connection; 10137 int connection;
10138 Display *dpy; 10138 Display *dpy;
10139 struct display *display; 10139 struct device *device;
10140 struct x_display_info *dpyinfo; 10140 struct x_display_info *dpyinfo;
10141 XrmDatabase xrdb; 10141 XrmDatabase xrdb;
10142 10142
@@ -10271,7 +10271,7 @@ x_term_init (display_name, xrm_option, resource_name)
10271 dpyinfo = (struct x_display_info *) xmalloc (sizeof (struct x_display_info)); 10271 dpyinfo = (struct x_display_info *) xmalloc (sizeof (struct x_display_info));
10272 bzero (dpyinfo, sizeof *dpyinfo); 10272 bzero (dpyinfo, sizeof *dpyinfo);
10273 10273
10274 display = x_create_frame_display (dpyinfo); 10274 device = x_create_device (dpyinfo);
10275 10275
10276#ifdef MULTI_KBOARD 10276#ifdef MULTI_KBOARD
10277 { 10277 {
@@ -10284,30 +10284,30 @@ x_term_init (display_name, xrm_option, resource_name)
10284 SDATA (display_name))) 10284 SDATA (display_name)))
10285 break; 10285 break;
10286 if (share) 10286 if (share)
10287 display->kboard = share->frame_display->kboard; 10287 device->kboard = share->device->kboard;
10288 else 10288 else
10289 { 10289 {
10290 display->kboard = (KBOARD *) xmalloc (sizeof (KBOARD)); 10290 device->kboard = (KBOARD *) xmalloc (sizeof (KBOARD));
10291 init_kboard (display->kboard); 10291 init_kboard (device->kboard);
10292 if (!EQ (XSYMBOL (Qvendor_specific_keysyms)->function, Qunbound)) 10292 if (!EQ (XSYMBOL (Qvendor_specific_keysyms)->function, Qunbound))
10293 { 10293 {
10294 char *vendor = ServerVendor (dpy); 10294 char *vendor = ServerVendor (dpy);
10295 UNBLOCK_INPUT; 10295 UNBLOCK_INPUT;
10296 display->kboard->Vsystem_key_alist 10296 device->kboard->Vsystem_key_alist
10297 = call1 (Qvendor_specific_keysyms, 10297 = call1 (Qvendor_specific_keysyms,
10298 build_string (vendor ? vendor : "")); 10298 build_string (vendor ? vendor : ""));
10299 BLOCK_INPUT; 10299 BLOCK_INPUT;
10300 } 10300 }
10301 10301
10302 display->kboard->next_kboard = all_kboards; 10302 device->kboard->next_kboard = all_kboards;
10303 all_kboards = display->kboard; 10303 all_kboards = device->kboard;
10304 /* Don't let the initial kboard remain current longer than necessary. 10304 /* Don't let the initial kboard remain current longer than necessary.
10305 That would cause problems if a file loaded on startup tries to 10305 That would cause problems if a file loaded on startup tries to
10306 prompt in the mini-buffer. */ 10306 prompt in the mini-buffer. */
10307 if (current_kboard == initial_kboard) 10307 if (current_kboard == initial_kboard)
10308 current_kboard = display->kboard; 10308 current_kboard = device->kboard;
10309 } 10309 }
10310 display->kboard->reference_count++; 10310 device->kboard->reference_count++;
10311 } 10311 }
10312#endif 10312#endif
10313 10313
@@ -10322,10 +10322,10 @@ x_term_init (display_name, xrm_option, resource_name)
10322 10322
10323 dpyinfo->display = dpy; 10323 dpyinfo->display = dpy;
10324 10324
10325 /* Set the name of the display. */ 10325 /* Set the name of the device. */
10326 display->name = (char *) xmalloc (SBYTES (display_name) + 1); 10326 device->name = (char *) xmalloc (SBYTES (display_name) + 1);
10327 strncpy (display->name, SDATA (display_name), SBYTES (display_name)); 10327 strncpy (device->name, SDATA (display_name), SBYTES (display_name));
10328 display->name[SBYTES (display_name)] = 0; 10328 device->name[SBYTES (display_name)] = 0;
10329 10329
10330#if 0 10330#if 0
10331 XSetAfterFunction (x_current_display, x_trace_wire); 10331 XSetAfterFunction (x_current_display, x_trace_wire);
@@ -10632,13 +10632,13 @@ x_delete_display (dpyinfo)
10632 struct x_display_info *dpyinfo; 10632 struct x_display_info *dpyinfo;
10633{ 10633{
10634 int i; 10634 int i;
10635 struct display *d; 10635 struct device *d;
10636 10636
10637 /* Delete the generic struct display for this X display. */ 10637 /* Delete the generic struct device for this X display. */
10638 for (d = display_list; d; d = d->next_display) 10638 for (d = device_list; d; d = d->next_device)
10639 if (d->type == output_x_window && d->display_info.x == dpyinfo) 10639 if (d->type == output_x_window && d->display_info.x == dpyinfo)
10640 { 10640 {
10641 delete_display (d); 10641 delete_device (d);
10642 break; 10642 break;
10643 } 10643 }
10644 10644
@@ -10773,9 +10773,9 @@ static struct redisplay_interface x_redisplay_interface =
10773 10773
10774/* This function is called when the last frame on a display is deleted. */ 10774/* This function is called when the last frame on a display is deleted. */
10775void 10775void
10776x_delete_frame_display (struct display *display) 10776x_delete_device (struct device *device)
10777{ 10777{
10778 struct x_display_info *dpyinfo = display->display_info.x; 10778 struct x_display_info *dpyinfo = device->display_info.x;
10779 int i; 10779 int i;
10780 10780
10781 BLOCK_INPUT; 10781 BLOCK_INPUT;
@@ -10804,50 +10804,50 @@ x_delete_frame_display (struct display *display)
10804} 10804}
10805 10805
10806 10806
10807struct display * 10807struct device *
10808x_create_frame_display (struct x_display_info *dpyinfo) 10808x_create_device (struct x_display_info *dpyinfo)
10809{ 10809{
10810 struct display *display; 10810 struct device *device;
10811 10811
10812 display = create_display (); 10812 device = create_device ();
10813 10813
10814 display->type = output_x_window; 10814 device->type = output_x_window;
10815 display->display_info.x = dpyinfo; 10815 device->display_info.x = dpyinfo;
10816 dpyinfo->frame_display = display; 10816 dpyinfo->device = device;
10817 10817
10818 /* kboard is initialized in x_term_init. */ 10818 /* kboard is initialized in x_term_init. */
10819 10819
10820 display->clear_frame_hook = x_clear_frame; 10820 device->clear_frame_hook = x_clear_frame;
10821 display->ins_del_lines_hook = x_ins_del_lines; 10821 device->ins_del_lines_hook = x_ins_del_lines;
10822 display->delete_glyphs_hook = x_delete_glyphs; 10822 device->delete_glyphs_hook = x_delete_glyphs;
10823 display->ring_bell_hook = XTring_bell; 10823 device->ring_bell_hook = XTring_bell;
10824 display->reset_terminal_modes_hook = XTreset_terminal_modes; 10824 device->reset_terminal_modes_hook = XTreset_terminal_modes;
10825 display->set_terminal_modes_hook = XTset_terminal_modes; 10825 device->set_terminal_modes_hook = XTset_terminal_modes;
10826 display->update_begin_hook = x_update_begin; 10826 device->update_begin_hook = x_update_begin;
10827 display->update_end_hook = x_update_end; 10827 device->update_end_hook = x_update_end;
10828 display->set_terminal_window_hook = XTset_terminal_window; 10828 device->set_terminal_window_hook = XTset_terminal_window;
10829 display->read_socket_hook = XTread_socket; 10829 device->read_socket_hook = XTread_socket;
10830 display->frame_up_to_date_hook = XTframe_up_to_date; 10830 device->frame_up_to_date_hook = XTframe_up_to_date;
10831 display->mouse_position_hook = XTmouse_position; 10831 device->mouse_position_hook = XTmouse_position;
10832 display->frame_rehighlight_hook = XTframe_rehighlight; 10832 device->frame_rehighlight_hook = XTframe_rehighlight;
10833 display->frame_raise_lower_hook = XTframe_raise_lower; 10833 device->frame_raise_lower_hook = XTframe_raise_lower;
10834 display->set_vertical_scroll_bar_hook = XTset_vertical_scroll_bar; 10834 device->set_vertical_scroll_bar_hook = XTset_vertical_scroll_bar;
10835 display->condemn_scroll_bars_hook = XTcondemn_scroll_bars; 10835 device->condemn_scroll_bars_hook = XTcondemn_scroll_bars;
10836 display->redeem_scroll_bar_hook = XTredeem_scroll_bar; 10836 device->redeem_scroll_bar_hook = XTredeem_scroll_bar;
10837 display->judge_scroll_bars_hook = XTjudge_scroll_bars; 10837 device->judge_scroll_bars_hook = XTjudge_scroll_bars;
10838 10838
10839 display->delete_frame_hook = x_destroy_window; 10839 device->delete_frame_hook = x_destroy_window;
10840 display->delete_display_hook = x_delete_frame_display; 10840 device->delete_device_hook = x_delete_device;
10841 10841
10842 display->rif = &x_redisplay_interface; 10842 device->rif = &x_redisplay_interface;
10843 display->scroll_region_ok = 1; /* We'll scroll partial frames. */ 10843 device->scroll_region_ok = 1; /* We'll scroll partial frames. */
10844 display->char_ins_del_ok = 1; 10844 device->char_ins_del_ok = 1;
10845 display->line_ins_del_ok = 1; /* We'll just blt 'em. */ 10845 device->line_ins_del_ok = 1; /* We'll just blt 'em. */
10846 display->fast_clear_end_of_line = 1; /* X does this well. */ 10846 device->fast_clear_end_of_line = 1; /* X does this well. */
10847 display->memory_below_frame = 0; /* We don't remember what scrolls 10847 device->memory_below_frame = 0; /* We don't remember what scrolls
10848 off the bottom. */ 10848 off the bottom. */
10849 10849
10850 return display; 10850 return device;
10851} 10851}
10852 10852
10853void 10853void
diff --git a/src/xterm.h b/src/xterm.h
index b05efa32746..8a0da0d9f6b 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -388,7 +388,7 @@ struct x_display_info
388 } wm_type; 388 } wm_type;
389 389
390 /* The generic display parameters corresponding to this X display. */ 390 /* The generic display parameters corresponding to this X display. */
391 struct display *frame_display; 391 struct device *device;
392}; 392};
393 393
394#ifdef HAVE_X_I18N 394#ifdef HAVE_X_I18N