1 /* Generic frame functions.
2 Copyright (C) 1993, 1994, 1995 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, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
26 #include "termhooks.h"
32 /* Evaluate this expression to rebuild the section of syms_of_frame
33 that initializes and staticpros the symbols declared below. Note
34 that Emacs 18 has a bug that keeps C-x C-e from being able to
35 evaluate this expression.
38 ;; Accumulate a list of the symbols we want to initialize from the
39 ;; declarations at the top of the file.
40 (goto-char (point-min))
41 (search-forward "/\*&&& symbols declared here &&&*\/\n")
43 (while (looking-at "Lisp_Object \\(Q[a-z_]+\\)")
45 (cons (buffer-substring (match-beginning 1) (match-end 1))
48 (setq symbol-list (nreverse symbol-list))
49 ;; Delete the section of syms_of_... where we initialize the symbols.
50 (search-forward "\n /\*&&& init symbols here &&&*\/\n")
51 (let ((start (point)))
52 (while (looking-at "^ Q")
54 (kill-region start (point)))
55 ;; Write a new symbol initialization section.
57 (insert (format " %s = intern (\"" (car symbol-list)))
58 (let ((start (point)))
59 (insert (substring (car symbol-list) 1))
60 (subst-char-in-region start (point) ?_ ?-))
61 (insert (format "\");\n staticpro (&%s);\n" (car symbol-list)))
62 (setq symbol-list (cdr symbol-list)))))
65 /* We need most of these symbols even if not MULTI_FRAME;
66 easiest to define them all, all of the time. */
67 /*&&& symbols declared here &&&*/
69 Lisp_Object Qframe_live_p
;
72 Lisp_Object Qminibuffer
;
73 Lisp_Object Qmodeline
;
76 Lisp_Object Qunsplittable
;
77 Lisp_Object Qmenu_bar_lines
;
82 Lisp_Object Qbuffer_predicate
;
85 Lisp_Object Vterminal_frame
;
86 Lisp_Object Vdefault_frame_alist
;
88 Lisp_Object Qmouse_leave_buffer_hook
;
93 /*&&& init symbols here &&&*/
94 Qframep
= intern ("framep");
96 Qframe_live_p
= intern ("frame-live-p");
97 staticpro (&Qframe_live_p
);
98 Qheight
= intern ("height");
100 Qicon
= intern ("icon");
102 Qminibuffer
= intern ("minibuffer");
103 staticpro (&Qminibuffer
);
104 Qmodeline
= intern ("modeline");
105 staticpro (&Qmodeline
);
106 Qname
= intern ("name");
108 Qonly
= intern ("only");
110 Qunsplittable
= intern ("unsplittable");
111 staticpro (&Qunsplittable
);
112 Qmenu_bar_lines
= intern ("menu-bar-lines");
113 staticpro (&Qmenu_bar_lines
);
114 Qwidth
= intern ("width");
118 Qwin32
= intern ("win32");
120 Qvisible
= intern ("visible");
121 staticpro (&Qvisible
);
122 Qbuffer_predicate
= intern ("buffer-predicate");
123 staticpro (&Qbuffer_predicate
);
124 Qtitle
= intern ("title");
127 Qmouse_leave_buffer_hook
= intern ("mouse-leave-buffer-hook");
128 staticpro (&Qmouse_leave_buffer_hook
);
130 DEFVAR_LISP ("default-frame-alist", &Vdefault_frame_alist
,
131 "Alist of default values for frame creation.\n\
132 These may be set in your init file, like this:\n\
133 (setq default-frame-alist '((width . 80) (height . 55) (menu-bar-lines . 1))\n\
134 These override values given in window system configuration data,\n\
135 including X Windows' defaults database.\n\
136 For values specific to the first Emacs frame, see `initial-frame-alist'.\n\
137 For values specific to the separate minibuffer frame, see\n\
138 `minibuffer-frame-alist'.\n\
139 The `menu-bar-lines' element of the list controls whether new frames\n\
140 have menu bars; `menu-bar-mode' works by altering this element.");
141 Vdefault_frame_alist
= Qnil
;
145 set_menu_bar_lines_1 (window
, n
)
149 struct window
*w
= XWINDOW (window
);
151 XSETFASTINT (w
->last_modified
, 0);
152 XSETFASTINT (w
->top
, XFASTINT (w
->top
) + n
);
153 XSETFASTINT (w
->height
, XFASTINT (w
->height
) - n
);
155 /* Handle just the top child in a vertical split. */
156 if (!NILP (w
->vchild
))
157 set_menu_bar_lines_1 (w
->vchild
, n
);
159 /* Adjust all children in a horizontal split. */
160 for (window
= w
->hchild
; !NILP (window
); window
= w
->next
)
162 w
= XWINDOW (window
);
163 set_menu_bar_lines_1 (window
, n
);
168 set_menu_bar_lines (f
, value
, oldval
)
170 Lisp_Object value
, oldval
;
173 int olines
= FRAME_MENU_BAR_LINES (f
);
175 /* Right now, menu bars don't work properly in minibuf-only frames;
176 most of the commands try to apply themselves to the minibuffer
177 frame itslef, and get an error because you can't switch buffers
178 in or split the minibuffer window. */
179 if (FRAME_MINIBUF_ONLY_P (f
))
182 if (INTEGERP (value
))
183 nlines
= XINT (value
);
187 if (nlines
!= olines
)
189 windows_or_buffers_changed
++;
190 FRAME_WINDOW_SIZES_CHANGED (f
) = 1;
191 FRAME_MENU_BAR_LINES (f
) = nlines
;
192 set_menu_bar_lines_1 (f
->root_window
, nlines
- olines
);
200 /* These help us bind and responding to switch-frame events. */
201 #include "commands.h"
202 #include "keyboard.h"
204 Lisp_Object Vemacs_iconified
;
205 Lisp_Object Vframe_list
;
207 extern Lisp_Object Vminibuffer_list
;
208 extern Lisp_Object
get_minibuffer ();
209 extern Lisp_Object
Fhandle_switch_frame ();
210 extern Lisp_Object
Fredirect_frame_focus ();
211 extern Lisp_Object
x_get_focus_frame ();
213 DEFUN ("framep", Fframep
, Sframep
, 1, 1, 0,
214 "Return non-nil if OBJECT is a frame.\n\
215 Value is t for a termcap frame (a character-only terminal),\n\
216 `x' for an Emacs frame that is really an X window,\n\
217 `pc' for a direct-write MS-DOS frame.\n\
218 See also `frame-live-p'.")
222 if (!FRAMEP (object
))
224 switch (XFRAME (object
)->output_method
)
228 case output_x_window
:
232 /* The `pc' case is in the Fframep below. */
238 DEFUN ("frame-live-p", Fframe_live_p
, Sframe_live_p
, 1, 1, 0,
239 "Return non-nil if OBJECT is a frame which has not been deleted.\n\
240 Value is nil if OBJECT is not a live frame. If object is a live\n\
241 frame, the return value indicates what sort of output device it is\n\
242 displayed on. Value is t for a termcap frame (a character-only\n\
243 terminal), `x' for an Emacs frame being displayed in an X window.")
247 return ((FRAMEP (object
)
248 && FRAME_LIVE_P (XFRAME (object
)))
258 register struct frame
*f
;
259 register Lisp_Object root_window
;
260 register Lisp_Object mini_window
;
261 register struct Lisp_Vector
*vec
;
264 vec
= allocate_vectorlike ((EMACS_INT
) VECSIZE (struct frame
));
265 for (i
= 0; i
< VECSIZE (struct frame
); i
++)
266 XSETFASTINT (vec
->contents
[i
], 0);
267 vec
->size
= VECSIZE (struct frame
);
268 f
= (struct frame
*)vec
;
269 XSETFRAME (frame
, f
);
273 f
->current_glyphs
= 0;
274 f
->desired_glyphs
= 0;
276 f
->async_visible
= 0;
277 f
->output_data
.nothing
= 0;
279 f
->async_iconified
= 0;
280 f
->wants_modeline
= 1;
285 f
->has_minibuffer
= mini_p
;
286 f
->focus_frame
= Qnil
;
287 f
->explicit_name
= 0;
288 f
->can_have_scroll_bars
= 0;
289 f
->has_vertical_scroll_bars
= 0;
290 f
->param_alist
= Qnil
;
291 f
->scroll_bars
= Qnil
;
292 f
->condemned_scroll_bars
= Qnil
;
293 f
->face_alist
= Qnil
;
294 f
->menu_bar_items
= Qnil
;
295 f
->menu_bar_vector
= Qnil
;
296 f
->menu_bar_items_used
= 0;
297 f
->buffer_predicate
= Qnil
;
299 f
->kboard
= initial_kboard
;
304 root_window
= make_window ();
307 mini_window
= make_window ();
308 XWINDOW (root_window
)->next
= mini_window
;
309 XWINDOW (mini_window
)->prev
= root_window
;
310 XWINDOW (mini_window
)->mini_p
= Qt
;
311 XWINDOW (mini_window
)->frame
= frame
;
312 f
->minibuffer_window
= mini_window
;
317 XWINDOW (root_window
)->next
= Qnil
;
318 f
->minibuffer_window
= Qnil
;
321 XWINDOW (root_window
)->frame
= frame
;
324 just so that there is "something there."
325 Correct size will be set up later with change_frame_size. */
330 XSETFASTINT (XWINDOW (root_window
)->width
, 10);
331 XSETFASTINT (XWINDOW (root_window
)->height
, (mini_p
? 9 : 10));
335 XSETFASTINT (XWINDOW (mini_window
)->width
, 10);
336 XSETFASTINT (XWINDOW (mini_window
)->top
, 9);
337 XSETFASTINT (XWINDOW (mini_window
)->height
, 1);
340 /* Choose a buffer for the frame's root window. */
344 XWINDOW (root_window
)->buffer
= Qt
;
345 buf
= Fcurrent_buffer ();
346 /* If buf is a 'hidden' buffer (i.e. one whose name starts with
347 a space), try to find another one. */
348 if (XSTRING (Fbuffer_name (buf
))->data
[0] == ' ')
349 buf
= Fother_buffer (buf
, Qnil
);
350 Fset_window_buffer (root_window
, buf
);
355 XWINDOW (mini_window
)->buffer
= Qt
;
356 Fset_window_buffer (mini_window
,
357 (NILP (Vminibuffer_list
)
359 : Fcar (Vminibuffer_list
)));
362 f
->root_window
= root_window
;
363 f
->selected_window
= root_window
;
364 /* Make sure this window seems more recently used than
365 a newly-created, never-selected window. */
366 XSETFASTINT (XWINDOW (f
->selected_window
)->use_time
, ++window_select_count
);
371 /* Make a frame using a separate minibuffer window on another frame.
372 MINI_WINDOW is the minibuffer window to use. nil means use the
373 default (the global minibuffer). */
376 make_frame_without_minibuffer (mini_window
, kb
, display
)
377 register Lisp_Object mini_window
;
381 register struct frame
*f
;
383 if (!NILP (mini_window
))
384 CHECK_LIVE_WINDOW (mini_window
, 0);
387 if (!NILP (mini_window
)
388 && XFRAME (XWINDOW (mini_window
)->frame
)->kboard
!= kb
)
389 error ("frame and minibuffer must be on the same display");
392 /* Make a frame containing just a root window. */
395 if (NILP (mini_window
))
397 /* Use default-minibuffer-frame if possible. */
398 if (!FRAMEP (kb
->Vdefault_minibuffer_frame
)
399 || ! FRAME_LIVE_P (XFRAME (kb
->Vdefault_minibuffer_frame
)))
401 /* If there's no minibuffer frame to use, create one. */
402 kb
->Vdefault_minibuffer_frame
403 = call1 (intern ("make-initial-minibuffer-frame"), display
);
405 mini_window
= XFRAME (kb
->Vdefault_minibuffer_frame
)->minibuffer_window
;
408 f
->minibuffer_window
= mini_window
;
410 /* Make the chosen minibuffer window display the proper minibuffer,
411 unless it is already showing a minibuffer. */
412 if (NILP (Fmemq (XWINDOW (mini_window
)->buffer
, Vminibuffer_list
)))
413 Fset_window_buffer (mini_window
,
414 (NILP (Vminibuffer_list
)
416 : Fcar (Vminibuffer_list
)));
420 /* Make a frame containing only a minibuffer window. */
423 make_minibuffer_frame ()
425 /* First make a frame containing just a root window, no minibuffer. */
427 register struct frame
*f
= make_frame (0);
428 register Lisp_Object mini_window
;
429 register Lisp_Object frame
;
431 XSETFRAME (frame
, f
);
436 f
->wants_modeline
= 0;
437 f
->has_minibuffer
= 1;
439 /* Now label the root window as also being the minibuffer.
440 Avoid infinite looping on the window chain by marking next pointer
443 mini_window
= f
->minibuffer_window
= f
->root_window
;
444 XWINDOW (mini_window
)->mini_p
= Qt
;
445 XWINDOW (mini_window
)->next
= Qnil
;
446 XWINDOW (mini_window
)->prev
= Qnil
;
447 XWINDOW (mini_window
)->frame
= frame
;
449 /* Put the proper buffer in that window. */
451 Fset_window_buffer (mini_window
,
452 (NILP (Vminibuffer_list
)
454 : Fcar (Vminibuffer_list
)));
458 /* Construct a frame that refers to the terminal (stdin and stdout). */
460 static int terminal_frame_count
;
463 make_terminal_frame ()
465 register struct frame
*f
;
472 initial_kboard
= (KBOARD
*) xmalloc (sizeof (KBOARD
));
473 init_kboard (initial_kboard
);
474 initial_kboard
->next_kboard
= all_kboards
;
475 all_kboards
= initial_kboard
;
479 /* The first call must initialize Vframe_list. */
480 if (! (NILP (Vframe_list
) || CONSP (Vframe_list
)))
485 XSETFRAME (frame
, f
);
486 Vframe_list
= Fcons (frame
, Vframe_list
);
488 terminal_frame_count
++;
489 if (terminal_frame_count
== 1)
491 f
->name
= build_string ("Emacs");
495 sprintf (name
, "Emacs-%d", terminal_frame_count
);
496 f
->name
= build_string (name
);
499 f
->visible
= 1; /* FRAME_SET_VISIBLE wd set frame_garbaged. */
500 f
->async_visible
= 1; /* Don't let visible be cleared later. */
501 f
->output_data
.nothing
= 1; /* Nonzero means frame isn't deleted. */
505 DEFUN ("make-terminal-frame", Fmake_terminal_frame
, Smake_terminal_frame
,
506 1, 1, 0, "Create an additional terminal frame.\n\
507 You can create multiple frames on a text-only terminal in this way.\n\
508 Only the selected terminal frame is actually displayed.\n\
509 This function takes one argument, an alist specifying frame parameters.\n\
510 In practice, generally you don't need to specify any parameters.\n\
511 Note that changing the size of one terminal frame automatically affects all.")
518 if (selected_frame
->output_method
!= output_termcap
)
519 error ("Not using an ASCII terminal now; cannot make a new ASCII frame");
521 f
= make_terminal_frame ();
522 change_frame_size (f
, FRAME_HEIGHT (selected_frame
),
523 FRAME_WIDTH (selected_frame
), 0, 0);
524 remake_frame_glyphs (f
);
526 XSETFRAME (frame
, f
);
527 Fmodify_frame_parameters (frame
, parms
);
528 f
->face_alist
= selected_frame
->face_alist
;
533 do_switch_frame (frame
, no_enter
, track
)
534 Lisp_Object frame
, no_enter
;
537 /* If FRAME is a switch-frame event, extract the frame we should
540 && EQ (XCONS (frame
)->car
, Qswitch_frame
)
541 && CONSP (XCONS (frame
)->cdr
))
542 frame
= XCONS (XCONS (frame
)->cdr
)->car
;
544 /* This used to say CHECK_LIVE_FRAME, but apparently it's possible for
545 a switch-frame event to arrive after a frame is no longer live,
546 especially when deleting the initial frame during startup. */
547 CHECK_FRAME (frame
, 0);
548 if (! FRAME_LIVE_P (XFRAME (frame
)))
551 if (selected_frame
== XFRAME (frame
))
554 /* This is too greedy; it causes inappropriate focus redirection
555 that's hard to get rid of. */
557 /* If a frame's focus has been redirected toward the currently
558 selected frame, we should change the redirection to point to the
559 newly selected frame. This means that if the focus is redirected
560 from a minibufferless frame to a surrogate minibuffer frame, we
561 can use `other-window' to switch between all the frames using
562 that minibuffer frame, and the focus redirection will follow us
568 for (tail
= Vframe_list
; CONSP (tail
); tail
= XCONS (tail
)->cdr
)
572 if (!FRAMEP (XCONS (tail
)->car
))
575 focus
= FRAME_FOCUS_FRAME (XFRAME (XCONS (tail
)->car
));
577 if (FRAMEP (focus
) && XFRAME (focus
) == selected_frame
)
578 Fredirect_frame_focus (XCONS (tail
)->car
, frame
);
582 /* Instead, apply it only to the frame we're pointing to. */
583 #ifdef HAVE_WINDOW_SYSTEM
584 if (track
&& (FRAME_WINDOW_P (XFRAME (frame
))))
586 Lisp_Object focus
, xfocus
;
588 xfocus
= x_get_focus_frame (XFRAME (frame
));
591 focus
= FRAME_FOCUS_FRAME (XFRAME (xfocus
));
592 if (FRAMEP (focus
) && XFRAME (focus
) == selected_frame
)
593 Fredirect_frame_focus (xfocus
, frame
);
596 #endif /* HAVE_X_WINDOWS */
599 selected_frame
= XFRAME (frame
);
600 if (! FRAME_MINIBUF_ONLY_P (selected_frame
))
601 last_nonminibuf_frame
= selected_frame
;
603 Fselect_window (XFRAME (frame
)->selected_window
);
605 /* We want to make sure that the next event generates a frame-switch
606 event to the appropriate frame. This seems kludgy to me, but
607 before you take it out, make sure that evaluating something like
608 (select-window (frame-root-window (new-frame))) doesn't end up
609 with your typing being interpreted in the new frame instead of
610 the one you're actually typing in. */
611 internal_last_event_frame
= Qnil
;
616 DEFUN ("select-frame", Fselect_frame
, Sselect_frame
, 1, 2, "e",
617 "Select the frame FRAME.\n\
618 Subsequent editing commands apply to its selected window.\n\
619 The selection of FRAME lasts until the next time the user does\n\
620 something to select a different frame, or until the next time this\n\
621 function is called.")
623 Lisp_Object frame
, no_enter
;
625 return do_switch_frame (frame
, no_enter
, 1);
629 DEFUN ("handle-switch-frame", Fhandle_switch_frame
, Shandle_switch_frame
, 1, 2, "e",
630 "Handle a switch-frame event EVENT.\n\
631 Switch-frame events are usually bound to this function.\n\
632 A switch-frame event tells Emacs that the window manager has requested\n\
633 that the user's events be directed to the frame mentioned in the event.\n\
634 This function selects the selected window of the frame of EVENT.\n\
636 If EVENT is frame object, handle it as if it were a switch-frame event\n\
639 Lisp_Object event
, no_enter
;
641 /* Preserve prefix arg that the command loop just cleared. */
642 current_kboard
->Vprefix_arg
= Vcurrent_prefix_arg
;
643 call1 (Vrun_hooks
, Qmouse_leave_buffer_hook
);
644 return do_switch_frame (event
, no_enter
, 0);
647 DEFUN ("ignore-event", Fignore_event
, Signore_event
, 0, 0, "",
648 "Do nothing, but preserve any prefix argument already specified.\n\
649 This is a suitable binding for iconify-frame and make-frame-visible.")
652 current_kboard
->Vprefix_arg
= Vcurrent_prefix_arg
;
656 DEFUN ("selected-frame", Fselected_frame
, Sselected_frame
, 0, 0, 0,
657 "Return the frame that is now selected.")
661 XSETFRAME (tem
, selected_frame
);
665 DEFUN ("window-frame", Fwindow_frame
, Swindow_frame
, 1, 1, 0,
666 "Return the frame object that window WINDOW is on.")
670 CHECK_LIVE_WINDOW (window
, 0);
671 return XWINDOW (window
)->frame
;
674 DEFUN ("frame-first-window", Fframe_first_window
, Sframe_first_window
, 0, 1, 0,
675 "Returns the topmost, leftmost window of FRAME.\n\
676 If omitted, FRAME defaults to the currently selected frame.")
683 w
= selected_frame
->root_window
;
686 CHECK_LIVE_FRAME (frame
, 0);
687 w
= XFRAME (frame
)->root_window
;
689 while (NILP (XWINDOW (w
)->buffer
))
691 if (! NILP (XWINDOW (w
)->hchild
))
692 w
= XWINDOW (w
)->hchild
;
693 else if (! NILP (XWINDOW (w
)->vchild
))
694 w
= XWINDOW (w
)->vchild
;
701 DEFUN ("active-minibuffer-window", Factive_minibuffer_window
,
702 Sactive_minibuffer_window
, 0, 0, 0,
703 "Return the currently active minibuffer window, or nil if none.")
706 return minibuf_level
? minibuf_window
: Qnil
;
709 DEFUN ("frame-root-window", Fframe_root_window
, Sframe_root_window
, 0, 1, 0,
710 "Returns the root-window of FRAME.\n\
711 If omitted, FRAME defaults to the currently selected frame.")
716 XSETFRAME (frame
, selected_frame
);
718 CHECK_LIVE_FRAME (frame
, 0);
720 return XFRAME (frame
)->root_window
;
723 DEFUN ("frame-selected-window", Fframe_selected_window
,
724 Sframe_selected_window
, 0, 1, 0,
725 "Return the selected window of frame object FRAME.\n\
726 If omitted, FRAME defaults to the currently selected frame.")
731 XSETFRAME (frame
, selected_frame
);
733 CHECK_LIVE_FRAME (frame
, 0);
735 return XFRAME (frame
)->selected_window
;
738 DEFUN ("set-frame-selected-window", Fset_frame_selected_window
,
739 Sset_frame_selected_window
, 2, 2, 0,
740 "Set the selected window of frame object FRAME to WINDOW.\n\
741 If FRAME is nil, the selected frame is used.\n\
742 If FRAME is the selected frame, this makes WINDOW the selected window.")
744 Lisp_Object frame
, window
;
747 XSETFRAME (frame
, selected_frame
);
749 CHECK_LIVE_FRAME (frame
, 0);
751 CHECK_LIVE_WINDOW (window
, 1);
753 if (! EQ (frame
, WINDOW_FRAME (XWINDOW (window
))))
754 error ("In `set-frame-selected-window', WINDOW is not on FRAME");
756 if (XFRAME (frame
) == selected_frame
)
757 return Fselect_window (window
);
759 return XFRAME (frame
)->selected_window
= window
;
762 DEFUN ("frame-list", Fframe_list
, Sframe_list
,
764 "Return a list of all frames.")
767 return Fcopy_sequence (Vframe_list
);
770 /* Return the next frame in the frame list after FRAME.
771 If MINIBUF is nil, exclude minibuffer-only frames.
772 If MINIBUF is a window, include only its own frame
773 and any frame now using that window as the minibuffer.
774 If MINIBUF is `visible', include all visible frames.
775 If MINIBUF is 0, include all visible and iconified frames.
776 Otherwise, include all frames. */
779 next_frame (frame
, minibuf
)
786 /* There must always be at least one frame in Vframe_list. */
787 if (! CONSP (Vframe_list
))
790 /* If this frame is dead, it won't be in Vframe_list, and we'll loop
791 forever. Forestall that. */
792 CHECK_LIVE_FRAME (frame
, 0);
795 for (tail
= Vframe_list
; CONSP (tail
); tail
= XCONS (tail
)->cdr
)
799 f
= XCONS (tail
)->car
;
802 && FRAME_KBOARD (XFRAME (f
)) == FRAME_KBOARD (XFRAME (frame
)))
804 /* Decide whether this frame is eligible to be returned. */
806 /* If we've looped all the way around without finding any
807 eligible frames, return the original frame. */
811 /* Let minibuf decide if this frame is acceptable. */
814 if (! FRAME_MINIBUF_ONLY_P (XFRAME (f
)))
817 else if (EQ (minibuf
, Qvisible
))
819 FRAME_SAMPLE_VISIBILITY (XFRAME (f
));
820 if (FRAME_VISIBLE_P (XFRAME (f
)))
823 else if (XFASTINT (minibuf
) == 0)
825 FRAME_SAMPLE_VISIBILITY (XFRAME (f
));
826 if (FRAME_VISIBLE_P (XFRAME (f
))
827 || FRAME_ICONIFIED_P (XFRAME (f
)))
830 else if (WINDOWP (minibuf
))
832 if (EQ (FRAME_MINIBUF_WINDOW (XFRAME (f
)), minibuf
)
833 /* Check that F either is, or has forwarded its focus to,
835 && (EQ (WINDOW_FRAME (XWINDOW (minibuf
)), f
)
836 || EQ (WINDOW_FRAME (XWINDOW (minibuf
)),
837 FRAME_FOCUS_FRAME (XFRAME (f
)))))
849 /* Return the previous frame in the frame list before FRAME.
850 If MINIBUF is nil, exclude minibuffer-only frames.
851 If MINIBUF is a window, include only its own frame
852 and any frame now using that window as the minibuffer.
853 If MINIBUF is `visible', include all visible frames.
854 If MINIBUF is 0, include all visible and iconified frames.
855 Otherwise, include all frames. */
858 prev_frame (frame
, minibuf
)
865 /* There must always be at least one frame in Vframe_list. */
866 if (! CONSP (Vframe_list
))
870 for (tail
= Vframe_list
; CONSP (tail
); tail
= XCONS (tail
)->cdr
)
874 f
= XCONS (tail
)->car
;
878 if (EQ (frame
, f
) && !NILP (prev
))
881 if (FRAME_KBOARD (XFRAME (f
)) == FRAME_KBOARD (XFRAME (frame
)))
883 /* Decide whether this frame is eligible to be returned,
884 according to minibuf. */
887 if (! FRAME_MINIBUF_ONLY_P (XFRAME (f
)))
890 else if (WINDOWP (minibuf
))
892 if (EQ (FRAME_MINIBUF_WINDOW (XFRAME (f
)), minibuf
)
893 /* Check that F either is, or has forwarded its focus to,
895 && (EQ (WINDOW_FRAME (XWINDOW (minibuf
)), f
)
896 || EQ (WINDOW_FRAME (XWINDOW (minibuf
)),
897 FRAME_FOCUS_FRAME (XFRAME (f
)))))
900 else if (EQ (minibuf
, Qvisible
))
902 FRAME_SAMPLE_VISIBILITY (XFRAME (f
));
903 if (FRAME_VISIBLE_P (XFRAME (f
)))
906 else if (XFASTINT (minibuf
) == 0)
908 FRAME_SAMPLE_VISIBILITY (XFRAME (f
));
909 if (FRAME_VISIBLE_P (XFRAME (f
))
910 || FRAME_ICONIFIED_P (XFRAME (f
)))
918 /* We've scanned the entire list. */
920 /* We went through the whole frame list without finding a single
921 acceptable frame. Return the original frame. */
924 /* There were no acceptable frames in the list before FRAME; otherwise,
925 we would have returned directly from the loop. Since PREV is the last
926 acceptable frame in the list, return it. */
931 DEFUN ("next-frame", Fnext_frame
, Snext_frame
, 0, 2, 0,
932 "Return the next frame in the frame list after FRAME.\n\
933 It considers only frames on the same terminal as FRAME.\n\
934 By default, skip minibuffer-only frames.\n\
935 If omitted, FRAME defaults to the selected frame.\n\
936 If optional argument MINIFRAME is nil, exclude minibuffer-only frames.\n\
937 If MINIFRAME is a window, include only its own frame\n\
938 and any frame now using that window as the minibuffer.\n\
939 If MINIFRAME is `visible', include all visible frames.\n\
940 If MINIFRAME is 0, include all visible and iconified frames.\n\
941 Otherwise, include all frames.")
943 Lisp_Object frame
, miniframe
;
948 XSETFRAME (frame
, selected_frame
);
950 CHECK_LIVE_FRAME (frame
, 0);
952 return next_frame (frame
, miniframe
);
955 DEFUN ("previous-frame", Fprevious_frame
, Sprevious_frame
, 0, 2, 0,
956 "Return the previous frame in the frame list before FRAME.\n\
957 It considers only frames on the same terminal as FRAME.\n\
958 By default, skip minibuffer-only frames.\n\
959 If omitted, FRAME defaults to the selected frame.\n\
960 If optional argument MINIFRAME is nil, exclude minibuffer-only frames.\n\
961 If MINIFRAME is a window, include only its own frame\n\
962 and any frame now using that window as the minibuffer.\n\
963 If MINIFRAME is `visible', include all visible frames.\n\
964 If MINIFRAME is 0, include all visible and iconified frames.\n\
965 Otherwise, include all frames.")
967 Lisp_Object frame
, miniframe
;
972 XSETFRAME (frame
, selected_frame
);
974 CHECK_LIVE_FRAME (frame
, 0);
976 return prev_frame (frame
, miniframe
);
979 /* Return 1 if it is ok to delete frame F;
980 0 if all frames aside from F are invisible.
981 (Exception: if F is the terminal frame, and we are using X, return 1.) */
984 other_visible_frames (f
)
987 /* We know the selected frame is visible,
988 so if F is some other frame, it can't be the sole visible one. */
989 if (f
== selected_frame
)
994 for (frames
= Vframe_list
;
996 frames
= XCONS (frames
)->cdr
)
1000 this = XCONS (frames
)->car
;
1001 /* Verify that the frame's window still exists
1002 and we can still talk to it. And note any recent change
1004 #ifdef HAVE_WINDOW_SYSTEM
1005 if (FRAME_WINDOW_P (XFRAME (this)))
1007 x_sync (XFRAME (this));
1008 FRAME_SAMPLE_VISIBILITY (XFRAME (this));
1012 if (FRAME_VISIBLE_P (XFRAME (this))
1013 || FRAME_ICONIFIED_P (XFRAME (this))
1014 /* Allow deleting the terminal frame when at least
1015 one X frame exists! */
1016 || (FRAME_WINDOW_P (XFRAME (this)) && !FRAME_WINDOW_P (f
)))
1024 DEFUN ("delete-frame", Fdelete_frame
, Sdelete_frame
, 0, 2, "",
1025 "Delete FRAME, permanently eliminating it from use.\n\
1026 If omitted, FRAME defaults to the selected frame.\n\
1027 A frame may not be deleted if its minibuffer is used by other frames.\n\
1028 Normally, you may not delete a frame if all other frames are invisible,\n\
1029 but if the second optional argument FORCE is non-nil, you may do so.")
1031 Lisp_Object frame
, force
;
1034 int minibuffer_selected
;
1036 if (EQ (frame
, Qnil
))
1039 XSETFRAME (frame
, f
);
1043 CHECK_FRAME (frame
, 0);
1047 if (! FRAME_LIVE_P (f
))
1050 if (NILP (force
) && !other_visible_frames (f
))
1051 error ("Attempt to delete the sole visible or iconified frame");
1053 /* Does this frame have a minibuffer, and is it the surrogate
1054 minibuffer for any other frame? */
1055 if (FRAME_HAS_MINIBUF_P (XFRAME (frame
)))
1059 for (frames
= Vframe_list
;
1061 frames
= XCONS (frames
)->cdr
)
1064 this = XCONS (frames
)->car
;
1066 if (! EQ (this, frame
)
1068 WINDOW_FRAME (XWINDOW
1069 (FRAME_MINIBUF_WINDOW (XFRAME (this))))))
1070 error ("Attempt to delete a surrogate minibuffer frame");
1074 minibuffer_selected
= EQ (minibuf_window
, selected_window
);
1076 /* Don't let the frame remain selected. */
1077 if (f
== selected_frame
)
1079 Lisp_Object tail
, frame1
;
1081 /* Look for another visible frame on the same terminal. */
1082 frame1
= next_frame (frame
, Qvisible
);
1084 /* If there is none, find *some* other frame. */
1085 if (NILP (frame1
) || EQ (frame1
, frame
))
1087 FOR_EACH_FRAME (tail
, frame1
)
1089 if (! EQ (frame
, frame1
))
1094 do_switch_frame (frame1
, Qnil
, 0);
1097 /* Don't allow minibuf_window to remain on a deleted frame. */
1098 if (EQ (f
->minibuffer_window
, minibuf_window
))
1100 Fset_window_buffer (selected_frame
->minibuffer_window
,
1101 XWINDOW (minibuf_window
)->buffer
);
1102 minibuf_window
= selected_frame
->minibuffer_window
;
1104 /* If the dying minibuffer window was selected,
1105 select the new one. */
1106 if (minibuffer_selected
)
1107 Fselect_window (minibuf_window
);
1110 /* Clear any X selections for this frame. */
1111 #ifdef HAVE_X_WINDOWS
1113 x_clear_frame_selections (f
);
1116 /* Mark all the windows that used to be on FRAME as deleted, and then
1117 remove the reference to them. */
1118 delete_all_subwindows (XWINDOW (f
->root_window
));
1119 f
->root_window
= Qnil
;
1121 Vframe_list
= Fdelq (frame
, Vframe_list
);
1122 FRAME_SET_VISIBLE (f
, 0);
1126 if (FRAME_CURRENT_GLYPHS (f
))
1127 free_frame_glyphs (f
, FRAME_CURRENT_GLYPHS (f
));
1128 if (FRAME_DESIRED_GLYPHS (f
))
1129 free_frame_glyphs (f
, FRAME_DESIRED_GLYPHS (f
));
1130 if (FRAME_TEMP_GLYPHS (f
))
1131 free_frame_glyphs (f
, FRAME_TEMP_GLYPHS (f
));
1132 if (FRAME_INSERT_COST (f
))
1133 free (FRAME_INSERT_COST (f
));
1134 if (FRAME_DELETEN_COST (f
))
1135 free (FRAME_DELETEN_COST (f
));
1136 if (FRAME_INSERTN_COST (f
))
1137 free (FRAME_INSERTN_COST (f
));
1138 if (FRAME_DELETE_COST (f
))
1139 free (FRAME_DELETE_COST (f
));
1141 /* Since some events are handled at the interrupt level, we may get
1142 an event for f at any time; if we zero out the frame's display
1143 now, then we may trip up the event-handling code. Instead, we'll
1144 promise that the display of the frame must be valid until we have
1145 called the window-system-dependent frame destruction routine. */
1147 /* I think this should be done with a hook. */
1148 #ifdef HAVE_WINDOW_SYSTEM
1149 if (FRAME_WINDOW_P (f
))
1150 x_destroy_window (f
);
1153 f
->output_data
.nothing
= 0;
1155 /* If we've deleted the last_nonminibuf_frame, then try to find
1157 if (f
== last_nonminibuf_frame
)
1161 last_nonminibuf_frame
= 0;
1163 for (frames
= Vframe_list
;
1165 frames
= XCONS (frames
)->cdr
)
1167 f
= XFRAME (XCONS (frames
)->car
);
1168 if (!FRAME_MINIBUF_ONLY_P (f
))
1170 last_nonminibuf_frame
= f
;
1176 /* If we've deleted this keyboard's default_minibuffer_frame, try to
1177 find another one. Prefer minibuffer-only frames, but also notice
1178 frames with other windows. */
1179 if (EQ (frame
, FRAME_KBOARD (f
)->Vdefault_minibuffer_frame
))
1183 /* The last frame we saw with a minibuffer, minibuffer-only or not. */
1184 Lisp_Object frame_with_minibuf
;
1185 /* Some frame we found on the same kboard, or nil if there are none. */
1186 Lisp_Object frame_on_same_kboard
;
1188 frame_on_same_kboard
= Qnil
;
1189 frame_with_minibuf
= Qnil
;
1191 for (frames
= Vframe_list
;
1193 frames
= XCONS (frames
)->cdr
)
1198 this = XCONS (frames
)->car
;
1203 /* Consider only frames on the same kboard
1204 and only those with minibuffers. */
1205 if (FRAME_KBOARD (f
) == FRAME_KBOARD (f1
)
1206 && FRAME_HAS_MINIBUF_P (f1
))
1208 frame_with_minibuf
= this;
1209 if (FRAME_MINIBUF_ONLY_P (f1
))
1213 if (FRAME_KBOARD (f
) == FRAME_KBOARD (f1
))
1214 frame_on_same_kboard
= this;
1217 if (!NILP (frame_on_same_kboard
))
1219 /* We know that there must be some frame with a minibuffer out
1220 there. If this were not true, all of the frames present
1221 would have to be minibufferless, which implies that at some
1222 point their minibuffer frames must have been deleted, but
1223 that is prohibited at the top; you can't delete surrogate
1224 minibuffer frames. */
1225 if (NILP (frame_with_minibuf
))
1228 FRAME_KBOARD (f
)->Vdefault_minibuffer_frame
= frame_with_minibuf
;
1231 /* No frames left on this kboard--say no minibuffer either. */
1232 FRAME_KBOARD (f
)->Vdefault_minibuffer_frame
= Qnil
;
1238 /* Return mouse position in character cell units. */
1240 DEFUN ("mouse-position", Fmouse_position
, Smouse_position
, 0, 0, 0,
1241 "Return a list (FRAME X . Y) giving the current mouse frame and position.\n\
1242 The position is given in character cells, where (0, 0) is the\n\
1243 upper-left corner.\n\
1244 If Emacs is running on a mouseless terminal or hasn't been programmed\n\
1245 to read the mouse position, it returns the selected frame for FRAME\n\
1246 and nil for X and Y.")
1250 Lisp_Object lispy_dummy
;
1251 enum scroll_bar_part party_dummy
;
1254 unsigned long long_dummy
;
1260 /* It's okay for the hook to refrain from storing anything. */
1261 if (mouse_position_hook
)
1262 (*mouse_position_hook
) (&f
, 0,
1263 &lispy_dummy
, &party_dummy
,
1270 pixel_to_glyph_coords (f
, col
, row
, &col
, &row
, NULL
, 1);
1275 XSETFRAME (lispy_dummy
, f
);
1276 return Fcons (lispy_dummy
, Fcons (x
, y
));
1279 DEFUN ("mouse-pixel-position", Fmouse_pixel_position
,
1280 Smouse_pixel_position
, 0, 0, 0,
1281 "Return a list (FRAME X . Y) giving the current mouse frame and position.\n\
1282 The position is given in pixel units, where (0, 0) is the\n\
1283 upper-left corner.\n\
1284 If Emacs is running on a mouseless terminal or hasn't been programmed\n\
1285 to read the mouse position, it returns the selected frame for FRAME\n\
1286 and nil for X and Y.")
1290 Lisp_Object lispy_dummy
;
1291 enum scroll_bar_part party_dummy
;
1294 unsigned long long_dummy
;
1300 /* It's okay for the hook to refrain from storing anything. */
1301 if (mouse_position_hook
)
1302 (*mouse_position_hook
) (&f
, 0,
1303 &lispy_dummy
, &party_dummy
,
1307 XSETFRAME (lispy_dummy
, f
);
1308 return Fcons (lispy_dummy
, Fcons (x
, y
));
1311 DEFUN ("set-mouse-position", Fset_mouse_position
, Sset_mouse_position
, 3, 3, 0,
1312 "Move the mouse pointer to the center of character cell (X,Y) in FRAME.\n\
1313 Note, this is a no-op for an X frame that is not visible.\n\
1314 If you have just created a frame, you must wait for it to become visible\n\
1315 before calling this function on it, like this.\n\
1316 (while (not (frame-visible-p frame)) (sleep-for .5))")
1318 Lisp_Object frame
, x
, y
;
1320 CHECK_LIVE_FRAME (frame
, 0);
1321 CHECK_NUMBER (x
, 2);
1322 CHECK_NUMBER (y
, 1);
1324 /* I think this should be done with a hook. */
1325 #ifdef HAVE_WINDOW_SYSTEM
1326 if (FRAME_WINDOW_P (XFRAME (frame
)))
1327 /* Warping the mouse will cause enternotify and focus events. */
1328 x_set_mouse_position (XFRAME (frame
), x
, y
);
1334 DEFUN ("set-mouse-pixel-position", Fset_mouse_pixel_position
,
1335 Sset_mouse_pixel_position
, 3, 3, 0,
1336 "Move the mouse pointer to pixel position (X,Y) in FRAME.\n\
1337 Note, this is a no-op for an X frame that is not visible.\n\
1338 If you have just created a frame, you must wait for it to become visible\n\
1339 before calling this function on it, like this.\n\
1340 (while (not (frame-visible-p frame)) (sleep-for .5))")
1342 Lisp_Object frame
, x
, y
;
1344 CHECK_LIVE_FRAME (frame
, 0);
1345 CHECK_NUMBER (x
, 2);
1346 CHECK_NUMBER (y
, 1);
1348 /* I think this should be done with a hook. */
1349 #ifdef HAVE_WINDOW_SYSTEM
1350 if (FRAME_WINDOW_P (XFRAME (frame
)))
1351 /* Warping the mouse will cause enternotify and focus events. */
1352 x_set_mouse_pixel_position (XFRAME (frame
), x
, y
);
1358 DEFUN ("make-frame-visible", Fmake_frame_visible
, Smake_frame_visible
,
1360 "Make the frame FRAME visible (assuming it is an X-window).\n\
1361 If omitted, FRAME defaults to the currently selected frame.")
1366 XSETFRAME (frame
, selected_frame
);
1368 CHECK_LIVE_FRAME (frame
, 0);
1370 /* I think this should be done with a hook. */
1371 #ifdef HAVE_WINDOW_SYSTEM
1372 if (FRAME_WINDOW_P (XFRAME (frame
)))
1374 FRAME_SAMPLE_VISIBILITY (XFRAME (frame
));
1375 x_make_frame_visible (XFRAME (frame
));
1379 /* Make menu bar update for the Buffers and Frams menus. */
1380 windows_or_buffers_changed
++;
1385 DEFUN ("make-frame-invisible", Fmake_frame_invisible
, Smake_frame_invisible
,
1387 "Make the frame FRAME invisible (assuming it is an X-window).\n\
1388 If omitted, FRAME defaults to the currently selected frame.\n\
1389 Normally you may not make FRAME invisible if all other frames are invisible,\n\
1390 but if the second optional argument FORCE is non-nil, you may do so.")
1392 Lisp_Object frame
, force
;
1395 XSETFRAME (frame
, selected_frame
);
1397 CHECK_LIVE_FRAME (frame
, 0);
1399 if (NILP (force
) && !other_visible_frames (XFRAME (frame
)))
1400 error ("Attempt to make invisible the sole visible or iconified frame");
1402 #if 0 /* This isn't logically necessary, and it can do GC. */
1403 /* Don't let the frame remain selected. */
1404 if (XFRAME (frame
) == selected_frame
)
1405 do_switch_frame (next_frame (frame
, Qt
), Qnil
, 0)
1408 /* Don't allow minibuf_window to remain on a deleted frame. */
1409 if (EQ (XFRAME (frame
)->minibuffer_window
, minibuf_window
))
1411 Fset_window_buffer (selected_frame
->minibuffer_window
,
1412 XWINDOW (minibuf_window
)->buffer
);
1413 minibuf_window
= selected_frame
->minibuffer_window
;
1416 /* I think this should be done with a hook. */
1417 #ifdef HAVE_WINDOW_SYSTEM
1418 if (FRAME_WINDOW_P (XFRAME (frame
)))
1419 x_make_frame_invisible (XFRAME (frame
));
1422 /* Make menu bar update for the Buffers and Frams menus. */
1423 windows_or_buffers_changed
++;
1428 DEFUN ("iconify-frame", Ficonify_frame
, Siconify_frame
,
1430 "Make the frame FRAME into an icon.\n\
1431 If omitted, FRAME defaults to the currently selected frame.")
1436 XSETFRAME (frame
, selected_frame
);
1438 CHECK_LIVE_FRAME (frame
, 0);
1440 #if 0 /* This isn't logically necessary, and it can do GC. */
1441 /* Don't let the frame remain selected. */
1442 if (XFRAME (frame
) == selected_frame
)
1443 Fhandle_switch_frame (next_frame (frame
, Qt
), Qnil
);
1446 /* Don't allow minibuf_window to remain on a deleted frame. */
1447 if (EQ (XFRAME (frame
)->minibuffer_window
, minibuf_window
))
1449 Fset_window_buffer (selected_frame
->minibuffer_window
,
1450 XWINDOW (minibuf_window
)->buffer
);
1451 minibuf_window
= selected_frame
->minibuffer_window
;
1454 /* I think this should be done with a hook. */
1455 #ifdef HAVE_WINDOW_SYSTEM
1456 if (FRAME_WINDOW_P (XFRAME (frame
)))
1457 x_iconify_frame (XFRAME (frame
));
1460 /* Make menu bar update for the Buffers and Frams menus. */
1461 windows_or_buffers_changed
++;
1466 DEFUN ("frame-visible-p", Fframe_visible_p
, Sframe_visible_p
,
1468 "Return t if FRAME is now \"visible\" (actually in use for display).\n\
1469 A frame that is not \"visible\" is not updated and, if it works through\n\
1470 a window system, it may not show at all.\n\
1471 Return the symbol `icon' if frame is visible only as an icon.")
1475 CHECK_LIVE_FRAME (frame
, 0);
1477 FRAME_SAMPLE_VISIBILITY (XFRAME (frame
));
1479 if (FRAME_VISIBLE_P (XFRAME (frame
)))
1481 if (FRAME_ICONIFIED_P (XFRAME (frame
)))
1486 DEFUN ("visible-frame-list", Fvisible_frame_list
, Svisible_frame_list
,
1488 "Return a list of all frames now \"visible\" (being updated).")
1491 Lisp_Object tail
, frame
;
1496 for (tail
= Vframe_list
; CONSP (tail
); tail
= XCONS (tail
)->cdr
)
1498 frame
= XCONS (tail
)->car
;
1499 if (!FRAMEP (frame
))
1502 if (FRAME_VISIBLE_P (f
))
1503 value
= Fcons (frame
, value
);
1509 DEFUN ("raise-frame", Fraise_frame
, Sraise_frame
, 0, 1, "",
1510 "Bring FRAME to the front, so it occludes any frames it overlaps.\n\
1511 If FRAME is invisible, make it visible.\n\
1512 If you don't specify a frame, the selected frame is used.\n\
1513 If Emacs is displaying on an ordinary terminal or some other device which\n\
1514 doesn't support multiple overlapping frames, this function does nothing.")
1519 XSETFRAME (frame
, selected_frame
);
1521 CHECK_LIVE_FRAME (frame
, 0);
1523 /* Do like the documentation says. */
1524 Fmake_frame_visible (frame
);
1526 if (frame_raise_lower_hook
)
1527 (*frame_raise_lower_hook
) (XFRAME (frame
), 1);
1532 /* Should we have a corresponding function called Flower_Power? */
1533 DEFUN ("lower-frame", Flower_frame
, Slower_frame
, 0, 1, "",
1534 "Send FRAME to the back, so it is occluded by any frames that overlap it.\n\
1535 If you don't specify a frame, the selected frame is used.\n\
1536 If Emacs is displaying on an ordinary terminal or some other device which\n\
1537 doesn't support multiple overlapping frames, this function does nothing.")
1542 XSETFRAME (frame
, selected_frame
);
1544 CHECK_LIVE_FRAME (frame
, 0);
1546 if (frame_raise_lower_hook
)
1547 (*frame_raise_lower_hook
) (XFRAME (frame
), 0);
1553 DEFUN ("redirect-frame-focus", Fredirect_frame_focus
, Sredirect_frame_focus
,
1555 "Arrange for keystrokes typed at FRAME to be sent to FOCUS-FRAME.\n\
1556 In other words, switch-frame events caused by events in FRAME will\n\
1557 request a switch to FOCUS-FRAME, and `last-event-frame' will be\n\
1558 FOCUS-FRAME after reading an event typed at FRAME.\n\
1560 If FOCUS-FRAME is omitted or nil, any existing redirection is\n\
1561 cancelled, and the frame again receives its own keystrokes.\n\
1563 Focus redirection is useful for temporarily redirecting keystrokes to\n\
1564 a surrogate minibuffer frame when a frame doesn't have its own\n\
1565 minibuffer window.\n\
1567 A frame's focus redirection can be changed by select-frame. If frame\n\
1568 FOO is selected, and then a different frame BAR is selected, any\n\
1569 frames redirecting their focus to FOO are shifted to redirect their\n\
1570 focus to BAR. This allows focus redirection to work properly when the\n\
1571 user switches from one frame to another using `select-window'.\n\
1573 This means that a frame whose focus is redirected to itself is treated\n\
1574 differently from a frame whose focus is redirected to nil; the former\n\
1575 is affected by select-frame, while the latter is not.\n\
1577 The redirection lasts until `redirect-frame-focus' is called to change it.")
1578 (frame
, focus_frame
)
1579 Lisp_Object frame
, focus_frame
;
1581 /* Note that we don't check for a live frame here. It's reasonable
1582 to redirect the focus of a frame you're about to delete, if you
1583 know what other frame should receive those keystrokes. */
1584 CHECK_FRAME (frame
, 0);
1586 if (! NILP (focus_frame
))
1587 CHECK_LIVE_FRAME (focus_frame
, 1);
1589 XFRAME (frame
)->focus_frame
= focus_frame
;
1591 /* I think this should be done with a hook. */
1592 #ifdef HAVE_WINDOW_SYSTEM
1593 if (!NILP (focus_frame
) && ! EQ (focus_frame
, frame
)
1594 && (FRAME_WINDOW_P (XFRAME (focus_frame
))))
1595 Ffocus_frame (focus_frame
);
1598 if (frame_rehighlight_hook
)
1599 (*frame_rehighlight_hook
) (XFRAME (frame
));
1605 DEFUN ("frame-focus", Fframe_focus
, Sframe_focus
, 1, 1, 0,
1606 "Return the frame to which FRAME's keystrokes are currently being sent.\n\
1607 This returns nil if FRAME's focus is not redirected.\n\
1608 See `redirect-frame-focus'.")
1612 CHECK_LIVE_FRAME (frame
, 0);
1614 return FRAME_FOCUS_FRAME (XFRAME (frame
));
1619 /* Return the value of frame parameter PROP in frame FRAME. */
1622 get_frame_param (frame
, prop
)
1623 register struct frame
*frame
;
1626 register Lisp_Object tem
;
1628 tem
= Fassq (prop
, frame
->param_alist
);
1634 /* Return the buffer-predicate of the selected frame. */
1637 frame_buffer_predicate ()
1639 return selected_frame
->buffer_predicate
;
1642 /* Modify the alist in *ALISTPTR to associate PROP with VAL.
1643 If the alist already has an element for PROP, we change it. */
1646 store_in_alist (alistptr
, prop
, val
)
1647 Lisp_Object
*alistptr
, val
;
1650 register Lisp_Object tem
;
1652 tem
= Fassq (prop
, *alistptr
);
1654 *alistptr
= Fcons (Fcons (prop
, val
), *alistptr
);
1660 store_frame_param (f
, prop
, val
)
1662 Lisp_Object prop
, val
;
1664 register Lisp_Object tem
;
1666 tem
= Fassq (prop
, f
->param_alist
);
1668 f
->param_alist
= Fcons (Fcons (prop
, val
), f
->param_alist
);
1672 if (EQ (prop
, Qbuffer_predicate
))
1673 f
->buffer_predicate
= val
;
1675 if (! FRAME_WINDOW_P (f
))
1676 if (EQ (prop
, Qmenu_bar_lines
))
1677 set_menu_bar_lines (f
, val
, make_number (FRAME_MENU_BAR_LINES (f
)));
1679 if (EQ (prop
, Qminibuffer
) && WINDOWP (val
))
1681 if (! MINI_WINDOW_P (XWINDOW (val
)))
1682 error ("Surrogate minibuffer windows must be minibuffer windows.");
1684 if (FRAME_HAS_MINIBUF_P (f
) || FRAME_MINIBUF_ONLY_P (f
))
1685 error ("can't change the surrogate minibuffer of a frame with its own minibuffer");
1687 /* Install the chosen minibuffer window, with proper buffer. */
1688 f
->minibuffer_window
= val
;
1692 DEFUN ("frame-parameters", Fframe_parameters
, Sframe_parameters
, 0, 1, 0,
1693 "Return the parameters-alist of frame FRAME.\n\
1694 It is a list of elements of the form (PARM . VALUE), where PARM is a symbol.\n\
1695 The meaningful PARMs depend on the kind of frame.\n\
1696 If FRAME is omitted, return information on the currently selected frame.")
1703 if (EQ (frame
, Qnil
))
1707 CHECK_FRAME (frame
, 0);
1711 if (!FRAME_LIVE_P (f
))
1714 alist
= Fcopy_alist (f
->param_alist
);
1715 store_in_alist (&alist
, Qname
, f
->name
);
1716 store_in_alist (&alist
, Qheight
, make_number (FRAME_HEIGHT (f
)));
1717 store_in_alist (&alist
, Qwidth
, make_number (FRAME_WIDTH (f
)));
1718 store_in_alist (&alist
, Qmodeline
, (FRAME_WANTS_MODELINE_P (f
) ? Qt
: Qnil
));
1719 store_in_alist (&alist
, Qminibuffer
,
1720 (! FRAME_HAS_MINIBUF_P (f
) ? Qnil
1721 : FRAME_MINIBUF_ONLY_P (f
) ? Qonly
1722 : FRAME_MINIBUF_WINDOW (f
)));
1723 store_in_alist (&alist
, Qunsplittable
, (FRAME_NO_SPLIT_P (f
) ? Qt
: Qnil
));
1725 /* I think this should be done with a hook. */
1726 #ifdef HAVE_WINDOW_SYSTEM
1727 if (FRAME_WINDOW_P (f
))
1728 x_report_frame_params (f
, &alist
);
1732 /* This ought to be correct in f->param_alist for an X frame. */
1734 XSETFASTINT (lines
, FRAME_MENU_BAR_LINES (f
));
1735 store_in_alist (&alist
, Qmenu_bar_lines
, lines
);
1740 DEFUN ("modify-frame-parameters", Fmodify_frame_parameters
,
1741 Smodify_frame_parameters
, 2, 2, 0,
1742 "Modify the parameters of frame FRAME according to ALIST.\n\
1743 ALIST is an alist of parameters to change and their new values.\n\
1744 Each element of ALIST has the form (PARM . VALUE), where PARM is a symbol.\n\
1745 The meaningful PARMs depend on the kind of frame; undefined PARMs are ignored.")
1747 Lisp_Object frame
, alist
;
1750 register Lisp_Object tail
, elt
, prop
, val
;
1752 if (EQ (frame
, Qnil
))
1756 CHECK_LIVE_FRAME (frame
, 0);
1760 /* I think this should be done with a hook. */
1761 #ifdef HAVE_WINDOW_SYSTEM
1762 if (FRAME_WINDOW_P (f
))
1763 x_set_frame_parameters (f
, alist
);
1766 for (tail
= alist
; !EQ (tail
, Qnil
); tail
= Fcdr (tail
))
1771 store_frame_param (f
, prop
, val
);
1777 DEFUN ("frame-char-height", Fframe_char_height
, Sframe_char_height
,
1779 "Height in pixels of a line in the font in frame FRAME.\n\
1780 If FRAME is omitted, the selected frame is used.\n\
1781 For a terminal frame, the value is always 1.")
1791 CHECK_FRAME (frame
, 0);
1795 #ifdef HAVE_WINDOW_SYSTEM
1796 if (FRAME_WINDOW_P (f
))
1797 return make_number (x_char_height (f
));
1800 return make_number (1);
1804 DEFUN ("frame-char-width", Fframe_char_width
, Sframe_char_width
,
1806 "Width in pixels of characters in the font in frame FRAME.\n\
1807 If FRAME is omitted, the selected frame is used.\n\
1808 The width is the same for all characters, because\n\
1809 currently Emacs supports only fixed-width fonts.\n\
1810 For a terminal screen, the value is always 1.")
1820 CHECK_FRAME (frame
, 0);
1824 #ifdef HAVE_WINDOW_SYSTEM
1825 if (FRAME_WINDOW_P (f
))
1826 return make_number (x_char_width (f
));
1829 return make_number (1);
1832 DEFUN ("frame-pixel-height", Fframe_pixel_height
,
1833 Sframe_pixel_height
, 0, 1, 0,
1834 "Return a FRAME's height in pixels.\n\
1835 For a terminal frame, the result really gives the height in characters.\n\
1836 If FRAME is omitted, the selected frame is used.")
1846 CHECK_FRAME (frame
, 0);
1850 #ifdef HAVE_WINDOW_SYSTEM
1851 if (FRAME_WINDOW_P (f
))
1852 return make_number (x_pixel_height (f
));
1855 return make_number (FRAME_HEIGHT (f
));
1858 DEFUN ("frame-pixel-width", Fframe_pixel_width
,
1859 Sframe_pixel_width
, 0, 1, 0,
1860 "Return FRAME's width in pixels.\n\
1861 For a terminal frame, the result really gives the width in characters.\n\
1862 If FRAME is omitted, the selected frame is used.")
1872 CHECK_FRAME (frame
, 0);
1876 #ifdef HAVE_WINDOW_SYSTEM
1877 if (FRAME_WINDOW_P (f
))
1878 return make_number (x_pixel_width (f
));
1881 return make_number (FRAME_WIDTH (f
));
1884 DEFUN ("set-frame-height", Fset_frame_height
, Sset_frame_height
, 2, 3, 0,
1885 "Specify that the frame FRAME has LINES lines.\n\
1886 Optional third arg non-nil means that redisplay should use LINES lines\n\
1887 but that the idea of the actual height of the frame should not be changed.")
1888 (frame
, lines
, pretend
)
1889 Lisp_Object frame
, lines
, pretend
;
1891 register struct frame
*f
;
1893 CHECK_NUMBER (lines
, 0);
1898 CHECK_LIVE_FRAME (frame
, 0);
1902 /* I think this should be done with a hook. */
1903 #ifdef HAVE_WINDOW_SYSTEM
1904 if (FRAME_WINDOW_P (f
))
1906 if (XINT (lines
) != f
->height
)
1907 x_set_window_size (f
, 1, f
->width
, XINT (lines
));
1911 change_frame_size (f
, XINT (lines
), 0, !NILP (pretend
), 0);
1915 DEFUN ("set-frame-width", Fset_frame_width
, Sset_frame_width
, 2, 3, 0,
1916 "Specify that the frame FRAME has COLS columns.\n\
1917 Optional third arg non-nil means that redisplay should use COLS columns\n\
1918 but that the idea of the actual width of the frame should not be changed.")
1919 (frame
, cols
, pretend
)
1920 Lisp_Object frame
, cols
, pretend
;
1922 register struct frame
*f
;
1923 CHECK_NUMBER (cols
, 0);
1928 CHECK_LIVE_FRAME (frame
, 0);
1932 /* I think this should be done with a hook. */
1933 #ifdef HAVE_WINDOW_SYSTEM
1934 if (FRAME_WINDOW_P (f
))
1936 if (XINT (cols
) != f
->width
)
1937 x_set_window_size (f
, 1, XINT (cols
), f
->height
);
1941 change_frame_size (f
, 0, XINT (cols
), !NILP (pretend
), 0);
1945 DEFUN ("set-frame-size", Fset_frame_size
, Sset_frame_size
, 3, 3, 0,
1946 "Sets size of FRAME to COLS by ROWS, measured in characters.")
1948 Lisp_Object frame
, cols
, rows
;
1950 register struct frame
*f
;
1953 CHECK_LIVE_FRAME (frame
, 0);
1954 CHECK_NUMBER (cols
, 2);
1955 CHECK_NUMBER (rows
, 1);
1958 /* I think this should be done with a hook. */
1959 #ifdef HAVE_WINDOW_SYSTEM
1960 if (FRAME_WINDOW_P (f
))
1962 if (XINT (rows
) != f
->height
|| XINT (cols
) != f
->width
1963 || FRAME_NEW_HEIGHT (f
) || FRAME_NEW_WIDTH (f
))
1964 x_set_window_size (f
, 1, XINT (cols
), XINT (rows
));
1968 change_frame_size (f
, XINT (rows
), XINT (cols
), 0, 0);
1973 DEFUN ("set-frame-position", Fset_frame_position
,
1974 Sset_frame_position
, 3, 3, 0,
1975 "Sets position of FRAME in pixels to XOFFSET by YOFFSET.\n\
1976 This is actually the position of the upper left corner of the frame.\n\
1977 Negative values for XOFFSET or YOFFSET are interpreted relative to\n\
1978 the rightmost or bottommost possible position (that stays within the screen).")
1979 (frame
, xoffset
, yoffset
)
1980 Lisp_Object frame
, xoffset
, yoffset
;
1982 register struct frame
*f
;
1985 CHECK_LIVE_FRAME (frame
, 0);
1986 CHECK_NUMBER (xoffset
, 1);
1987 CHECK_NUMBER (yoffset
, 2);
1990 /* I think this should be done with a hook. */
1991 #ifdef HAVE_WINDOW_SYSTEM
1992 if (FRAME_WINDOW_P (f
))
1993 x_set_offset (f
, XINT (xoffset
), XINT (yoffset
), 1);
2004 staticpro (&Vframe_list
);
2006 DEFVAR_LISP ("terminal-frame", &Vterminal_frame
,
2007 "The initial frame-object, which represents Emacs's stdout.");
2009 DEFVAR_LISP ("emacs-iconified", &Vemacs_iconified
,
2010 "Non-nil if all of emacs is iconified and frame updates are not needed.");
2011 Vemacs_iconified
= Qnil
;
2013 DEFVAR_KBOARD ("default-minibuffer-frame", Vdefault_minibuffer_frame
,
2014 "Minibufferless frames use this frame's minibuffer.\n\
2016 Emacs cannot create minibufferless frames unless this is set to an\n\
2017 appropriate surrogate.\n\
2019 Emacs consults this variable only when creating minibufferless\n\
2020 frames; once the frame is created, it sticks with its assigned\n\
2021 minibuffer, no matter what this variable is set to. This means that\n\
2022 this variable doesn't necessarily say anything meaningful about the\n\
2023 current set of frames, or where the minibuffer is currently being\n\
2026 defsubr (&Sactive_minibuffer_window
);
2028 defsubr (&Sframe_live_p
);
2029 defsubr (&Smake_terminal_frame
);
2030 defsubr (&Shandle_switch_frame
);
2031 defsubr (&Signore_event
);
2032 defsubr (&Sselect_frame
);
2033 defsubr (&Sselected_frame
);
2034 defsubr (&Swindow_frame
);
2035 defsubr (&Sframe_root_window
);
2036 defsubr (&Sframe_first_window
);
2037 defsubr (&Sframe_selected_window
);
2038 defsubr (&Sset_frame_selected_window
);
2039 defsubr (&Sframe_list
);
2040 defsubr (&Snext_frame
);
2041 defsubr (&Sprevious_frame
);
2042 defsubr (&Sdelete_frame
);
2043 defsubr (&Smouse_position
);
2044 defsubr (&Smouse_pixel_position
);
2045 defsubr (&Sset_mouse_position
);
2046 defsubr (&Sset_mouse_pixel_position
);
2048 defsubr (&Sframe_configuration
);
2049 defsubr (&Srestore_frame_configuration
);
2051 defsubr (&Smake_frame_visible
);
2052 defsubr (&Smake_frame_invisible
);
2053 defsubr (&Siconify_frame
);
2054 defsubr (&Sframe_visible_p
);
2055 defsubr (&Svisible_frame_list
);
2056 defsubr (&Sraise_frame
);
2057 defsubr (&Slower_frame
);
2058 defsubr (&Sredirect_frame_focus
);
2059 defsubr (&Sframe_focus
);
2060 defsubr (&Sframe_parameters
);
2061 defsubr (&Smodify_frame_parameters
);
2062 defsubr (&Sframe_char_height
);
2063 defsubr (&Sframe_char_width
);
2064 defsubr (&Sframe_pixel_height
);
2065 defsubr (&Sframe_pixel_width
);
2066 defsubr (&Sset_frame_height
);
2067 defsubr (&Sset_frame_width
);
2068 defsubr (&Sset_frame_size
);
2069 defsubr (&Sset_frame_position
);
2074 initial_define_lispy_key (global_map
, "switch-frame", "handle-switch-frame");
2075 initial_define_lispy_key (global_map
, "delete-frame", "handle-delete-frame");
2076 initial_define_lispy_key (global_map
, "iconify-frame", "ignore-event");
2077 initial_define_lispy_key (global_map
, "make-frame-visible", "ignore-event");
2080 #else /* not MULTI_FRAME */
2082 /* If we're not using multi-frame stuff, we still need to provide some
2083 support functions. */
2085 /* Unless this function is defined, providing set-frame-height and
2086 set-frame-width doesn't help compatibility any, since they both
2087 want this as their first argument. */
2088 DEFUN ("selected-frame", Fselected_frame
, Sselected_frame
, 0, 0, 0,
2089 /* Don't confuse make-docfile by having two doc strings for this function.
2090 make-docfile does not pay attention to #if, for good reason! */
2094 /* For your possible information, this code is unfolded into the
2095 second WINDOW_FRAME in frame.h. */
2097 XSETFASTINT (tem
, 0);
2101 DEFUN ("active-minibuffer-window", Factive_minibuffer_window
,
2102 Sactive_minibuffer_window
, 0, 0, 0,
2103 /* Don't confuse make-docfile by having two doc strings for this function.
2104 make-docfile does not pay attention to #if, for good reason! */
2108 return minibuf_level
? minibuf_window
: Qnil
;
2111 DEFUN ("window-frame", Fwindow_frame
, Swindow_frame
, 1, 1, 0,
2112 /* Don't confuse make-docfile by having two doc strings for this function.
2113 make-docfile does not pay attention to #if, for good reason! */
2118 /* For your possible information, this code is unfolded into the
2119 second WINDOW_FRAME in frame.h. */
2121 XSETFASTINT (tem
, 0);
2125 DEFUN ("frame-first-window", Fframe_first_window
, Sframe_first_window
, 0, 1, 0,
2132 w
= FRAME_ROOT_WINDOW (selected_frame
);
2134 while (NILP (XWINDOW (w
)->buffer
))
2136 if (! NILP (XWINDOW (w
)->hchild
))
2137 w
= XWINDOW (w
)->hchild
;
2138 else if (! NILP (XWINDOW (w
)->vchild
))
2139 w
= XWINDOW (w
)->vchild
;
2146 DEFUN ("framep", Fframep
, Sframep
, 1, 1, 0,
2147 /* Don't confuse make-docfile by having two doc strings for this function.
2148 make-docfile does not pay attention to #if, for good reason! */
2154 if (FRAME_X_P (object
))
2155 return intern ("pc");
2160 DEFUN ("set-frame-height", Fset_frame_height
, Sset_frame_height
, 2, 3, 0,
2161 /* Don't confuse make-docfile by having two doc strings for this function.
2162 make-docfile does not pay attention to #if, for good reason! */
2164 (frame
, rows
, pretend
)
2165 Lisp_Object frame
, rows
, pretend
;
2167 CHECK_NUMBER (rows
, 0);
2169 change_frame_size (0, XINT (rows
), 0, !NILP (pretend
), 0);
2173 DEFUN ("set-frame-width", Fset_frame_width
, Sset_frame_width
, 2, 3, 0,
2174 /* Don't confuse make-docfile by having two doc strings for this function.
2175 make-docfile does not pay attention to #if, for good reason! */
2177 (frame
, cols
, pretend
)
2178 Lisp_Object frame
, cols
, pretend
;
2180 CHECK_NUMBER (cols
, 0);
2182 change_frame_size (0, 0, XINT (cols
), !NILP (pretend
), 0);
2186 DEFUN ("set-frame-size", Fset_frame_size
, Sset_frame_size
, 3, 3, 0,
2187 /* Don't confuse make-docfile by having two doc strings for this function.
2188 make-docfile does not pay attention to #if, for good reason! */
2191 Lisp_Object frame
, cols
, rows
;
2193 CHECK_NUMBER (cols
, 2);
2194 CHECK_NUMBER (rows
, 1);
2196 change_frame_size (0, XINT (rows
), XINT (cols
), 0, 0);
2201 DEFUN ("frame-height", Fframe_height
, Sframe_height
, 0, 1, 0,
2202 /* Don't confuse make-docfile by having two doc strings for this function.
2203 make-docfile does not pay attention to #if, for good reason! */
2208 return make_number (FRAME_HEIGHT (selected_frame
));
2211 DEFUN ("frame-width", Fframe_width
, Sframe_width
, 0, 1, 0,
2212 /* Don't confuse make-docfile by having two doc strings for this function.
2213 make-docfile does not pay attention to #if, for good reason! */
2218 return make_number (FRAME_WIDTH (selected_frame
));
2221 DEFUN ("frame-char-height", Fframe_char_height
, Sframe_char_height
,
2223 /* Don't confuse make-docfile by having two doc strings for this function.
2224 make-docfile does not pay attention to #if, for good reason! */
2229 return make_number (1);
2233 DEFUN ("frame-char-width", Fframe_char_width
, Sframe_char_width
,
2235 /* Don't confuse make-docfile by having two doc strings for this function.
2236 make-docfile does not pay attention to #if, for good reason! */
2241 return make_number (1);
2244 DEFUN ("frame-pixel-height", Fframe_pixel_height
,
2245 Sframe_pixel_height
, 0, 1, 0,
2246 /* Don't confuse make-docfile by having two doc strings for this function.
2247 make-docfile does not pay attention to #if, for good reason! */
2252 return make_number (FRAME_HEIGHT (f
));
2255 DEFUN ("frame-pixel-width", Fframe_pixel_width
,
2256 Sframe_pixel_width
, 0, 1, 0,
2257 /* Don't confuse make-docfile by having two doc strings for this function.
2258 make-docfile does not pay attention to #if, for good reason! */
2263 return make_number (FRAME_WIDTH (f
));
2266 /* These are for backward compatibility with Emacs 18. */
2268 DEFUN ("set-screen-height", Fset_screen_height
, Sset_screen_height
, 1, 2, 0,
2269 /* Don't confuse make-docfile by having two doc strings for this function.
2270 make-docfile does not pay attention to #if, for good reason! */
2273 Lisp_Object lines
, pretend
;
2275 CHECK_NUMBER (lines
, 0);
2277 change_frame_size (0, XINT (lines
), 0, !NILP (pretend
), 0);
2281 DEFUN ("set-screen-width", Fset_screen_width
, Sset_screen_width
, 1, 2, 0,
2282 /* Don't confuse make-docfile by having two doc strings for this function.
2283 make-docfile does not pay attention to #if, for good reason! */
2286 Lisp_Object cols
, pretend
;
2288 CHECK_NUMBER (cols
, 0);
2290 change_frame_size (0, 0, XINT (cols
), !NILP (pretend
), 0);
2294 DEFUN ("mouse-position", Fmouse_position
, Smouse_position
, 0, 0, 0,
2295 /* Don't confuse make-docfile by having two doc strings for this function.
2296 make-docfile does not pay attention to #if, for good reason! */
2301 if (mouse_position_hook
)
2304 Lisp_Object lispy_dummy
;
2305 enum scroll_bar_part party_dummy
;
2307 unsigned long long_dummy
;
2309 (*mouse_position_hook
) (&f
, 0,
2310 &lispy_dummy
, &party_dummy
,
2313 return Fcons (Fselected_frame (), Fcons (x
, y
));
2316 return Fcons (Qnil
, Fcons (Qnil
, Qnil
));
2320 store_in_alist (alistptr
, prop
, val
)
2321 Lisp_Object
*alistptr
, val
;
2324 register Lisp_Object tem
;
2326 tem
= Fassq (prop
, *alistptr
);
2328 *alistptr
= Fcons (Fcons (prop
, val
), *alistptr
);
2333 DEFUN ("frame-parameters", Fframe_parameters
, Sframe_parameters
, 0, 1, 0,
2334 /* Don't confuse make-docfile by having two doc strings for this function.
2335 make-docfile does not pay attention to #if, for good reason! */
2343 if (EQ (frame
, Qnil
))
2347 CHECK_FRAME (frame
, 0);
2351 if (!FRAME_LIVE_P (f
))
2358 static char *colornames
[16] =
2360 "black", "blue", "green", "cyan", "red", "magenta", "brown",
2361 "lightgray", "darkgray", "lightblue", "lightgreen", "lightcyan",
2362 "lightred", "lightmagenta", "yellow", "white"
2364 store_in_alist (&alist
, intern ("foreground-color"),
2365 build_string (colornames
[FRAME_FOREGROUND_PIXEL (f
)]));
2366 store_in_alist (&alist
, intern ("background-color"),
2367 build_string (colornames
[FRAME_BACKGROUND_PIXEL (f
)]));
2370 store_in_alist (&alist
, intern ("font"), build_string ("default"));
2371 store_in_alist (&alist
, Qname
, build_string ("emacs"));
2372 store_in_alist (&alist
, Qheight
, make_number (FRAME_HEIGHT (f
)));
2373 store_in_alist (&alist
, Qwidth
, make_number (FRAME_WIDTH (f
)));
2374 store_in_alist (&alist
, Qmodeline
, (FRAME_WANTS_MODELINE_P (f
) ? Qt
: Qnil
));
2375 store_in_alist (&alist
, Qminibuffer
, FRAME_MINIBUF_WINDOW (f
));
2376 store_in_alist (&alist
, Qunsplittable
, (FRAME_NO_SPLIT_P (f
) ? Qt
: Qnil
));
2377 store_in_alist (&alist
, Qmenu_bar_lines
, (FRAME_MENU_BAR_LINES (f
)));
2382 DEFUN ("modify-frame-parameters", Fmodify_frame_parameters
,
2383 Smodify_frame_parameters
, 2, 2, 0,
2384 /* Don't confuse make-docfile by having two doc strings for this function.
2385 make-docfile does not pay attention to #if, for good reason! */
2388 Lisp_Object frame
, alist
;
2390 Lisp_Object tail
, elt
, prop
, val
;
2397 CHECK_LIVE_FRAME (frame
, 0);
2402 if (FRAME_X_P (frame
))
2403 IT_set_frame_parameters (XFRAME (frame
), alist
);
2406 for (tail
= alist
; !EQ (tail
, Qnil
); tail
= Fcdr (tail
))
2411 if (EQ (prop
, Qmenu_bar_lines
))
2412 set_menu_bar_lines (f
, val
, make_number (FRAME_MENU_BAR_LINES (f
)));
2418 DEFUN ("frame-live-p", Fframe_live_p
, Sframe_live_p
, 1, 1, 0,
2419 /* Don't confuse make-docfile by having two doc strings for this function.
2420 make-docfile does not pay attention to #if, for good reason! */
2428 DEFUN ("frame-visible-p", Fframe_visible_p
, Sframe_visible_p
, 1, 1, 0,
2429 /* Don't confuse make-docfile by having two doc strings for this function.
2430 make-docfile does not pay attention to #if, for good reason! */
2438 DEFUN ("frame-list", Fframe_list
, Sframe_list
, 0, 0, 0,
2439 /* Don't confuse make-docfile by having two doc strings for this function.
2440 make-docfile does not pay attention to #if, for good reason! */
2444 return Fcons (Fselected_frame (), Qnil
);
2451 DEFVAR_LISP ("terminal-frame", &Vterminal_frame
,
2452 /* Don't confuse make-docfile by having two doc strings for this variable.
2453 make-docfile does not pay attention to #if, for good reason! */
2455 XSETFASTINT (Vterminal_frame
, 0);
2457 defsubr (&Sselected_frame
);
2458 defsubr (&Sactive_minibuffer_window
);
2459 defsubr (&Swindow_frame
);
2460 defsubr (&Sframe_first_window
);
2462 defsubr (&Sframe_char_height
);
2463 defsubr (&Sframe_char_width
);
2464 defsubr (&Sframe_pixel_height
);
2465 defsubr (&Sframe_pixel_width
);
2466 defsubr (&Sset_frame_height
);
2467 defsubr (&Sset_frame_width
);
2468 defsubr (&Sset_frame_size
);
2469 defsubr (&Sset_screen_height
);
2470 defsubr (&Sset_screen_width
);
2471 defsubr (&Sframe_height
);
2472 Ffset (intern ("screen-height"), intern ("frame-height"));
2473 defsubr (&Sframe_width
);
2474 Ffset (intern ("screen-width"), intern ("frame-width"));
2475 defsubr (&Smouse_position
);
2476 Ffset (intern ("mouse-pixel-position"), intern ("mouse-position"));
2477 defsubr (&Sframe_parameters
);
2478 defsubr (&Smodify_frame_parameters
);
2479 defsubr (&Sframe_live_p
);
2480 defsubr (&Sframe_visible_p
);
2481 defsubr (&Sframe_list
);
2484 /* A comment in dispnew.c says the_only_frame is not protected. */
2485 the_only_frame
.face_alist
= Qnil
;
2486 staticpro (&the_only_frame
.face_alist
);
2487 the_only_frame
.menu_bar_items
= Qnil
;
2488 staticpro (&the_only_frame
.menu_bar_items
);
2489 the_only_frame
.menu_bar_vector
= Qnil
;
2490 staticpro (&the_only_frame
.menu_bar_vector
);
2491 the_only_frame
.menu_bar_items
= menu_bar_items (Qnil
);
2499 #endif /* not MULTI_FRAME */