1 /* Generic frame functions.
2 Copyright (C) 1993 Free Software Foundation.
4 This file is part of GNU Emacs.
6 GNU Emacs is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 GNU Emacs is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Emacs; see the file COPYING. If not, write to
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
25 #include "termhooks.h"
32 /* These help us bind and responding to switch-frame events. */
36 Lisp_Object Vemacs_iconified
;
37 Lisp_Object Vframe_list
;
38 Lisp_Object Vterminal_frame
;
39 Lisp_Object Vdefault_minibuffer_frame
;
40 Lisp_Object Vdefault_frame_alist
;
42 /* Evaluate this expression to rebuild the section of syms_of_frame
43 that initializes and staticpros the symbols declared below. Note
44 that Emacs 18 has a bug that keeps C-x C-e from being able to
45 evaluate this expression.
48 ;; Accumulate a list of the symbols we want to initialize from the
49 ;; declarations at the top of the file.
50 (goto-char (point-min))
51 (search-forward "/\*&&& symbols declared here &&&*\/\n")
53 (while (looking-at "Lisp_Object \\(Q[a-z_]+\\)")
55 (cons (buffer-substring (match-beginning 1) (match-end 1))
58 (setq symbol-list (nreverse symbol-list))
59 ;; Delete the section of syms_of_... where we initialize the symbols.
60 (search-forward "\n /\*&&& init symbols here &&&*\/\n")
61 (let ((start (point)))
62 (while (looking-at "^ Q")
64 (kill-region start (point)))
65 ;; Write a new symbol initialization section.
67 (insert (format " %s = intern (\"" (car symbol-list)))
68 (let ((start (point)))
69 (insert (substring (car symbol-list) 1))
70 (subst-char-in-region start (point) ?_ ?-))
71 (insert (format "\");\n staticpro (&%s);\n" (car symbol-list)))
72 (setq symbol-list (cdr symbol-list)))))
75 /*&&& symbols declared here &&&*/
77 Lisp_Object Qframe_live_p
;
80 Lisp_Object Qminibuffer
;
81 Lisp_Object Qmodeline
;
84 Lisp_Object Qunsplittable
;
85 Lisp_Object Qmenu_bar_lines
;
89 extern Lisp_Object Vminibuffer_list
;
90 extern Lisp_Object
get_minibuffer ();
91 extern Lisp_Object
Fhandle_switch_frame ();
92 extern Lisp_Object
Fredirect_frame_focus ();
94 DEFUN ("framep", Fframep
, Sframep
, 1, 1, 0,
95 "Return non-nil if OBJECT is a frame.\n\
96 Value is t for a termcap frame (a character-only terminal),\n\
97 `x' for an Emacs frame that is really an X window.\n\
98 Also see `live-frame-p'.")
102 if (XTYPE (object
) != Lisp_Frame
)
104 switch (XFRAME (object
)->output_method
)
108 case output_x_window
:
115 DEFUN ("frame-live-p", Fframe_live_p
, Sframe_live_p
, 1, 1, 0,
116 "Return non-nil if OBJECT is a frame which has not been deleted.\n\
117 Value is nil if OBJECT is not a live frame. If object is a live\n\
118 frame, the return value indicates what sort of output device it is\n\
119 displayed on. Value is t for a termcap frame (a character-only\n\
120 terminal), `x' for an Emacs frame being displayed in an X window.")
124 return ((FRAMEP (object
)
125 && FRAME_LIVE_P (XFRAME (object
)))
135 register struct frame
*f
;
136 register Lisp_Object root_window
;
137 register Lisp_Object mini_window
;
139 frame
= Fmake_vector (((sizeof (struct frame
) - (sizeof (Lisp_Vector
)
140 - sizeof (Lisp_Object
)))
141 / sizeof (Lisp_Object
)),
143 XSETTYPE (frame
, Lisp_Frame
);
148 f
->current_glyphs
= 0;
149 f
->desired_glyphs
= 0;
151 f
->async_visible
= 0;
152 f
->display
.nothing
= 0;
154 f
->async_iconified
= 0;
155 f
->wants_modeline
= 1;
160 f
->has_minibuffer
= mini_p
;
161 f
->focus_frame
= Qnil
;
162 f
->explicit_name
= 0;
163 f
->can_have_scroll_bars
= 0;
164 f
->has_vertical_scroll_bars
= 0;
165 f
->param_alist
= Qnil
;
166 f
->scroll_bars
= Qnil
;
167 f
->condemned_scroll_bars
= Qnil
;
168 f
->face_alist
= Qnil
;
170 root_window
= make_window ();
173 mini_window
= make_window ();
174 XWINDOW (root_window
)->next
= mini_window
;
175 XWINDOW (mini_window
)->prev
= root_window
;
176 XWINDOW (mini_window
)->mini_p
= Qt
;
177 XWINDOW (mini_window
)->frame
= frame
;
178 f
->minibuffer_window
= mini_window
;
183 XWINDOW (root_window
)->next
= Qnil
;
184 f
->minibuffer_window
= Qnil
;
187 XWINDOW (root_window
)->frame
= frame
;
190 just so that there is "something there."
191 Correct size will be set up later with change_frame_size. */
196 XFASTINT (XWINDOW (root_window
)->width
) = 10;
197 XFASTINT (XWINDOW (root_window
)->height
) = (mini_p
? 9 : 10);
201 XFASTINT (XWINDOW (mini_window
)->width
) = 10;
202 XFASTINT (XWINDOW (mini_window
)->top
) = 9;
203 XFASTINT (XWINDOW (mini_window
)->height
) = 1;
206 /* Choose a buffer for the frame's root window. */
210 XWINDOW (root_window
)->buffer
= Qt
;
211 buf
= Fcurrent_buffer ();
212 /* If buf is a 'hidden' buffer (i.e. one whose name starts with
213 a space), try to find another one. */
214 if (XSTRING (Fbuffer_name (buf
))->data
[0] == ' ')
215 buf
= Fother_buffer (buf
, Qnil
);
216 Fset_window_buffer (root_window
, buf
);
221 XWINDOW (mini_window
)->buffer
= Qt
;
222 Fset_window_buffer (mini_window
,
223 (NILP (Vminibuffer_list
)
225 : Fcar (Vminibuffer_list
)));
228 f
->root_window
= root_window
;
229 f
->selected_window
= root_window
;
230 /* Make sure this window seems more recently used than
231 a newly-created, never-selected window. */
232 XFASTINT (XWINDOW (f
->selected_window
)->use_time
) = ++window_select_count
;
237 /* Make a frame using a separate minibuffer window on another frame.
238 MINI_WINDOW is the minibuffer window to use. nil means use the
239 default (the global minibuffer). */
242 make_frame_without_minibuffer (mini_window
)
243 register Lisp_Object mini_window
;
245 register struct frame
*f
;
247 /* Choose the minibuffer window to use. */
248 if (NILP (mini_window
))
250 if (XTYPE (Vdefault_minibuffer_frame
) != Lisp_Frame
)
251 error ("default-minibuffer-frame must be set when creating minibufferless frames");
252 if (! FRAME_LIVE_P (XFRAME (Vdefault_minibuffer_frame
)))
253 error ("default-minibuffer-frame must be a live frame");
254 mini_window
= XFRAME (Vdefault_minibuffer_frame
)->minibuffer_window
;
258 CHECK_LIVE_WINDOW (mini_window
, 0);
261 /* Make a frame containing just a root window. */
264 /* Install the chosen minibuffer window, with proper buffer. */
265 f
->minibuffer_window
= mini_window
;
266 Fset_window_buffer (mini_window
,
267 (NILP (Vminibuffer_list
)
269 : Fcar (Vminibuffer_list
)));
273 /* Make a frame containing only a minibuffer window. */
276 make_minibuffer_frame ()
278 /* First make a frame containing just a root window, no minibuffer. */
280 register struct frame
*f
= make_frame (0);
281 register Lisp_Object mini_window
;
282 register Lisp_Object frame
;
284 XSET (frame
, Lisp_Frame
, f
);
289 f
->wants_modeline
= 0;
290 f
->has_minibuffer
= 1;
292 /* Now label the root window as also being the minibuffer.
293 Avoid infinite looping on the window chain by marking next pointer
296 mini_window
= f
->minibuffer_window
= f
->root_window
;
297 XWINDOW (mini_window
)->mini_p
= Qt
;
298 XWINDOW (mini_window
)->next
= Qnil
;
299 XWINDOW (mini_window
)->prev
= Qnil
;
300 XWINDOW (mini_window
)->frame
= frame
;
302 /* Put the proper buffer in that window. */
304 Fset_window_buffer (mini_window
,
305 (NILP (Vminibuffer_list
)
307 : Fcar (Vminibuffer_list
)));
311 /* Construct a frame that refers to the terminal (stdin and stdout). */
314 make_terminal_frame ()
316 register struct frame
*f
;
322 XSET (frame
, Lisp_Frame
, f
);
323 Vframe_list
= Fcons (frame
, Vframe_list
);
325 f
->name
= build_string ("terminal");
326 FRAME_SET_VISIBLE (f
, 1);
327 f
->display
.nothing
= 1; /* Nonzero means frame isn't deleted. */
328 XSET (Vterminal_frame
, Lisp_Frame
, f
);
332 DEFUN ("select-frame", Fselect_frame
, Sselect_frame
, 1, 2, "e",
333 "Select the frame FRAME.\n\
334 Subsequent editing commands apply to its selected window.\n\
335 The selection of FRAME lasts until the next time the user does\n\
336 something to select a different frame, or until the next time this\n\
337 function is called.")
339 Lisp_Object frame
, no_enter
;
341 return Fhandle_switch_frame (frame
, no_enter
);
345 DEFUN ("handle-switch-frame", Fhandle_switch_frame
, Shandle_switch_frame
, 1, 2, "e",
346 "Handle a switch-frame event EVENT.\n\
347 Switch-frame events are usually bound to this function.\n\
348 A switch-frame event tells Emacs that the window manager has requested\n\
349 that the user's events be directed to the frame mentioned in the event.\n\
350 This function selects the selected window of the frame of EVENT.\n\
352 If EVENT is frame object, handle it as if it were a switch-frame event\n\
355 Lisp_Object frame
, no_enter
;
357 /* If FRAME is a switch-frame event, extract the frame we should
360 && EQ (XCONS (frame
)->car
, Qswitch_frame
)
361 && CONSP (XCONS (frame
)->cdr
))
362 frame
= XCONS (XCONS (frame
)->cdr
)->car
;
364 CHECK_LIVE_FRAME (frame
, 0);
366 if (selected_frame
== XFRAME (frame
))
369 /* If a frame's focus has been redirected toward the currently
370 selected frame, we should change the redirection to point to the
371 newly selected frame. This means that if the focus is redirected
372 from a minibufferless frame to a surrogate minibuffer frame, we
373 can use `other-window' to switch between all the frames using
374 that minibuffer frame, and the focus redirection will follow us
379 for (tail
= Vframe_list
; CONSP (tail
); tail
= XCONS (tail
)->cdr
)
383 if (XTYPE (XCONS (tail
)->car
) != Lisp_Frame
)
386 focus
= FRAME_FOCUS_FRAME (XFRAME (XCONS (tail
)->car
));
388 if (XTYPE (focus
) == Lisp_Frame
389 && XFRAME (focus
) == selected_frame
)
390 Fredirect_frame_focus (XCONS (tail
)->car
, frame
);
394 selected_frame
= XFRAME (frame
);
395 if (! FRAME_MINIBUF_ONLY_P (selected_frame
))
396 last_nonminibuf_frame
= selected_frame
;
398 Fselect_window (XFRAME (frame
)->selected_window
);
399 choose_minibuf_frame ();
401 /* We want to make sure that the next event generates a frame-switch
402 event to the appropriate frame. This seems kludgy to me, but
403 before you take it out, make sure that evaluating something like
404 (select-window (frame-root-window (new-frame))) doesn't end up
405 with your typing being interpreted in the new frame instead of
406 the one you're actually typing in. */
407 internal_last_event_frame
= Qnil
;
412 DEFUN ("selected-frame", Fselected_frame
, Sselected_frame
, 0, 0, 0,
413 "Return the frame that is now selected.")
417 XSET (tem
, Lisp_Frame
, selected_frame
);
421 DEFUN ("window-frame", Fwindow_frame
, Swindow_frame
, 1, 1, 0,
422 "Return the frame object that window WINDOW is on.")
426 CHECK_LIVE_WINDOW (window
, 0);
427 return XWINDOW (window
)->frame
;
430 DEFUN ("frame-root-window", Fframe_root_window
, Sframe_root_window
, 0, 1, 0,
431 "Returns the root-window of FRAME.\n\
432 If omitted, FRAME defaults to the currently selected frame.")
437 XSET (frame
, Lisp_Frame
, selected_frame
);
439 CHECK_LIVE_FRAME (frame
, 0);
441 return XFRAME (frame
)->root_window
;
444 DEFUN ("frame-selected-window", Fframe_selected_window
,
445 Sframe_selected_window
, 0, 1, 0,
446 "Return the selected window of frame object FRAME.\n\
447 If omitted, FRAME defaults to the currently selected frame.")
452 XSET (frame
, Lisp_Frame
, selected_frame
);
454 CHECK_LIVE_FRAME (frame
, 0);
456 return XFRAME (frame
)->selected_window
;
459 DEFUN ("frame-list", Fframe_list
, Sframe_list
,
461 "Return a list of all frames.")
464 return Fcopy_sequence (Vframe_list
);
467 /* Return the next frame in the frame list after FRAME.
468 If MINIBUF is nil, exclude minibuffer-only frames.
469 If MINIBUF is a window, include only frames using that window for
471 If MINIBUF is non-nil, and not a window, include all frames. */
473 next_frame (frame
, minibuf
)
480 /* There must always be at least one frame in Vframe_list. */
481 if (! CONSP (Vframe_list
))
484 /* If this frame is dead, it won't be in Vframe_list, and we'll loop
485 forever. Forestall that. */
486 CHECK_LIVE_FRAME (frame
, 0);
489 for (tail
= Vframe_list
; CONSP (tail
); tail
= XCONS (tail
)->cdr
)
491 Lisp_Object f
= XCONS (tail
)->car
;
495 /* Decide whether this frame is eligible to be returned. */
497 /* If we've looped all the way around without finding any
498 eligible frames, return the original frame. */
502 /* Let minibuf decide if this frame is acceptable. */
505 if (! FRAME_MINIBUF_ONLY_P (XFRAME (f
)))
508 else if (XTYPE (minibuf
) == Lisp_Window
)
510 if (EQ (FRAME_MINIBUF_WINDOW (XFRAME (f
)), minibuf
))
522 /* Return the previous frame in the frame list before FRAME.
523 If MINIBUF is nil, exclude minibuffer-only frames.
524 If MINIBUF is a window, include only frames using that window for
526 If MINIBUF is non-nil and not a window, include all frames. */
528 prev_frame (frame
, minibuf
)
535 /* There must always be at least one frame in Vframe_list. */
536 if (! CONSP (Vframe_list
))
540 for (tail
= Vframe_list
; CONSP (tail
); tail
= XCONS (tail
)->cdr
)
542 Lisp_Object f
= XCONS (tail
)->car
;
544 if (XTYPE (f
) != Lisp_Frame
)
547 if (EQ (frame
, f
) && !NILP (prev
))
550 /* Decide whether this frame is eligible to be returned,
551 according to minibuf. */
554 if (! FRAME_MINIBUF_ONLY_P (XFRAME (f
)))
557 else if (XTYPE (minibuf
) == Lisp_Window
)
559 if (EQ (FRAME_MINIBUF_WINDOW (XFRAME (f
)), minibuf
))
566 /* We've scanned the entire list. */
568 /* We went through the whole frame list without finding a single
569 acceptable frame. Return the original frame. */
572 /* There were no acceptable frames in the list before FRAME; otherwise,
573 we would have returned directly from the loop. Since PREV is the last
574 acceptable frame in the list, return it. */
579 DEFUN ("next-frame", Fnext_frame
, Snext_frame
, 0, 2, 0,
580 "Return the next frame in the frame list after FRAME.\n\
581 By default, skip minibuffer-only frames.\n\
582 If omitted, FRAME defaults to the selected frame.\n\
583 If optional argument MINIFRAME is nil, exclude minibuffer-only frames.\n\
584 If MINIFRAME is a window, include only frames using that window for their\n\
586 If MINIFRAME is non-nil and not a window, include all frames.")
588 Lisp_Object frame
, miniframe
;
593 XSET (frame
, Lisp_Frame
, selected_frame
);
595 CHECK_LIVE_FRAME (frame
, 0);
597 return next_frame (frame
, miniframe
);
600 DEFUN ("previous-frame", Fprevious_frame
, Sprevious_frame
, 0, 2, 0,
601 "Return the previous frame in the frame list before FRAME.\n\
602 By default, skip minibuffer-only frames.\n\
603 If omitted, FRAME defaults to the selected frame.\n\
604 If optional argument MINIFRAME is nil, exclude minibuffer-only frames.\n\
605 If MINIFRAME is a window, include only frames using that window for their\n\
607 If MINIFRAME is non-nil and not a window, include all frames.")
609 Lisp_Object frame
, miniframe
;
614 XSET (frame
, Lisp_Frame
, selected_frame
);
616 CHECK_LIVE_FRAME (frame
, 0);
618 return prev_frame (frame
, miniframe
);
621 DEFUN ("delete-frame", Fdelete_frame
, Sdelete_frame
, 0, 2, "",
622 "Delete FRAME, permanently eliminating it from use.\n\
623 If omitted, FRAME defaults to the selected frame.\n\
624 A frame may not be deleted if its minibuffer is used by other frames.\n\
625 Normally, you may not delete a frame if all other frames are invisible,\n\
626 but if the second optional argument FORCE is non-nil, you may do so.")
628 Lisp_Object frame
, force
;
632 if (EQ (frame
, Qnil
))
635 XSET (frame
, Lisp_Frame
, f
);
639 CHECK_FRAME (frame
, 0);
643 if (! FRAME_LIVE_P (f
))
646 /* If all other frames are invisible, refuse to delete.
647 (Exception: allow deleting the terminal frame when using X.) */
648 if (f
== selected_frame
&& NILP (force
))
653 for (frames
= Vframe_list
;
655 frames
= XCONS (frames
)->cdr
)
657 Lisp_Object
this = XCONS (frames
)->car
;
659 #ifdef HAVE_X_WINDOWS
660 if (FRAME_X_P (XFRAME (this)))
663 FRAME_SAMPLE_VISIBILITY (XFRAME (this));
667 if (FRAME_VISIBLE_P (XFRAME (this))
668 || FRAME_ICONIFIED_P (XFRAME (this))
669 /* Allow deleting the terminal frame when at least
670 one X frame exists! */
671 || (FRAME_X_P (XFRAME (this)) && !FRAME_X_P (f
)))
675 error ("Attempt to delete the only frame");
678 /* Does this frame have a minibuffer, and is it the surrogate
679 minibuffer for any other frame? */
680 if (FRAME_HAS_MINIBUF_P (XFRAME (frame
)))
684 for (frames
= Vframe_list
;
686 frames
= XCONS (frames
)->cdr
)
688 Lisp_Object
this = XCONS (frames
)->car
;
690 if (! EQ (this, frame
)
694 (FRAME_MINIBUF_WINDOW
696 error ("Attempt to delete a surrogate minibuffer frame");
700 /* Don't let the frame remain selected. */
701 if (f
== selected_frame
)
702 Fhandle_switch_frame (next_frame (frame
, Qt
), Qnil
);
704 /* Don't allow minibuf_window to remain on a deleted frame. */
705 if (EQ (f
->minibuffer_window
, minibuf_window
))
707 Fset_window_buffer (selected_frame
->minibuffer_window
,
708 XWINDOW (minibuf_window
)->buffer
);
709 minibuf_window
= selected_frame
->minibuffer_window
;
712 /* Mark all the windows that used to be on FRAME as deleted, and then
713 remove the reference to them. */
714 delete_all_subwindows (XWINDOW (f
->root_window
));
715 f
->root_window
= Qnil
;
717 Vframe_list
= Fdelq (frame
, Vframe_list
);
718 FRAME_SET_VISIBLE (f
, 0);
720 /* Since some events are handled at the interrupt level, we may get
721 an event for f at any time; if we zero out the frame's display
722 now, then we may trip up the event-handling code. Instead, we'll
723 promise that the display of the frame must be valid until we have
724 called the window-system-dependent frame destruction routine. */
726 /* I think this should be done with a hook. */
727 #ifdef HAVE_X_WINDOWS
729 x_destroy_window (f
);
732 f
->display
.nothing
= 0;
734 /* If we've deleted the last_nonminibuf_frame, then try to find
736 if (f
== last_nonminibuf_frame
)
740 last_nonminibuf_frame
= 0;
742 for (frames
= Vframe_list
;
744 frames
= XCONS (frames
)->cdr
)
746 f
= XFRAME (XCONS (frames
)->car
);
747 if (!FRAME_MINIBUF_ONLY_P (f
))
749 last_nonminibuf_frame
= f
;
755 /* If we've deleted Vdefault_minibuffer_frame, try to find another
756 one. Prefer minibuffer-only frames, but also notice frames
757 with other windows. */
758 if (EQ (frame
, Vdefault_minibuffer_frame
))
762 /* The last frame we saw with a minibuffer, minibuffer-only or not. */
763 Lisp_Object frame_with_minibuf
= Qnil
;
765 for (frames
= Vframe_list
;
767 frames
= XCONS (frames
)->cdr
)
769 Lisp_Object
this = XCONS (frames
)->car
;
771 if (XTYPE (this) != Lisp_Frame
)
775 if (FRAME_HAS_MINIBUF_P (f
))
777 frame_with_minibuf
= this;
778 if (FRAME_MINIBUF_ONLY_P (f
))
783 /* We know that there must be some frame with a minibuffer out
784 there. If this were not true, all of the frames present
785 would have to be minibufferless, which implies that at some
786 point their minibuffer frames must have been deleted, but
787 that is prohibited at the top; you can't delete surrogate
788 minibuffer frames. */
789 if (NILP (frame_with_minibuf
))
792 Vdefault_minibuffer_frame
= frame_with_minibuf
;
798 /* Return mouse position in character cell units. */
800 DEFUN ("mouse-position", Fmouse_position
, Smouse_position
, 0, 0, 0,
801 "Return a list (FRAME X . Y) giving the current mouse frame and position.\n\
802 The position is given in character cells, where (0, 0) is the\n\
803 upper-left corner.\n\
804 If Emacs is running on a mouseless terminal or hasn't been programmed\n\
805 to read the mouse position, it returns the selected frame for FRAME\n\
806 and nil for X and Y.")
810 Lisp_Object lispy_dummy
;
811 enum scroll_bar_part party_dummy
;
813 unsigned long long_dummy
;
818 /* It's okay for the hook to refrain from storing anything. */
819 if (mouse_position_hook
)
820 (*mouse_position_hook
) (&f
,
821 &lispy_dummy
, &party_dummy
,
825 XSET (lispy_dummy
, Lisp_Frame
, f
);
826 return Fcons (lispy_dummy
, Fcons (x
, y
));
829 DEFUN ("set-mouse-position", Fset_mouse_position
, Sset_mouse_position
, 3, 3, 0,
830 "Move the mouse pointer to the center of character cell (X,Y) in FRAME.\n\
831 WARNING: If you use this under X, you should do `unfocus-frame' afterwards.")
833 Lisp_Object frame
, x
, y
;
835 CHECK_LIVE_FRAME (frame
, 0);
839 /* I think this should be done with a hook. */
840 #ifdef HAVE_X_WINDOWS
841 if (FRAME_X_P (XFRAME (frame
)))
842 /* Warping the mouse will cause enternotify and focus events. */
843 x_set_mouse_position (XFRAME (frame
), x
, y
);
849 DEFUN ("make-frame-visible", Fmake_frame_visible
, Smake_frame_visible
,
851 "Make the frame FRAME visible (assuming it is an X-window).\n\
852 If omitted, FRAME defaults to the currently selected frame.")
857 XSET (frame
, Lisp_Frame
, selected_frame
);
859 CHECK_LIVE_FRAME (frame
, 0);
861 /* I think this should be done with a hook. */
862 #ifdef HAVE_X_WINDOWS
863 if (FRAME_X_P (XFRAME (frame
)))
865 FRAME_SAMPLE_VISIBILITY (XFRAME (frame
));
866 x_make_frame_visible (XFRAME (frame
));
873 DEFUN ("make-frame-invisible", Fmake_frame_invisible
, Smake_frame_invisible
,
875 "Make the frame FRAME invisible (assuming it is an X-window).\n\
876 If omitted, FRAME defaults to the currently selected frame.")
881 XSET (frame
, Lisp_Frame
, selected_frame
);
883 CHECK_LIVE_FRAME (frame
, 0);
885 /* Don't let the frame remain selected. */
886 if (XFRAME (frame
) == selected_frame
)
887 Fhandle_switch_frame (next_frame (frame
, Qt
), Qnil
);
889 /* Don't allow minibuf_window to remain on a deleted frame. */
890 if (EQ (XFRAME (frame
)->minibuffer_window
, minibuf_window
))
892 Fset_window_buffer (selected_frame
->minibuffer_window
,
893 XWINDOW (minibuf_window
)->buffer
);
894 minibuf_window
= selected_frame
->minibuffer_window
;
897 /* I think this should be done with a hook. */
898 #ifdef HAVE_X_WINDOWS
899 if (FRAME_X_P (XFRAME (frame
)))
900 x_make_frame_invisible (XFRAME (frame
));
906 DEFUN ("iconify-frame", Ficonify_frame
, Siconify_frame
,
908 "Make the frame FRAME into an icon.\n\
909 If omitted, FRAME defaults to the currently selected frame.")
914 XSET (frame
, Lisp_Frame
, selected_frame
);
916 CHECK_LIVE_FRAME (frame
, 0);
918 /* Don't let the frame remain selected. */
919 if (XFRAME (frame
) == selected_frame
)
920 Fhandle_switch_frame (next_frame (frame
, Qt
), Qnil
);
922 /* Don't allow minibuf_window to remain on a deleted frame. */
923 if (EQ (XFRAME (frame
)->minibuffer_window
, minibuf_window
))
925 Fset_window_buffer (selected_frame
->minibuffer_window
,
926 XWINDOW (minibuf_window
)->buffer
);
927 minibuf_window
= selected_frame
->minibuffer_window
;
930 /* I think this should be done with a hook. */
931 #ifdef HAVE_X_WINDOWS
932 if (FRAME_X_P (XFRAME (frame
)))
933 x_iconify_frame (XFRAME (frame
));
939 DEFUN ("frame-visible-p", Fframe_visible_p
, Sframe_visible_p
,
941 "Return t if FRAME is now \"visible\" (actually in use for display).\n\
942 A frame that is not \"visible\" is not updated and, if it works through\n\
943 a window system, it may not show at all.\n\
944 Return the symbol `icon' if frame is visible only as an icon.")
948 CHECK_LIVE_FRAME (frame
, 0);
950 if (FRAME_VISIBLE_P (XFRAME (frame
)))
952 if (FRAME_ICONIFIED_P (XFRAME (frame
)))
957 DEFUN ("visible-frame-list", Fvisible_frame_list
, Svisible_frame_list
,
959 "Return a list of all frames now \"visible\" (being updated).")
962 Lisp_Object tail
, frame
;
967 for (tail
= Vframe_list
; CONSP (tail
); tail
= XCONS (tail
)->cdr
)
969 frame
= XCONS (tail
)->car
;
970 if (XTYPE (frame
) != Lisp_Frame
)
973 if (FRAME_VISIBLE_P (f
))
974 value
= Fcons (frame
, value
);
980 DEFUN ("raise-frame", Fraise_frame
, Sraise_frame
, 1, 1, 0,
981 "Bring FRAME to the front, so it occludes any frames it overlaps.\n\
982 If FRAME is invisible, make it visible.\n\
983 If Emacs is displaying on an ordinary terminal or some other device which\n\
984 doesn't support multiple overlapping frames, this function does nothing.")
988 CHECK_LIVE_FRAME (frame
, 0);
990 /* Do like the documentation says. */
991 Fmake_frame_visible (frame
);
993 if (frame_raise_lower_hook
)
994 (*frame_raise_lower_hook
) (XFRAME (frame
), 1);
999 /* Should we have a corresponding function called Flower_Power? */
1000 DEFUN ("lower-frame", Flower_frame
, Slower_frame
, 1, 1, 0,
1001 "Send FRAME to the back, so it is occluded by any frames that overlap it.\n\
1002 If Emacs is displaying on an ordinary terminal or some other device which\n\
1003 doesn't support multiple overlapping frames, this function does nothing.")
1007 CHECK_LIVE_FRAME (frame
, 0);
1009 if (frame_raise_lower_hook
)
1010 (*frame_raise_lower_hook
) (XFRAME (frame
), 0);
1016 DEFUN ("redirect-frame-focus", Fredirect_frame_focus
, Sredirect_frame_focus
,
1018 "Arrange for keystrokes typed at FRAME to be sent to FOCUS-FRAME.\n\
1019 In other words, switch-frame events caused by events in FRAME will\n\
1020 request a switch to FOCUS-FRAME, and `last-event-frame' will be\n\
1021 FOCUS-FRAME after reading an event typed at FRAME.\n\
1023 If FOCUS-FRAME is omitted or nil, any existing redirection is\n\
1024 cancelled, and the frame again receives its own keystrokes.\n\
1026 Focus redirection is useful for temporarily redirecting keystrokes to\n\
1027 a surrogate minibuffer frame when a frame doesn't have its own\n\
1028 minibuffer window.\n\
1030 A frame's focus redirection can be changed by select-frame. If frame\n\
1031 FOO is selected, and then a different frame BAR is selected, any\n\
1032 frames redirecting their focus to FOO are shifted to redirect their\n\
1033 focus to BAR. This allows focus redirection to work properly when the\n\
1034 user switches from one frame to another using `select-window'.\n\
1036 This means that a frame whose focus is redirected to itself is treated\n\
1037 differently from a frame whose focus is redirected to nil; the former\n\
1038 is affected by select-frame, while the latter is not.\n\
1040 The redirection lasts until `redirect-frame-focus' is called to change it.")
1041 (frame
, focus_frame
)
1042 Lisp_Object frame
, focus_frame
;
1044 /* Note that we don't check for a live frame here. It's reasonable
1045 to redirect the focus of a frame you're about to delete, if you
1046 know what other frame should receive those keystrokes. */
1047 CHECK_FRAME (frame
, 0);
1049 if (! NILP (focus_frame
))
1050 CHECK_LIVE_FRAME (focus_frame
, 1);
1052 XFRAME (frame
)->focus_frame
= focus_frame
;
1054 /* I think this should be done with a hook. */
1055 #ifdef HAVE_X_WINDOWS
1056 if (!NILP (focus_frame
) && ! EQ (focus_frame
, frame
)
1057 && FRAME_X_P (XFRAME (focus_frame
)))
1058 Ffocus_frame (focus_frame
);
1061 if (frame_rehighlight_hook
)
1062 (*frame_rehighlight_hook
) ();
1068 DEFUN ("frame-focus", Fframe_focus
, Sframe_focus
, 1, 1, 0,
1069 "Return the frame to which FRAME's keystrokes are currently being sent.\n\
1070 This returns nil if FRAME's focus is not redirected.\n\
1071 See `redirect-frame-focus'.")
1075 CHECK_LIVE_FRAME (frame
, 0);
1077 return FRAME_FOCUS_FRAME (XFRAME (frame
));
1083 get_frame_param (frame
, prop
)
1084 register struct frame
*frame
;
1087 register Lisp_Object tem
;
1089 tem
= Fassq (prop
, frame
->param_alist
);
1096 store_in_alist (alistptr
, prop
, val
)
1097 Lisp_Object
*alistptr
, val
;
1100 register Lisp_Object tem
;
1102 tem
= Fassq (prop
, *alistptr
);
1104 *alistptr
= Fcons (Fcons (prop
, val
), *alistptr
);
1110 store_frame_param (f
, prop
, val
)
1112 Lisp_Object prop
, val
;
1114 register Lisp_Object tem
;
1116 tem
= Fassq (prop
, f
->param_alist
);
1118 f
->param_alist
= Fcons (Fcons (prop
, val
), f
->param_alist
);
1122 if (EQ (prop
, Qminibuffer
)
1123 && XTYPE (val
) == Lisp_Window
)
1125 if (! MINI_WINDOW_P (XWINDOW (val
)))
1126 error ("Surrogate minibuffer windows must be minibuffer windows.");
1128 if (FRAME_HAS_MINIBUF_P (f
) || FRAME_MINIBUF_ONLY_P (f
))
1129 error ("can't change the surrogate minibuffer of a frame with its own minibuffer");
1131 /* Install the chosen minibuffer window, with proper buffer. */
1132 f
->minibuffer_window
= val
;
1136 DEFUN ("frame-parameters", Fframe_parameters
, Sframe_parameters
, 0, 1, 0,
1137 "Return the parameters-alist of frame FRAME.\n\
1138 It is a list of elements of the form (PARM . VALUE), where PARM is a symbol.\n\
1139 The meaningful PARMs depend on the kind of frame.\n\
1140 If FRAME is omitted, return information on the currently selected frame.")
1147 if (EQ (frame
, Qnil
))
1151 CHECK_FRAME (frame
, 0);
1155 if (f
->display
.nothing
== 0)
1158 alist
= Fcopy_alist (f
->param_alist
);
1159 store_in_alist (&alist
, Qname
, f
->name
);
1160 store_in_alist (&alist
, Qheight
, make_number (f
->height
));
1161 store_in_alist (&alist
, Qwidth
, make_number (f
->width
));
1162 store_in_alist (&alist
, Qmodeline
, (f
->wants_modeline
? Qt
: Qnil
));
1163 store_in_alist (&alist
, Qminibuffer
,
1164 (! FRAME_HAS_MINIBUF_P (f
) ? Qnil
1165 : (FRAME_MINIBUF_ONLY_P (f
) ? Qonly
1166 : FRAME_MINIBUF_WINDOW (f
))));
1167 store_in_alist (&alist
, Qunsplittable
, (f
->no_split
? Qt
: Qnil
));
1168 store_in_alist (&alist
, Qmenu_bar_lines
, (FRAME_MENU_BAR_LINES (f
)));
1170 /* I think this should be done with a hook. */
1171 #ifdef HAVE_X_WINDOWS
1173 x_report_frame_params (f
, &alist
);
1178 DEFUN ("modify-frame-parameters", Fmodify_frame_parameters
,
1179 Smodify_frame_parameters
, 2, 2, 0,
1180 "Modify the parameters of frame FRAME according to ALIST.\n\
1181 ALIST is an alist of parameters to change and their new values.\n\
1182 Each element of ALIST has the form (PARM . VALUE), where PARM is a symbol.\n\
1183 The meaningful PARMs depend on the kind of frame; undefined PARMs are ignored.")
1185 Lisp_Object frame
, alist
;
1188 register Lisp_Object tail
, elt
, prop
, val
;
1190 if (EQ (frame
, Qnil
))
1194 CHECK_LIVE_FRAME (frame
, 0);
1198 /* I think this should be done with a hook. */
1199 #ifdef HAVE_X_WINDOWS
1202 x_set_frame_parameters (f
, alist
);
1204 for (tail
= alist
; !EQ (tail
, Qnil
); tail
= Fcdr (tail
))
1209 x_set_frame_param (f
, prop
, val
, get_frame_param (f
, prop
));
1210 store_frame_param (f
, prop
, val
);
1218 DEFUN ("frame-char-height", Fframe_char_height
, Sframe_char_height
,
1220 "Height in pixels of a line in the font in frame FRAME.\n\
1221 If FRAME is omitted, the selected frame is used.\n\
1222 For a terminal frame, the value is always 1.")
1232 CHECK_FRAME (frame
, 0);
1236 #ifdef HAVE_X_WINDOWS
1238 return make_number (x_char_height (f
));
1241 return make_number (1);
1245 DEFUN ("frame-char-width", Fframe_char_width
, Sframe_char_width
,
1247 "Width in pixels of characters in the font in frame FRAME.\n\
1248 If FRAME is omitted, the selected frame is used.\n\
1249 The width is the same for all characters, because\n\
1250 currently Emacs supports only fixed-width fonts.\n\
1251 For a terminal screen, the value is always 1.")
1261 CHECK_FRAME (frame
, 0);
1265 #ifdef HAVE_X_WINDOWS
1267 return make_number (x_char_width (f
));
1270 return make_number (1);
1273 DEFUN ("frame-pixel-height", Fframe_pixel_height
,
1274 Sframe_pixel_height
, 0, 1, 0,
1275 "Return a FRAME's height in pixels.\n\
1276 For a terminal frame, the result really gives the height in characters.\n\
1277 If FRAME is omitted, the selected frame is used.")
1287 CHECK_FRAME (frame
, 0);
1291 #ifdef HAVE_X_WINDOWS
1293 return make_number (x_pixel_height (f
));
1296 return make_number (FRAME_HEIGHT (f
));
1299 DEFUN ("frame-pixel-width", Fframe_pixel_width
,
1300 Sframe_pixel_width
, 0, 1, 0,
1301 "Return FRAME's width in pixels.\n\
1302 For a terminal frame, the result really gives the width in characters.\n\
1303 If FRAME is omitted, the selected frame is used.")
1313 CHECK_FRAME (frame
, 0);
1317 #ifdef HAVE_X_WINDOWS
1319 return make_number (x_pixel_width (f
));
1322 return make_number (FRAME_WIDTH (f
));
1325 DEFUN ("set-frame-height", Fset_frame_height
, Sset_frame_height
, 2, 3, 0,
1326 "Specify that the frame FRAME has LINES lines.\n\
1327 Optional third arg non-nil means that redisplay should use LINES lines\n\
1328 but that the idea of the actual height of the frame should not be changed.")
1329 (frame
, rows
, pretend
)
1330 Lisp_Object frame
, rows
, pretend
;
1332 register struct frame
*f
;
1334 CHECK_NUMBER (rows
, 0);
1339 CHECK_LIVE_FRAME (frame
, 0);
1343 /* I think this should be done with a hook. */
1344 #ifdef HAVE_X_WINDOWS
1347 if (XINT (rows
) != f
->width
)
1348 x_set_window_size (f
, f
->width
, XINT (rows
));
1352 change_frame_size (f
, XINT (rows
), 0, !NILP (pretend
), 0);
1356 DEFUN ("set-frame-width", Fset_frame_width
, Sset_frame_width
, 2, 3, 0,
1357 "Specify that the frame FRAME has COLS columns.\n\
1358 Optional third arg non-nil means that redisplay should use COLS columns\n\
1359 but that the idea of the actual width of the frame should not be changed.")
1360 (frame
, cols
, pretend
)
1361 Lisp_Object frame
, cols
, pretend
;
1363 register struct frame
*f
;
1364 CHECK_NUMBER (cols
, 0);
1369 CHECK_LIVE_FRAME (frame
, 0);
1373 /* I think this should be done with a hook. */
1374 #ifdef HAVE_X_WINDOWS
1377 if (XINT (cols
) != f
->width
)
1378 x_set_window_size (f
, XINT (cols
), f
->height
);
1382 change_frame_size (f
, 0, XINT (cols
), !NILP (pretend
), 0);
1386 DEFUN ("set-frame-size", Fset_frame_size
, Sset_frame_size
, 3, 3, 0,
1387 "Sets size of FRAME to COLS by ROWS, measured in characters.")
1389 Lisp_Object frame
, cols
, rows
;
1391 register struct frame
*f
;
1394 CHECK_LIVE_FRAME (frame
, 0);
1395 CHECK_NUMBER (cols
, 2);
1396 CHECK_NUMBER (rows
, 1);
1399 /* I think this should be done with a hook. */
1400 #ifdef HAVE_X_WINDOWS
1403 if (XINT (rows
) != f
->height
|| XINT (cols
) != f
->width
)
1404 x_set_window_size (f
, XINT (cols
), XINT (rows
));
1408 change_frame_size (f
, XINT (rows
), XINT (cols
), 0, 0);
1413 DEFUN ("set-frame-position", Fset_frame_position
,
1414 Sset_frame_position
, 3, 3, 0,
1415 "Sets position of FRAME in pixels to XOFFSET by YOFFSET.\n\
1416 This is actually the position of the upper left corner of the frame.\n\
1417 Negative values for XOFFSET or YOFFSET are interpreted relative to\n\
1418 the rightmost or bottommost possible position (that stays within the screen).")
1419 (frame
, xoffset
, yoffset
)
1420 Lisp_Object frame
, xoffset
, yoffset
;
1422 register struct frame
*f
;
1425 CHECK_LIVE_FRAME (frame
, 0);
1426 CHECK_NUMBER (xoffset
, 1);
1427 CHECK_NUMBER (yoffset
, 2);
1430 /* I think this should be done with a hook. */
1431 #ifdef HAVE_X_WINDOWS
1433 x_set_offset (f
, XINT (xoffset
), XINT (yoffset
));
1440 choose_minibuf_frame ()
1442 /* For lowest-level minibuf, put it on currently selected frame
1443 if frame has a minibuffer. */
1445 if (minibuf_level
== 0
1446 && selected_frame
!= 0
1447 && !EQ (minibuf_window
, selected_frame
->minibuffer_window
))
1449 /* I don't think that any frames may validly have a null minibuffer
1451 if (NILP (selected_frame
->minibuffer_window
))
1454 Fset_window_buffer (selected_frame
->minibuffer_window
,
1455 XWINDOW (minibuf_window
)->buffer
);
1456 minibuf_window
= selected_frame
->minibuffer_window
;
1462 /*&&& init symbols here &&&*/
1463 Qframep
= intern ("framep");
1464 staticpro (&Qframep
);
1465 Qframe_live_p
= intern ("frame-live-p");
1466 staticpro (&Qframe_live_p
);
1467 Qheight
= intern ("height");
1468 staticpro (&Qheight
);
1469 Qicon
= intern ("icon");
1471 Qminibuffer
= intern ("minibuffer");
1472 staticpro (&Qminibuffer
);
1473 Qmodeline
= intern ("modeline");
1474 staticpro (&Qmodeline
);
1475 Qname
= intern ("name");
1477 Qonly
= intern ("only");
1479 Qunsplittable
= intern ("unsplittable");
1480 staticpro (&Qunsplittable
);
1481 Qwidth
= intern ("width");
1482 staticpro (&Qwidth
);
1485 Qmenu_bar_lines
= intern ("menu-bar-lines");
1486 staticpro (&Qmenu_bar_lines
);
1488 staticpro (&Vframe_list
);
1490 DEFVAR_LISP ("terminal-frame", &Vterminal_frame
,
1491 "The initial frame-object, which represents Emacs's stdout.");
1493 DEFVAR_LISP ("emacs-iconified", &Vemacs_iconified
,
1494 "Non-nil if all of emacs is iconified and frame updates are not needed.");
1495 Vemacs_iconified
= Qnil
;
1497 DEFVAR_LISP ("default-minibuffer-frame", &Vdefault_minibuffer_frame
,
1498 "Minibufferless frames use this frame's minibuffer.\n\
1500 Emacs cannot create minibufferless frames unless this is set to an\n\
1501 appropriate surrogate.\n\
1503 Emacs consults this variable only when creating minibufferless\n\
1504 frames; once the frame is created, it sticks with its assigned\n\
1505 minibuffer, no matter what this variable is set to. This means that\n\
1506 this variable doesn't necessarily say anything meaningful about the\n\
1507 current set of frames, or where the minibuffer is currently being\n\
1509 Vdefault_minibuffer_frame
= Qnil
;
1511 DEFVAR_LISP ("default-frame-alist", &Vdefault_frame_alist
,
1512 "Alist of default values for frame creation.\n\
1513 These may be set in your init file, like this:\n\
1514 (setq default-frame-alist '((width . 80) (height . 55)))\n\
1515 These override values given in window system configuration data, like\n\
1516 X Windows' defaults database.\n\
1517 For values specific to the first Emacs frame, see `initial-frame-alist'.\n\
1518 For values specific to the separate minibuffer frame, see\n\
1519 `minibuffer-frame-alist'.");
1520 Vdefault_frame_alist
= Qnil
;
1523 defsubr (&Sframe_live_p
);
1524 defsubr (&Shandle_switch_frame
);
1525 defsubr (&Sselect_frame
);
1526 defsubr (&Sselected_frame
);
1527 defsubr (&Swindow_frame
);
1528 defsubr (&Sframe_root_window
);
1529 defsubr (&Sframe_selected_window
);
1530 defsubr (&Sframe_list
);
1531 defsubr (&Snext_frame
);
1532 defsubr (&Sprevious_frame
);
1533 defsubr (&Sdelete_frame
);
1534 defsubr (&Smouse_position
);
1535 defsubr (&Sset_mouse_position
);
1537 defsubr (&Sframe_configuration
);
1538 defsubr (&Srestore_frame_configuration
);
1540 defsubr (&Smake_frame_visible
);
1541 defsubr (&Smake_frame_invisible
);
1542 defsubr (&Siconify_frame
);
1543 defsubr (&Sframe_visible_p
);
1544 defsubr (&Svisible_frame_list
);
1545 defsubr (&Sraise_frame
);
1546 defsubr (&Slower_frame
);
1547 defsubr (&Sredirect_frame_focus
);
1548 defsubr (&Sframe_focus
);
1549 defsubr (&Sframe_parameters
);
1550 defsubr (&Smodify_frame_parameters
);
1551 defsubr (&Sframe_char_height
);
1552 defsubr (&Sframe_char_width
);
1553 defsubr (&Sframe_pixel_height
);
1554 defsubr (&Sframe_pixel_width
);
1555 defsubr (&Sset_frame_height
);
1556 defsubr (&Sset_frame_width
);
1557 defsubr (&Sset_frame_size
);
1558 defsubr (&Sset_frame_position
);
1563 initial_define_lispy_key (global_map
, "switch-frame", "handle-switch-frame");
1566 #else /* not MULTI_FRAME */
1568 /* If we're not using multi-frame stuff, we still need to provide some
1569 support functions. */
1571 /* Unless this function is defined, providing set-frame-height and
1572 set-frame-width doesn't help compatibility any, since they both
1573 want this as their first argument. */
1574 DEFUN ("selected-frame", Fselected_frame
, Sselected_frame
, 0, 0, 0,
1575 "Return the frame that is now selected.")
1582 DEFUN ("framep", Fframep
, Sframep
, 1, 1, 0,
1583 "Return non-nil if OBJECT is a frame.\n\
1584 Value is t for a termcap frame (a character-only terminal),\n\
1585 `x' for an Emacs frame that is really an X window.\n\
1586 Also see `live-frame-p'.")
1593 DEFUN ("set-frame-height", Fset_frame_height
, Sset_frame_height
, 2, 3, 0,
1594 "Specify that the frame FRAME has LINES lines.\n\
1595 Optional third arg non-nil means that redisplay should use LINES lines\n\
1596 but that the idea of the actual height of the frame should not be changed.")
1597 (frame
, rows
, pretend
)
1598 Lisp_Object frame
, rows
, pretend
;
1600 CHECK_NUMBER (rows
, 0);
1602 change_frame_size (0, XINT (rows
), 0, !NILP (pretend
), 0);
1606 DEFUN ("set-frame-width", Fset_frame_width
, Sset_frame_width
, 2, 3, 0,
1607 "Specify that the frame FRAME has COLS columns.\n\
1608 Optional third arg non-nil means that redisplay should use COLS columns\n\
1609 but that the idea of the actual width of the frame should not be changed.")
1610 (frame
, cols
, pretend
)
1611 Lisp_Object frame
, cols
, pretend
;
1613 CHECK_NUMBER (cols
, 0);
1615 change_frame_size (0, 0, XINT (cols
), !NILP (pretend
), 0);
1619 DEFUN ("set-frame-size", Fset_frame_size
, Sset_frame_size
, 3, 3, 0,
1620 "Sets size of FRAME to COLS by ROWS, measured in characters.")
1622 Lisp_Object frame
, cols
, rows
;
1624 CHECK_NUMBER (cols
, 2);
1625 CHECK_NUMBER (rows
, 1);
1627 change_frame_size (0, XINT (rows
), XINT (cols
), 0, 0);
1632 DEFUN ("frame-height", Fframe_height
, Sframe_height
, 0, 1, 0,
1633 "Return number of lines available for display on FRAME.\n\
1634 If FRAME is omitted, describe the currently selected frame.")
1638 return make_number (FRAME_HEIGHT (selected_frame
));
1641 DEFUN ("frame-width", Fframe_width
, Sframe_width
, 0, 1, 0,
1642 "Return number of columns available for display on FRAME.\n\
1643 If FRAME is omitted, describe the currently selected frame.")
1647 return make_number (FRAME_WIDTH (selected_frame
));
1650 DEFUN ("frame-char-height", Fframe_char_height
, Sframe_char_height
,
1652 "Height in pixels of a line in the font in frame FRAME.\n\
1653 If FRAME is omitted, the selected frame is used.\n\
1654 For a terminal frame, the value is always 1.")
1658 return make_number (1);
1662 DEFUN ("frame-char-width", Fframe_char_width
, Sframe_char_width
,
1664 "Width in pixels of characters in the font in frame FRAME.\n\
1665 If FRAME is omitted, the selected frame is used.\n\
1666 The width is the same for all characters, because\n\
1667 currently Emacs supports only fixed-width fonts.\n\
1668 For a terminal screen, the value is always 1.")
1672 return make_number (1);
1675 DEFUN ("frame-pixel-height", Fframe_pixel_height
,
1676 Sframe_pixel_height
, 0, 1, 0,
1677 "Return FRAME's height in pixels.\n\
1678 For a terminal frame, the result really gives the height in characters.\n\
1679 If FRAME is omitted, the selected frame is used.")
1683 return make_number (FRAME_HEIGHT (f
));
1686 DEFUN ("frame-pixel-width", Fframe_pixel_width
,
1687 Sframe_pixel_width
, 0, 1, 0,
1688 "Return FRAME's width in pixels.\n\
1689 For a terminal frame, the result really gives the width in characters.\n\
1690 If FRAME is omitted, the selected frame is used.")
1694 return make_number (FRAME_WIDTH (f
));
1697 /* These are for backward compatibility with Emacs 18. */
1699 DEFUN ("set-screen-height", Fset_screen_height
, Sset_screen_height
, 1, 2, 0,
1700 "Tell redisplay that the screen has LINES lines.\n\
1701 Optional second arg non-nil means that redisplay should use LINES lines\n\
1702 but that the idea of the actual height of the screen should not be changed.")
1704 Lisp_Object lines
, pretend
;
1706 CHECK_NUMBER (lines
, 0);
1708 change_frame_size (0, XINT (lines
), 0, !NILP (pretend
), 0);
1712 DEFUN ("set-screen-width", Fset_screen_width
, Sset_screen_width
, 1, 2, 0,
1713 "Tell redisplay that the screen has COLS columns.\n\
1714 Optional second arg non-nil means that redisplay should use COLS columns\n\
1715 but that the idea of the actual width of the screen should not be changed.")
1717 Lisp_Object cols
, pretend
;
1719 CHECK_NUMBER (cols
, 0);
1721 change_frame_size (0, 0, XINT (cols
), !NILP (pretend
), 0);
1725 DEFUN ("mouse-position", Fmouse_position
, Smouse_position
, 0, 0, 0,
1726 "Return a list (FRAME X . Y) giving the current mouse frame and position.\n\
1727 The position is given in character cells, where (0, 0) is the\n\
1728 upper-left corner.\n\
1729 If Emacs is running on a mouseless terminal or hasn't been programmed\n\
1730 to read the mouse position, it returns the selected frame for FRAME\n\
1731 and nil for X and Y.")
1735 Lisp_Object lispy_dummy
;
1736 enum scroll_bar_part party_dummy
;
1738 unsigned long long_dummy
;
1743 /* It's okay for the hook to refrain from storing anything. */
1744 if (mouse_position_hook
)
1745 (*mouse_position_hook
) (&f
,
1746 &lispy_dummy
, &party_dummy
,
1750 /* Always return nil for frame. */
1751 return Fcons (Qnil
, Fcons (x
, y
));
1756 defsubr (&Sselected_frame
);
1758 defsubr (&Sframe_char_height
);
1759 defsubr (&Sframe_char_width
);
1760 defsubr (&Sframe_pixel_height
);
1761 defsubr (&Sframe_pixel_width
);
1762 defsubr (&Sset_frame_height
);
1763 defsubr (&Sset_frame_width
);
1764 defsubr (&Sset_frame_size
);
1765 defsubr (&Sset_screen_height
);
1766 defsubr (&Sset_screen_width
);
1767 defsubr (&Sframe_height
);
1768 Ffset (intern ("screen-height"), intern ("frame-height"));
1769 defsubr (&Sframe_width
);
1770 Ffset (intern ("screen-width"), intern ("frame-width"));
1771 defsubr (&Smouse_position
);
1778 #endif /* not MULTI_FRAME */