1 /* Generic frame functions.
2 Copyright (C) 1993, 1994, 1995, 1997, 1999, 2000, 2001
3 Free Software Foundation.
5 This file is part of GNU Emacs.
7 GNU Emacs is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
12 GNU Emacs is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GNU Emacs; see the file COPYING. If not, write to
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
37 /* These help us bind and responding to switch-frame events. */
41 #ifdef HAVE_WINDOW_SYSTEM
44 #include "termhooks.h"
45 #include "dispextern.h"
53 Lisp_Object Qframe_live_p
;
56 Lisp_Object Qminibuffer
;
57 Lisp_Object Qmodeline
;
60 Lisp_Object Qunsplittable
;
61 Lisp_Object Qmenu_bar_lines
;
62 Lisp_Object Qtool_bar_lines
;
69 Lisp_Object Qbuffer_predicate
;
70 Lisp_Object Qbuffer_list
;
72 Lisp_Object Qdisplay_type
;
73 Lisp_Object Qbackground_mode
;
74 Lisp_Object Qinhibit_default_face_x_resources
;
75 Lisp_Object Qleft_fringe
;
76 Lisp_Object Qright_fringe
;
78 Lisp_Object Vterminal_frame
;
79 Lisp_Object Vdefault_frame_alist
;
80 Lisp_Object Vmouse_position_function
;
83 set_menu_bar_lines_1 (window
, n
)
87 struct window
*w
= XWINDOW (window
);
89 XSETFASTINT (w
->last_modified
, 0);
90 XSETFASTINT (w
->top
, XFASTINT (w
->top
) + n
);
91 XSETFASTINT (w
->height
, XFASTINT (w
->height
) - n
);
93 if (INTEGERP (w
->orig_top
))
94 XSETFASTINT (w
->orig_top
, XFASTINT (w
->orig_top
) + n
);
95 if (INTEGERP (w
->orig_height
))
96 XSETFASTINT (w
->orig_height
, XFASTINT (w
->orig_height
) - n
);
98 /* Handle just the top child in a vertical split. */
99 if (!NILP (w
->vchild
))
100 set_menu_bar_lines_1 (w
->vchild
, n
);
102 /* Adjust all children in a horizontal split. */
103 for (window
= w
->hchild
; !NILP (window
); window
= w
->next
)
105 w
= XWINDOW (window
);
106 set_menu_bar_lines_1 (window
, n
);
111 set_menu_bar_lines (f
, value
, oldval
)
113 Lisp_Object value
, oldval
;
116 int olines
= FRAME_MENU_BAR_LINES (f
);
118 /* Right now, menu bars don't work properly in minibuf-only frames;
119 most of the commands try to apply themselves to the minibuffer
120 frame itself, and get an error because you can't switch buffers
121 in or split the minibuffer window. */
122 if (FRAME_MINIBUF_ONLY_P (f
))
125 if (INTEGERP (value
))
126 nlines
= XINT (value
);
130 if (nlines
!= olines
)
132 windows_or_buffers_changed
++;
133 FRAME_WINDOW_SIZES_CHANGED (f
) = 1;
134 FRAME_MENU_BAR_LINES (f
) = nlines
;
135 set_menu_bar_lines_1 (f
->root_window
, nlines
- olines
);
140 Lisp_Object Vemacs_iconified
;
141 Lisp_Object Vframe_list
;
143 struct x_output tty_display
;
145 extern Lisp_Object Vminibuffer_list
;
146 extern Lisp_Object
get_minibuffer ();
147 extern Lisp_Object
Fhandle_switch_frame ();
148 extern Lisp_Object
Fredirect_frame_focus ();
149 extern Lisp_Object
x_get_focus_frame ();
151 DEFUN ("framep", Fframep
, Sframep
, 1, 1, 0,
152 doc
: /* Return non-nil if OBJECT is a frame.
153 Value is t for a termcap frame (a character-only terminal),
154 `x' for an Emacs frame that is really an X window,
155 `w32' for an Emacs frame that is a window on MS-Windows display,
156 `mac' for an Emacs frame on a Macintosh display,
157 `pc' for a direct-write MS-DOS frame.
158 See also `frame-live-p'. */)
162 if (!FRAMEP (object
))
164 switch (XFRAME (object
)->output_method
)
168 case output_x_window
:
172 case output_msdos_raw
:
181 DEFUN ("frame-live-p", Fframe_live_p
, Sframe_live_p
, 1, 1, 0,
182 doc
: /* Return non-nil if OBJECT is a frame which has not been deleted.
183 Value is nil if OBJECT is not a live frame. If object is a live
184 frame, the return value indicates what sort of output device it is
185 displayed on. See the documentation of `framep' for possible
190 return ((FRAMEP (object
)
191 && FRAME_LIVE_P (XFRAME (object
)))
201 register struct frame
*f
;
202 register Lisp_Object root_window
;
203 register Lisp_Object mini_window
;
205 f
= allocate_frame ();
206 XSETFRAME (frame
, f
);
208 f
->desired_matrix
= 0;
209 f
->current_matrix
= 0;
212 f
->glyphs_initialized_p
= 0;
213 f
->decode_mode_spec_buffer
= 0;
215 f
->async_visible
= 0;
216 f
->output_data
.nothing
= 0;
218 f
->async_iconified
= 0;
219 f
->wants_modeline
= 1;
224 f
->has_minibuffer
= mini_p
;
225 f
->focus_frame
= Qnil
;
226 f
->explicit_name
= 0;
227 f
->can_have_scroll_bars
= 0;
228 f
->vertical_scroll_bar_type
= vertical_scroll_bar_none
;
229 f
->param_alist
= Qnil
;
230 f
->scroll_bars
= Qnil
;
231 f
->condemned_scroll_bars
= Qnil
;
232 f
->face_alist
= Qnil
;
233 f
->face_cache
= NULL
;
234 f
->menu_bar_items
= Qnil
;
235 f
->menu_bar_vector
= Qnil
;
236 f
->menu_bar_items_used
= 0;
237 f
->buffer_predicate
= Qnil
;
238 f
->buffer_list
= Qnil
;
240 f
->kboard
= initial_kboard
;
244 f
->menu_bar_window
= Qnil
;
245 f
->tool_bar_window
= Qnil
;
246 f
->tool_bar_items
= Qnil
;
247 f
->desired_tool_bar_string
= f
->current_tool_bar_string
= Qnil
;
248 f
->n_tool_bar_items
= 0;
250 root_window
= make_window ();
253 mini_window
= make_window ();
254 XWINDOW (root_window
)->next
= mini_window
;
255 XWINDOW (mini_window
)->prev
= root_window
;
256 XWINDOW (mini_window
)->mini_p
= Qt
;
257 XWINDOW (mini_window
)->frame
= frame
;
258 f
->minibuffer_window
= mini_window
;
263 XWINDOW (root_window
)->next
= Qnil
;
264 f
->minibuffer_window
= Qnil
;
267 XWINDOW (root_window
)->frame
= frame
;
270 just so that there is "something there."
271 Correct size will be set up later with change_frame_size. */
273 SET_FRAME_WIDTH (f
, 10);
276 XSETFASTINT (XWINDOW (root_window
)->width
, 10);
277 XSETFASTINT (XWINDOW (root_window
)->height
, (mini_p
? 9 : 10));
281 XSETFASTINT (XWINDOW (mini_window
)->width
, 10);
282 XSETFASTINT (XWINDOW (mini_window
)->top
, 9);
283 XSETFASTINT (XWINDOW (mini_window
)->height
, 1);
286 /* Choose a buffer for the frame's root window. */
290 XWINDOW (root_window
)->buffer
= Qt
;
291 buf
= Fcurrent_buffer ();
292 /* If buf is a 'hidden' buffer (i.e. one whose name starts with
293 a space), try to find another one. */
294 if (XSTRING (Fbuffer_name (buf
))->data
[0] == ' ')
295 buf
= Fother_buffer (buf
, Qnil
, Qnil
);
297 /* Use set_window_buffer, not Fset_window_buffer, and don't let
298 hooks be run by it. The reason is that the whole frame/window
299 arrangement is not yet fully intialized at this point. Windows
300 don't have the right size, glyph matrices aren't initialized
301 etc. Running Lisp functions at this point surely ends in a
303 set_window_buffer (root_window
, buf
, 0);
304 f
->buffer_list
= Fcons (buf
, Qnil
);
309 XWINDOW (mini_window
)->buffer
= Qt
;
310 set_window_buffer (mini_window
,
311 (NILP (Vminibuffer_list
)
313 : Fcar (Vminibuffer_list
)),
317 f
->root_window
= root_window
;
318 f
->selected_window
= root_window
;
319 /* Make sure this window seems more recently used than
320 a newly-created, never-selected window. */
321 XSETFASTINT (XWINDOW (f
->selected_window
)->use_time
, ++window_select_count
);
326 #ifdef HAVE_WINDOW_SYSTEM
327 /* Make a frame using a separate minibuffer window on another frame.
328 MINI_WINDOW is the minibuffer window to use. nil means use the
329 default (the global minibuffer). */
332 make_frame_without_minibuffer (mini_window
, kb
, display
)
333 register Lisp_Object mini_window
;
337 register struct frame
*f
;
340 if (!NILP (mini_window
))
341 CHECK_LIVE_WINDOW (mini_window
);
344 if (!NILP (mini_window
)
345 && XFRAME (XWINDOW (mini_window
)->frame
)->kboard
!= kb
)
346 error ("frame and minibuffer must be on the same display");
349 /* Make a frame containing just a root window. */
352 if (NILP (mini_window
))
354 /* Use default-minibuffer-frame if possible. */
355 if (!FRAMEP (kb
->Vdefault_minibuffer_frame
)
356 || ! FRAME_LIVE_P (XFRAME (kb
->Vdefault_minibuffer_frame
)))
358 Lisp_Object frame_dummy
;
360 XSETFRAME (frame_dummy
, f
);
361 GCPRO1 (frame_dummy
);
362 /* If there's no minibuffer frame to use, create one. */
363 kb
->Vdefault_minibuffer_frame
=
364 call1 (intern ("make-initial-minibuffer-frame"), display
);
368 mini_window
= XFRAME (kb
->Vdefault_minibuffer_frame
)->minibuffer_window
;
371 f
->minibuffer_window
= mini_window
;
373 /* Make the chosen minibuffer window display the proper minibuffer,
374 unless it is already showing a minibuffer. */
375 if (NILP (Fmemq (XWINDOW (mini_window
)->buffer
, Vminibuffer_list
)))
376 Fset_window_buffer (mini_window
,
377 (NILP (Vminibuffer_list
)
379 : Fcar (Vminibuffer_list
)));
383 /* Make a frame containing only a minibuffer window. */
386 make_minibuffer_frame ()
388 /* First make a frame containing just a root window, no minibuffer. */
390 register struct frame
*f
= make_frame (0);
391 register Lisp_Object mini_window
;
392 register Lisp_Object frame
;
394 XSETFRAME (frame
, f
);
399 f
->wants_modeline
= 0;
400 f
->has_minibuffer
= 1;
402 /* Now label the root window as also being the minibuffer.
403 Avoid infinite looping on the window chain by marking next pointer
406 mini_window
= f
->minibuffer_window
= f
->root_window
;
407 XWINDOW (mini_window
)->mini_p
= Qt
;
408 XWINDOW (mini_window
)->next
= Qnil
;
409 XWINDOW (mini_window
)->prev
= Qnil
;
410 XWINDOW (mini_window
)->frame
= frame
;
412 /* Put the proper buffer in that window. */
414 Fset_window_buffer (mini_window
,
415 (NILP (Vminibuffer_list
)
417 : Fcar (Vminibuffer_list
)));
420 #endif /* HAVE_WINDOW_SYSTEM */
422 /* Construct a frame that refers to the terminal (stdin and stdout). */
424 static int terminal_frame_count
;
427 make_terminal_frame ()
429 register struct frame
*f
;
436 initial_kboard
= (KBOARD
*) xmalloc (sizeof (KBOARD
));
437 init_kboard (initial_kboard
);
438 initial_kboard
->next_kboard
= all_kboards
;
439 all_kboards
= initial_kboard
;
443 /* The first call must initialize Vframe_list. */
444 if (! (NILP (Vframe_list
) || CONSP (Vframe_list
)))
449 XSETFRAME (frame
, f
);
450 Vframe_list
= Fcons (frame
, Vframe_list
);
452 terminal_frame_count
++;
453 sprintf (name
, "F%d", terminal_frame_count
);
454 f
->name
= build_string (name
);
456 f
->visible
= 1; /* FRAME_SET_VISIBLE wd set frame_garbaged. */
457 f
->async_visible
= 1; /* Don't let visible be cleared later. */
459 f
->output_data
.x
= &the_only_x_display
;
460 if (!inhibit_window_system
461 && (!FRAMEP (selected_frame
) || !FRAME_LIVE_P (XFRAME (selected_frame
))
462 || XFRAME (selected_frame
)->output_method
== output_msdos_raw
))
464 f
->output_method
= output_msdos_raw
;
465 /* This initialization of foreground and background pixels is
466 only important for the initial frame created in temacs. If
467 we don't do that, we get black background and foreground in
468 the dumped Emacs because the_only_x_display is a static
469 variable, hence it is born all-zeroes, and zero is the code
470 for the black color. Other frames all inherit their pixels
471 from what's already in the_only_x_display. */
472 if ((!FRAMEP (selected_frame
) || !FRAME_LIVE_P (XFRAME (selected_frame
)))
473 && f
->output_data
.x
->background_pixel
== 0
474 && f
->output_data
.x
->foreground_pixel
== 0)
476 f
->output_data
.x
->background_pixel
= FACE_TTY_DEFAULT_BG_COLOR
;
477 f
->output_data
.x
->foreground_pixel
= FACE_TTY_DEFAULT_FG_COLOR
;
481 f
->output_method
= output_termcap
;
484 f
->output_method
= output_termcap
;
485 f
->output_data
.x
= &tty_display
;
488 make_mac_terminal_frame (f
);
490 f
->output_data
.x
= &tty_display
;
491 #endif /* macintosh */
492 #endif /* WINDOWSNT */
496 init_frame_faces (f
);
501 DEFUN ("make-terminal-frame", Fmake_terminal_frame
, Smake_terminal_frame
,
503 doc
: /* Create an additional terminal frame.
504 You can create multiple frames on a text-only terminal in this way.
505 Only the selected terminal frame is actually displayed.
506 This function takes one argument, an alist specifying frame parameters.
507 In practice, generally you don't need to specify any parameters.
508 Note that changing the size of one terminal frame automatically affects all. */)
513 Lisp_Object frame
, tem
;
514 struct frame
*sf
= SELECTED_FRAME ();
517 if (sf
->output_method
!= output_msdos_raw
518 && sf
->output_method
!= output_termcap
)
520 #else /* not MSDOS */
523 if (sf
->output_method
!= output_mac
)
524 error ("Not running on a Macintosh screen; cannot make a new Macintosh frame");
526 if (sf
->output_method
!= output_termcap
)
527 error ("Not using an ASCII terminal now; cannot make a new ASCII frame");
529 #endif /* not MSDOS */
531 f
= make_terminal_frame ();
533 change_frame_size (f
, FRAME_HEIGHT (sf
),
534 FRAME_WIDTH (sf
), 0, 0, 0);
537 XSETFRAME (frame
, f
);
538 Fmodify_frame_parameters (frame
, Vdefault_frame_alist
);
539 Fmodify_frame_parameters (frame
, parms
);
541 /* Make the frame face alist be frame-specific, so that each
542 frame could change its face definitions independently. */
543 f
->face_alist
= Fcopy_alist (sf
->face_alist
);
544 /* Simple Fcopy_alist isn't enough, because we need the contents of
545 the vectors which are the CDRs of associations in face_alist to
546 be copied as well. */
547 for (tem
= f
->face_alist
; CONSP (tem
); tem
= XCDR (tem
))
548 XSETCDR (XCAR (tem
), Fcopy_sequence (XCDR (XCAR (tem
))));
553 /* Perform the switch to frame FRAME.
555 If FRAME is a switch-frame event `(switch-frame FRAME1)', use
558 If TRACK is non-zero and the frame that currently has the focus
559 redirects its focus to the selected frame, redirect that focused
560 frame's focus to FRAME instead.
562 FOR_DELETION non-zero means that the selected frame is being
563 deleted, which includes the possibility that the frame's display
567 do_switch_frame (frame
, track
, for_deletion
)
569 int track
, for_deletion
;
571 struct frame
*sf
= SELECTED_FRAME ();
573 /* If FRAME is a switch-frame event, extract the frame we should
576 && EQ (XCAR (frame
), Qswitch_frame
)
577 && CONSP (XCDR (frame
)))
578 frame
= XCAR (XCDR (frame
));
580 /* This used to say CHECK_LIVE_FRAME, but apparently it's possible for
581 a switch-frame event to arrive after a frame is no longer live,
582 especially when deleting the initial frame during startup. */
584 if (! FRAME_LIVE_P (XFRAME (frame
)))
587 if (sf
== XFRAME (frame
))
590 /* This is too greedy; it causes inappropriate focus redirection
591 that's hard to get rid of. */
593 /* If a frame's focus has been redirected toward the currently
594 selected frame, we should change the redirection to point to the
595 newly selected frame. This means that if the focus is redirected
596 from a minibufferless frame to a surrogate minibuffer frame, we
597 can use `other-window' to switch between all the frames using
598 that minibuffer frame, and the focus redirection will follow us
604 for (tail
= Vframe_list
; CONSP (tail
); tail
= XCDR (tail
))
608 if (!FRAMEP (XCAR (tail
)))
611 focus
= FRAME_FOCUS_FRAME (XFRAME (XCAR (tail
)));
613 if (FRAMEP (focus
) && XFRAME (focus
) == SELECTED_FRAME ())
614 Fredirect_frame_focus (XCAR (tail
), frame
);
618 /* Instead, apply it only to the frame we're pointing to. */
619 #ifdef HAVE_WINDOW_SYSTEM
620 if (track
&& FRAME_WINDOW_P (XFRAME (frame
)))
622 Lisp_Object focus
, xfocus
;
624 xfocus
= x_get_focus_frame (XFRAME (frame
));
627 focus
= FRAME_FOCUS_FRAME (XFRAME (xfocus
));
628 if (FRAMEP (focus
) && XFRAME (focus
) == SELECTED_FRAME ())
629 Fredirect_frame_focus (xfocus
, frame
);
632 #endif /* HAVE_X_WINDOWS */
635 if (!for_deletion
&& FRAME_HAS_MINIBUF_P (sf
))
636 resize_mini_window (XWINDOW (FRAME_MINIBUF_WINDOW (sf
)), 1);
638 selected_frame
= frame
;
639 if (! FRAME_MINIBUF_ONLY_P (XFRAME (selected_frame
)))
640 last_nonminibuf_frame
= XFRAME (selected_frame
);
642 Fselect_window (XFRAME (frame
)->selected_window
);
644 /* We want to make sure that the next event generates a frame-switch
645 event to the appropriate frame. This seems kludgy to me, but
646 before you take it out, make sure that evaluating something like
647 (select-window (frame-root-window (new-frame))) doesn't end up
648 with your typing being interpreted in the new frame instead of
649 the one you're actually typing in. */
650 internal_last_event_frame
= Qnil
;
655 DEFUN ("select-frame", Fselect_frame
, Sselect_frame
, 1, 2, "e",
656 doc
: /* Select the frame FRAME.
657 Subsequent editing commands apply to its selected window.
658 The selection of FRAME lasts until the next time the user does
659 something to select a different frame, or until the next time this
660 function is called. */)
662 Lisp_Object frame
, no_enter
;
664 return do_switch_frame (frame
, 1, 0);
668 DEFUN ("handle-switch-frame", Fhandle_switch_frame
, Shandle_switch_frame
, 1, 2, "e",
669 doc
: /* Handle a switch-frame event EVENT.
670 Switch-frame events are usually bound to this function.
671 A switch-frame event tells Emacs that the window manager has requested
672 that the user's events be directed to the frame mentioned in the event.
673 This function selects the selected window of the frame of EVENT.
675 If EVENT is frame object, handle it as if it were a switch-frame event
678 Lisp_Object event
, no_enter
;
680 /* Preserve prefix arg that the command loop just cleared. */
681 current_kboard
->Vprefix_arg
= Vcurrent_prefix_arg
;
682 call1 (Vrun_hooks
, Qmouse_leave_buffer_hook
);
683 return do_switch_frame (event
, 0, 0);
686 DEFUN ("ignore-event", Fignore_event
, Signore_event
, 0, 0, "",
687 doc
: /* Do nothing, but preserve any prefix argument already specified.
688 This is a suitable binding for iconify-frame and make-frame-visible. */)
691 current_kboard
->Vprefix_arg
= Vcurrent_prefix_arg
;
695 DEFUN ("selected-frame", Fselected_frame
, Sselected_frame
, 0, 0, 0,
696 doc
: /* Return the frame that is now selected. */)
699 return selected_frame
;
702 DEFUN ("window-frame", Fwindow_frame
, Swindow_frame
, 1, 1, 0,
703 doc
: /* Return the frame object that window WINDOW is on. */)
707 CHECK_LIVE_WINDOW (window
);
708 return XWINDOW (window
)->frame
;
711 DEFUN ("frame-first-window", Fframe_first_window
, Sframe_first_window
, 0, 1, 0,
712 doc
: /* Returns the topmost, leftmost window of FRAME.
713 If omitted, FRAME defaults to the currently selected frame. */)
720 w
= SELECTED_FRAME ()->root_window
;
723 CHECK_LIVE_FRAME (frame
);
724 w
= XFRAME (frame
)->root_window
;
726 while (NILP (XWINDOW (w
)->buffer
))
728 if (! NILP (XWINDOW (w
)->hchild
))
729 w
= XWINDOW (w
)->hchild
;
730 else if (! NILP (XWINDOW (w
)->vchild
))
731 w
= XWINDOW (w
)->vchild
;
738 DEFUN ("active-minibuffer-window", Factive_minibuffer_window
,
739 Sactive_minibuffer_window
, 0, 0, 0,
740 doc
: /* Return the currently active minibuffer window, or nil if none. */)
743 return minibuf_level
? minibuf_window
: Qnil
;
746 DEFUN ("frame-root-window", Fframe_root_window
, Sframe_root_window
, 0, 1, 0,
747 doc
: /* Returns the root-window of FRAME.
748 If omitted, FRAME defaults to the currently selected frame. */)
755 window
= SELECTED_FRAME ()->root_window
;
758 CHECK_LIVE_FRAME (frame
);
759 window
= XFRAME (frame
)->root_window
;
765 DEFUN ("frame-selected-window", Fframe_selected_window
,
766 Sframe_selected_window
, 0, 1, 0,
767 doc
: /* Return the selected window of frame object FRAME.
768 If omitted, FRAME defaults to the currently selected frame. */)
775 window
= SELECTED_FRAME ()->selected_window
;
778 CHECK_LIVE_FRAME (frame
);
779 window
= XFRAME (frame
)->selected_window
;
785 DEFUN ("set-frame-selected-window", Fset_frame_selected_window
,
786 Sset_frame_selected_window
, 2, 2, 0,
787 doc
: /* Set the selected window of frame object FRAME to WINDOW.
788 If FRAME is nil, the selected frame is used.
789 If FRAME is the selected frame, this makes WINDOW the selected window. */)
791 Lisp_Object frame
, window
;
794 frame
= selected_frame
;
796 CHECK_LIVE_FRAME (frame
);
797 CHECK_LIVE_WINDOW (window
);
799 if (! EQ (frame
, WINDOW_FRAME (XWINDOW (window
))))
800 error ("In `set-frame-selected-window', WINDOW is not on FRAME");
802 if (EQ (frame
, selected_frame
))
803 return Fselect_window (window
);
805 return XFRAME (frame
)->selected_window
= window
;
808 DEFUN ("frame-list", Fframe_list
, Sframe_list
,
810 doc
: /* Return a list of all frames. */)
814 frames
= Fcopy_sequence (Vframe_list
);
815 #ifdef HAVE_WINDOW_SYSTEM
816 if (FRAMEP (tip_frame
))
817 frames
= Fdelq (tip_frame
, frames
);
822 /* Return the next frame in the frame list after FRAME.
823 If MINIBUF is nil, exclude minibuffer-only frames.
824 If MINIBUF is a window, include only its own frame
825 and any frame now using that window as the minibuffer.
826 If MINIBUF is `visible', include all visible frames.
827 If MINIBUF is 0, include all visible and iconified frames.
828 Otherwise, include all frames. */
831 next_frame (frame
, minibuf
)
838 /* There must always be at least one frame in Vframe_list. */
839 if (! CONSP (Vframe_list
))
842 /* If this frame is dead, it won't be in Vframe_list, and we'll loop
843 forever. Forestall that. */
844 CHECK_LIVE_FRAME (frame
);
847 for (tail
= Vframe_list
; CONSP (tail
); tail
= XCDR (tail
))
854 && FRAME_KBOARD (XFRAME (f
)) == FRAME_KBOARD (XFRAME (frame
)))
856 /* Decide whether this frame is eligible to be returned. */
858 /* If we've looped all the way around without finding any
859 eligible frames, return the original frame. */
863 /* Let minibuf decide if this frame is acceptable. */
866 if (! FRAME_MINIBUF_ONLY_P (XFRAME (f
)))
869 else if (EQ (minibuf
, Qvisible
))
871 FRAME_SAMPLE_VISIBILITY (XFRAME (f
));
872 if (FRAME_VISIBLE_P (XFRAME (f
)))
875 else if (INTEGERP (minibuf
) && XINT (minibuf
) == 0)
877 FRAME_SAMPLE_VISIBILITY (XFRAME (f
));
878 if (FRAME_VISIBLE_P (XFRAME (f
))
879 || FRAME_ICONIFIED_P (XFRAME (f
)))
882 else if (WINDOWP (minibuf
))
884 if (EQ (FRAME_MINIBUF_WINDOW (XFRAME (f
)), minibuf
)
885 || EQ (WINDOW_FRAME (XWINDOW (minibuf
)), f
)
886 || EQ (WINDOW_FRAME (XWINDOW (minibuf
)),
887 FRAME_FOCUS_FRAME (XFRAME (f
))))
899 /* Return the previous frame in the frame list before FRAME.
900 If MINIBUF is nil, exclude minibuffer-only frames.
901 If MINIBUF is a window, include only its own frame
902 and any frame now using that window as the minibuffer.
903 If MINIBUF is `visible', include all visible frames.
904 If MINIBUF is 0, include all visible and iconified frames.
905 Otherwise, include all frames. */
908 prev_frame (frame
, minibuf
)
915 /* There must always be at least one frame in Vframe_list. */
916 if (! CONSP (Vframe_list
))
920 for (tail
= Vframe_list
; CONSP (tail
); tail
= XCDR (tail
))
928 if (EQ (frame
, f
) && !NILP (prev
))
931 if (FRAME_KBOARD (XFRAME (f
)) == FRAME_KBOARD (XFRAME (frame
)))
933 /* Decide whether this frame is eligible to be returned,
934 according to minibuf. */
937 if (! FRAME_MINIBUF_ONLY_P (XFRAME (f
)))
940 else if (WINDOWP (minibuf
))
942 if (EQ (FRAME_MINIBUF_WINDOW (XFRAME (f
)), minibuf
)
943 || EQ (WINDOW_FRAME (XWINDOW (minibuf
)), f
)
944 || EQ (WINDOW_FRAME (XWINDOW (minibuf
)),
945 FRAME_FOCUS_FRAME (XFRAME (f
))))
948 else if (EQ (minibuf
, Qvisible
))
950 FRAME_SAMPLE_VISIBILITY (XFRAME (f
));
951 if (FRAME_VISIBLE_P (XFRAME (f
)))
954 else if (XFASTINT (minibuf
) == 0)
956 FRAME_SAMPLE_VISIBILITY (XFRAME (f
));
957 if (FRAME_VISIBLE_P (XFRAME (f
))
958 || FRAME_ICONIFIED_P (XFRAME (f
)))
966 /* We've scanned the entire list. */
968 /* We went through the whole frame list without finding a single
969 acceptable frame. Return the original frame. */
972 /* There were no acceptable frames in the list before FRAME; otherwise,
973 we would have returned directly from the loop. Since PREV is the last
974 acceptable frame in the list, return it. */
979 DEFUN ("next-frame", Fnext_frame
, Snext_frame
, 0, 2, 0,
980 doc
: /* Return the next frame in the frame list after FRAME.
981 It considers only frames on the same terminal as FRAME.
982 By default, skip minibuffer-only frames.
983 If omitted, FRAME defaults to the selected frame.
984 If optional argument MINIFRAME is nil, exclude minibuffer-only frames.
985 If MINIFRAME is a window, include only its own frame
986 and any frame now using that window as the minibuffer.
987 If MINIFRAME is `visible', include all visible frames.
988 If MINIFRAME is 0, include all visible and iconified frames.
989 Otherwise, include all frames. */)
991 Lisp_Object frame
, miniframe
;
994 frame
= selected_frame
;
996 CHECK_LIVE_FRAME (frame
);
997 return next_frame (frame
, miniframe
);
1000 DEFUN ("previous-frame", Fprevious_frame
, Sprevious_frame
, 0, 2, 0,
1001 doc
: /* Return the previous frame in the frame list before FRAME.
1002 It considers only frames on the same terminal as FRAME.
1003 By default, skip minibuffer-only frames.
1004 If omitted, FRAME defaults to the selected frame.
1005 If optional argument MINIFRAME is nil, exclude minibuffer-only frames.
1006 If MINIFRAME is a window, include only its own frame
1007 and any frame now using that window as the minibuffer.
1008 If MINIFRAME is `visible', include all visible frames.
1009 If MINIFRAME is 0, include all visible and iconified frames.
1010 Otherwise, include all frames. */)
1012 Lisp_Object frame
, miniframe
;
1015 frame
= selected_frame
;
1016 CHECK_LIVE_FRAME (frame
);
1017 return prev_frame (frame
, miniframe
);
1020 /* Return 1 if it is ok to delete frame F;
1021 0 if all frames aside from F are invisible.
1022 (Exception: if F is the terminal frame, and we are using X, return 1.) */
1025 other_visible_frames (f
)
1028 /* We know the selected frame is visible,
1029 so if F is some other frame, it can't be the sole visible one. */
1030 if (f
== SELECTED_FRAME ())
1035 for (frames
= Vframe_list
;
1037 frames
= XCDR (frames
))
1041 this = XCAR (frames
);
1042 /* Verify that the frame's window still exists
1043 and we can still talk to it. And note any recent change
1045 #ifdef HAVE_WINDOW_SYSTEM
1046 if (FRAME_WINDOW_P (XFRAME (this)))
1048 x_sync (XFRAME (this));
1049 FRAME_SAMPLE_VISIBILITY (XFRAME (this));
1053 if (FRAME_VISIBLE_P (XFRAME (this))
1054 || FRAME_ICONIFIED_P (XFRAME (this))
1055 /* Allow deleting the terminal frame when at least
1056 one X frame exists! */
1057 || (FRAME_WINDOW_P (XFRAME (this)) && !FRAME_WINDOW_P (f
)))
1065 DEFUN ("delete-frame", Fdelete_frame
, Sdelete_frame
, 0, 2, "",
1066 doc
: /* Delete FRAME, permanently eliminating it from use.
1067 If omitted, FRAME defaults to the selected frame.
1068 A frame may not be deleted if its minibuffer is used by other frames.
1069 Normally, you may not delete a frame if all other frames are invisible,
1070 but if the second optional argument FORCE is non-nil, you may do so.
1072 This function runs `delete-frame-hook' before actually deleting the
1073 frame. The hook is called with one argument FRAME. */)
1075 Lisp_Object frame
, force
;
1078 struct frame
*sf
= SELECTED_FRAME ();
1079 int minibuffer_selected
;
1081 if (EQ (frame
, Qnil
))
1084 XSETFRAME (frame
, f
);
1088 CHECK_FRAME (frame
);
1092 if (! FRAME_LIVE_P (f
))
1095 if (NILP (force
) && !other_visible_frames (f
)
1097 /* Terminal frame deleted before any other visible frames are
1099 && strcmp (XSTRING (f
->name
)->data
, "F1") != 0
1102 error ("Attempt to delete the sole visible or iconified frame");
1105 /* This is a nice idea, but x_connection_closed needs to be able
1106 to delete the last frame, if it is gone. */
1107 if (NILP (XCDR (Vframe_list
)))
1108 error ("Attempt to delete the only frame");
1111 /* Does this frame have a minibuffer, and is it the surrogate
1112 minibuffer for any other frame? */
1113 if (FRAME_HAS_MINIBUF_P (XFRAME (frame
)))
1117 for (frames
= Vframe_list
;
1119 frames
= XCDR (frames
))
1122 this = XCAR (frames
);
1124 if (! EQ (this, frame
)
1126 WINDOW_FRAME (XWINDOW
1127 (FRAME_MINIBUF_WINDOW (XFRAME (this))))))
1128 error ("Attempt to delete a surrogate minibuffer frame");
1132 /* Run `delete-frame-hook'. */
1133 if (!NILP (Vrun_hooks
))
1135 Lisp_Object args
[2];
1136 args
[0] = intern ("delete-frame-hook");
1138 Frun_hook_with_args (2, args
);
1141 minibuffer_selected
= EQ (minibuf_window
, selected_window
);
1143 /* Don't let the frame remain selected. */
1146 Lisp_Object tail
, frame1
;
1148 /* Look for another visible frame on the same terminal. */
1149 frame1
= next_frame (frame
, Qvisible
);
1151 /* If there is none, find *some* other frame. */
1152 if (NILP (frame1
) || EQ (frame1
, frame
))
1154 FOR_EACH_FRAME (tail
, frame1
)
1156 if (! EQ (frame
, frame1
))
1161 do_switch_frame (frame1
, 0, 1);
1162 sf
= SELECTED_FRAME ();
1165 /* Don't allow minibuf_window to remain on a deleted frame. */
1166 if (EQ (f
->minibuffer_window
, minibuf_window
))
1168 Fset_window_buffer (sf
->minibuffer_window
,
1169 XWINDOW (minibuf_window
)->buffer
);
1170 minibuf_window
= sf
->minibuffer_window
;
1172 /* If the dying minibuffer window was selected,
1173 select the new one. */
1174 if (minibuffer_selected
)
1175 Fselect_window (minibuf_window
);
1178 /* Don't let echo_area_window to remain on a deleted frame. */
1179 if (EQ (f
->minibuffer_window
, echo_area_window
))
1180 echo_area_window
= sf
->minibuffer_window
;
1182 /* Clear any X selections for this frame. */
1183 #ifdef HAVE_X_WINDOWS
1185 x_clear_frame_selections (f
);
1189 This function must be called before the window tree of the
1190 frame is deleted because windows contain dynamically allocated
1194 /* Mark all the windows that used to be on FRAME as deleted, and then
1195 remove the reference to them. */
1196 delete_all_subwindows (XWINDOW (f
->root_window
));
1197 f
->root_window
= Qnil
;
1199 Vframe_list
= Fdelq (frame
, Vframe_list
);
1200 FRAME_SET_VISIBLE (f
, 0);
1204 if (FRAME_INSERT_COST (f
))
1205 xfree (FRAME_INSERT_COST (f
));
1206 if (FRAME_DELETEN_COST (f
))
1207 xfree (FRAME_DELETEN_COST (f
));
1208 if (FRAME_INSERTN_COST (f
))
1209 xfree (FRAME_INSERTN_COST (f
));
1210 if (FRAME_DELETE_COST (f
))
1211 xfree (FRAME_DELETE_COST (f
));
1212 if (FRAME_MESSAGE_BUF (f
))
1213 xfree (FRAME_MESSAGE_BUF (f
));
1215 /* Since some events are handled at the interrupt level, we may get
1216 an event for f at any time; if we zero out the frame's display
1217 now, then we may trip up the event-handling code. Instead, we'll
1218 promise that the display of the frame must be valid until we have
1219 called the window-system-dependent frame destruction routine. */
1221 /* I think this should be done with a hook. */
1222 #ifdef HAVE_WINDOW_SYSTEM
1223 if (FRAME_WINDOW_P (f
))
1224 x_destroy_window (f
);
1227 f
->output_data
.nothing
= 0;
1229 /* If we've deleted the last_nonminibuf_frame, then try to find
1231 if (f
== last_nonminibuf_frame
)
1235 last_nonminibuf_frame
= 0;
1237 for (frames
= Vframe_list
;
1239 frames
= XCDR (frames
))
1241 f
= XFRAME (XCAR (frames
));
1242 if (!FRAME_MINIBUF_ONLY_P (f
))
1244 last_nonminibuf_frame
= f
;
1250 /* If we've deleted this keyboard's default_minibuffer_frame, try to
1251 find another one. Prefer minibuffer-only frames, but also notice
1252 frames with other windows. */
1253 if (EQ (frame
, FRAME_KBOARD (f
)->Vdefault_minibuffer_frame
))
1257 /* The last frame we saw with a minibuffer, minibuffer-only or not. */
1258 Lisp_Object frame_with_minibuf
;
1259 /* Some frame we found on the same kboard, or nil if there are none. */
1260 Lisp_Object frame_on_same_kboard
;
1262 frame_on_same_kboard
= Qnil
;
1263 frame_with_minibuf
= Qnil
;
1265 for (frames
= Vframe_list
;
1267 frames
= XCDR (frames
))
1272 this = XCAR (frames
);
1277 /* Consider only frames on the same kboard
1278 and only those with minibuffers. */
1279 if (FRAME_KBOARD (f
) == FRAME_KBOARD (f1
)
1280 && FRAME_HAS_MINIBUF_P (f1
))
1282 frame_with_minibuf
= this;
1283 if (FRAME_MINIBUF_ONLY_P (f1
))
1287 if (FRAME_KBOARD (f
) == FRAME_KBOARD (f1
))
1288 frame_on_same_kboard
= this;
1291 if (!NILP (frame_on_same_kboard
))
1293 /* We know that there must be some frame with a minibuffer out
1294 there. If this were not true, all of the frames present
1295 would have to be minibufferless, which implies that at some
1296 point their minibuffer frames must have been deleted, but
1297 that is prohibited at the top; you can't delete surrogate
1298 minibuffer frames. */
1299 if (NILP (frame_with_minibuf
))
1302 FRAME_KBOARD (f
)->Vdefault_minibuffer_frame
= frame_with_minibuf
;
1305 /* No frames left on this kboard--say no minibuffer either. */
1306 FRAME_KBOARD (f
)->Vdefault_minibuffer_frame
= Qnil
;
1309 /* Cause frame titles to update--necessary if we now have just one frame. */
1310 update_mode_lines
= 1;
1315 /* Return mouse position in character cell units. */
1317 DEFUN ("mouse-position", Fmouse_position
, Smouse_position
, 0, 0, 0,
1318 doc
: /* Return a list (FRAME X . Y) giving the current mouse frame and position.
1319 The position is given in character cells, where (0, 0) is the
1321 If Emacs is running on a mouseless terminal or hasn't been programmed
1322 to read the mouse position, it returns the selected frame for FRAME
1323 and nil for X and Y.
1324 If `mouse-position-function' is non-nil, `mouse-position' calls it,
1325 passing the normal return value to that function as an argument,
1326 and returns whatever that function returns. */)
1330 Lisp_Object lispy_dummy
;
1331 enum scroll_bar_part party_dummy
;
1332 Lisp_Object x
, y
, retval
;
1334 unsigned long long_dummy
;
1335 struct gcpro gcpro1
;
1337 f
= SELECTED_FRAME ();
1341 /* It's okay for the hook to refrain from storing anything. */
1342 if (mouse_position_hook
)
1343 (*mouse_position_hook
) (&f
, -1,
1344 &lispy_dummy
, &party_dummy
,
1351 pixel_to_glyph_coords (f
, col
, row
, &col
, &row
, NULL
, 1);
1356 XSETFRAME (lispy_dummy
, f
);
1357 retval
= Fcons (lispy_dummy
, Fcons (x
, y
));
1359 if (!NILP (Vmouse_position_function
))
1360 retval
= call1 (Vmouse_position_function
, retval
);
1361 RETURN_UNGCPRO (retval
);
1364 DEFUN ("mouse-pixel-position", Fmouse_pixel_position
,
1365 Smouse_pixel_position
, 0, 0, 0,
1366 doc
: /* Return a list (FRAME X . Y) giving the current mouse frame and position.
1367 The position is given in pixel units, where (0, 0) is the
1369 If Emacs is running on a mouseless terminal or hasn't been programmed
1370 to read the mouse position, it returns the selected frame for FRAME
1371 and nil for X and Y. */)
1375 Lisp_Object lispy_dummy
;
1376 enum scroll_bar_part party_dummy
;
1378 unsigned long long_dummy
;
1380 f
= SELECTED_FRAME ();
1384 /* It's okay for the hook to refrain from storing anything. */
1385 if (mouse_position_hook
)
1386 (*mouse_position_hook
) (&f
, -1,
1387 &lispy_dummy
, &party_dummy
,
1391 XSETFRAME (lispy_dummy
, f
);
1392 return Fcons (lispy_dummy
, Fcons (x
, y
));
1395 DEFUN ("set-mouse-position", Fset_mouse_position
, Sset_mouse_position
, 3, 3, 0,
1396 doc
: /* Move the mouse pointer to the center of character cell (X,Y) in FRAME.
1397 Coordinates are relative to the frame, not a window,
1398 so the coordinates of the top left character in the frame
1399 may be nonzero due to left-hand scroll bars or the menu bar.
1401 This function is a no-op for an X frame that is not visible.
1402 If you have just created a frame, you must wait for it to become visible
1403 before calling this function on it, like this.
1404 (while (not (frame-visible-p frame)) (sleep-for .5)) */)
1406 Lisp_Object frame
, x
, y
;
1408 CHECK_LIVE_FRAME (frame
);
1412 /* I think this should be done with a hook. */
1413 #ifdef HAVE_WINDOW_SYSTEM
1414 if (FRAME_WINDOW_P (XFRAME (frame
)))
1415 /* Warping the mouse will cause enternotify and focus events. */
1416 x_set_mouse_position (XFRAME (frame
), XINT (x
), XINT (y
));
1418 #if defined (MSDOS) && defined (HAVE_MOUSE)
1419 if (FRAME_MSDOS_P (XFRAME (frame
)))
1421 Fselect_frame (frame
, Qnil
);
1422 mouse_moveto (XINT (x
), XINT (y
));
1430 DEFUN ("set-mouse-pixel-position", Fset_mouse_pixel_position
,
1431 Sset_mouse_pixel_position
, 3, 3, 0,
1432 doc
: /* Move the mouse pointer to pixel position (X,Y) in FRAME.
1433 Note, this is a no-op for an X frame that is not visible.
1434 If you have just created a frame, you must wait for it to become visible
1435 before calling this function on it, like this.
1436 (while (not (frame-visible-p frame)) (sleep-for .5)) */)
1438 Lisp_Object frame
, x
, y
;
1440 CHECK_LIVE_FRAME (frame
);
1444 /* I think this should be done with a hook. */
1445 #ifdef HAVE_WINDOW_SYSTEM
1446 if (FRAME_WINDOW_P (XFRAME (frame
)))
1447 /* Warping the mouse will cause enternotify and focus events. */
1448 x_set_mouse_pixel_position (XFRAME (frame
), XINT (x
), XINT (y
));
1450 #if defined (MSDOS) && defined (HAVE_MOUSE)
1451 if (FRAME_MSDOS_P (XFRAME (frame
)))
1453 Fselect_frame (frame
, Qnil
);
1454 mouse_moveto (XINT (x
), XINT (y
));
1462 static void make_frame_visible_1
P_ ((Lisp_Object
));
1464 DEFUN ("make-frame-visible", Fmake_frame_visible
, Smake_frame_visible
,
1466 doc
: /* Make the frame FRAME visible (assuming it is an X window).
1467 If omitted, FRAME defaults to the currently selected frame. */)
1472 frame
= selected_frame
;
1474 CHECK_LIVE_FRAME (frame
);
1476 /* I think this should be done with a hook. */
1477 #ifdef HAVE_WINDOW_SYSTEM
1478 if (FRAME_WINDOW_P (XFRAME (frame
)))
1480 FRAME_SAMPLE_VISIBILITY (XFRAME (frame
));
1481 x_make_frame_visible (XFRAME (frame
));
1485 make_frame_visible_1 (XFRAME (frame
)->root_window
);
1487 /* Make menu bar update for the Buffers and Frames menus. */
1488 windows_or_buffers_changed
++;
1493 /* Update the display_time slot of the buffers shown in WINDOW
1494 and all its descendents. */
1497 make_frame_visible_1 (window
)
1502 for (;!NILP (window
); window
= w
->next
)
1504 w
= XWINDOW (window
);
1506 if (!NILP (w
->buffer
))
1507 XBUFFER (w
->buffer
)->display_time
= Fcurrent_time ();
1509 if (!NILP (w
->vchild
))
1510 make_frame_visible_1 (w
->vchild
);
1511 if (!NILP (w
->hchild
))
1512 make_frame_visible_1 (w
->hchild
);
1516 DEFUN ("make-frame-invisible", Fmake_frame_invisible
, Smake_frame_invisible
,
1518 doc
: /* Make the frame FRAME invisible (assuming it is an X window).
1519 If omitted, FRAME defaults to the currently selected frame.
1520 Normally you may not make FRAME invisible if all other frames are invisible,
1521 but if the second optional argument FORCE is non-nil, you may do so. */)
1523 Lisp_Object frame
, force
;
1526 frame
= selected_frame
;
1528 CHECK_LIVE_FRAME (frame
);
1530 if (NILP (force
) && !other_visible_frames (XFRAME (frame
)))
1531 error ("Attempt to make invisible the sole visible or iconified frame");
1533 #if 0 /* This isn't logically necessary, and it can do GC. */
1534 /* Don't let the frame remain selected. */
1535 if (EQ (frame
, selected_frame
))
1536 do_switch_frame (next_frame (frame
, Qt
), 0, 0)
1539 /* Don't allow minibuf_window to remain on a deleted frame. */
1540 if (EQ (XFRAME (frame
)->minibuffer_window
, minibuf_window
))
1542 struct frame
*sf
= XFRAME (selected_frame
);
1543 Fset_window_buffer (sf
->minibuffer_window
,
1544 XWINDOW (minibuf_window
)->buffer
);
1545 minibuf_window
= sf
->minibuffer_window
;
1548 /* I think this should be done with a hook. */
1549 #ifdef HAVE_WINDOW_SYSTEM
1550 if (FRAME_WINDOW_P (XFRAME (frame
)))
1551 x_make_frame_invisible (XFRAME (frame
));
1554 /* Make menu bar update for the Buffers and Frames menus. */
1555 windows_or_buffers_changed
++;
1560 DEFUN ("iconify-frame", Ficonify_frame
, Siconify_frame
,
1562 doc
: /* Make the frame FRAME into an icon.
1563 If omitted, FRAME defaults to the currently selected frame. */)
1568 frame
= selected_frame
;
1570 CHECK_LIVE_FRAME (frame
);
1572 #if 0 /* This isn't logically necessary, and it can do GC. */
1573 /* Don't let the frame remain selected. */
1574 if (EQ (frame
, selected_frame
))
1575 Fhandle_switch_frame (next_frame (frame
, Qt
), Qnil
);
1578 /* Don't allow minibuf_window to remain on a deleted frame. */
1579 if (EQ (XFRAME (frame
)->minibuffer_window
, minibuf_window
))
1581 struct frame
*sf
= XFRAME (selected_frame
);
1582 Fset_window_buffer (sf
->minibuffer_window
,
1583 XWINDOW (minibuf_window
)->buffer
);
1584 minibuf_window
= sf
->minibuffer_window
;
1587 /* I think this should be done with a hook. */
1588 #ifdef HAVE_WINDOW_SYSTEM
1589 if (FRAME_WINDOW_P (XFRAME (frame
)))
1590 x_iconify_frame (XFRAME (frame
));
1593 /* Make menu bar update for the Buffers and Frames menus. */
1594 windows_or_buffers_changed
++;
1599 DEFUN ("frame-visible-p", Fframe_visible_p
, Sframe_visible_p
,
1601 doc
: /* Return t if FRAME is now \"visible\" (actually in use for display).
1602 A frame that is not \"visible\" is not updated and, if it works through
1603 a window system, it may not show at all.
1604 Return the symbol `icon' if frame is visible only as an icon. */)
1608 CHECK_LIVE_FRAME (frame
);
1610 FRAME_SAMPLE_VISIBILITY (XFRAME (frame
));
1612 if (FRAME_VISIBLE_P (XFRAME (frame
)))
1614 if (FRAME_ICONIFIED_P (XFRAME (frame
)))
1619 DEFUN ("visible-frame-list", Fvisible_frame_list
, Svisible_frame_list
,
1621 doc
: /* Return a list of all frames now \"visible\" (being updated). */)
1624 Lisp_Object tail
, frame
;
1629 for (tail
= Vframe_list
; CONSP (tail
); tail
= XCDR (tail
))
1631 frame
= XCAR (tail
);
1632 if (!FRAMEP (frame
))
1635 if (FRAME_VISIBLE_P (f
))
1636 value
= Fcons (frame
, value
);
1642 DEFUN ("raise-frame", Fraise_frame
, Sraise_frame
, 0, 1, "",
1643 doc
: /* Bring FRAME to the front, so it occludes any frames it overlaps.
1644 If FRAME is invisible, make it visible.
1645 If you don't specify a frame, the selected frame is used.
1646 If Emacs is displaying on an ordinary terminal or some other device which
1647 doesn't support multiple overlapping frames, this function does nothing. */)
1652 frame
= selected_frame
;
1654 CHECK_LIVE_FRAME (frame
);
1656 /* Do like the documentation says. */
1657 Fmake_frame_visible (frame
);
1659 if (frame_raise_lower_hook
)
1660 (*frame_raise_lower_hook
) (XFRAME (frame
), 1);
1665 /* Should we have a corresponding function called Flower_Power? */
1666 DEFUN ("lower-frame", Flower_frame
, Slower_frame
, 0, 1, "",
1667 doc
: /* Send FRAME to the back, so it is occluded by any frames that overlap it.
1668 If you don't specify a frame, the selected frame is used.
1669 If Emacs is displaying on an ordinary terminal or some other device which
1670 doesn't support multiple overlapping frames, this function does nothing. */)
1675 frame
= selected_frame
;
1677 CHECK_LIVE_FRAME (frame
);
1679 if (frame_raise_lower_hook
)
1680 (*frame_raise_lower_hook
) (XFRAME (frame
), 0);
1686 DEFUN ("redirect-frame-focus", Fredirect_frame_focus
, Sredirect_frame_focus
,
1688 doc
: /* Arrange for keystrokes typed at FRAME to be sent to FOCUS-FRAME.
1689 In other words, switch-frame events caused by events in FRAME will
1690 request a switch to FOCUS-FRAME, and `last-event-frame' will be
1691 FOCUS-FRAME after reading an event typed at FRAME.
1693 If FOCUS-FRAME is omitted or nil, any existing redirection is
1694 cancelled, and the frame again receives its own keystrokes.
1696 Focus redirection is useful for temporarily redirecting keystrokes to
1697 a surrogate minibuffer frame when a frame doesn't have its own
1700 A frame's focus redirection can be changed by select-frame. If frame
1701 FOO is selected, and then a different frame BAR is selected, any
1702 frames redirecting their focus to FOO are shifted to redirect their
1703 focus to BAR. This allows focus redirection to work properly when the
1704 user switches from one frame to another using `select-window'.
1706 This means that a frame whose focus is redirected to itself is treated
1707 differently from a frame whose focus is redirected to nil; the former
1708 is affected by select-frame, while the latter is not.
1710 The redirection lasts until `redirect-frame-focus' is called to change it. */)
1711 (frame
, focus_frame
)
1712 Lisp_Object frame
, focus_frame
;
1714 /* Note that we don't check for a live frame here. It's reasonable
1715 to redirect the focus of a frame you're about to delete, if you
1716 know what other frame should receive those keystrokes. */
1717 CHECK_FRAME (frame
);
1719 if (! NILP (focus_frame
))
1720 CHECK_LIVE_FRAME (focus_frame
);
1722 XFRAME (frame
)->focus_frame
= focus_frame
;
1724 if (frame_rehighlight_hook
)
1725 (*frame_rehighlight_hook
) (XFRAME (frame
));
1731 DEFUN ("frame-focus", Fframe_focus
, Sframe_focus
, 1, 1, 0,
1732 doc
: /* Return the frame to which FRAME's keystrokes are currently being sent.
1733 This returns nil if FRAME's focus is not redirected.
1734 See `redirect-frame-focus'. */)
1738 CHECK_LIVE_FRAME (frame
);
1740 return FRAME_FOCUS_FRAME (XFRAME (frame
));
1745 /* Return the value of frame parameter PROP in frame FRAME. */
1748 get_frame_param (frame
, prop
)
1749 register struct frame
*frame
;
1752 register Lisp_Object tem
;
1754 tem
= Fassq (prop
, frame
->param_alist
);
1760 /* Return the buffer-predicate of the selected frame. */
1763 frame_buffer_predicate (frame
)
1766 return XFRAME (frame
)->buffer_predicate
;
1769 /* Return the buffer-list of the selected frame. */
1772 frame_buffer_list (frame
)
1775 return XFRAME (frame
)->buffer_list
;
1778 /* Set the buffer-list of the selected frame. */
1781 set_frame_buffer_list (frame
, list
)
1782 Lisp_Object frame
, list
;
1784 XFRAME (frame
)->buffer_list
= list
;
1787 /* Discard BUFFER from the buffer-list of each frame. */
1790 frames_discard_buffer (buffer
)
1793 Lisp_Object frame
, tail
;
1795 FOR_EACH_FRAME (tail
, frame
)
1797 XFRAME (frame
)->buffer_list
1798 = Fdelq (buffer
, XFRAME (frame
)->buffer_list
);
1802 /* Move BUFFER to the end of the buffer-list of each frame. */
1805 frames_bury_buffer (buffer
)
1808 Lisp_Object frame
, tail
;
1810 FOR_EACH_FRAME (tail
, frame
)
1812 struct frame
*f
= XFRAME (frame
);
1815 found
= Fmemq (buffer
, f
->buffer_list
);
1817 f
->buffer_list
= nconc2 (Fdelq (buffer
, f
->buffer_list
),
1818 Fcons (buffer
, Qnil
));
1822 /* Modify the alist in *ALISTPTR to associate PROP with VAL.
1823 If the alist already has an element for PROP, we change it. */
1826 store_in_alist (alistptr
, prop
, val
)
1827 Lisp_Object
*alistptr
, val
;
1830 register Lisp_Object tem
;
1832 tem
= Fassq (prop
, *alistptr
);
1834 *alistptr
= Fcons (Fcons (prop
, val
), *alistptr
);
1840 frame_name_fnn_p (str
, len
)
1844 if (len
> 1 && str
[0] == 'F')
1848 strtol (str
+ 1, &end_ptr
, 10);
1850 if (end_ptr
== str
+ len
)
1856 /* Set the name of the terminal frame. Also used by MSDOS frames.
1857 Modeled after x_set_name which is used for WINDOW frames. */
1860 set_term_frame_name (f
, name
)
1864 f
->explicit_name
= ! NILP (name
);
1866 /* If NAME is nil, set the name to F<num>. */
1871 /* Check for no change needed in this very common case
1872 before we do any consing. */
1873 if (frame_name_fnn_p (XSTRING (f
->name
)->data
,
1874 STRING_BYTES (XSTRING (f
->name
))))
1877 terminal_frame_count
++;
1878 sprintf (namebuf
, "F%d", terminal_frame_count
);
1879 name
= build_string (namebuf
);
1883 CHECK_STRING (name
);
1885 /* Don't change the name if it's already NAME. */
1886 if (! NILP (Fstring_equal (name
, f
->name
)))
1889 /* Don't allow the user to set the frame name to F<num>, so it
1890 doesn't clash with the names we generate for terminal frames. */
1891 if (frame_name_fnn_p (XSTRING (name
)->data
, STRING_BYTES (XSTRING (name
))))
1892 error ("Frame names of the form F<num> are usurped by Emacs");
1896 update_mode_lines
= 1;
1900 store_frame_param (f
, prop
, val
)
1902 Lisp_Object prop
, val
;
1904 register Lisp_Object old_alist_elt
;
1906 /* The buffer-alist parameter is stored in a special place and is
1907 not in the alist. */
1908 if (EQ (prop
, Qbuffer_list
))
1910 f
->buffer_list
= val
;
1914 /* If PROP is a symbol which is supposed to have frame-local values,
1915 and it is set up based on this frame, switch to the global
1916 binding. That way, we can create or alter the frame-local binding
1917 without messing up the symbol's status. */
1920 Lisp_Object valcontents
;
1921 valcontents
= SYMBOL_VALUE (prop
);
1922 if ((BUFFER_LOCAL_VALUEP (valcontents
)
1923 || SOME_BUFFER_LOCAL_VALUEP (valcontents
))
1924 && XBUFFER_LOCAL_VALUE (valcontents
)->check_frame
1925 && XFRAME (XBUFFER_LOCAL_VALUE (valcontents
)->frame
) == f
)
1926 swap_in_global_binding (prop
);
1929 /* Update the frame parameter alist. */
1930 old_alist_elt
= Fassq (prop
, f
->param_alist
);
1931 if (EQ (old_alist_elt
, Qnil
))
1932 f
->param_alist
= Fcons (Fcons (prop
, val
), f
->param_alist
);
1934 Fsetcdr (old_alist_elt
, val
);
1936 /* Update some other special parameters in their special places
1937 in addition to the alist. */
1939 if (EQ (prop
, Qbuffer_predicate
))
1940 f
->buffer_predicate
= val
;
1942 if (! FRAME_WINDOW_P (f
))
1944 if (EQ (prop
, Qmenu_bar_lines
))
1945 set_menu_bar_lines (f
, val
, make_number (FRAME_MENU_BAR_LINES (f
)));
1946 else if (EQ (prop
, Qname
))
1947 set_term_frame_name (f
, val
);
1950 if (EQ (prop
, Qminibuffer
) && WINDOWP (val
))
1952 if (! MINI_WINDOW_P (XWINDOW (val
)))
1953 error ("Surrogate minibuffer windows must be minibuffer windows.");
1955 if ((FRAME_HAS_MINIBUF_P (f
) || FRAME_MINIBUF_ONLY_P (f
))
1956 && !EQ (val
, f
->minibuffer_window
))
1957 error ("Can't change the surrogate minibuffer of a frame with its own minibuffer");
1959 /* Install the chosen minibuffer window, with proper buffer. */
1960 f
->minibuffer_window
= val
;
1964 DEFUN ("frame-parameters", Fframe_parameters
, Sframe_parameters
, 0, 1, 0,
1965 doc
: /* Return the parameters-alist of frame FRAME.
1966 It is a list of elements of the form (PARM . VALUE), where PARM is a symbol.
1967 The meaningful PARMs depend on the kind of frame.
1968 If FRAME is omitted, return information on the currently selected frame. */)
1975 struct gcpro gcpro1
;
1978 frame
= selected_frame
;
1980 CHECK_FRAME (frame
);
1983 if (!FRAME_LIVE_P (f
))
1986 alist
= Fcopy_alist (f
->param_alist
);
1989 if (!FRAME_WINDOW_P (f
))
1991 int fg
= FRAME_FOREGROUND_PIXEL (f
);
1992 int bg
= FRAME_BACKGROUND_PIXEL (f
);
1995 /* If the frame's parameter alist says the colors are
1996 unspecified and reversed, take the frame's background pixel
1997 for foreground and vice versa. */
1998 elt
= Fassq (Qforeground_color
, alist
);
1999 if (!NILP (elt
) && CONSP (elt
) && STRINGP (XCDR (elt
)))
2001 if (strncmp (XSTRING (XCDR (elt
))->data
,
2003 XSTRING (XCDR (elt
))->size
) == 0)
2004 store_in_alist (&alist
, Qforeground_color
, tty_color_name (f
, bg
));
2005 else if (strncmp (XSTRING (XCDR (elt
))->data
,
2007 XSTRING (XCDR (elt
))->size
) == 0)
2008 store_in_alist (&alist
, Qforeground_color
, tty_color_name (f
, fg
));
2011 store_in_alist (&alist
, Qforeground_color
, tty_color_name (f
, fg
));
2012 elt
= Fassq (Qbackground_color
, alist
);
2013 if (!NILP (elt
) && CONSP (elt
) && STRINGP (XCDR (elt
)))
2015 if (strncmp (XSTRING (XCDR (elt
))->data
,
2017 XSTRING (XCDR (elt
))->size
) == 0)
2018 store_in_alist (&alist
, Qbackground_color
, tty_color_name (f
, fg
));
2019 else if (strncmp (XSTRING (XCDR (elt
))->data
,
2021 XSTRING (XCDR (elt
))->size
) == 0)
2022 store_in_alist (&alist
, Qbackground_color
, tty_color_name (f
, bg
));
2025 store_in_alist (&alist
, Qbackground_color
, tty_color_name (f
, bg
));
2026 store_in_alist (&alist
, intern ("font"),
2027 build_string (FRAME_MSDOS_P (f
)
2029 : FRAME_W32_P (f
) ? "w32term"
2032 store_in_alist (&alist
, Qname
, f
->name
);
2033 height
= (FRAME_NEW_HEIGHT (f
) ? FRAME_NEW_HEIGHT (f
) : FRAME_HEIGHT (f
));
2034 store_in_alist (&alist
, Qheight
, make_number (height
));
2035 width
= (FRAME_NEW_WIDTH (f
) ? FRAME_NEW_WIDTH (f
) : FRAME_WIDTH (f
));
2036 store_in_alist (&alist
, Qwidth
, make_number (width
));
2037 store_in_alist (&alist
, Qmodeline
, (FRAME_WANTS_MODELINE_P (f
) ? Qt
: Qnil
));
2038 store_in_alist (&alist
, Qminibuffer
,
2039 (! FRAME_HAS_MINIBUF_P (f
) ? Qnil
2040 : FRAME_MINIBUF_ONLY_P (f
) ? Qonly
2041 : FRAME_MINIBUF_WINDOW (f
)));
2042 store_in_alist (&alist
, Qunsplittable
, (FRAME_NO_SPLIT_P (f
) ? Qt
: Qnil
));
2043 store_in_alist (&alist
, Qbuffer_list
, frame_buffer_list (frame
));
2045 /* I think this should be done with a hook. */
2046 #ifdef HAVE_WINDOW_SYSTEM
2047 if (FRAME_WINDOW_P (f
))
2048 x_report_frame_params (f
, &alist
);
2052 /* This ought to be correct in f->param_alist for an X frame. */
2054 XSETFASTINT (lines
, FRAME_MENU_BAR_LINES (f
));
2055 store_in_alist (&alist
, Qmenu_bar_lines
, lines
);
2063 DEFUN ("frame-parameter", Fframe_parameter
, Sframe_parameter
, 2, 2, 0,
2064 doc
: /* Return FRAME's value for parameter PARAMETER.
2065 If FRAME is nil, describe the currently selected frame. */)
2067 Lisp_Object frame
, parameter
;
2073 frame
= selected_frame
;
2075 CHECK_FRAME (frame
);
2076 CHECK_SYMBOL (parameter
);
2081 if (FRAME_LIVE_P (f
))
2083 /* Avoid consing in frequent cases. */
2084 if (EQ (parameter
, Qname
))
2086 #ifdef HAVE_X_WINDOWS
2087 else if (EQ (parameter
, Qdisplay
) && FRAME_X_P (f
))
2088 value
= XCAR (FRAME_X_DISPLAY_INFO (f
)->name_list_element
);
2089 #endif /* HAVE_X_WINDOWS */
2090 else if (EQ (parameter
, Qbackground_color
)
2091 || EQ (parameter
, Qforeground_color
))
2093 value
= Fassq (parameter
, f
->param_alist
);
2096 value
= XCDR (value
);
2097 /* Fframe_parameters puts the actual fg/bg color names,
2098 even if f->param_alist says otherwise. This is
2099 important when param_alist's notion of colors is
2100 "unspecified". We need to do the same here. */
2101 if (STRINGP (value
) && !FRAME_WINDOW_P (f
))
2106 if (EQ (parameter
, Qbackground_color
))
2108 color_name
= XSTRING (value
)->data
;
2109 csz
= XSTRING (value
)->size
;
2110 if (strncmp (color_name
, unspecified_bg
, csz
) == 0)
2111 value
= tty_color_name (f
, FRAME_BACKGROUND_PIXEL (f
));
2112 else if (strncmp (color_name
, unspecified_fg
, csz
) == 0)
2113 value
= tty_color_name (f
, FRAME_FOREGROUND_PIXEL (f
));
2115 else if (EQ (parameter
, Qforeground_color
))
2117 color_name
= XSTRING (value
)->data
;
2118 csz
= XSTRING (value
)->size
;
2119 if (strncmp (color_name
, unspecified_fg
, csz
) == 0)
2120 value
= tty_color_name (f
, FRAME_FOREGROUND_PIXEL (f
));
2121 else if (strncmp (color_name
, unspecified_bg
, csz
) == 0)
2122 value
= tty_color_name (f
, FRAME_BACKGROUND_PIXEL (f
));
2127 value
= Fcdr (Fassq (parameter
, Fframe_parameters (frame
)));
2129 else if (EQ (parameter
, Qdisplay_type
)
2130 || EQ (parameter
, Qbackground_mode
))
2131 value
= Fcdr (Fassq (parameter
, f
->param_alist
));
2133 value
= Fcdr (Fassq (parameter
, Fframe_parameters (frame
)));
2140 DEFUN ("modify-frame-parameters", Fmodify_frame_parameters
,
2141 Smodify_frame_parameters
, 2, 2, 0,
2142 doc
: /* Modify the parameters of frame FRAME according to ALIST.
2143 If FRAME is nil, it defaults to the selected frame.
2144 ALIST is an alist of parameters to change and their new values.
2145 Each element of ALIST has the form (PARM . VALUE), where PARM is a symbol.
2146 The meaningful PARMs depend on the kind of frame.
2147 Undefined PARMs are ignored, but stored in the frame's parameter list
2148 so that `frame-parameters' will return them.
2150 The value of frame parameter FOO can also be accessed
2151 as a frame-local binding for the variable FOO, if you have
2152 enabled such bindings for that variable with `make-variable-frame-local'. */)
2154 Lisp_Object frame
, alist
;
2157 register Lisp_Object tail
, prop
, val
;
2158 int count
= BINDING_STACK_SIZE ();
2160 /* Bind this to t to inhibit initialization of the default face from
2161 X resources in face-set-after-frame-default. If we don't inhibit
2162 this, modifying the `font' frame parameter, for example, while
2163 there is a `default.attributeFont' X resource, won't work,
2164 because `default's font is reset to the value of the X resource
2165 and that resets the `font' frame parameter. */
2166 specbind (Qinhibit_default_face_x_resources
, Qt
);
2168 if (EQ (frame
, Qnil
))
2169 frame
= selected_frame
;
2170 CHECK_LIVE_FRAME (frame
);
2173 /* I think this should be done with a hook. */
2174 #ifdef HAVE_WINDOW_SYSTEM
2175 if (FRAME_WINDOW_P (f
))
2176 x_set_frame_parameters (f
, alist
);
2180 if (FRAME_MSDOS_P (f
))
2181 IT_set_frame_parameters (f
, alist
);
2186 int length
= XINT (Flength (alist
));
2189 = (Lisp_Object
*) alloca (length
* sizeof (Lisp_Object
));
2191 = (Lisp_Object
*) alloca (length
* sizeof (Lisp_Object
));
2193 /* Extract parm names and values into those vectors. */
2196 for (tail
= alist
; CONSP (tail
); tail
= Fcdr (tail
))
2201 parms
[i
] = Fcar (elt
);
2202 values
[i
] = Fcdr (elt
);
2206 /* Now process them in reverse of specified order. */
2207 for (i
--; i
>= 0; i
--)
2211 store_frame_param (f
, prop
, val
);
2215 return unbind_to (count
, Qnil
);
2218 DEFUN ("frame-char-height", Fframe_char_height
, Sframe_char_height
,
2220 doc
: /* Height in pixels of a line in the font in frame FRAME.
2221 If FRAME is omitted, the selected frame is used.
2222 For a terminal frame, the value is always 1. */)
2229 frame
= selected_frame
;
2230 CHECK_FRAME (frame
);
2233 #ifdef HAVE_WINDOW_SYSTEM
2234 if (FRAME_WINDOW_P (f
))
2235 return make_number (x_char_height (f
));
2238 return make_number (1);
2242 DEFUN ("frame-char-width", Fframe_char_width
, Sframe_char_width
,
2244 doc
: /* Width in pixels of characters in the font in frame FRAME.
2245 If FRAME is omitted, the selected frame is used.
2246 The width is the same for all characters, because
2247 currently Emacs supports only fixed-width fonts.
2248 For a terminal screen, the value is always 1. */)
2255 frame
= selected_frame
;
2256 CHECK_FRAME (frame
);
2259 #ifdef HAVE_WINDOW_SYSTEM
2260 if (FRAME_WINDOW_P (f
))
2261 return make_number (x_char_width (f
));
2264 return make_number (1);
2267 DEFUN ("frame-pixel-height", Fframe_pixel_height
,
2268 Sframe_pixel_height
, 0, 1, 0,
2269 doc
: /* Return a FRAME's height in pixels.
2270 This counts only the height available for text lines,
2271 not menu bars on window-system Emacs frames.
2272 For a terminal frame, the result really gives the height in characters.
2273 If FRAME is omitted, the selected frame is used. */)
2280 frame
= selected_frame
;
2281 CHECK_FRAME (frame
);
2284 #ifdef HAVE_WINDOW_SYSTEM
2285 if (FRAME_WINDOW_P (f
))
2286 return make_number (x_pixel_height (f
));
2289 return make_number (FRAME_HEIGHT (f
));
2292 DEFUN ("frame-pixel-width", Fframe_pixel_width
,
2293 Sframe_pixel_width
, 0, 1, 0,
2294 doc
: /* Return FRAME's width in pixels.
2295 For a terminal frame, the result really gives the width in characters.
2296 If FRAME is omitted, the selected frame is used. */)
2303 frame
= selected_frame
;
2304 CHECK_FRAME (frame
);
2307 #ifdef HAVE_WINDOW_SYSTEM
2308 if (FRAME_WINDOW_P (f
))
2309 return make_number (x_pixel_width (f
));
2312 return make_number (FRAME_WIDTH (f
));
2315 DEFUN ("set-frame-height", Fset_frame_height
, Sset_frame_height
, 2, 3, 0,
2316 doc
: /* Specify that the frame FRAME has LINES lines.
2317 Optional third arg non-nil means that redisplay should use LINES lines
2318 but that the idea of the actual height of the frame should not be changed. */)
2319 (frame
, lines
, pretend
)
2320 Lisp_Object frame
, lines
, pretend
;
2322 register struct frame
*f
;
2324 CHECK_NUMBER (lines
);
2326 frame
= selected_frame
;
2327 CHECK_LIVE_FRAME (frame
);
2330 /* I think this should be done with a hook. */
2331 #ifdef HAVE_WINDOW_SYSTEM
2332 if (FRAME_WINDOW_P (f
))
2334 if (XINT (lines
) != f
->height
)
2335 x_set_window_size (f
, 1, f
->width
, XINT (lines
));
2336 do_pending_window_change (0);
2340 change_frame_size (f
, XINT (lines
), 0, !NILP (pretend
), 0, 0);
2344 DEFUN ("set-frame-width", Fset_frame_width
, Sset_frame_width
, 2, 3, 0,
2345 doc
: /* Specify that the frame FRAME has COLS columns.
2346 Optional third arg non-nil means that redisplay should use COLS columns
2347 but that the idea of the actual width of the frame should not be changed. */)
2348 (frame
, cols
, pretend
)
2349 Lisp_Object frame
, cols
, pretend
;
2351 register struct frame
*f
;
2352 CHECK_NUMBER (cols
);
2354 frame
= selected_frame
;
2355 CHECK_LIVE_FRAME (frame
);
2358 /* I think this should be done with a hook. */
2359 #ifdef HAVE_WINDOW_SYSTEM
2360 if (FRAME_WINDOW_P (f
))
2362 if (XINT (cols
) != f
->width
)
2363 x_set_window_size (f
, 1, XINT (cols
), f
->height
);
2364 do_pending_window_change (0);
2368 change_frame_size (f
, 0, XINT (cols
), !NILP (pretend
), 0, 0);
2372 DEFUN ("set-frame-size", Fset_frame_size
, Sset_frame_size
, 3, 3, 0,
2373 doc
: /* Sets size of FRAME to COLS by ROWS, measured in characters. */)
2375 Lisp_Object frame
, cols
, rows
;
2377 register struct frame
*f
;
2379 CHECK_LIVE_FRAME (frame
);
2380 CHECK_NUMBER (cols
);
2381 CHECK_NUMBER (rows
);
2384 /* I think this should be done with a hook. */
2385 #ifdef HAVE_WINDOW_SYSTEM
2386 if (FRAME_WINDOW_P (f
))
2388 if (XINT (rows
) != f
->height
|| XINT (cols
) != f
->width
2389 || FRAME_NEW_HEIGHT (f
) || FRAME_NEW_WIDTH (f
))
2390 x_set_window_size (f
, 1, XINT (cols
), XINT (rows
));
2391 do_pending_window_change (0);
2395 change_frame_size (f
, XINT (rows
), XINT (cols
), 0, 0, 0);
2400 DEFUN ("set-frame-position", Fset_frame_position
,
2401 Sset_frame_position
, 3, 3, 0,
2402 doc
: /* Sets position of FRAME in pixels to XOFFSET by YOFFSET.
2403 This is actually the position of the upper left corner of the frame.
2404 Negative values for XOFFSET or YOFFSET are interpreted relative to
2405 the rightmost or bottommost possible position (that stays within the screen). */)
2406 (frame
, xoffset
, yoffset
)
2407 Lisp_Object frame
, xoffset
, yoffset
;
2409 register struct frame
*f
;
2411 CHECK_LIVE_FRAME (frame
);
2412 CHECK_NUMBER (xoffset
);
2413 CHECK_NUMBER (yoffset
);
2416 /* I think this should be done with a hook. */
2417 #ifdef HAVE_WINDOW_SYSTEM
2418 if (FRAME_WINDOW_P (f
))
2419 x_set_offset (f
, XINT (xoffset
), XINT (yoffset
), 1);
2429 Qframep
= intern ("framep");
2430 staticpro (&Qframep
);
2431 Qframe_live_p
= intern ("frame-live-p");
2432 staticpro (&Qframe_live_p
);
2433 Qheight
= intern ("height");
2434 staticpro (&Qheight
);
2435 Qicon
= intern ("icon");
2437 Qminibuffer
= intern ("minibuffer");
2438 staticpro (&Qminibuffer
);
2439 Qmodeline
= intern ("modeline");
2440 staticpro (&Qmodeline
);
2441 Qname
= intern ("name");
2443 Qonly
= intern ("only");
2445 Qunsplittable
= intern ("unsplittable");
2446 staticpro (&Qunsplittable
);
2447 Qmenu_bar_lines
= intern ("menu-bar-lines");
2448 staticpro (&Qmenu_bar_lines
);
2449 Qtool_bar_lines
= intern ("tool-bar-lines");
2450 staticpro (&Qtool_bar_lines
);
2451 Qwidth
= intern ("width");
2452 staticpro (&Qwidth
);
2455 Qw32
= intern ("w32");
2457 Qpc
= intern ("pc");
2459 Qmac
= intern ("mac");
2461 Qvisible
= intern ("visible");
2462 staticpro (&Qvisible
);
2463 Qbuffer_predicate
= intern ("buffer-predicate");
2464 staticpro (&Qbuffer_predicate
);
2465 Qbuffer_list
= intern ("buffer-list");
2466 staticpro (&Qbuffer_list
);
2467 Qtitle
= intern ("title");
2468 staticpro (&Qtitle
);
2469 Qdisplay_type
= intern ("display-type");
2470 staticpro (&Qdisplay_type
);
2471 Qbackground_mode
= intern ("background-mode");
2472 staticpro (&Qbackground_mode
);
2473 Qleft_fringe
= intern ("left-fringe");
2474 staticpro (&Qleft_fringe
);
2475 Qright_fringe
= intern ("right-fringe");
2476 staticpro (&Qright_fringe
);
2478 DEFVAR_LISP ("default-frame-alist", &Vdefault_frame_alist
,
2479 doc
: /* Alist of default values for frame creation.
2480 These may be set in your init file, like this:
2481 (setq default-frame-alist '((width . 80) (height . 55) (menu-bar-lines . 1))
2482 These override values given in window system configuration data,
2483 including X Windows' defaults database.
2484 For values specific to the first Emacs frame, see `initial-frame-alist'.
2485 For values specific to the separate minibuffer frame, see
2486 `minibuffer-frame-alist'.
2487 The `menu-bar-lines' element of the list controls whether new frames
2488 have menu bars; `menu-bar-mode' works by altering this element. */);
2489 Vdefault_frame_alist
= Qnil
;
2491 Qinhibit_default_face_x_resources
2492 = intern ("inhibit-default-face-x-resources");
2493 staticpro (&Qinhibit_default_face_x_resources
);
2495 DEFVAR_LISP ("terminal-frame", &Vterminal_frame
,
2496 doc
: /* The initial frame-object, which represents Emacs's stdout. */);
2498 DEFVAR_LISP ("emacs-iconified", &Vemacs_iconified
,
2499 doc
: /* Non-nil if all of emacs is iconified and frame updates are not needed. */);
2500 Vemacs_iconified
= Qnil
;
2502 DEFVAR_LISP ("mouse-position-function", &Vmouse_position_function
,
2503 doc
: /* If non-nil, function to transform normal value of `mouse-position'.
2504 `mouse-position' calls this function, passing its usual return value as
2505 argument, and returns whatever this function returns.
2506 This abnormal hook exists for the benefit of packages like `xt-mouse.el'
2507 which need to do mouse handling at the Lisp level. */);
2508 Vmouse_position_function
= Qnil
;
2510 DEFVAR_KBOARD ("default-minibuffer-frame", Vdefault_minibuffer_frame
,
2511 doc
: /* Minibufferless frames use this frame's minibuffer.
2513 Emacs cannot create minibufferless frames unless this is set to an
2514 appropriate surrogate.
2516 Emacs consults this variable only when creating minibufferless
2517 frames; once the frame is created, it sticks with its assigned
2518 minibuffer, no matter what this variable is set to. This means that
2519 this variable doesn't necessarily say anything meaningful about the
2520 current set of frames, or where the minibuffer is currently being
2523 This variable is local to the current terminal and cannot be buffer-local. */);
2525 staticpro (&Vframe_list
);
2527 defsubr (&Sactive_minibuffer_window
);
2529 defsubr (&Sframe_live_p
);
2530 defsubr (&Smake_terminal_frame
);
2531 defsubr (&Shandle_switch_frame
);
2532 defsubr (&Signore_event
);
2533 defsubr (&Sselect_frame
);
2534 defsubr (&Sselected_frame
);
2535 defsubr (&Swindow_frame
);
2536 defsubr (&Sframe_root_window
);
2537 defsubr (&Sframe_first_window
);
2538 defsubr (&Sframe_selected_window
);
2539 defsubr (&Sset_frame_selected_window
);
2540 defsubr (&Sframe_list
);
2541 defsubr (&Snext_frame
);
2542 defsubr (&Sprevious_frame
);
2543 defsubr (&Sdelete_frame
);
2544 defsubr (&Smouse_position
);
2545 defsubr (&Smouse_pixel_position
);
2546 defsubr (&Sset_mouse_position
);
2547 defsubr (&Sset_mouse_pixel_position
);
2549 defsubr (&Sframe_configuration
);
2550 defsubr (&Srestore_frame_configuration
);
2552 defsubr (&Smake_frame_visible
);
2553 defsubr (&Smake_frame_invisible
);
2554 defsubr (&Siconify_frame
);
2555 defsubr (&Sframe_visible_p
);
2556 defsubr (&Svisible_frame_list
);
2557 defsubr (&Sraise_frame
);
2558 defsubr (&Slower_frame
);
2559 defsubr (&Sredirect_frame_focus
);
2560 defsubr (&Sframe_focus
);
2561 defsubr (&Sframe_parameters
);
2562 defsubr (&Sframe_parameter
);
2563 defsubr (&Smodify_frame_parameters
);
2564 defsubr (&Sframe_char_height
);
2565 defsubr (&Sframe_char_width
);
2566 defsubr (&Sframe_pixel_height
);
2567 defsubr (&Sframe_pixel_width
);
2568 defsubr (&Sset_frame_height
);
2569 defsubr (&Sset_frame_width
);
2570 defsubr (&Sset_frame_size
);
2571 defsubr (&Sset_frame_position
);