1 /* Generic frame functions.
2 Copyright (C) 1993, 1994, 1995, 1997, 1999, 2000 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. */
33 /* These help us bind and responding to switch-frame events. */
37 #ifdef HAVE_WINDOW_SYSTEM
40 #include "termhooks.h"
41 #include "dispextern.h"
49 extern struct mac_output
*NewMacWindow ();
50 extern void DisposeMacWindow (struct mac_output
*);
53 /* Evaluate this expression to rebuild the section of syms_of_frame
54 that initializes and staticpros the symbols declared below. Note
55 that Emacs 18 has a bug that keeps C-x C-e from being able to
56 evaluate this expression.
59 ;; Accumulate a list of the symbols we want to initialize from the
60 ;; declarations at the top of the file.
61 (goto-char (point-min))
62 (search-forward "/\*&&& symbols declared here &&&*\/\n")
64 (while (looking-at "Lisp_Object \\(Q[a-z_]+\\)")
66 (cons (buffer-substring (match-beginning 1) (match-end 1))
69 (setq symbol-list (nreverse symbol-list))
70 ;; Delete the section of syms_of_... where we initialize the symbols.
71 (search-forward "\n /\*&&& init symbols here &&&*\/\n")
72 (let ((start (point)))
73 (while (looking-at "^ Q")
75 (kill-region start (point)))
76 ;; Write a new symbol initialization section.
78 (insert (format " %s = intern (\"" (car symbol-list)))
79 (let ((start (point)))
80 (insert (substring (car symbol-list) 1))
81 (subst-char-in-region start (point) ?_ ?-))
82 (insert (format "\");\n staticpro (&%s);\n" (car symbol-list)))
83 (setq symbol-list (cdr symbol-list)))))
86 /*&&& symbols declared here &&&*/
88 Lisp_Object Qframe_live_p
;
91 Lisp_Object Qminibuffer
;
92 Lisp_Object Qmodeline
;
95 Lisp_Object Qunsplittable
;
96 Lisp_Object Qmenu_bar_lines
;
97 Lisp_Object Qtool_bar_lines
;
103 Lisp_Object Qvisible
;
104 Lisp_Object Qbuffer_predicate
;
105 Lisp_Object Qbuffer_list
;
107 Lisp_Object Qdisplay_type
;
109 Lisp_Object Vterminal_frame
;
110 Lisp_Object Vdefault_frame_alist
;
111 Lisp_Object Vmouse_position_function
;
116 /*&&& init symbols here &&&*/
117 Qframep
= intern ("framep");
118 staticpro (&Qframep
);
119 Qframe_live_p
= intern ("frame-live-p");
120 staticpro (&Qframe_live_p
);
121 Qheight
= intern ("height");
122 staticpro (&Qheight
);
123 Qicon
= intern ("icon");
125 Qminibuffer
= intern ("minibuffer");
126 staticpro (&Qminibuffer
);
127 Qmodeline
= intern ("modeline");
128 staticpro (&Qmodeline
);
129 Qname
= intern ("name");
131 Qonly
= intern ("only");
133 Qunsplittable
= intern ("unsplittable");
134 staticpro (&Qunsplittable
);
135 Qmenu_bar_lines
= intern ("menu-bar-lines");
136 staticpro (&Qmenu_bar_lines
);
137 Qtool_bar_lines
= intern ("tool-bar-lines");
138 staticpro (&Qtool_bar_lines
);
139 Qwidth
= intern ("width");
143 Qw32
= intern ("w32");
147 Qmac
= intern ("mac");
149 Qvisible
= intern ("visible");
150 staticpro (&Qvisible
);
151 Qbuffer_predicate
= intern ("buffer-predicate");
152 staticpro (&Qbuffer_predicate
);
153 Qbuffer_list
= intern ("buffer-list");
154 staticpro (&Qbuffer_list
);
155 Qtitle
= intern ("title");
157 Qdisplay_type
= intern ("display-type");
158 staticpro (&Qdisplay_type
);
160 DEFVAR_LISP ("default-frame-alist", &Vdefault_frame_alist
,
161 "Alist of default values for frame creation.\n\
162 These may be set in your init file, like this:\n\
163 (setq default-frame-alist '((width . 80) (height . 55) (menu-bar-lines . 1))\n\
164 These override values given in window system configuration data,\n\
165 including X Windows' defaults database.\n\
166 For values specific to the first Emacs frame, see `initial-frame-alist'.\n\
167 For values specific to the separate minibuffer frame, see\n\
168 `minibuffer-frame-alist'.\n\
169 The `menu-bar-lines' element of the list controls whether new frames\n\
170 have menu bars; `menu-bar-mode' works by altering this element.");
171 Vdefault_frame_alist
= Qnil
;
175 set_menu_bar_lines_1 (window
, n
)
179 struct window
*w
= XWINDOW (window
);
181 XSETFASTINT (w
->last_modified
, 0);
182 XSETFASTINT (w
->top
, XFASTINT (w
->top
) + n
);
183 XSETFASTINT (w
->height
, XFASTINT (w
->height
) - n
);
185 if (INTEGERP (w
->orig_top
))
186 XSETFASTINT (w
->orig_top
, XFASTINT (w
->orig_top
) + n
);
187 if (INTEGERP (w
->orig_height
))
188 XSETFASTINT (w
->orig_height
, XFASTINT (w
->orig_height
) - n
);
190 /* Handle just the top child in a vertical split. */
191 if (!NILP (w
->vchild
))
192 set_menu_bar_lines_1 (w
->vchild
, n
);
194 /* Adjust all children in a horizontal split. */
195 for (window
= w
->hchild
; !NILP (window
); window
= w
->next
)
197 w
= XWINDOW (window
);
198 set_menu_bar_lines_1 (window
, n
);
203 set_menu_bar_lines (f
, value
, oldval
)
205 Lisp_Object value
, oldval
;
208 int olines
= FRAME_MENU_BAR_LINES (f
);
210 /* Right now, menu bars don't work properly in minibuf-only frames;
211 most of the commands try to apply themselves to the minibuffer
212 frame itself, and get an error because you can't switch buffers
213 in or split the minibuffer window. */
214 if (FRAME_MINIBUF_ONLY_P (f
))
217 if (INTEGERP (value
))
218 nlines
= XINT (value
);
222 if (nlines
!= olines
)
224 windows_or_buffers_changed
++;
225 FRAME_WINDOW_SIZES_CHANGED (f
) = 1;
226 FRAME_MENU_BAR_LINES (f
) = nlines
;
227 set_menu_bar_lines_1 (f
->root_window
, nlines
- olines
);
232 Lisp_Object Vemacs_iconified
;
233 Lisp_Object Vframe_list
;
235 struct x_output tty_display
;
237 extern Lisp_Object Vminibuffer_list
;
238 extern Lisp_Object
get_minibuffer ();
239 extern Lisp_Object
Fhandle_switch_frame ();
240 extern Lisp_Object
Fredirect_frame_focus ();
241 extern Lisp_Object
x_get_focus_frame ();
243 DEFUN ("framep", Fframep
, Sframep
, 1, 1, 0,
244 "Return non-nil if OBJECT is a frame.\n\
245 Value is t for a termcap frame (a character-only terminal),\n\
246 `x' for an Emacs frame that is really an X window,\n\
247 `w32' for an Emacs frame that is a window on MS-Windows display,\n\
248 `mac' for an Emacs frame on a Macintosh display,\n\
249 `pc' for a direct-write MS-DOS frame.\n\
250 See also `frame-live-p'.")
254 if (!FRAMEP (object
))
256 switch (XFRAME (object
)->output_method
)
260 case output_x_window
:
264 case output_msdos_raw
:
273 DEFUN ("frame-live-p", Fframe_live_p
, Sframe_live_p
, 1, 1, 0,
274 "Return non-nil if OBJECT is a frame which has not been deleted.\n\
275 Value is nil if OBJECT is not a live frame. If object is a live\n\
276 frame, the return value indicates what sort of output device it is\n\
277 displayed on. Value is t for a termcap frame (a character-only\n\
278 terminal), `x' for an Emacs frame being displayed in an X window.")
282 return ((FRAMEP (object
)
283 && FRAME_LIVE_P (XFRAME (object
)))
293 register struct frame
*f
;
294 register Lisp_Object root_window
;
295 register Lisp_Object mini_window
;
296 register struct Lisp_Vector
*vec
;
299 vec
= allocate_vectorlike ((EMACS_INT
) VECSIZE (struct frame
));
300 for (i
= 0; i
< VECSIZE (struct frame
); i
++)
301 XSETFASTINT (vec
->contents
[i
], 0);
302 vec
->size
= VECSIZE (struct frame
);
303 f
= (struct frame
*)vec
;
304 XSETFRAME (frame
, f
);
306 f
->desired_matrix
= 0;
307 f
->current_matrix
= 0;
310 f
->glyphs_initialized_p
= 0;
311 f
->decode_mode_spec_buffer
= 0;
313 f
->async_visible
= 0;
314 f
->output_data
.nothing
= 0;
316 f
->async_iconified
= 0;
317 f
->wants_modeline
= 1;
322 f
->has_minibuffer
= mini_p
;
323 f
->focus_frame
= Qnil
;
324 f
->explicit_name
= 0;
325 f
->can_have_scroll_bars
= 0;
326 f
->vertical_scroll_bar_type
= vertical_scroll_bar_none
;
327 f
->param_alist
= Qnil
;
328 f
->scroll_bars
= Qnil
;
329 f
->condemned_scroll_bars
= Qnil
;
330 f
->face_alist
= Qnil
;
331 f
->face_cache
= NULL
;
332 f
->menu_bar_items
= Qnil
;
333 f
->menu_bar_vector
= Qnil
;
334 f
->menu_bar_items_used
= 0;
335 f
->buffer_predicate
= Qnil
;
336 f
->buffer_list
= Qnil
;
338 f
->kboard
= initial_kboard
;
342 f
->menu_bar_window
= Qnil
;
343 f
->tool_bar_window
= Qnil
;
344 f
->desired_tool_bar_items
= f
->current_tool_bar_items
= Qnil
;
345 f
->desired_tool_bar_string
= f
->current_tool_bar_string
= Qnil
;
346 f
->n_desired_tool_bar_items
= f
->n_current_tool_bar_items
= 0;
348 root_window
= make_window ();
351 mini_window
= make_window ();
352 XWINDOW (root_window
)->next
= mini_window
;
353 XWINDOW (mini_window
)->prev
= root_window
;
354 XWINDOW (mini_window
)->mini_p
= Qt
;
355 XWINDOW (mini_window
)->frame
= frame
;
356 f
->minibuffer_window
= mini_window
;
361 XWINDOW (root_window
)->next
= Qnil
;
362 f
->minibuffer_window
= Qnil
;
365 XWINDOW (root_window
)->frame
= frame
;
368 just so that there is "something there."
369 Correct size will be set up later with change_frame_size. */
371 SET_FRAME_WIDTH (f
, 10);
374 XSETFASTINT (XWINDOW (root_window
)->width
, 10);
375 XSETFASTINT (XWINDOW (root_window
)->height
, (mini_p
? 9 : 10));
379 XSETFASTINT (XWINDOW (mini_window
)->width
, 10);
380 XSETFASTINT (XWINDOW (mini_window
)->top
, 9);
381 XSETFASTINT (XWINDOW (mini_window
)->height
, 1);
384 /* Choose a buffer for the frame's root window. */
388 XWINDOW (root_window
)->buffer
= Qt
;
389 buf
= Fcurrent_buffer ();
390 /* If buf is a 'hidden' buffer (i.e. one whose name starts with
391 a space), try to find another one. */
392 if (XSTRING (Fbuffer_name (buf
))->data
[0] == ' ')
393 buf
= Fother_buffer (buf
, Qnil
, Qnil
);
395 /* Use set_window_buffer, not Fset_window_buffer, and don't let
396 hooks be run by it. The reason is that the whole frame/window
397 arrangement is not yet fully intialized at this point. Windows
398 don't have the right size, glyph matrices aren't initialized
399 etc. Running Lisp functions at this point surely ends in a
401 set_window_buffer (root_window
, buf
, 0);
402 f
->buffer_list
= Fcons (buf
, Qnil
);
407 XWINDOW (mini_window
)->buffer
= Qt
;
408 set_window_buffer (mini_window
,
409 (NILP (Vminibuffer_list
)
411 : Fcar (Vminibuffer_list
)),
415 f
->root_window
= root_window
;
416 f
->selected_window
= root_window
;
417 /* Make sure this window seems more recently used than
418 a newly-created, never-selected window. */
419 XSETFASTINT (XWINDOW (f
->selected_window
)->use_time
, ++window_select_count
);
424 #ifdef HAVE_WINDOW_SYSTEM
425 /* Make a frame using a separate minibuffer window on another frame.
426 MINI_WINDOW is the minibuffer window to use. nil means use the
427 default (the global minibuffer). */
430 make_frame_without_minibuffer (mini_window
, kb
, display
)
431 register Lisp_Object mini_window
;
435 register struct frame
*f
;
438 if (!NILP (mini_window
))
439 CHECK_LIVE_WINDOW (mini_window
, 0);
442 if (!NILP (mini_window
)
443 && XFRAME (XWINDOW (mini_window
)->frame
)->kboard
!= kb
)
444 error ("frame and minibuffer must be on the same display");
447 /* Make a frame containing just a root window. */
450 if (NILP (mini_window
))
452 /* Use default-minibuffer-frame if possible. */
453 if (!FRAMEP (kb
->Vdefault_minibuffer_frame
)
454 || ! FRAME_LIVE_P (XFRAME (kb
->Vdefault_minibuffer_frame
)))
456 Lisp_Object frame_dummy
;
458 XSETFRAME (frame_dummy
, f
);
459 GCPRO1 (frame_dummy
);
460 /* If there's no minibuffer frame to use, create one. */
461 kb
->Vdefault_minibuffer_frame
=
462 call1 (intern ("make-initial-minibuffer-frame"), display
);
466 mini_window
= XFRAME (kb
->Vdefault_minibuffer_frame
)->minibuffer_window
;
469 f
->minibuffer_window
= mini_window
;
471 /* Make the chosen minibuffer window display the proper minibuffer,
472 unless it is already showing a minibuffer. */
473 if (NILP (Fmemq (XWINDOW (mini_window
)->buffer
, Vminibuffer_list
)))
474 Fset_window_buffer (mini_window
,
475 (NILP (Vminibuffer_list
)
477 : Fcar (Vminibuffer_list
)));
481 /* Make a frame containing only a minibuffer window. */
484 make_minibuffer_frame ()
486 /* First make a frame containing just a root window, no minibuffer. */
488 register struct frame
*f
= make_frame (0);
489 register Lisp_Object mini_window
;
490 register Lisp_Object frame
;
492 XSETFRAME (frame
, f
);
497 f
->wants_modeline
= 0;
498 f
->has_minibuffer
= 1;
500 /* Now label the root window as also being the minibuffer.
501 Avoid infinite looping on the window chain by marking next pointer
504 mini_window
= f
->minibuffer_window
= f
->root_window
;
505 XWINDOW (mini_window
)->mini_p
= Qt
;
506 XWINDOW (mini_window
)->next
= Qnil
;
507 XWINDOW (mini_window
)->prev
= Qnil
;
508 XWINDOW (mini_window
)->frame
= frame
;
510 /* Put the proper buffer in that window. */
512 Fset_window_buffer (mini_window
,
513 (NILP (Vminibuffer_list
)
515 : Fcar (Vminibuffer_list
)));
518 #endif /* HAVE_WINDOW_SYSTEM */
520 /* Construct a frame that refers to the terminal (stdin and stdout). */
522 static int terminal_frame_count
;
525 make_terminal_frame ()
527 register struct frame
*f
;
534 initial_kboard
= (KBOARD
*) xmalloc (sizeof (KBOARD
));
535 init_kboard (initial_kboard
);
536 initial_kboard
->next_kboard
= all_kboards
;
537 all_kboards
= initial_kboard
;
541 /* The first call must initialize Vframe_list. */
542 if (! (NILP (Vframe_list
) || CONSP (Vframe_list
)))
547 XSETFRAME (frame
, f
);
548 Vframe_list
= Fcons (frame
, Vframe_list
);
550 terminal_frame_count
++;
551 sprintf (name
, "F%d", terminal_frame_count
);
552 f
->name
= build_string (name
);
554 f
->visible
= 1; /* FRAME_SET_VISIBLE wd set frame_garbaged. */
555 f
->async_visible
= 1; /* Don't let visible be cleared later. */
557 f
->output_data
.x
= &the_only_x_display
;
558 if (!inhibit_window_system
559 && (!FRAMEP (selected_frame
) || !FRAME_LIVE_P (XFRAME (selected_frame
))
560 || XFRAME (selected_frame
)->output_method
== output_msdos_raw
))
561 f
->output_method
= output_msdos_raw
;
563 f
->output_method
= output_termcap
;
566 f
->output_data
.mac
= NewMacWindow(f
);
567 f
->output_data
.mac
->background_pixel
= 0xffffff;
568 f
->output_data
.mac
->foreground_pixel
= 0;
569 f
->output_data
.mac
->n_param_faces
= 0;
570 f
->output_data
.mac
->n_computed_faces
= 0;
571 f
->output_data
.mac
->size_computed_faces
= 0;
572 f
->output_method
= output_mac
;
575 init_frame_faces (f
);
576 #else /* !macintosh */
577 f
->output_data
.x
= &tty_display
;
578 #endif /* !macintosh */
583 init_frame_faces (f
);
588 DEFUN ("make-terminal-frame", Fmake_terminal_frame
, Smake_terminal_frame
,
589 1, 1, 0, "Create an additional terminal frame.\n\
590 You can create multiple frames on a text-only terminal in this way.\n\
591 Only the selected terminal frame is actually displayed.\n\
592 This function takes one argument, an alist specifying frame parameters.\n\
593 In practice, generally you don't need to specify any parameters.\n\
594 Note that changing the size of one terminal frame automatically affects all.")
599 Lisp_Object frame
, tem
;
600 struct frame
*sf
= SELECTED_FRAME ();
603 if (sf
->output_method
!= output_msdos_raw
604 && sf
->output_method
!= output_termcap
)
606 #else /* not MSDOS */
609 if (sf
->output_method
!= output_mac
)
610 error ("Not running on a Macintosh screen; cannot make a new Macintosh frame");
612 if (sf
->output_method
!= output_termcap
)
613 error ("Not using an ASCII terminal now; cannot make a new ASCII frame");
615 #endif /* not MSDOS */
617 f
= make_terminal_frame ();
619 change_frame_size (f
, FRAME_HEIGHT (sf
),
620 FRAME_WIDTH (sf
), 0, 0, 0);
623 XSETFRAME (frame
, f
);
624 Fmodify_frame_parameters (frame
, Vdefault_frame_alist
);
625 Fmodify_frame_parameters (frame
, parms
);
627 /* Make the frame face alist be frame-specific, so that each
628 frame could change its face definitions independently. */
629 f
->face_alist
= Fcopy_alist (sf
->face_alist
);
630 /* Simple Fcopy_alist isn't enough, because we need the contents of
631 the vectors which are the CDRs of associations in face_alist to
632 be copied as well. */
633 for (tem
= f
->face_alist
; CONSP (tem
); tem
= XCDR (tem
))
634 XCDR (XCAR (tem
)) = Fcopy_sequence (XCDR (XCAR (tem
)));
639 do_switch_frame (frame
, no_enter
, track
)
640 Lisp_Object frame
, no_enter
;
643 struct frame
*sf
= SELECTED_FRAME ();
645 /* If FRAME is a switch-frame event, extract the frame we should
648 && EQ (XCAR (frame
), Qswitch_frame
)
649 && CONSP (XCDR (frame
)))
650 frame
= XCAR (XCDR (frame
));
652 /* This used to say CHECK_LIVE_FRAME, but apparently it's possible for
653 a switch-frame event to arrive after a frame is no longer live,
654 especially when deleting the initial frame during startup. */
655 CHECK_FRAME (frame
, 0);
656 if (! FRAME_LIVE_P (XFRAME (frame
)))
659 if (sf
== XFRAME (frame
))
662 /* This is too greedy; it causes inappropriate focus redirection
663 that's hard to get rid of. */
665 /* If a frame's focus has been redirected toward the currently
666 selected frame, we should change the redirection to point to the
667 newly selected frame. This means that if the focus is redirected
668 from a minibufferless frame to a surrogate minibuffer frame, we
669 can use `other-window' to switch between all the frames using
670 that minibuffer frame, and the focus redirection will follow us
676 for (tail
= Vframe_list
; CONSP (tail
); tail
= XCDR (tail
))
680 if (!FRAMEP (XCAR (tail
)))
683 focus
= FRAME_FOCUS_FRAME (XFRAME (XCAR (tail
)));
685 if (FRAMEP (focus
) && XFRAME (focus
) == SELECTED_FRAME ())
686 Fredirect_frame_focus (XCAR (tail
), frame
);
690 /* Instead, apply it only to the frame we're pointing to. */
691 #ifdef HAVE_WINDOW_SYSTEM
692 if (track
&& (FRAME_WINDOW_P (XFRAME (frame
))))
694 Lisp_Object focus
, xfocus
;
696 xfocus
= x_get_focus_frame (XFRAME (frame
));
699 focus
= FRAME_FOCUS_FRAME (XFRAME (xfocus
));
700 if (FRAMEP (focus
) && XFRAME (focus
) == SELECTED_FRAME ())
701 Fredirect_frame_focus (xfocus
, frame
);
704 #endif /* HAVE_X_WINDOWS */
707 selected_frame
= frame
;
708 if (! FRAME_MINIBUF_ONLY_P (XFRAME (selected_frame
)))
709 last_nonminibuf_frame
= XFRAME (selected_frame
);
711 Fselect_window (XFRAME (frame
)->selected_window
);
713 /* We want to make sure that the next event generates a frame-switch
714 event to the appropriate frame. This seems kludgy to me, but
715 before you take it out, make sure that evaluating something like
716 (select-window (frame-root-window (new-frame))) doesn't end up
717 with your typing being interpreted in the new frame instead of
718 the one you're actually typing in. */
719 internal_last_event_frame
= Qnil
;
724 DEFUN ("select-frame", Fselect_frame
, Sselect_frame
, 1, 2, "e",
725 "Select the frame FRAME.\n\
726 Subsequent editing commands apply to its selected window.\n\
727 The selection of FRAME lasts until the next time the user does\n\
728 something to select a different frame, or until the next time this\n\
729 function is called.")
731 Lisp_Object frame
, no_enter
;
733 return do_switch_frame (frame
, no_enter
, 1);
737 DEFUN ("handle-switch-frame", Fhandle_switch_frame
, Shandle_switch_frame
, 1, 2, "e",
738 "Handle a switch-frame event EVENT.\n\
739 Switch-frame events are usually bound to this function.\n\
740 A switch-frame event tells Emacs that the window manager has requested\n\
741 that the user's events be directed to the frame mentioned in the event.\n\
742 This function selects the selected window of the frame of EVENT.\n\
744 If EVENT is frame object, handle it as if it were a switch-frame event\n\
747 Lisp_Object event
, no_enter
;
749 /* Preserve prefix arg that the command loop just cleared. */
750 current_kboard
->Vprefix_arg
= Vcurrent_prefix_arg
;
751 call1 (Vrun_hooks
, Qmouse_leave_buffer_hook
);
752 return do_switch_frame (event
, no_enter
, 0);
755 DEFUN ("ignore-event", Fignore_event
, Signore_event
, 0, 0, "",
756 "Do nothing, but preserve any prefix argument already specified.\n\
757 This is a suitable binding for iconify-frame and make-frame-visible.")
760 current_kboard
->Vprefix_arg
= Vcurrent_prefix_arg
;
764 DEFUN ("selected-frame", Fselected_frame
, Sselected_frame
, 0, 0, 0,
765 "Return the frame that is now selected.")
768 return selected_frame
;
771 DEFUN ("window-frame", Fwindow_frame
, Swindow_frame
, 1, 1, 0,
772 "Return the frame object that window WINDOW is on.")
776 CHECK_LIVE_WINDOW (window
, 0);
777 return XWINDOW (window
)->frame
;
780 DEFUN ("frame-first-window", Fframe_first_window
, Sframe_first_window
, 0, 1, 0,
781 "Returns the topmost, leftmost window of FRAME.\n\
782 If omitted, FRAME defaults to the currently selected frame.")
789 w
= SELECTED_FRAME ()->root_window
;
792 CHECK_LIVE_FRAME (frame
, 0);
793 w
= XFRAME (frame
)->root_window
;
795 while (NILP (XWINDOW (w
)->buffer
))
797 if (! NILP (XWINDOW (w
)->hchild
))
798 w
= XWINDOW (w
)->hchild
;
799 else if (! NILP (XWINDOW (w
)->vchild
))
800 w
= XWINDOW (w
)->vchild
;
807 DEFUN ("active-minibuffer-window", Factive_minibuffer_window
,
808 Sactive_minibuffer_window
, 0, 0, 0,
809 "Return the currently active minibuffer window, or nil if none.")
812 return minibuf_level
? minibuf_window
: Qnil
;
815 DEFUN ("frame-root-window", Fframe_root_window
, Sframe_root_window
, 0, 1, 0,
816 "Returns the root-window of FRAME.\n\
817 If omitted, FRAME defaults to the currently selected frame.")
824 window
= SELECTED_FRAME ()->root_window
;
827 CHECK_LIVE_FRAME (frame
, 0);
828 window
= XFRAME (frame
)->root_window
;
834 DEFUN ("frame-selected-window", Fframe_selected_window
,
835 Sframe_selected_window
, 0, 1, 0,
836 "Return the selected window of frame object FRAME.\n\
837 If omitted, FRAME defaults to the currently selected frame.")
844 window
= SELECTED_FRAME ()->selected_window
;
847 CHECK_LIVE_FRAME (frame
, 0);
848 window
= XFRAME (frame
)->selected_window
;
854 DEFUN ("set-frame-selected-window", Fset_frame_selected_window
,
855 Sset_frame_selected_window
, 2, 2, 0,
856 "Set the selected window of frame object FRAME to WINDOW.\n\
857 If FRAME is nil, the selected frame is used.\n\
858 If FRAME is the selected frame, this makes WINDOW the selected window.")
860 Lisp_Object frame
, window
;
863 frame
= selected_frame
;
865 CHECK_LIVE_FRAME (frame
, 0);
866 CHECK_LIVE_WINDOW (window
, 1);
868 if (! EQ (frame
, WINDOW_FRAME (XWINDOW (window
))))
869 error ("In `set-frame-selected-window', WINDOW is not on FRAME");
871 if (EQ (frame
, selected_frame
))
872 return Fselect_window (window
);
874 return XFRAME (frame
)->selected_window
= window
;
877 DEFUN ("frame-list", Fframe_list
, Sframe_list
,
879 "Return a list of all frames.")
882 return Fcopy_sequence (Vframe_list
);
885 /* Return the next frame in the frame list after FRAME.
886 If MINIBUF is nil, exclude minibuffer-only frames.
887 If MINIBUF is a window, include only its own frame
888 and any frame now using that window as the minibuffer.
889 If MINIBUF is `visible', include all visible frames.
890 If MINIBUF is 0, include all visible and iconified frames.
891 Otherwise, include all frames. */
894 next_frame (frame
, minibuf
)
901 /* There must always be at least one frame in Vframe_list. */
902 if (! CONSP (Vframe_list
))
905 /* If this frame is dead, it won't be in Vframe_list, and we'll loop
906 forever. Forestall that. */
907 CHECK_LIVE_FRAME (frame
, 0);
910 for (tail
= Vframe_list
; CONSP (tail
); tail
= XCDR (tail
))
917 && FRAME_KBOARD (XFRAME (f
)) == FRAME_KBOARD (XFRAME (frame
)))
919 /* Decide whether this frame is eligible to be returned. */
921 /* If we've looped all the way around without finding any
922 eligible frames, return the original frame. */
926 /* Let minibuf decide if this frame is acceptable. */
929 if (! FRAME_MINIBUF_ONLY_P (XFRAME (f
)))
932 else if (EQ (minibuf
, Qvisible
))
934 FRAME_SAMPLE_VISIBILITY (XFRAME (f
));
935 if (FRAME_VISIBLE_P (XFRAME (f
)))
938 else if (INTEGERP (minibuf
) && XINT (minibuf
) == 0)
940 FRAME_SAMPLE_VISIBILITY (XFRAME (f
));
941 if (FRAME_VISIBLE_P (XFRAME (f
))
942 || FRAME_ICONIFIED_P (XFRAME (f
)))
945 else if (WINDOWP (minibuf
))
947 if (EQ (FRAME_MINIBUF_WINDOW (XFRAME (f
)), minibuf
)
948 || EQ (WINDOW_FRAME (XWINDOW (minibuf
)), f
)
949 || EQ (WINDOW_FRAME (XWINDOW (minibuf
)),
950 FRAME_FOCUS_FRAME (XFRAME (f
))))
962 /* Return the previous frame in the frame list before FRAME.
963 If MINIBUF is nil, exclude minibuffer-only frames.
964 If MINIBUF is a window, include only its own frame
965 and any frame now using that window as the minibuffer.
966 If MINIBUF is `visible', include all visible frames.
967 If MINIBUF is 0, include all visible and iconified frames.
968 Otherwise, include all frames. */
971 prev_frame (frame
, minibuf
)
978 /* There must always be at least one frame in Vframe_list. */
979 if (! CONSP (Vframe_list
))
983 for (tail
= Vframe_list
; CONSP (tail
); tail
= XCDR (tail
))
991 if (EQ (frame
, f
) && !NILP (prev
))
994 if (FRAME_KBOARD (XFRAME (f
)) == FRAME_KBOARD (XFRAME (frame
)))
996 /* Decide whether this frame is eligible to be returned,
997 according to minibuf. */
1000 if (! FRAME_MINIBUF_ONLY_P (XFRAME (f
)))
1003 else if (WINDOWP (minibuf
))
1005 if (EQ (FRAME_MINIBUF_WINDOW (XFRAME (f
)), minibuf
)
1006 || EQ (WINDOW_FRAME (XWINDOW (minibuf
)), f
)
1007 || EQ (WINDOW_FRAME (XWINDOW (minibuf
)),
1008 FRAME_FOCUS_FRAME (XFRAME (f
))))
1011 else if (EQ (minibuf
, Qvisible
))
1013 FRAME_SAMPLE_VISIBILITY (XFRAME (f
));
1014 if (FRAME_VISIBLE_P (XFRAME (f
)))
1017 else if (XFASTINT (minibuf
) == 0)
1019 FRAME_SAMPLE_VISIBILITY (XFRAME (f
));
1020 if (FRAME_VISIBLE_P (XFRAME (f
))
1021 || FRAME_ICONIFIED_P (XFRAME (f
)))
1029 /* We've scanned the entire list. */
1031 /* We went through the whole frame list without finding a single
1032 acceptable frame. Return the original frame. */
1035 /* There were no acceptable frames in the list before FRAME; otherwise,
1036 we would have returned directly from the loop. Since PREV is the last
1037 acceptable frame in the list, return it. */
1042 DEFUN ("next-frame", Fnext_frame
, Snext_frame
, 0, 2, 0,
1043 "Return the next frame in the frame list after FRAME.\n\
1044 It considers only frames on the same terminal as FRAME.\n\
1045 By default, skip minibuffer-only frames.\n\
1046 If omitted, FRAME defaults to the selected frame.\n\
1047 If optional argument MINIFRAME is nil, exclude minibuffer-only frames.\n\
1048 If MINIFRAME is a window, include only its own frame\n\
1049 and any frame now using that window as the minibuffer.\n\
1050 If MINIFRAME is `visible', include all visible frames.\n\
1051 If MINIFRAME is 0, include all visible and iconified frames.\n\
1052 Otherwise, include all frames.")
1054 Lisp_Object frame
, miniframe
;
1057 frame
= selected_frame
;
1059 CHECK_LIVE_FRAME (frame
, 0);
1060 return next_frame (frame
, miniframe
);
1063 DEFUN ("previous-frame", Fprevious_frame
, Sprevious_frame
, 0, 2, 0,
1064 "Return the previous frame in the frame list before FRAME.\n\
1065 It considers only frames on the same terminal as FRAME.\n\
1066 By default, skip minibuffer-only frames.\n\
1067 If omitted, FRAME defaults to the selected frame.\n\
1068 If optional argument MINIFRAME is nil, exclude minibuffer-only frames.\n\
1069 If MINIFRAME is a window, include only its own frame\n\
1070 and any frame now using that window as the minibuffer.\n\
1071 If MINIFRAME is `visible', include all visible frames.\n\
1072 If MINIFRAME is 0, include all visible and iconified frames.\n\
1073 Otherwise, include all frames.")
1075 Lisp_Object frame
, miniframe
;
1078 frame
= selected_frame
;
1079 CHECK_LIVE_FRAME (frame
, 0);
1080 return prev_frame (frame
, miniframe
);
1083 /* Return 1 if it is ok to delete frame F;
1084 0 if all frames aside from F are invisible.
1085 (Exception: if F is the terminal frame, and we are using X, return 1.) */
1088 other_visible_frames (f
)
1091 /* We know the selected frame is visible,
1092 so if F is some other frame, it can't be the sole visible one. */
1093 if (f
== SELECTED_FRAME ())
1098 for (frames
= Vframe_list
;
1100 frames
= XCDR (frames
))
1104 this = XCAR (frames
);
1105 /* Verify that the frame's window still exists
1106 and we can still talk to it. And note any recent change
1108 #ifdef HAVE_WINDOW_SYSTEM
1109 if (FRAME_WINDOW_P (XFRAME (this)))
1111 x_sync (XFRAME (this));
1112 FRAME_SAMPLE_VISIBILITY (XFRAME (this));
1116 if (FRAME_VISIBLE_P (XFRAME (this))
1117 || FRAME_ICONIFIED_P (XFRAME (this))
1118 /* Allow deleting the terminal frame when at least
1119 one X frame exists! */
1120 || (FRAME_WINDOW_P (XFRAME (this)) && !FRAME_WINDOW_P (f
)))
1128 DEFUN ("delete-frame", Fdelete_frame
, Sdelete_frame
, 0, 2, "",
1129 "Delete FRAME, permanently eliminating it from use.\n\
1130 If omitted, FRAME defaults to the selected frame.\n\
1131 A frame may not be deleted if its minibuffer is used by other frames.\n\
1132 Normally, you may not delete a frame if all other frames are invisible,\n\
1133 but if the second optional argument FORCE is non-nil, you may do so.")
1135 Lisp_Object frame
, force
;
1138 struct frame
*sf
= SELECTED_FRAME ();
1139 int minibuffer_selected
;
1141 if (EQ (frame
, Qnil
))
1144 XSETFRAME (frame
, f
);
1148 CHECK_FRAME (frame
, 0);
1152 if (! FRAME_LIVE_P (f
))
1155 if (NILP (force
) && !other_visible_frames (f
))
1156 error ("Attempt to delete the sole visible or iconified frame");
1159 /* This is a nice idea, but x_connection_closed needs to be able
1160 to delete the last frame, if it is gone. */
1161 if (NILP (XCDR (Vframe_list
)))
1162 error ("Attempt to delete the only frame");
1165 /* Does this frame have a minibuffer, and is it the surrogate
1166 minibuffer for any other frame? */
1167 if (FRAME_HAS_MINIBUF_P (XFRAME (frame
)))
1171 for (frames
= Vframe_list
;
1173 frames
= XCDR (frames
))
1176 this = XCAR (frames
);
1178 if (! EQ (this, frame
)
1180 WINDOW_FRAME (XWINDOW
1181 (FRAME_MINIBUF_WINDOW (XFRAME (this))))))
1182 error ("Attempt to delete a surrogate minibuffer frame");
1186 minibuffer_selected
= EQ (minibuf_window
, selected_window
);
1188 /* Don't let the frame remain selected. */
1191 Lisp_Object tail
, frame1
;
1193 /* Look for another visible frame on the same terminal. */
1194 frame1
= next_frame (frame
, Qvisible
);
1196 /* If there is none, find *some* other frame. */
1197 if (NILP (frame1
) || EQ (frame1
, frame
))
1199 FOR_EACH_FRAME (tail
, frame1
)
1201 if (! EQ (frame
, frame1
))
1206 do_switch_frame (frame1
, Qnil
, 0);
1207 sf
= SELECTED_FRAME ();
1210 /* Don't allow minibuf_window to remain on a deleted frame. */
1211 if (EQ (f
->minibuffer_window
, minibuf_window
))
1213 Fset_window_buffer (sf
->minibuffer_window
,
1214 XWINDOW (minibuf_window
)->buffer
);
1215 minibuf_window
= sf
->minibuffer_window
;
1217 /* If the dying minibuffer window was selected,
1218 select the new one. */
1219 if (minibuffer_selected
)
1220 Fselect_window (minibuf_window
);
1223 /* Don't let echo_area_window to remain on a deleted frame. */
1224 if (EQ (f
->minibuffer_window
, echo_area_window
))
1225 echo_area_window
= sf
->minibuffer_window
;
1227 /* Clear any X selections for this frame. */
1228 #ifdef HAVE_X_WINDOWS
1230 x_clear_frame_selections (f
);
1234 This function must be called before the window tree of the
1235 frame is deleted because windows contain dynamically allocated
1239 /* Mark all the windows that used to be on FRAME as deleted, and then
1240 remove the reference to them. */
1241 delete_all_subwindows (XWINDOW (f
->root_window
));
1242 f
->root_window
= Qnil
;
1244 Vframe_list
= Fdelq (frame
, Vframe_list
);
1245 FRAME_SET_VISIBLE (f
, 0);
1249 if (FRAME_INSERT_COST (f
))
1250 xfree (FRAME_INSERT_COST (f
));
1251 if (FRAME_DELETEN_COST (f
))
1252 xfree (FRAME_DELETEN_COST (f
));
1253 if (FRAME_INSERTN_COST (f
))
1254 xfree (FRAME_INSERTN_COST (f
));
1255 if (FRAME_DELETE_COST (f
))
1256 xfree (FRAME_DELETE_COST (f
));
1257 if (FRAME_MESSAGE_BUF (f
))
1258 xfree (FRAME_MESSAGE_BUF (f
));
1260 /* Since some events are handled at the interrupt level, we may get
1261 an event for f at any time; if we zero out the frame's display
1262 now, then we may trip up the event-handling code. Instead, we'll
1263 promise that the display of the frame must be valid until we have
1264 called the window-system-dependent frame destruction routine. */
1266 /* I think this should be done with a hook. */
1267 #ifdef HAVE_WINDOW_SYSTEM
1268 if (FRAME_WINDOW_P (f
))
1269 x_destroy_window (f
);
1272 /* Done by x_destroy_window above already */
1275 if (FRAME_MAC_P (f
))
1276 DisposeMacWindow (f
->output_data
.mac
);
1280 f
->output_data
.nothing
= 0;
1282 /* If we've deleted the last_nonminibuf_frame, then try to find
1284 if (f
== last_nonminibuf_frame
)
1288 last_nonminibuf_frame
= 0;
1290 for (frames
= Vframe_list
;
1292 frames
= XCDR (frames
))
1294 f
= XFRAME (XCAR (frames
));
1295 if (!FRAME_MINIBUF_ONLY_P (f
))
1297 last_nonminibuf_frame
= f
;
1303 /* If we've deleted this keyboard's default_minibuffer_frame, try to
1304 find another one. Prefer minibuffer-only frames, but also notice
1305 frames with other windows. */
1306 if (EQ (frame
, FRAME_KBOARD (f
)->Vdefault_minibuffer_frame
))
1310 /* The last frame we saw with a minibuffer, minibuffer-only or not. */
1311 Lisp_Object frame_with_minibuf
;
1312 /* Some frame we found on the same kboard, or nil if there are none. */
1313 Lisp_Object frame_on_same_kboard
;
1315 frame_on_same_kboard
= Qnil
;
1316 frame_with_minibuf
= Qnil
;
1318 for (frames
= Vframe_list
;
1320 frames
= XCDR (frames
))
1325 this = XCAR (frames
);
1330 /* Consider only frames on the same kboard
1331 and only those with minibuffers. */
1332 if (FRAME_KBOARD (f
) == FRAME_KBOARD (f1
)
1333 && FRAME_HAS_MINIBUF_P (f1
))
1335 frame_with_minibuf
= this;
1336 if (FRAME_MINIBUF_ONLY_P (f1
))
1340 if (FRAME_KBOARD (f
) == FRAME_KBOARD (f1
))
1341 frame_on_same_kboard
= this;
1344 if (!NILP (frame_on_same_kboard
))
1346 /* We know that there must be some frame with a minibuffer out
1347 there. If this were not true, all of the frames present
1348 would have to be minibufferless, which implies that at some
1349 point their minibuffer frames must have been deleted, but
1350 that is prohibited at the top; you can't delete surrogate
1351 minibuffer frames. */
1352 if (NILP (frame_with_minibuf
))
1355 FRAME_KBOARD (f
)->Vdefault_minibuffer_frame
= frame_with_minibuf
;
1358 /* No frames left on this kboard--say no minibuffer either. */
1359 FRAME_KBOARD (f
)->Vdefault_minibuffer_frame
= Qnil
;
1362 /* Cause frame titles to update--necessary if we now have just one frame. */
1363 update_mode_lines
= 1;
1368 /* Return mouse position in character cell units. */
1370 DEFUN ("mouse-position", Fmouse_position
, Smouse_position
, 0, 0, 0,
1371 "Return a list (FRAME X . Y) giving the current mouse frame and position.\n\
1372 The position is given in character cells, where (0, 0) is the\n\
1373 upper-left corner.\n\
1374 If Emacs is running on a mouseless terminal or hasn't been programmed\n\
1375 to read the mouse position, it returns the selected frame for FRAME\n\
1376 and nil for X and Y.\n\
1377 Runs the abnormal hook `mouse-position-function' with the normal return\n\
1378 value as argument.")
1382 Lisp_Object lispy_dummy
;
1383 enum scroll_bar_part party_dummy
;
1384 Lisp_Object x
, y
, retval
;
1386 unsigned long long_dummy
;
1387 struct gcpro gcpro1
;
1389 f
= SELECTED_FRAME ();
1393 /* It's okay for the hook to refrain from storing anything. */
1394 if (mouse_position_hook
)
1395 (*mouse_position_hook
) (&f
, -1,
1396 &lispy_dummy
, &party_dummy
,
1403 pixel_to_glyph_coords (f
, col
, row
, &col
, &row
, NULL
, 1);
1408 XSETFRAME (lispy_dummy
, f
);
1409 retval
= Fcons (lispy_dummy
, Fcons (x
, y
));
1411 if (!NILP (Vmouse_position_function
))
1412 retval
= call1 (Vmouse_position_function
, retval
);
1413 RETURN_UNGCPRO (retval
);
1416 DEFUN ("mouse-pixel-position", Fmouse_pixel_position
,
1417 Smouse_pixel_position
, 0, 0, 0,
1418 "Return a list (FRAME X . Y) giving the current mouse frame and position.\n\
1419 The position is given in pixel units, where (0, 0) is the\n\
1420 upper-left corner.\n\
1421 If Emacs is running on a mouseless terminal or hasn't been programmed\n\
1422 to read the mouse position, it returns the selected frame for FRAME\n\
1423 and nil for X and Y.")
1427 Lisp_Object lispy_dummy
;
1428 enum scroll_bar_part party_dummy
;
1430 unsigned long long_dummy
;
1432 f
= SELECTED_FRAME ();
1436 /* It's okay for the hook to refrain from storing anything. */
1437 if (mouse_position_hook
)
1438 (*mouse_position_hook
) (&f
, -1,
1439 &lispy_dummy
, &party_dummy
,
1443 XSETFRAME (lispy_dummy
, f
);
1444 return Fcons (lispy_dummy
, Fcons (x
, y
));
1447 DEFUN ("set-mouse-position", Fset_mouse_position
, Sset_mouse_position
, 3, 3, 0,
1448 "Move the mouse pointer to the center of character cell (X,Y) in FRAME.\n\
1449 Coordinates are relative to the frame, not a window,\n\
1450 so the coordinates of the top left character in the frame\n\
1451 may be nonzero due to left-hand scroll bars or the menu bar.\n\
1453 This function is a no-op for an X frame that is not visible.\n\
1454 If you have just created a frame, you must wait for it to become visible\n\
1455 before calling this function on it, like this.\n\
1456 (while (not (frame-visible-p frame)) (sleep-for .5))")
1458 Lisp_Object frame
, x
, y
;
1460 CHECK_LIVE_FRAME (frame
, 0);
1461 CHECK_NUMBER (x
, 2);
1462 CHECK_NUMBER (y
, 1);
1464 /* I think this should be done with a hook. */
1465 #ifdef HAVE_WINDOW_SYSTEM
1466 if (FRAME_WINDOW_P (XFRAME (frame
)))
1467 /* Warping the mouse will cause enternotify and focus events. */
1468 x_set_mouse_position (XFRAME (frame
), XINT (x
), XINT (y
));
1470 #if defined (MSDOS) && defined (HAVE_MOUSE)
1471 if (FRAME_MSDOS_P (XFRAME (frame
)))
1473 Fselect_frame (frame
, Qnil
);
1474 mouse_moveto (XINT (x
), XINT (y
));
1482 DEFUN ("set-mouse-pixel-position", Fset_mouse_pixel_position
,
1483 Sset_mouse_pixel_position
, 3, 3, 0,
1484 "Move the mouse pointer to pixel position (X,Y) in FRAME.\n\
1485 Note, this is a no-op for an X frame that is not visible.\n\
1486 If you have just created a frame, you must wait for it to become visible\n\
1487 before calling this function on it, like this.\n\
1488 (while (not (frame-visible-p frame)) (sleep-for .5))")
1490 Lisp_Object frame
, x
, y
;
1492 CHECK_LIVE_FRAME (frame
, 0);
1493 CHECK_NUMBER (x
, 2);
1494 CHECK_NUMBER (y
, 1);
1496 /* I think this should be done with a hook. */
1497 #ifdef HAVE_WINDOW_SYSTEM
1498 if (FRAME_WINDOW_P (XFRAME (frame
)))
1499 /* Warping the mouse will cause enternotify and focus events. */
1500 x_set_mouse_pixel_position (XFRAME (frame
), XINT (x
), XINT (y
));
1502 #if defined (MSDOS) && defined (HAVE_MOUSE)
1503 if (FRAME_MSDOS_P (XFRAME (frame
)))
1505 Fselect_frame (frame
, Qnil
);
1506 mouse_moveto (XINT (x
), XINT (y
));
1514 static void make_frame_visible_1
P_ ((Lisp_Object
));
1516 DEFUN ("make-frame-visible", Fmake_frame_visible
, Smake_frame_visible
,
1518 "Make the frame FRAME visible (assuming it is an X-window).\n\
1519 If omitted, FRAME defaults to the currently selected frame.")
1524 frame
= selected_frame
;
1526 CHECK_LIVE_FRAME (frame
, 0);
1528 /* I think this should be done with a hook. */
1529 #ifdef HAVE_WINDOW_SYSTEM
1530 if (FRAME_WINDOW_P (XFRAME (frame
)))
1532 FRAME_SAMPLE_VISIBILITY (XFRAME (frame
));
1533 x_make_frame_visible (XFRAME (frame
));
1537 make_frame_visible_1 (XFRAME (frame
)->root_window
);
1539 /* Make menu bar update for the Buffers and Frams menus. */
1540 windows_or_buffers_changed
++;
1545 /* Update the display_time slot of the buffers shown in WINDOW
1546 and all its descendents. */
1549 make_frame_visible_1 (window
)
1554 for (;!NILP (window
); window
= w
->next
)
1556 w
= XWINDOW (window
);
1558 if (!NILP (w
->buffer
))
1559 XBUFFER (w
->buffer
)->display_time
= Fcurrent_time ();
1561 if (!NILP (w
->vchild
))
1562 make_frame_visible_1 (w
->vchild
);
1563 if (!NILP (w
->hchild
))
1564 make_frame_visible_1 (w
->hchild
);
1568 DEFUN ("make-frame-invisible", Fmake_frame_invisible
, Smake_frame_invisible
,
1570 "Make the frame FRAME invisible (assuming it is an X-window).\n\
1571 If omitted, FRAME defaults to the currently selected frame.\n\
1572 Normally you may not make FRAME invisible if all other frames are invisible,\n\
1573 but if the second optional argument FORCE is non-nil, you may do so.")
1575 Lisp_Object frame
, force
;
1578 frame
= selected_frame
;
1580 CHECK_LIVE_FRAME (frame
, 0);
1582 if (NILP (force
) && !other_visible_frames (XFRAME (frame
)))
1583 error ("Attempt to make invisible the sole visible or iconified frame");
1585 #if 0 /* This isn't logically necessary, and it can do GC. */
1586 /* Don't let the frame remain selected. */
1587 if (EQ (frame
, selected_frame
))
1588 do_switch_frame (next_frame (frame
, Qt
), Qnil
, 0)
1591 /* Don't allow minibuf_window to remain on a deleted frame. */
1592 if (EQ (XFRAME (frame
)->minibuffer_window
, minibuf_window
))
1594 struct frame
*sf
= XFRAME (selected_frame
);
1595 Fset_window_buffer (sf
->minibuffer_window
,
1596 XWINDOW (minibuf_window
)->buffer
);
1597 minibuf_window
= sf
->minibuffer_window
;
1600 /* I think this should be done with a hook. */
1601 #ifdef HAVE_WINDOW_SYSTEM
1602 if (FRAME_WINDOW_P (XFRAME (frame
)))
1603 x_make_frame_invisible (XFRAME (frame
));
1606 /* Make menu bar update for the Buffers and Frams menus. */
1607 windows_or_buffers_changed
++;
1612 DEFUN ("iconify-frame", Ficonify_frame
, Siconify_frame
,
1614 "Make the frame FRAME into an icon.\n\
1615 If omitted, FRAME defaults to the currently selected frame.")
1620 frame
= selected_frame
;
1622 CHECK_LIVE_FRAME (frame
, 0);
1624 #if 0 /* This isn't logically necessary, and it can do GC. */
1625 /* Don't let the frame remain selected. */
1626 if (EQ (frame
, selected_frame
))
1627 Fhandle_switch_frame (next_frame (frame
, Qt
), Qnil
);
1630 /* Don't allow minibuf_window to remain on a deleted frame. */
1631 if (EQ (XFRAME (frame
)->minibuffer_window
, minibuf_window
))
1633 struct frame
*sf
= XFRAME (selected_frame
);
1634 Fset_window_buffer (sf
->minibuffer_window
,
1635 XWINDOW (minibuf_window
)->buffer
);
1636 minibuf_window
= sf
->minibuffer_window
;
1639 /* I think this should be done with a hook. */
1640 #ifdef HAVE_WINDOW_SYSTEM
1641 if (FRAME_WINDOW_P (XFRAME (frame
)))
1642 x_iconify_frame (XFRAME (frame
));
1645 /* Make menu bar update for the Buffers and Frams menus. */
1646 windows_or_buffers_changed
++;
1651 DEFUN ("frame-visible-p", Fframe_visible_p
, Sframe_visible_p
,
1653 "Return t if FRAME is now \"visible\" (actually in use for display).\n\
1654 A frame that is not \"visible\" is not updated and, if it works through\n\
1655 a window system, it may not show at all.\n\
1656 Return the symbol `icon' if frame is visible only as an icon.")
1660 CHECK_LIVE_FRAME (frame
, 0);
1662 FRAME_SAMPLE_VISIBILITY (XFRAME (frame
));
1664 if (FRAME_VISIBLE_P (XFRAME (frame
)))
1666 if (FRAME_ICONIFIED_P (XFRAME (frame
)))
1671 DEFUN ("visible-frame-list", Fvisible_frame_list
, Svisible_frame_list
,
1673 "Return a list of all frames now \"visible\" (being updated).")
1676 Lisp_Object tail
, frame
;
1681 for (tail
= Vframe_list
; CONSP (tail
); tail
= XCDR (tail
))
1683 frame
= XCAR (tail
);
1684 if (!FRAMEP (frame
))
1687 if (FRAME_VISIBLE_P (f
))
1688 value
= Fcons (frame
, value
);
1694 DEFUN ("raise-frame", Fraise_frame
, Sraise_frame
, 0, 1, "",
1695 "Bring FRAME to the front, so it occludes any frames it overlaps.\n\
1696 If FRAME is invisible, make it visible.\n\
1697 If you don't specify a frame, the selected frame is used.\n\
1698 If Emacs is displaying on an ordinary terminal or some other device which\n\
1699 doesn't support multiple overlapping frames, this function does nothing.")
1704 frame
= selected_frame
;
1706 CHECK_LIVE_FRAME (frame
, 0);
1708 /* Do like the documentation says. */
1709 Fmake_frame_visible (frame
);
1711 if (frame_raise_lower_hook
)
1712 (*frame_raise_lower_hook
) (XFRAME (frame
), 1);
1717 /* Should we have a corresponding function called Flower_Power? */
1718 DEFUN ("lower-frame", Flower_frame
, Slower_frame
, 0, 1, "",
1719 "Send FRAME to the back, so it is occluded by any frames that overlap it.\n\
1720 If you don't specify a frame, the selected frame is used.\n\
1721 If Emacs is displaying on an ordinary terminal or some other device which\n\
1722 doesn't support multiple overlapping frames, this function does nothing.")
1727 frame
= selected_frame
;
1729 CHECK_LIVE_FRAME (frame
, 0);
1731 if (frame_raise_lower_hook
)
1732 (*frame_raise_lower_hook
) (XFRAME (frame
), 0);
1738 DEFUN ("redirect-frame-focus", Fredirect_frame_focus
, Sredirect_frame_focus
,
1740 "Arrange for keystrokes typed at FRAME to be sent to FOCUS-FRAME.\n\
1741 In other words, switch-frame events caused by events in FRAME will\n\
1742 request a switch to FOCUS-FRAME, and `last-event-frame' will be\n\
1743 FOCUS-FRAME after reading an event typed at FRAME.\n\
1745 If FOCUS-FRAME is omitted or nil, any existing redirection is\n\
1746 cancelled, and the frame again receives its own keystrokes.\n\
1748 Focus redirection is useful for temporarily redirecting keystrokes to\n\
1749 a surrogate minibuffer frame when a frame doesn't have its own\n\
1750 minibuffer window.\n\
1752 A frame's focus redirection can be changed by select-frame. If frame\n\
1753 FOO is selected, and then a different frame BAR is selected, any\n\
1754 frames redirecting their focus to FOO are shifted to redirect their\n\
1755 focus to BAR. This allows focus redirection to work properly when the\n\
1756 user switches from one frame to another using `select-window'.\n\
1758 This means that a frame whose focus is redirected to itself is treated\n\
1759 differently from a frame whose focus is redirected to nil; the former\n\
1760 is affected by select-frame, while the latter is not.\n\
1762 The redirection lasts until `redirect-frame-focus' is called to change it.")
1763 (frame
, focus_frame
)
1764 Lisp_Object frame
, focus_frame
;
1766 /* Note that we don't check for a live frame here. It's reasonable
1767 to redirect the focus of a frame you're about to delete, if you
1768 know what other frame should receive those keystrokes. */
1769 CHECK_FRAME (frame
, 0);
1771 if (! NILP (focus_frame
))
1772 CHECK_LIVE_FRAME (focus_frame
, 1);
1774 XFRAME (frame
)->focus_frame
= focus_frame
;
1776 if (frame_rehighlight_hook
)
1777 (*frame_rehighlight_hook
) (XFRAME (frame
));
1783 DEFUN ("frame-focus", Fframe_focus
, Sframe_focus
, 1, 1, 0,
1784 "Return the frame to which FRAME's keystrokes are currently being sent.\n\
1785 This returns nil if FRAME's focus is not redirected.\n\
1786 See `redirect-frame-focus'.")
1790 CHECK_LIVE_FRAME (frame
, 0);
1792 return FRAME_FOCUS_FRAME (XFRAME (frame
));
1797 /* Return the value of frame parameter PROP in frame FRAME. */
1800 get_frame_param (frame
, prop
)
1801 register struct frame
*frame
;
1804 register Lisp_Object tem
;
1806 tem
= Fassq (prop
, frame
->param_alist
);
1812 /* Return the buffer-predicate of the selected frame. */
1815 frame_buffer_predicate (frame
)
1818 return XFRAME (frame
)->buffer_predicate
;
1821 /* Return the buffer-list of the selected frame. */
1824 frame_buffer_list (frame
)
1827 return XFRAME (frame
)->buffer_list
;
1830 /* Set the buffer-list of the selected frame. */
1833 set_frame_buffer_list (frame
, list
)
1834 Lisp_Object frame
, list
;
1836 XFRAME (frame
)->buffer_list
= list
;
1839 /* Discard BUFFER from the buffer-list of each frame. */
1842 frames_discard_buffer (buffer
)
1845 Lisp_Object frame
, tail
;
1847 FOR_EACH_FRAME (tail
, frame
)
1849 XFRAME (frame
)->buffer_list
1850 = Fdelq (buffer
, XFRAME (frame
)->buffer_list
);
1854 /* Move BUFFER to the end of the buffer-list of each frame. */
1857 frames_bury_buffer (buffer
)
1860 Lisp_Object frame
, tail
;
1862 FOR_EACH_FRAME (tail
, frame
)
1864 struct frame
*f
= XFRAME (frame
);
1867 found
= Fmemq (buffer
, f
->buffer_list
);
1869 f
->buffer_list
= nconc2 (Fdelq (buffer
, f
->buffer_list
),
1870 Fcons (buffer
, Qnil
));
1874 /* Modify the alist in *ALISTPTR to associate PROP with VAL.
1875 If the alist already has an element for PROP, we change it. */
1878 store_in_alist (alistptr
, prop
, val
)
1879 Lisp_Object
*alistptr
, val
;
1882 register Lisp_Object tem
;
1884 tem
= Fassq (prop
, *alistptr
);
1886 *alistptr
= Fcons (Fcons (prop
, val
), *alistptr
);
1892 frame_name_fnn_p (str
, len
)
1896 if (len
> 1 && str
[0] == 'F')
1900 strtol (str
+ 1, &end_ptr
, 10);
1902 if (end_ptr
== str
+ len
)
1908 /* Set the name of the terminal frame. Also used by MSDOS frames.
1909 Modeled after x_set_name which is used for WINDOW frames. */
1912 set_term_frame_name (f
, name
)
1916 f
->explicit_name
= ! NILP (name
);
1918 /* If NAME is nil, set the name to F<num>. */
1923 /* Check for no change needed in this very common case
1924 before we do any consing. */
1925 if (frame_name_fnn_p (XSTRING (f
->name
)->data
,
1926 STRING_BYTES (XSTRING (f
->name
))))
1929 terminal_frame_count
++;
1930 sprintf (namebuf
, "F%d", terminal_frame_count
);
1931 name
= build_string (namebuf
);
1935 CHECK_STRING (name
, 0);
1937 /* Don't change the name if it's already NAME. */
1938 if (! NILP (Fstring_equal (name
, f
->name
)))
1941 /* Don't allow the user to set the frame name to F<num>, so it
1942 doesn't clash with the names we generate for terminal frames. */
1943 if (frame_name_fnn_p (XSTRING (name
)->data
, STRING_BYTES (XSTRING (name
))))
1944 error ("Frame names of the form F<num> are usurped by Emacs");
1948 update_mode_lines
= 1;
1952 store_frame_param (f
, prop
, val
)
1954 Lisp_Object prop
, val
;
1956 register Lisp_Object old_alist_elt
;
1958 /* The buffer-alist parameter is stored in a special place and is
1959 not in the alist. */
1960 if (EQ (prop
, Qbuffer_list
))
1962 f
->buffer_list
= val
;
1966 /* If PROP is a symbol which is supposed to have frame-local values,
1967 and it is set up based on this frame, switch to the global
1968 binding. That way, we can create or alter the frame-local binding
1969 without messing up the symbol's status. */
1972 Lisp_Object valcontents
;
1973 valcontents
= XSYMBOL (prop
)->value
;
1974 if ((BUFFER_LOCAL_VALUEP (valcontents
)
1975 || SOME_BUFFER_LOCAL_VALUEP (valcontents
))
1976 && XBUFFER_LOCAL_VALUE (valcontents
)->check_frame
1977 && XFRAME (XBUFFER_LOCAL_VALUE (valcontents
)->frame
) == f
)
1978 swap_in_global_binding (prop
);
1981 /* Update the frame parameter alist. */
1982 old_alist_elt
= Fassq (prop
, f
->param_alist
);
1983 if (EQ (old_alist_elt
, Qnil
))
1984 f
->param_alist
= Fcons (Fcons (prop
, val
), f
->param_alist
);
1986 Fsetcdr (old_alist_elt
, val
);
1988 /* Update some other special parameters in their special places
1989 in addition to the alist. */
1991 if (EQ (prop
, Qbuffer_predicate
))
1992 f
->buffer_predicate
= val
;
1994 if (! FRAME_WINDOW_P (f
))
1996 if (EQ (prop
, Qmenu_bar_lines
))
1997 set_menu_bar_lines (f
, val
, make_number (FRAME_MENU_BAR_LINES (f
)));
1998 else if (EQ (prop
, Qname
))
1999 set_term_frame_name (f
, val
);
2002 if (EQ (prop
, Qminibuffer
) && WINDOWP (val
))
2004 if (! MINI_WINDOW_P (XWINDOW (val
)))
2005 error ("Surrogate minibuffer windows must be minibuffer windows.");
2007 if ((FRAME_HAS_MINIBUF_P (f
) || FRAME_MINIBUF_ONLY_P (f
))
2008 && !EQ (val
, f
->minibuffer_window
))
2009 error ("Can't change the surrogate minibuffer of a frame with its own minibuffer");
2011 /* Install the chosen minibuffer window, with proper buffer. */
2012 f
->minibuffer_window
= val
;
2016 DEFUN ("frame-parameters", Fframe_parameters
, Sframe_parameters
, 0, 1, 0,
2017 "Return the parameters-alist of frame FRAME.\n\
2018 It is a list of elements of the form (PARM . VALUE), where PARM is a symbol.\n\
2019 The meaningful PARMs depend on the kind of frame.\n\
2020 If FRAME is omitted, return information on the currently selected frame.")
2027 struct gcpro gcpro1
;
2029 if (EQ (frame
, Qnil
))
2030 frame
= selected_frame
;
2032 CHECK_FRAME (frame
, 0);
2035 if (!FRAME_LIVE_P (f
))
2038 alist
= Fcopy_alist (f
->param_alist
);
2041 if (!FRAME_WINDOW_P (f
))
2043 int fg
= FRAME_FOREGROUND_PIXEL (f
);
2044 int bg
= FRAME_BACKGROUND_PIXEL (f
);
2046 store_in_alist (&alist
, intern ("foreground-color"),
2047 tty_color_name (f
, fg
));
2048 store_in_alist (&alist
, intern ("background-color"),
2049 tty_color_name (f
, bg
));
2050 store_in_alist (&alist
, intern ("font"),
2051 build_string (FRAME_MSDOS_P (f
)
2053 : FRAME_W32_P (f
) ? "w32term" : "tty"));
2055 store_in_alist (&alist
, Qname
, f
->name
);
2056 height
= (FRAME_NEW_HEIGHT (f
) ? FRAME_NEW_HEIGHT (f
) : FRAME_HEIGHT (f
));
2057 store_in_alist (&alist
, Qheight
, make_number (height
));
2058 width
= (FRAME_NEW_WIDTH (f
) ? FRAME_NEW_WIDTH (f
) : FRAME_WIDTH (f
));
2059 store_in_alist (&alist
, Qwidth
, make_number (width
));
2060 store_in_alist (&alist
, Qmodeline
, (FRAME_WANTS_MODELINE_P (f
) ? Qt
: Qnil
));
2061 store_in_alist (&alist
, Qminibuffer
,
2062 (! FRAME_HAS_MINIBUF_P (f
) ? Qnil
2063 : FRAME_MINIBUF_ONLY_P (f
) ? Qonly
2064 : FRAME_MINIBUF_WINDOW (f
)));
2065 store_in_alist (&alist
, Qunsplittable
, (FRAME_NO_SPLIT_P (f
) ? Qt
: Qnil
));
2066 store_in_alist (&alist
, Qbuffer_list
,
2067 frame_buffer_list (selected_frame
));
2069 /* I think this should be done with a hook. */
2070 #ifdef HAVE_WINDOW_SYSTEM
2071 if (FRAME_WINDOW_P (f
))
2072 x_report_frame_params (f
, &alist
);
2076 /* This ought to be correct in f->param_alist for an X frame. */
2078 XSETFASTINT (lines
, FRAME_MENU_BAR_LINES (f
));
2079 store_in_alist (&alist
, Qmenu_bar_lines
, lines
);
2087 DEFUN ("frame-parameter", Fframe_parameter
, Sframe_parameter
, 2, 2, 0,
2088 "Return FRAME's value for parameter PARAMETER.\n\
2089 If FRAME is nil, describe the currently selected frame.")
2091 Lisp_Object frame
, parameter
;
2097 frame
= selected_frame
;
2099 CHECK_FRAME (frame
, 0);
2100 CHECK_SYMBOL (parameter
, 1);
2105 if (FRAME_LIVE_P (f
))
2107 value
= Fassq (parameter
, f
->param_alist
);
2109 value
= XCDR (value
);
2110 else if (EQ (parameter
, Qdisplay_type
))
2111 /* Avoid consing in a frequent case. */
2114 value
= Fcdr (Fassq (parameter
, Fframe_parameters (frame
)));
2121 DEFUN ("modify-frame-parameters", Fmodify_frame_parameters
,
2122 Smodify_frame_parameters
, 2, 2, 0,
2123 "Modify the parameters of frame FRAME according to ALIST.\n\
2124 ALIST is an alist of parameters to change and their new values.\n\
2125 Each element of ALIST has the form (PARM . VALUE), where PARM is a symbol.\n\
2126 The meaningful PARMs depend on the kind of frame.\n\
2127 Undefined PARMs are ignored, but stored in the frame's parameter list\n\
2128 so that `frame-parameters' will return them.\n\
2130 The value of frame parameter FOO can also be accessed\n\
2131 as a frame-local binding for the variable FOO, if you have\n\
2132 enabled such bindings for that variable with `make-variable-frame-local'.")
2134 Lisp_Object frame
, alist
;
2137 register Lisp_Object tail
, prop
, val
;
2139 if (EQ (frame
, Qnil
))
2140 frame
= selected_frame
;
2141 CHECK_LIVE_FRAME (frame
, 0);
2144 /* I think this should be done with a hook. */
2145 #ifdef HAVE_WINDOW_SYSTEM
2146 if (FRAME_WINDOW_P (f
))
2147 x_set_frame_parameters (f
, alist
);
2151 if (FRAME_MSDOS_P (f
))
2152 IT_set_frame_parameters (f
, alist
);
2156 if (FRAME_MAC_P (f
))
2157 mac_set_frame_parameters (f
, alist
);
2162 int length
= XINT (Flength (alist
));
2165 = (Lisp_Object
*) alloca (length
* sizeof (Lisp_Object
));
2167 = (Lisp_Object
*) alloca (length
* sizeof (Lisp_Object
));
2169 /* Extract parm names and values into those vectors. */
2172 for (tail
= alist
; CONSP (tail
); tail
= Fcdr (tail
))
2177 parms
[i
] = Fcar (elt
);
2178 values
[i
] = Fcdr (elt
);
2182 /* Now process them in reverse of specified order. */
2183 for (i
--; i
>= 0; i
--)
2187 store_frame_param (f
, prop
, val
);
2194 DEFUN ("frame-char-height", Fframe_char_height
, Sframe_char_height
,
2196 "Height in pixels of a line in the font in frame FRAME.\n\
2197 If FRAME is omitted, the selected frame is used.\n\
2198 For a terminal frame, the value is always 1.")
2205 frame
= selected_frame
;
2206 CHECK_FRAME (frame
, 0);
2209 #ifdef HAVE_WINDOW_SYSTEM
2210 if (FRAME_WINDOW_P (f
))
2211 return make_number (x_char_height (f
));
2214 return make_number (1);
2218 DEFUN ("frame-char-width", Fframe_char_width
, Sframe_char_width
,
2220 "Width in pixels of characters in the font in frame FRAME.\n\
2221 If FRAME is omitted, the selected frame is used.\n\
2222 The width is the same for all characters, because\n\
2223 currently Emacs supports only fixed-width fonts.\n\
2224 For a terminal screen, the value is always 1.")
2231 frame
= selected_frame
;
2232 CHECK_FRAME (frame
, 0);
2235 #ifdef HAVE_WINDOW_SYSTEM
2236 if (FRAME_WINDOW_P (f
))
2237 return make_number (x_char_width (f
));
2240 return make_number (1);
2243 DEFUN ("frame-pixel-height", Fframe_pixel_height
,
2244 Sframe_pixel_height
, 0, 1, 0,
2245 "Return a FRAME's height in pixels.\n\
2246 This counts only the height available for text lines,\n\
2247 not menu bars on window-system Emacs frames.\n\
2248 For a terminal frame, the result really gives the height in characters.\n\
2249 If FRAME is omitted, the selected frame is used.")
2256 frame
= selected_frame
;
2257 CHECK_FRAME (frame
, 0);
2260 #ifdef HAVE_WINDOW_SYSTEM
2261 if (FRAME_WINDOW_P (f
))
2262 return make_number (x_pixel_height (f
));
2265 return make_number (FRAME_HEIGHT (f
));
2268 DEFUN ("frame-pixel-width", Fframe_pixel_width
,
2269 Sframe_pixel_width
, 0, 1, 0,
2270 "Return FRAME's width in pixels.\n\
2271 For a terminal frame, the result really gives the width in characters.\n\
2272 If FRAME is omitted, the selected frame is used.")
2279 frame
= selected_frame
;
2280 CHECK_FRAME (frame
, 0);
2283 #ifdef HAVE_WINDOW_SYSTEM
2284 if (FRAME_WINDOW_P (f
))
2285 return make_number (x_pixel_width (f
));
2288 return make_number (FRAME_WIDTH (f
));
2291 DEFUN ("set-frame-height", Fset_frame_height
, Sset_frame_height
, 2, 3, 0,
2292 "Specify that the frame FRAME has LINES lines.\n\
2293 Optional third arg non-nil means that redisplay should use LINES lines\n\
2294 but that the idea of the actual height of the frame should not be changed.")
2295 (frame
, lines
, pretend
)
2296 Lisp_Object frame
, lines
, pretend
;
2298 register struct frame
*f
;
2300 CHECK_NUMBER (lines
, 0);
2302 frame
= selected_frame
;
2303 CHECK_LIVE_FRAME (frame
, 0);
2306 /* I think this should be done with a hook. */
2307 #ifdef HAVE_WINDOW_SYSTEM
2308 if (FRAME_WINDOW_P (f
))
2310 if (XINT (lines
) != f
->height
)
2311 x_set_window_size (f
, 1, f
->width
, XINT (lines
));
2312 do_pending_window_change (0);
2316 change_frame_size (f
, XINT (lines
), 0, !NILP (pretend
), 0, 0);
2320 DEFUN ("set-frame-width", Fset_frame_width
, Sset_frame_width
, 2, 3, 0,
2321 "Specify that the frame FRAME has COLS columns.\n\
2322 Optional third arg non-nil means that redisplay should use COLS columns\n\
2323 but that the idea of the actual width of the frame should not be changed.")
2324 (frame
, cols
, pretend
)
2325 Lisp_Object frame
, cols
, pretend
;
2327 register struct frame
*f
;
2328 CHECK_NUMBER (cols
, 0);
2330 frame
= selected_frame
;
2331 CHECK_LIVE_FRAME (frame
, 0);
2334 /* I think this should be done with a hook. */
2335 #ifdef HAVE_WINDOW_SYSTEM
2336 if (FRAME_WINDOW_P (f
))
2338 if (XINT (cols
) != f
->width
)
2339 x_set_window_size (f
, 1, XINT (cols
), f
->height
);
2340 do_pending_window_change (0);
2344 change_frame_size (f
, 0, XINT (cols
), !NILP (pretend
), 0, 0);
2348 DEFUN ("set-frame-size", Fset_frame_size
, Sset_frame_size
, 3, 3, 0,
2349 "Sets size of FRAME to COLS by ROWS, measured in characters.")
2351 Lisp_Object frame
, cols
, rows
;
2353 register struct frame
*f
;
2355 CHECK_LIVE_FRAME (frame
, 0);
2356 CHECK_NUMBER (cols
, 2);
2357 CHECK_NUMBER (rows
, 1);
2360 /* I think this should be done with a hook. */
2361 #ifdef HAVE_WINDOW_SYSTEM
2362 if (FRAME_WINDOW_P (f
))
2364 if (XINT (rows
) != f
->height
|| XINT (cols
) != f
->width
2365 || FRAME_NEW_HEIGHT (f
) || FRAME_NEW_WIDTH (f
))
2366 x_set_window_size (f
, 1, XINT (cols
), XINT (rows
));
2367 do_pending_window_change (0);
2371 change_frame_size (f
, XINT (rows
), XINT (cols
), 0, 0, 0);
2376 DEFUN ("set-frame-position", Fset_frame_position
,
2377 Sset_frame_position
, 3, 3, 0,
2378 "Sets position of FRAME in pixels to XOFFSET by YOFFSET.\n\
2379 This is actually the position of the upper left corner of the frame.\n\
2380 Negative values for XOFFSET or YOFFSET are interpreted relative to\n\
2381 the rightmost or bottommost possible position (that stays within the screen).")
2382 (frame
, xoffset
, yoffset
)
2383 Lisp_Object frame
, xoffset
, yoffset
;
2385 register struct frame
*f
;
2387 CHECK_LIVE_FRAME (frame
, 0);
2388 CHECK_NUMBER (xoffset
, 1);
2389 CHECK_NUMBER (yoffset
, 2);
2392 /* I think this should be done with a hook. */
2393 #ifdef HAVE_WINDOW_SYSTEM
2394 if (FRAME_WINDOW_P (f
))
2395 x_set_offset (f
, XINT (xoffset
), XINT (yoffset
), 1);
2407 staticpro (&Vframe_list
);
2409 DEFVAR_LISP ("terminal-frame", &Vterminal_frame
,
2410 "The initial frame-object, which represents Emacs's stdout.");
2412 DEFVAR_LISP ("emacs-iconified", &Vemacs_iconified
,
2413 "Non-nil if all of emacs is iconified and frame updates are not needed.");
2414 Vemacs_iconified
= Qnil
;
2416 DEFVAR_LISP ("mouse-position-function", &Vmouse_position_function
,
2417 "If non-nil, function applied to the normal result of `mouse-position'.\n\
2418 This abnormal hook exists for the benefit of packages like XTerm-mouse\n\
2419 which need to do mouse handling at the Lisp level.");
2420 Vmouse_position_function
= Qnil
;
2422 DEFVAR_KBOARD ("default-minibuffer-frame", Vdefault_minibuffer_frame
,
2423 "Minibufferless frames use this frame's minibuffer.\n\
2425 Emacs cannot create minibufferless frames unless this is set to an\n\
2426 appropriate surrogate.\n\
2428 Emacs consults this variable only when creating minibufferless\n\
2429 frames; once the frame is created, it sticks with its assigned\n\
2430 minibuffer, no matter what this variable is set to. This means that\n\
2431 this variable doesn't necessarily say anything meaningful about the\n\
2432 current set of frames, or where the minibuffer is currently being\n\
2435 defsubr (&Sactive_minibuffer_window
);
2437 defsubr (&Sframe_live_p
);
2438 defsubr (&Smake_terminal_frame
);
2439 defsubr (&Shandle_switch_frame
);
2440 defsubr (&Signore_event
);
2441 defsubr (&Sselect_frame
);
2442 defsubr (&Sselected_frame
);
2443 defsubr (&Swindow_frame
);
2444 defsubr (&Sframe_root_window
);
2445 defsubr (&Sframe_first_window
);
2446 defsubr (&Sframe_selected_window
);
2447 defsubr (&Sset_frame_selected_window
);
2448 defsubr (&Sframe_list
);
2449 defsubr (&Snext_frame
);
2450 defsubr (&Sprevious_frame
);
2451 defsubr (&Sdelete_frame
);
2452 defsubr (&Smouse_position
);
2453 defsubr (&Smouse_pixel_position
);
2454 defsubr (&Sset_mouse_position
);
2455 defsubr (&Sset_mouse_pixel_position
);
2457 defsubr (&Sframe_configuration
);
2458 defsubr (&Srestore_frame_configuration
);
2460 defsubr (&Smake_frame_visible
);
2461 defsubr (&Smake_frame_invisible
);
2462 defsubr (&Siconify_frame
);
2463 defsubr (&Sframe_visible_p
);
2464 defsubr (&Svisible_frame_list
);
2465 defsubr (&Sraise_frame
);
2466 defsubr (&Slower_frame
);
2467 defsubr (&Sredirect_frame_focus
);
2468 defsubr (&Sframe_focus
);
2469 defsubr (&Sframe_parameters
);
2470 defsubr (&Sframe_parameter
);
2471 defsubr (&Smodify_frame_parameters
);
2472 defsubr (&Sframe_char_height
);
2473 defsubr (&Sframe_char_width
);
2474 defsubr (&Sframe_pixel_height
);
2475 defsubr (&Sframe_pixel_width
);
2476 defsubr (&Sset_frame_height
);
2477 defsubr (&Sset_frame_width
);
2478 defsubr (&Sset_frame_size
);
2479 defsubr (&Sset_frame_position
);
2485 initial_define_lispy_key (global_map
, "switch-frame", "handle-switch-frame");
2486 initial_define_lispy_key (global_map
, "delete-frame", "handle-delete-frame");
2487 initial_define_lispy_key (global_map
, "iconify-frame", "ignore-event");
2488 initial_define_lispy_key (global_map
, "make-frame-visible", "ignore-event");