comparison src/frame.c @ 965:0eb68c6c452a

* frame.c (Qheight, Qicon, Qmodeline, Qname, Qnone, Qonly, Qunsplittable, Qwidth, Qx): New symbols, with lisp code to rebuild syms_of_frame. (syms_of_xfns): Initialize and staticpro them. (Fframep, Fframe_visible_p, Fframe_parameters): Use the new Q... variables, instead of interning things. (store_in_alist): Change the argument char *PROPNAME into a Lisp_Object PROP; let the caller take care of interning the atom. * frame.c (Fframe_visible_p): Doc fix. * frame.c (Fframe_parameters): When figuring the `minibuffer' parameter, if FRAME doesn't have a minibuffer, return `none', not nil. If it does have a minibuffer with other windows, return the window. * frame.c (Fmodify_frame_parameters): Don't write out the loop for processing X frame parameters here; do it in the x specific code. Call the function which deals with this stuff x_set_frame_parameters, not x_set_frame_parameter. * frame.c (Fmake_frame_visible, Fmake_frame_invisible, Ficonify_frame, Fframe_parameters, Fmodify_frame_parameters, Fset_frame_height, Fset_frame_width, Fset_frame_size, Fset_frame_position): Place clauses controlled by FRAME_X_P inside `#ifdef HAVE_X_WINDOWS ... #endif' clauses. * frame.c (Fset_frame_position): Doc fix. * frame.c [MULTI_SCREEN] (Fset_frame_height, Fset_frame_width, Fset_frame_size): Call change_frame_size with a DELAY of 0. [not MULTI_SCREEN] (Fset_frame_height, Fset_frame_width, Fset_frame_size, Fset_screen_height, Fset_screen_width): Same. * frame.c [not MULTI_SCREEN] (Fset_frame_height, Fset_frame_width, Fset_frame_size, Fframe_height, Fframe_width): New functions, for use when Emacs is not compiled with multiple screens. [not MULTI_SCREEN] (Fset_screen_height, Fset_screen_width): Functions added for backward compatibility with Emacs 18. These would be just aliases, except that the version 18 functions don't take a FRAME argument. [not MULTI_SCREEN] (syms_of_frame): New function, to defsubr the above and add screen-height and screen-width as aliases for Fframe_height and Fframe_width. * frame.c (Fset_frame_width): Change the size of FRAME, not of selected_frame. * frame.c (Fset_frame_width, Fset_frame_height): Declare the `frame' argument to be a Lisp_Object. It used to be undeclared. * frame.c (FRAME_IS_TERMCAP, FRAME_IS_X, FRAME_HAS_MINIBUF): Renamed these to FRAME_TERMCAP_P, FRAME_X_P, and FRAME_HAS_MINIBUF_P, for consistency with the rest of the frame macros.
author Jim Blandy <jimb@redhat.com>
date Wed, 12 Aug 1992 13:55:21 +0000
parents cba3f9073641
children afb21e974ed2
comparison
equal deleted inserted replaced
964:ea0c91e13641 965:0eb68c6c452a
1
2 /* Generic frame functions. 1 /* Generic frame functions.
3 Copyright (C) 1989, 1992 Free Software Foundation. 2 Copyright (C) 1989, 1992 Free Software Foundation.
4 3
5 This file is part of GNU Emacs. 4 This file is part of GNU Emacs.
6 5
28 #include "frame.h" 27 #include "frame.h"
29 #include "window.h" 28 #include "window.h"
30 #include "termhooks.h" 29 #include "termhooks.h"
31 30
32 Lisp_Object Vemacs_iconified; 31 Lisp_Object Vemacs_iconified;
33 Lisp_Object Qframep;
34 Lisp_Object Qlive_frame_p;
35 Lisp_Object Vframe_list; 32 Lisp_Object Vframe_list;
36 Lisp_Object Vterminal_frame; 33 Lisp_Object Vterminal_frame;
37 Lisp_Object Vdefault_minibuffer_frame; 34 Lisp_Object Vdefault_minibuffer_frame;
38 Lisp_Object Vdefault_frame_alist; 35 Lisp_Object Vdefault_frame_alist;
36
37 /* Evaluate this expression to rebuild the section of syms_of_frame
38 that initializes and staticpros the symbols declared below. Note
39 that Emacs 18 has a bug that keeps C-x C-e from being able to
40 evaluate this expression.
41
42 (progn
43 ;; Accumulate a list of the symbols we want to initialize from the
44 ;; declarations at the top of the file.
45 (goto-char (point-min))
46 (search-forward "/\*&&& symbols declared here &&&*\/\n")
47 (let (symbol-list)
48 (while (looking-at "Lisp_Object \\(Q[a-z_]+\\)")
49 (setq symbol-list
50 (cons (buffer-substring (match-beginning 1) (match-end 1))
51 symbol-list))
52 (forward-line 1))
53 (setq symbol-list (nreverse symbol-list))
54 ;; Delete the section of syms_of_... where we initialize the symbols.
55 (search-forward "\n /\*&&& init symbols here &&&*\/\n")
56 (let ((start (point)))
57 (while (looking-at "^ Q")
58 (forward-line 2))
59 (kill-region start (point)))
60 ;; Write a new symbol initialization section.
61 (while symbol-list
62 (insert (format " %s = intern (\"" (car symbol-list)))
63 (let ((start (point)))
64 (insert (substring (car symbol-list) 1))
65 (subst-char-in-region start (point) ?_ ?-))
66 (insert (format "\");\n staticpro (&%s);\n" (car symbol-list)))
67 (setq symbol-list (cdr symbol-list)))))
68 */
69
70 /*&&& symbols declared here &&&*/
71 Lisp_Object Qframep;
72 Lisp_Object Qlive_frame_p;
73 Lisp_Object Qheight;
74 Lisp_Object Qicon;
39 Lisp_Object Qminibuffer; 75 Lisp_Object Qminibuffer;
76 Lisp_Object Qmodeline;
77 Lisp_Object Qname;
78 Lisp_Object Qnone;
79 Lisp_Object Qonly;
80 Lisp_Object Qunsplittable;
81 Lisp_Object Qwidth;
82 Lisp_Object Qx;
40 83
41 extern Lisp_Object Vminibuffer_list; 84 extern Lisp_Object Vminibuffer_list;
42 extern Lisp_Object get_minibuffer (); 85 extern Lisp_Object get_minibuffer ();
43 86
44 DEFUN ("framep", Fframep, Sframep, 1, 1, 0, 87 DEFUN ("framep", Fframep, Sframep, 1, 1, 0,
54 switch (XFRAME (object)->output_method) 97 switch (XFRAME (object)->output_method)
55 { 98 {
56 case output_termcap: 99 case output_termcap:
57 return Qt; 100 return Qt;
58 case output_x_window: 101 case output_x_window:
59 return intern ("x"); 102 return Qx;
60 default: 103 default:
61 abort (); 104 abort ();
62 } 105 }
63 } 106 }
64 107
288 331
289 Fselect_window (XFRAME (frame)->selected_window); 332 Fselect_window (XFRAME (frame)->selected_window);
290 333
291 #ifdef HAVE_X_WINDOWS 334 #ifdef HAVE_X_WINDOWS
292 #ifdef MULTI_FRAME 335 #ifdef MULTI_FRAME
293 if (FRAME_IS_X (XFRAME (frame)) 336 if (FRAME_X_P (XFRAME (frame))
294 && NILP (no_enter)) 337 && NILP (no_enter))
295 { 338 {
296 Ffocus_frame (frame); 339 Ffocus_frame (frame);
297 } 340 }
298 #endif 341 #endif
489 if (f == selected_frame && EQ (next_frame (frame, Qt), frame)) 532 if (f == selected_frame && EQ (next_frame (frame, Qt), frame))
490 error ("Attempt to delete the only frame"); 533 error ("Attempt to delete the only frame");
491 534
492 /* Does this frame have a minibuffer, and is it the surrogate 535 /* Does this frame have a minibuffer, and is it the surrogate
493 minibuffer for any other frame? */ 536 minibuffer for any other frame? */
494 if (FRAME_HAS_MINIBUF (XFRAME (frame))) 537 if (FRAME_HAS_MINIBUF_P (XFRAME (frame)))
495 { 538 {
496 Lisp_Object frames; 539 Lisp_Object frames;
497 540
498 for (frames = Vframe_list; 541 for (frames = Vframe_list;
499 CONSP (frames); 542 CONSP (frames);
527 f->visible = 0; 570 f->visible = 0;
528 displ = f->display; 571 displ = f->display;
529 f->display.nothing = 0; 572 f->display.nothing = 0;
530 573
531 #ifdef HAVE_X_WINDOWS 574 #ifdef HAVE_X_WINDOWS
532 if (FRAME_IS_X (f)) 575 if (FRAME_X_P (f))
533 x_destroy_window (f, displ); 576 x_destroy_window (f, displ);
534 #endif 577 #endif
535 578
536 /* If we've deleted the last_nonminibuf_frame, then try to find 579 /* If we've deleted the last_nonminibuf_frame, then try to find
537 another one. */ 580 another one. */
572 615
573 if (XTYPE (this) != Lisp_Frame) 616 if (XTYPE (this) != Lisp_Frame)
574 abort (); 617 abort ();
575 f = XFRAME (this); 618 f = XFRAME (this);
576 619
577 if (FRAME_HAS_MINIBUF (f)) 620 if (FRAME_HAS_MINIBUF_P (f))
578 { 621 {
579 frame_with_minibuf = this; 622 frame_with_minibuf = this;
580 if (FRAME_MINIBUF_ONLY_P (f)) 623 if (FRAME_MINIBUF_ONLY_P (f))
581 break; 624 break;
582 } 625 }
630 CHECK_LIVE_FRAME (frame, 0); 673 CHECK_LIVE_FRAME (frame, 0);
631 CHECK_NUMBER (x, 2); 674 CHECK_NUMBER (x, 2);
632 CHECK_NUMBER (y, 1); 675 CHECK_NUMBER (y, 1);
633 676
634 #ifdef HAVE_X_WINDOWS 677 #ifdef HAVE_X_WINDOWS
635 if (FRAME_IS_X (XFRAME (frame))) 678 if (FRAME_X_P (XFRAME (frame)))
636 /* Warping the mouse will cause enternotify and focus events. */ 679 /* Warping the mouse will cause enternotify and focus events. */
637 x_set_mouse_position (XFRAME (frame), x, y); 680 x_set_mouse_position (XFRAME (frame), x, y);
638 #endif 681 #endif
639 682
640 return Qnil; 683 return Qnil;
706 if (NILP (frame)) 749 if (NILP (frame))
707 XSET (frame, Lisp_Frame, selected_frame); 750 XSET (frame, Lisp_Frame, selected_frame);
708 751
709 CHECK_LIVE_FRAME (frame, 0); 752 CHECK_LIVE_FRAME (frame, 0);
710 753
711 if (FRAME_IS_X (XFRAME (frame))) 754 #ifdef HAVE_X_WINDOWS
755 if (FRAME_X_P (XFRAME (frame)))
712 x_make_frame_visible (XFRAME (frame)); 756 x_make_frame_visible (XFRAME (frame));
757 #endif
713 758
714 return frame; 759 return frame;
715 } 760 }
716 761
717 DEFUN ("make-frame-invisible", Fmake_frame_invisible, Smake_frame_invisible, 762 DEFUN ("make-frame-invisible", Fmake_frame_invisible, Smake_frame_invisible,
723 if (NILP (frame)) 768 if (NILP (frame))
724 XSET (frame, Lisp_Frame, selected_frame); 769 XSET (frame, Lisp_Frame, selected_frame);
725 770
726 CHECK_LIVE_FRAME (frame, 0); 771 CHECK_LIVE_FRAME (frame, 0);
727 772
728 if (FRAME_IS_X (XFRAME (frame))) 773 #ifdef HAVE_X_WINDOWS
774 if (FRAME_X_P (XFRAME (frame)))
729 x_make_frame_invisible (XFRAME (frame)); 775 x_make_frame_invisible (XFRAME (frame));
776 #endif
730 777
731 return Qnil; 778 return Qnil;
732 } 779 }
733 780
734 DEFUN ("iconify-frame", Ficonify_frame, Siconify_frame, 781 DEFUN ("iconify-frame", Ficonify_frame, Siconify_frame,
740 if (NILP (frame)) 787 if (NILP (frame))
741 XSET (frame, Lisp_Frame, selected_frame); 788 XSET (frame, Lisp_Frame, selected_frame);
742 789
743 CHECK_LIVE_FRAME (frame, 0); 790 CHECK_LIVE_FRAME (frame, 0);
744 791
745 if (FRAME_IS_X (XFRAME (frame))) 792 #ifdef HAVE_X_WINDOWS
793 if (FRAME_X_P (XFRAME (frame)))
746 x_iconify_frame (XFRAME (frame)); 794 x_iconify_frame (XFRAME (frame));
795 #endif
747 796
748 return Qnil; 797 return Qnil;
749 } 798 }
750 799
751 DEFUN ("frame-visible-p", Fframe_visible_p, Sframe_visible_p, 800 DEFUN ("frame-visible-p", Fframe_visible_p, Sframe_visible_p,
752 1, 1, 0, 801 1, 1, 0,
753 "Return t if FRAME is now \"visible\" (actually in use for display).\n\ 802 "Return t if FRAME is now \"visible\" (actually in use for display).\n\
754 A frame that is not \"visible\" is not updated and, if it works through\n\ 803 A frame that is not \"visible\" is not updated and, if it works through\n\
755 a window system, it may not show at all.\n\ 804 a window system, it may not show at all.\n\
756 Return the symbol `icon' if window is visible only as an icon.") 805 Return the symbol `icon' if frame is visible only as an icon.")
757 (frame) 806 (frame)
758 Lisp_Object frame; 807 Lisp_Object frame;
759 { 808 {
760 CHECK_LIVE_FRAME (frame, 0); 809 CHECK_LIVE_FRAME (frame, 0);
761 810
762 if (XFRAME (frame)->visible) 811 if (XFRAME (frame)->visible)
763 return Qt; 812 return Qt;
764 if (XFRAME (frame)->iconified) 813 if (XFRAME (frame)->iconified)
765 return intern ("icon"); 814 return Qicon;
766 return Qnil; 815 return Qnil;
767 } 816 }
768 817
769 DEFUN ("visible-frame-list", Fvisible_frame_list, Svisible_frame_list, 818 DEFUN ("visible-frame-list", Fvisible_frame_list, Svisible_frame_list,
770 0, 0, 0, 819 0, 0, 0,
847 return tem; 896 return tem;
848 return Fcdr (tem); 897 return Fcdr (tem);
849 } 898 }
850 899
851 void 900 void
852 store_in_alist (alistptr, propname, val) 901 store_in_alist (alistptr, prop, val)
853 Lisp_Object *alistptr, val; 902 Lisp_Object *alistptr, val;
854 char *propname; 903 Lisp_Object prop;
855 { 904 {
856 register Lisp_Object tem; 905 register Lisp_Object tem;
857 register Lisp_Object prop; 906
858
859 prop = intern (propname);
860 tem = Fassq (prop, *alistptr); 907 tem = Fassq (prop, *alistptr);
861 if (EQ (tem, Qnil)) 908 if (EQ (tem, Qnil))
862 *alistptr = Fcons (Fcons (prop, val), *alistptr); 909 *alistptr = Fcons (Fcons (prop, val), *alistptr);
863 else 910 else
864 Fsetcdr (tem, val); 911 Fsetcdr (tem, val);
881 && XTYPE (val) == Lisp_Window) 928 && XTYPE (val) == Lisp_Window)
882 { 929 {
883 if (! MINI_WINDOW_P (XWINDOW (val))) 930 if (! MINI_WINDOW_P (XWINDOW (val)))
884 error ("Surrogate minibuffer windows must be minibuffer windows."); 931 error ("Surrogate minibuffer windows must be minibuffer windows.");
885 932
886 if (FRAME_HAS_MINIBUF (f) || FRAME_MINIBUF_ONLY_P (f)) 933 if (FRAME_HAS_MINIBUF_P (f) || FRAME_MINIBUF_ONLY_P (f))
887 error ("Can't change the surrogate minibuffer of a frame with its own minibuffer."); 934 error ("Can't change the surrogate minibuffer of a frame with its own minibuffer.");
888 935
889 /* Install the chosen minibuffer window, with proper buffer. */ 936 /* Install the chosen minibuffer window, with proper buffer. */
890 f->minibuffer_window = val; 937 f->minibuffer_window = val;
891 } 938 }
912 959
913 if (f->display.nothing == 0) 960 if (f->display.nothing == 0)
914 return Qnil; 961 return Qnil;
915 962
916 alist = Fcopy_alist (f->param_alist); 963 alist = Fcopy_alist (f->param_alist);
917 store_in_alist (&alist, "name", f->name); 964 store_in_alist (&alist, Qname, f->name);
918 store_in_alist (&alist, "height", make_number (f->height)); 965 store_in_alist (&alist, Qheight, make_number (f->height));
919 store_in_alist (&alist, "width", make_number (f->width)); 966 store_in_alist (&alist, Qwidth, make_number (f->width));
920 store_in_alist (&alist, "modeline", (f->wants_modeline ? Qt : Qnil)); 967 store_in_alist (&alist, Qmodeline, (f->wants_modeline ? Qt : Qnil));
921 store_in_alist (&alist, "minibuffer", 968 store_in_alist (&alist, Qminibuffer,
922 (FRAME_HAS_MINIBUF (f) 969 (! FRAME_HAS_MINIBUF_P (f) ? Qnone
923 ? (FRAME_MINIBUF_ONLY_P (f) ? intern ("only") : Qt) 970 : (FRAME_MINIBUF_ONLY_P (f) ? Qonly
924 : FRAME_MINIBUF_WINDOW (f))); 971 : FRAME_MINIBUF_WINDOW (f))));
925 store_in_alist (&alist, "unsplittable", (f->no_split ? Qt : Qnil)); 972 store_in_alist (&alist, Qunsplittable, (f->no_split ? Qt : Qnil));
926 973
927 if (FRAME_IS_X (f)) 974 #ifdef HAVE_X_WINDOWS
975 if (FRAME_X_P (f))
928 x_report_frame_params (f, &alist); 976 x_report_frame_params (f, &alist);
977 #endif
929 return alist; 978 return alist;
930 } 979 }
931 980
932 DEFUN ("modify-frame-parameters", Fmodify_frame_parameters, 981 DEFUN ("modify-frame-parameters", Fmodify_frame_parameters,
933 Smodify_frame_parameters, 2, 2, 0, 982 Smodify_frame_parameters, 2, 2, 0,
936 Each element of ALIST has the form (PARM . VALUE), where PARM is a symbol.\n\ 985 Each element of ALIST has the form (PARM . VALUE), where PARM is a symbol.\n\
937 The meaningful PARMs depend on the kind of frame; undefined PARMs are ignored.") 986 The meaningful PARMs depend on the kind of frame; undefined PARMs are ignored.")
938 (frame, alist) 987 (frame, alist)
939 Lisp_Object frame, alist; 988 Lisp_Object frame, alist;
940 { 989 {
941 register struct frame *f; 990 FRAME_PTR f;
942 register Lisp_Object tail, elt, prop, val; 991 register Lisp_Object tail, elt, prop, val;
943 992
944 if (EQ (frame, Qnil)) 993 if (EQ (frame, Qnil))
945 f = selected_frame; 994 f = selected_frame;
946 else 995 else
947 { 996 {
948 CHECK_LIVE_FRAME (frame, 0); 997 CHECK_LIVE_FRAME (frame, 0);
949 f = XFRAME (frame); 998 f = XFRAME (frame);
950 } 999 }
951 1000
952 if (FRAME_IS_X (f)) 1001 #ifdef HAVE_X_WINDOWS
1002 if (FRAME_X_P (f))
1003 #if 1
1004 x_set_frame_parameters (f, alist);
1005 #else
953 for (tail = alist; !EQ (tail, Qnil); tail = Fcdr (tail)) 1006 for (tail = alist; !EQ (tail, Qnil); tail = Fcdr (tail))
954 { 1007 {
955 elt = Fcar (tail); 1008 elt = Fcar (tail);
956 prop = Fcar (elt); 1009 prop = Fcar (elt);
957 val = Fcdr (elt); 1010 val = Fcdr (elt);
958 x_set_frame_param (f, prop, val, 1011 x_set_frame_param (f, prop, val, get_frame_param (f, prop));
959 get_frame_param (f, prop));
960 store_frame_param (f, prop, val); 1012 store_frame_param (f, prop, val);
961 } 1013 }
1014 #endif
1015 #endif
962 1016
963 return Qnil; 1017 return Qnil;
964 } 1018 }
965 1019
966 1020
1007 DEFUN ("set-frame-height", Fset_frame_height, Sset_frame_height, 2, 3, 0, 1061 DEFUN ("set-frame-height", Fset_frame_height, Sset_frame_height, 2, 3, 0,
1008 "Specify that the frame FRAME has LINES lines.\n\ 1062 "Specify that the frame FRAME has LINES lines.\n\
1009 Optional third arg non-nil means that redisplay should use LINES lines\n\ 1063 Optional third arg non-nil means that redisplay should use LINES lines\n\
1010 but that the idea of the actual height of the frame should not be changed.") 1064 but that the idea of the actual height of the frame should not be changed.")
1011 (frame, rows, pretend) 1065 (frame, rows, pretend)
1012 Lisp_Object rows, pretend; 1066 Lisp_Object frame, rows, pretend;
1013 { 1067 {
1014 register struct frame *f; 1068 register struct frame *f;
1015 1069
1016 CHECK_NUMBER (rows, 0); 1070 CHECK_NUMBER (rows, 0);
1017 if (NILP (frame)) 1071 if (NILP (frame))
1020 { 1074 {
1021 CHECK_LIVE_FRAME (frame, 0); 1075 CHECK_LIVE_FRAME (frame, 0);
1022 f = XFRAME (frame); 1076 f = XFRAME (frame);
1023 } 1077 }
1024 1078
1025 if (FRAME_IS_X (f)) 1079 #ifdef HAVE_X_WINDOWS
1080 if (FRAME_X_P (f))
1026 { 1081 {
1027 if (XINT (rows) != f->width) 1082 if (XINT (rows) != f->width)
1028 x_set_window_size (f, f->width, XINT (rows)); 1083 x_set_window_size (f, f->width, XINT (rows));
1029 } 1084 }
1030 else 1085 else
1031 change_frame_size (f, XINT (rows), 0, !NILP (pretend)); 1086 #endif
1087 change_frame_size (f, XINT (rows), 0, !NILP (pretend), 0);
1032 return Qnil; 1088 return Qnil;
1033 } 1089 }
1034 1090
1035 DEFUN ("set-frame-width", Fset_frame_width, Sset_frame_width, 2, 3, 0, 1091 DEFUN ("set-frame-width", Fset_frame_width, Sset_frame_width, 2, 3, 0,
1036 "Specify that the frame FRAME has COLS columns.\n\ 1092 "Specify that the frame FRAME has COLS columns.\n\
1037 Optional third arg non-nil means that redisplay should use COLS columns\n\ 1093 Optional third arg non-nil means that redisplay should use COLS columns\n\
1038 but that the idea of the actual width of the frame should not be changed.") 1094 but that the idea of the actual width of the frame should not be changed.")
1039 (frame, cols, pretend) 1095 (frame, cols, pretend)
1040 Lisp_Object cols, pretend; 1096 Lisp_Object frame, cols, pretend;
1041 { 1097 {
1042 register struct frame *f; 1098 register struct frame *f;
1043 CHECK_NUMBER (cols, 0); 1099 CHECK_NUMBER (cols, 0);
1044 if (NILP (frame)) 1100 if (NILP (frame))
1045 f = selected_frame; 1101 f = selected_frame;
1047 { 1103 {
1048 CHECK_LIVE_FRAME (frame, 0); 1104 CHECK_LIVE_FRAME (frame, 0);
1049 f = XFRAME (frame); 1105 f = XFRAME (frame);
1050 } 1106 }
1051 1107
1052 if (FRAME_IS_X (f)) 1108 #ifdef HAVE_X_WINDOWS
1109 if (FRAME_X_P (f))
1053 { 1110 {
1054 if (XINT (cols) != f->width) 1111 if (XINT (cols) != f->width)
1055 x_set_window_size (f, XINT (cols), f->height); 1112 x_set_window_size (f, XINT (cols), f->height);
1056 } 1113 }
1057 else 1114 else
1058 change_frame_size (selected_frame, 0, XINT (cols), !NILP (pretend)); 1115 #endif
1116 change_frame_size (f, 0, XINT (cols), !NILP (pretend), 0);
1059 return Qnil; 1117 return Qnil;
1060 } 1118 }
1061 1119
1062 DEFUN ("set-frame-size", Fset_frame_size, Sset_frame_size, 3, 3, 0, 1120 DEFUN ("set-frame-size", Fset_frame_size, Sset_frame_size, 3, 3, 0,
1063 "Sets size of FRAME to COLS by ROWS, measured in characters.") 1121 "Sets size of FRAME to COLS by ROWS, measured in characters.")
1070 CHECK_LIVE_FRAME (frame, 0); 1128 CHECK_LIVE_FRAME (frame, 0);
1071 CHECK_NUMBER (cols, 2); 1129 CHECK_NUMBER (cols, 2);
1072 CHECK_NUMBER (rows, 1); 1130 CHECK_NUMBER (rows, 1);
1073 f = XFRAME (frame); 1131 f = XFRAME (frame);
1074 1132
1075 if (FRAME_IS_X (f)) 1133 #ifdef HAVE_X_WINDOWS
1134 if (FRAME_X_P (f))
1076 { 1135 {
1077 if (XINT (rows) != f->height || XINT (cols) != f->width) 1136 if (XINT (rows) != f->height || XINT (cols) != f->width)
1078 x_set_window_size (f, XINT (cols), XINT (rows)); 1137 x_set_window_size (f, XINT (cols), XINT (rows));
1079 } 1138 }
1080 else 1139 else
1081 change_frame_size (f, XINT (rows), XINT (cols), 0); 1140 #endif
1141 change_frame_size (f, XINT (rows), XINT (cols), 0, 0);
1082 1142
1083 return Qnil; 1143 return Qnil;
1084 } 1144 }
1085 1145
1086 DEFUN ("set-frame-position", Fset_frame_position, 1146 DEFUN ("set-frame-position", Fset_frame_position,
1087 Sset_frame_position, 3, 3, 0, 1147 Sset_frame_position, 3, 3, 0,
1088 "Sets position of FRAME in pixels to XOFFSET by YOFFSET.\n\ 1148 "Sets position of FRAME in pixels to XOFFSET by YOFFSET.\n\
1089 If XOFFSET or YOFFSET are negative, they are interpreted relative to\n\ 1149 If XOFFSET or YOFFSET are negative, they are interpreted relative to\n\
1090 the leftmost or bottommost position FRAME could occupy without going\n\ 1150 the leftmost or bottommost position FRAME could occupy without going\n\
1091 off the frame.") 1151 off the screen.")
1092 (frame, xoffset, yoffset) 1152 (frame, xoffset, yoffset)
1093 Lisp_Object frame, xoffset, yoffset; 1153 Lisp_Object frame, xoffset, yoffset;
1094 { 1154 {
1095 register struct frame *f; 1155 register struct frame *f;
1096 int mask; 1156 int mask;
1098 CHECK_LIVE_FRAME (frame, 0); 1158 CHECK_LIVE_FRAME (frame, 0);
1099 CHECK_NUMBER (xoffset, 1); 1159 CHECK_NUMBER (xoffset, 1);
1100 CHECK_NUMBER (yoffset, 2); 1160 CHECK_NUMBER (yoffset, 2);
1101 f = XFRAME (frame); 1161 f = XFRAME (frame);
1102 1162
1103 if (FRAME_IS_X (f)) 1163 #ifdef HAVE_X_WINDOWS
1164 if (FRAME_X_P (f))
1104 x_set_offset (f, XINT (xoffset), XINT (yoffset)); 1165 x_set_offset (f, XINT (xoffset), XINT (yoffset));
1166 #endif
1105 1167
1106 return Qt; 1168 return Qt;
1107 } 1169 }
1108 1170
1109 1171
1162 } 1224 }
1163 } 1225 }
1164 1226
1165 syms_of_frame () 1227 syms_of_frame ()
1166 { 1228 {
1229 /*&&& init symbols here &&&*/
1167 Qframep = intern ("framep"); 1230 Qframep = intern ("framep");
1168 Qlive_frame_p = intern ("live_frame_p"); 1231 staticpro (&Qframep);
1232 Qlive_frame_p = intern ("live-frame-p");
1233 staticpro (&Qlive_frame_p);
1234 Qheight = intern ("height");
1235 staticpro (&Qheight);
1236 Qicon = intern ("icon");
1237 staticpro (&Qicon);
1169 Qminibuffer = intern ("minibuffer"); 1238 Qminibuffer = intern ("minibuffer");
1170
1171 staticpro (&Qframep);
1172 staticpro (&Qlive_frame_p);
1173 staticpro (&Qminibuffer); 1239 staticpro (&Qminibuffer);
1240 Qmodeline = intern ("modeline");
1241 staticpro (&Qmodeline);
1242 Qname = intern ("name");
1243 staticpro (&Qname);
1244 Qnone = intern ("none");
1245 staticpro (&Qnone);
1246 Qonly = intern ("only");
1247 staticpro (&Qonly);
1248 Qunsplittable = intern ("unsplittable");
1249 staticpro (&Qunsplittable);
1250 Qwidth = intern ("width");
1251 staticpro (&Qwidth);
1252 Qx = intern ("x");
1253 staticpro (&Qx);
1174 1254
1175 staticpro (&Vframe_list); 1255 staticpro (&Vframe_list);
1176 1256
1177 DEFVAR_LISP ("terminal-frame", &Vterminal_frame, 1257 DEFVAR_LISP ("terminal-frame", &Vterminal_frame,
1178 "The initial frame-object, which represents Emacs's stdout."); 1258 "The initial frame-object, which represents Emacs's stdout.");
1243 #ifndef HAVE_X11 1323 #ifndef HAVE_X11
1244 defsubr (&Srubber_band_rectangle); 1324 defsubr (&Srubber_band_rectangle);
1245 #endif /* HAVE_X11 */ 1325 #endif /* HAVE_X11 */
1246 } 1326 }
1247 1327
1248 #endif 1328 #else /* not MULTI_SCREEN */
1329
1330 /* If we're not using multi-frame stuff, we still need to provide
1331 some support functions. These were present in Emacs 18. */
1332
1333 DEFUN ("set-frame-height", Fset_frame_height, Sset_frame_height, 2, 3, 0,
1334 "Specify that the frame FRAME has LINES lines.\n\
1335 Optional third arg non-nil means that redisplay should use LINES lines\n\
1336 but that the idea of the actual height of the frame should not be changed.")
1337 (frame, rows, pretend)
1338 Lisp_Object frame, rows, pretend;
1339 {
1340 CHECK_NUMBER (rows, 0);
1341
1342 change_frame_size (0, XINT (rows), 0, !NILP (pretend), 0);
1343 return Qnil;
1344 }
1345
1346 DEFUN ("set-frame-width", Fset_frame_width, Sset_frame_width, 2, 3, 0,
1347 "Specify that the frame FRAME has COLS columns.\n\
1348 Optional third arg non-nil means that redisplay should use COLS columns\n\
1349 but that the idea of the actual width of the frame should not be changed.")
1350 (frame, cols, pretend)
1351 Lisp_Object frame, cols, pretend;
1352 {
1353 CHECK_NUMBER (cols, 0);
1354
1355 change_frame_size (0, 0, XINT (cols), !NILP (pretend), 0);
1356 return Qnil;
1357 }
1358
1359 DEFUN ("set-frame-size", Fset_frame_size, Sset_frame_size, 3, 3, 0,
1360 "Sets size of FRAME to COLS by ROWS, measured in characters.")
1361 (frame, cols, rows)
1362 Lisp_Object frame, cols, rows;
1363 {
1364 CHECK_NUMBER (cols, 2);
1365 CHECK_NUMBER (rows, 1);
1366
1367 change_frame_size (0, XINT (rows), XINT (cols), 0, 0);
1368
1369 return Qnil;
1370 }
1371
1372 DEFUN ("set-screen-height", Fset_screen_height, Sset_screen_height, 1, 2, 0,
1373 "Tell redisplay that the screen has LINES lines.\n\
1374 Optional second arg non-nil means that redisplay should use LINES lines\n\
1375 but that the idea of the actual height of the screen should not be changed.")
1376 (lines, pretend)
1377 Lisp_Object lines, pretend;
1378 {
1379 CHECK_NUMBER (lines, 0);
1380
1381 change_frame_size (0, XINT (lines), 0, !NILP (pretend), 0);
1382 return Qnil;
1383 }
1384
1385 DEFUN ("set-screen-width", Fset_screen_width, Sset_screen_width, 1, 2, 0,
1386 "Tell redisplay that the screen has COLS columns.\n\
1387 Optional second arg non-nil means that redisplay should use COLS columns\n\
1388 but that the idea of the actual width of the screen should not be changed.")
1389 (cols, pretend)
1390 Lisp_Object cols, pretend;
1391 {
1392 CHECK_NUMBER (cols, 0);
1393
1394 change_frame_size (0, 0, XINT (cols), !NILP (pretend), 0);
1395 return Qnil;
1396 }
1397
1398 DEFUN ("frame-height", Fframe_height, Sframe_height, 0, 0, 0,
1399 "Return number of lines available for display on selected frame.")
1400 ()
1401 {
1402 return make_number (FRAME_HEIGHT (selected_frame));
1403 }
1404
1405 DEFUN ("frame-width", Fframe_width, Sframe_width, 0, 0, 0,
1406 "Return number of columns available for display on selected frame.")
1407 ()
1408 {
1409 return make_number (FRAME_WIDTH (selected_frame));
1410 }
1411
1412 syms_of_frame ()
1413 {
1414 defsubr (&Sset_frame_height);
1415 defsubr (&Sset_frame_width);
1416 defsubr (&Sset_frame_size);
1417 defsubr (&Sset_screen_height);
1418 defsubr (&Sset_screen_width);
1419 defsubr (&Sframe_height);
1420 Ffset (intern ("screen-height"), intern ("frame-height"));
1421 defsubr (&Sframe_width);
1422 Ffset (intern ("screen-width"), intern ("frame-width"));
1423 }
1424
1425 #endif /* not MULTI_FRAME */
1426
1427
1428
1429