1 /* Generic frame functions.
2 Copyright (C) 1993, 1994, 1995, 1997, 1999, 2000, 2001, 2002, 2003,
3 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
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., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA. */
37 /* These help us bind and responding to switch-frame events. */
41 #ifdef HAVE_WINDOW_SYSTEM
44 #include "blockinput.h"
46 #include "termhooks.h"
47 #include "dispextern.h"
55 #ifdef HAVE_WINDOW_SYSTEM
57 /* The name we're using in resource queries. Most often "emacs". */
59 Lisp_Object Vx_resource_name
;
61 /* The application class we're using in resource queries.
64 Lisp_Object Vx_resource_class
;
68 Lisp_Object Qframep
, Qframe_live_p
;
69 Lisp_Object Qicon
, Qmodeline
;
71 Lisp_Object Qx
, Qw32
, Qmac
, Qpc
;
73 Lisp_Object Qdisplay_type
;
74 Lisp_Object Qbackground_mode
;
76 Lisp_Object Qx_frame_parameter
;
77 Lisp_Object Qx_resource_name
;
78 Lisp_Object Qterminal
;
79 Lisp_Object Qterminal_live_p
;
81 /* Frame parameters (set or reported). */
83 Lisp_Object Qauto_raise
, Qauto_lower
;
84 Lisp_Object Qborder_color
, Qborder_width
;
85 Lisp_Object Qcursor_color
, Qcursor_type
;
86 Lisp_Object Qgeometry
; /* Not used */
87 Lisp_Object Qheight
, Qwidth
;
88 Lisp_Object Qleft
, Qright
;
89 Lisp_Object Qicon_left
, Qicon_top
, Qicon_type
, Qicon_name
;
90 Lisp_Object Qinternal_border_width
;
91 Lisp_Object Qmouse_color
;
92 Lisp_Object Qminibuffer
;
93 Lisp_Object Qscroll_bar_width
, Qvertical_scroll_bars
;
94 Lisp_Object Qvisibility
;
95 Lisp_Object Qscroll_bar_foreground
, Qscroll_bar_background
;
96 Lisp_Object Qscreen_gamma
;
97 Lisp_Object Qline_spacing
;
98 Lisp_Object Quser_position
, Quser_size
;
99 Lisp_Object Qwait_for_wm
;
100 Lisp_Object Qwindow_id
;
101 #ifdef HAVE_X_WINDOWS
102 Lisp_Object Qouter_window_id
;
104 Lisp_Object Qparent_id
;
105 Lisp_Object Qtitle
, Qname
;
106 Lisp_Object Qunsplittable
;
107 Lisp_Object Qmenu_bar_lines
, Qtool_bar_lines
;
108 Lisp_Object Qleft_fringe
, Qright_fringe
;
109 Lisp_Object Qbuffer_predicate
, Qbuffer_list
, Qburied_buffer_list
;
110 Lisp_Object Qtty_color_mode
;
111 Lisp_Object Qtty
, Qtty_type
;
112 Lisp_Object Qwindow_system
;
113 Lisp_Object Qenvironment
;
115 Lisp_Object Qfullscreen
, Qfullwidth
, Qfullheight
, Qfullboth
;
117 Lisp_Object Qinhibit_face_set_after_frame_default
;
118 Lisp_Object Qface_set_after_frame_default
;
120 Lisp_Object Vterminal_frame
;
121 Lisp_Object Vdefault_frame_alist
;
122 Lisp_Object Vdefault_frame_scroll_bars
;
123 Lisp_Object Vmouse_position_function
;
124 Lisp_Object Vmouse_highlight
;
125 Lisp_Object Vdelete_frame_functions
;
128 set_menu_bar_lines_1 (window
, n
)
132 struct window
*w
= XWINDOW (window
);
134 XSETFASTINT (w
->last_modified
, 0);
135 XSETFASTINT (w
->top_line
, XFASTINT (w
->top_line
) + n
);
136 XSETFASTINT (w
->total_lines
, XFASTINT (w
->total_lines
) - n
);
138 if (INTEGERP (w
->orig_top_line
))
139 XSETFASTINT (w
->orig_top_line
, XFASTINT (w
->orig_top_line
) + n
);
140 if (INTEGERP (w
->orig_total_lines
))
141 XSETFASTINT (w
->orig_total_lines
, XFASTINT (w
->orig_total_lines
) - n
);
143 /* Handle just the top child in a vertical split. */
144 if (!NILP (w
->vchild
))
145 set_menu_bar_lines_1 (w
->vchild
, n
);
147 /* Adjust all children in a horizontal split. */
148 for (window
= w
->hchild
; !NILP (window
); window
= w
->next
)
150 w
= XWINDOW (window
);
151 set_menu_bar_lines_1 (window
, n
);
156 set_menu_bar_lines (f
, value
, oldval
)
158 Lisp_Object value
, oldval
;
161 int olines
= FRAME_MENU_BAR_LINES (f
);
163 /* Right now, menu bars don't work properly in minibuf-only frames;
164 most of the commands try to apply themselves to the minibuffer
165 frame itself, and get an error because you can't switch buffers
166 in or split the minibuffer window. */
167 if (FRAME_MINIBUF_ONLY_P (f
))
170 if (INTEGERP (value
))
171 nlines
= XINT (value
);
175 if (nlines
!= olines
)
177 windows_or_buffers_changed
++;
178 FRAME_WINDOW_SIZES_CHANGED (f
) = 1;
179 FRAME_MENU_BAR_LINES (f
) = nlines
;
180 set_menu_bar_lines_1 (f
->root_window
, nlines
- olines
);
185 Lisp_Object Vemacs_iconified
;
186 Lisp_Object Vframe_list
;
188 extern Lisp_Object Vminibuffer_list
;
189 extern Lisp_Object
get_minibuffer ();
190 extern Lisp_Object
Fhandle_switch_frame ();
191 extern Lisp_Object
Fredirect_frame_focus ();
192 extern Lisp_Object
x_get_focus_frame ();
194 DEFUN ("framep", Fframep
, Sframep
, 1, 1, 0,
195 doc
: /* Return non-nil if OBJECT is a frame.
196 Value is t for a termcap frame (a character-only terminal),
197 `x' for an Emacs frame that is really an X window,
198 `w32' for an Emacs frame that is a window on MS-Windows display,
199 `mac' for an Emacs frame on a Macintosh display,
200 `pc' for a direct-write MS-DOS frame.
201 See also `frame-live-p'. */)
205 if (!FRAMEP (object
))
207 switch (XFRAME (object
)->output_method
)
209 case output_initial
: /* The initial frame is like a termcap frame. */
212 case output_x_window
:
216 case output_msdos_raw
:
225 DEFUN ("frame-live-p", Fframe_live_p
, Sframe_live_p
, 1, 1, 0,
226 doc
: /* Return non-nil if OBJECT is a frame which has not been deleted.
227 Value is nil if OBJECT is not a live frame. If object is a live
228 frame, the return value indicates what sort of terminal device it is
229 displayed on. See the documentation of `framep' for possible
234 return ((FRAMEP (object
)
235 && FRAME_LIVE_P (XFRAME (object
)))
240 DEFUN ("window-system", Fwindow_system
, Swindow_system
, 0, 1, 0,
241 doc
: /* The name of the window system that FRAME is displaying through.
242 The value is a symbol---for instance, 'x' for X windows.
243 The value is nil if Emacs is using a text-only terminal.
245 FRAME defaults to the currently selected frame. */)
251 frame
= selected_frame
;
253 type
= Fframep (frame
);
256 wrong_type_argument (Qframep
, frame
);
269 register struct frame
*f
;
270 register Lisp_Object root_window
;
271 register Lisp_Object mini_window
;
273 f
= allocate_frame ();
274 XSETFRAME (frame
, f
);
276 f
->desired_matrix
= 0;
277 f
->current_matrix
= 0;
280 f
->glyphs_initialized_p
= 0;
281 f
->decode_mode_spec_buffer
= 0;
283 f
->async_visible
= 0;
284 f
->output_data
.nothing
= 0;
286 f
->async_iconified
= 0;
287 f
->wants_modeline
= 1;
292 f
->has_minibuffer
= mini_p
;
293 f
->focus_frame
= Qnil
;
294 f
->explicit_name
= 0;
295 f
->can_have_scroll_bars
= 0;
296 f
->vertical_scroll_bar_type
= vertical_scroll_bar_none
;
297 f
->param_alist
= Qnil
;
298 f
->scroll_bars
= Qnil
;
299 f
->condemned_scroll_bars
= Qnil
;
300 f
->face_alist
= Qnil
;
301 f
->face_cache
= NULL
;
302 f
->menu_bar_items
= Qnil
;
303 f
->menu_bar_vector
= Qnil
;
304 f
->menu_bar_items_used
= 0;
305 f
->buffer_predicate
= Qnil
;
306 f
->buffer_list
= Qnil
;
307 f
->buried_buffer_list
= Qnil
;
310 f
->menu_bar_window
= Qnil
;
311 f
->tool_bar_window
= Qnil
;
312 f
->tool_bar_items
= Qnil
;
313 f
->desired_tool_bar_string
= f
->current_tool_bar_string
= Qnil
;
314 f
->n_tool_bar_items
= 0;
315 f
->left_fringe_width
= f
->right_fringe_width
= 0;
317 f
->scroll_bar_actual_width
= 0;
319 f
->internal_border_width
= 0;
320 f
->column_width
= 1; /* !FRAME_WINDOW_P value */
321 f
->line_height
= 1; /* !FRAME_WINDOW_P value */
322 f
->x_pixels_diff
= f
->y_pixels_diff
= 0;
323 #ifdef HAVE_WINDOW_SYSTEM
324 f
->want_fullscreen
= FULLSCREEN_NONE
;
326 f
->size_hint_flags
= 0;
329 root_window
= make_window ();
332 mini_window
= make_window ();
333 XWINDOW (root_window
)->next
= mini_window
;
334 XWINDOW (mini_window
)->prev
= root_window
;
335 XWINDOW (mini_window
)->mini_p
= Qt
;
336 XWINDOW (mini_window
)->frame
= frame
;
337 f
->minibuffer_window
= mini_window
;
342 XWINDOW (root_window
)->next
= Qnil
;
343 f
->minibuffer_window
= Qnil
;
346 XWINDOW (root_window
)->frame
= frame
;
349 just so that there is "something there."
350 Correct size will be set up later with change_frame_size. */
352 SET_FRAME_COLS (f
, 10);
353 FRAME_LINES (f
) = 10;
355 XSETFASTINT (XWINDOW (root_window
)->total_cols
, 10);
356 XSETFASTINT (XWINDOW (root_window
)->total_lines
, (mini_p
? 9 : 10));
360 XSETFASTINT (XWINDOW (mini_window
)->total_cols
, 10);
361 XSETFASTINT (XWINDOW (mini_window
)->top_line
, 9);
362 XSETFASTINT (XWINDOW (mini_window
)->total_lines
, 1);
365 /* Choose a buffer for the frame's root window. */
369 XWINDOW (root_window
)->buffer
= Qt
;
370 buf
= Fcurrent_buffer ();
371 /* If buf is a 'hidden' buffer (i.e. one whose name starts with
372 a space), try to find another one. */
373 if (SREF (Fbuffer_name (buf
), 0) == ' ')
374 buf
= Fother_buffer (buf
, Qnil
, Qnil
);
376 /* Use set_window_buffer, not Fset_window_buffer, and don't let
377 hooks be run by it. The reason is that the whole frame/window
378 arrangement is not yet fully intialized at this point. Windows
379 don't have the right size, glyph matrices aren't initialized
380 etc. Running Lisp functions at this point surely ends in a
382 set_window_buffer (root_window
, buf
, 0, 0);
383 f
->buffer_list
= Fcons (buf
, Qnil
);
388 XWINDOW (mini_window
)->buffer
= Qt
;
389 set_window_buffer (mini_window
,
390 (NILP (Vminibuffer_list
)
392 : Fcar (Vminibuffer_list
)),
396 f
->root_window
= root_window
;
397 f
->selected_window
= root_window
;
398 /* Make sure this window seems more recently used than
399 a newly-created, never-selected window. */
400 ++window_select_count
;
401 XSETFASTINT (XWINDOW (f
->selected_window
)->use_time
, window_select_count
);
403 f
->default_face_done_p
= 0;
408 #ifdef HAVE_WINDOW_SYSTEM
409 /* Make a frame using a separate minibuffer window on another frame.
410 MINI_WINDOW is the minibuffer window to use. nil means use the
411 default (the global minibuffer). */
414 make_frame_without_minibuffer (mini_window
, kb
, display
)
415 register Lisp_Object mini_window
;
419 register struct frame
*f
;
422 if (!NILP (mini_window
))
423 CHECK_LIVE_WINDOW (mini_window
);
426 if (!NILP (mini_window
)
427 && FRAME_KBOARD (XFRAME (XWINDOW (mini_window
)->frame
)) != kb
)
428 error ("Frame and minibuffer must be on the same terminal");
431 /* Make a frame containing just a root window. */
434 if (NILP (mini_window
))
436 /* Use default-minibuffer-frame if possible. */
437 if (!FRAMEP (kb
->Vdefault_minibuffer_frame
)
438 || ! FRAME_LIVE_P (XFRAME (kb
->Vdefault_minibuffer_frame
)))
440 Lisp_Object frame_dummy
;
442 XSETFRAME (frame_dummy
, f
);
443 GCPRO1 (frame_dummy
);
444 /* If there's no minibuffer frame to use, create one. */
445 kb
->Vdefault_minibuffer_frame
=
446 call1 (intern ("make-initial-minibuffer-frame"), display
);
450 mini_window
= XFRAME (kb
->Vdefault_minibuffer_frame
)->minibuffer_window
;
453 f
->minibuffer_window
= mini_window
;
455 /* Make the chosen minibuffer window display the proper minibuffer,
456 unless it is already showing a minibuffer. */
457 if (NILP (Fmemq (XWINDOW (mini_window
)->buffer
, Vminibuffer_list
)))
458 Fset_window_buffer (mini_window
,
459 (NILP (Vminibuffer_list
)
461 : Fcar (Vminibuffer_list
)), Qnil
);
465 /* Make a frame containing only a minibuffer window. */
468 make_minibuffer_frame ()
470 /* First make a frame containing just a root window, no minibuffer. */
472 register struct frame
*f
= make_frame (0);
473 register Lisp_Object mini_window
;
474 register Lisp_Object frame
;
476 XSETFRAME (frame
, f
);
481 f
->wants_modeline
= 0;
482 f
->has_minibuffer
= 1;
484 /* Now label the root window as also being the minibuffer.
485 Avoid infinite looping on the window chain by marking next pointer
488 mini_window
= f
->minibuffer_window
= f
->root_window
;
489 XWINDOW (mini_window
)->mini_p
= Qt
;
490 XWINDOW (mini_window
)->next
= Qnil
;
491 XWINDOW (mini_window
)->prev
= Qnil
;
492 XWINDOW (mini_window
)->frame
= frame
;
494 /* Put the proper buffer in that window. */
496 Fset_window_buffer (mini_window
,
497 (NILP (Vminibuffer_list
)
499 : Fcar (Vminibuffer_list
)), Qnil
);
502 #endif /* HAVE_WINDOW_SYSTEM */
504 /* Construct a frame that refers to a terminal. */
506 static int tty_frame_count
;
509 make_initial_frame (void)
512 struct terminal
*terminal
;
516 /* Create the initial keyboard. */
519 initial_kboard
= (KBOARD
*) xmalloc (sizeof (KBOARD
));
520 init_kboard (initial_kboard
);
521 initial_kboard
->next_kboard
= all_kboards
;
522 all_kboards
= initial_kboard
;
526 /* The first call must initialize Vframe_list. */
527 if (! (NILP (Vframe_list
) || CONSP (Vframe_list
)))
530 terminal
= init_initial_terminal ();
533 XSETFRAME (frame
, f
);
535 Vframe_list
= Fcons (frame
, Vframe_list
);
538 f
->name
= build_string ("F1");
541 f
->async_visible
= 1;
543 f
->output_method
= terminal
->type
;
544 f
->terminal
= terminal
;
545 f
->terminal
->reference_count
++;
546 f
->output_data
.nothing
= 0;
548 FRAME_FOREGROUND_PIXEL (f
) = FACE_TTY_DEFAULT_FG_COLOR
;
549 FRAME_BACKGROUND_PIXEL (f
) = FACE_TTY_DEFAULT_BG_COLOR
;
551 FRAME_CAN_HAVE_SCROLL_BARS (f
) = 0;
552 FRAME_VERTICAL_SCROLL_BAR_TYPE (f
) = vertical_scroll_bar_none
;
559 make_terminal_frame (struct terminal
*terminal
)
561 register struct frame
*f
;
565 if (terminal
->deleted
)
566 error ("Terminal is being deleted, can't create new frames on it");
570 XSETFRAME (frame
, f
);
571 Vframe_list
= Fcons (frame
, Vframe_list
);
574 sprintf (name
, "F%d", tty_frame_count
);
575 f
->name
= build_string (name
);
577 f
->visible
= 1; /* FRAME_SET_VISIBLE wd set frame_garbaged. */
578 f
->async_visible
= 1; /* Don't let visible be cleared later. */
580 f
->output_data
.x
= &the_only_x_display
;
581 if (!inhibit_window_system
582 && (!FRAMEP (selected_frame
) || !FRAME_LIVE_P (XFRAME (selected_frame
))
583 || XFRAME (selected_frame
)->output_method
== output_msdos_raw
))
585 f
->output_method
= output_msdos_raw
;
586 /* This initialization of foreground and background pixels is
587 only important for the initial frame created in temacs. If
588 we don't do that, we get black background and foreground in
589 the dumped Emacs because the_only_x_display is a static
590 variable, hence it is born all-zeroes, and zero is the code
591 for the black color. Other frames all inherit their pixels
592 from what's already in the_only_x_display. */
593 if ((!FRAMEP (selected_frame
) || !FRAME_LIVE_P (XFRAME (selected_frame
)))
594 && FRAME_BACKGROUND_PIXEL (f
) == 0
595 && FRAME_FOREGROUND_PIXEL (f
) == 0)
597 FRAME_BACKGROUND_PIXEL (f
) = FACE_TTY_DEFAULT_BG_COLOR
;
598 FRAME_FOREGROUND_PIXEL (f
) = FACE_TTY_DEFAULT_FG_COLOR
;
602 f
->output_method
= output_termcap
;
605 f
->output_method
= output_termcap
;
606 f
->terminal
= terminal
;
607 f
->terminal
->reference_count
++;
608 create_w32cons_output (f
);
611 make_mac_terminal_frame (f
);
614 f
->output_method
= output_termcap
;
615 f
->terminal
= terminal
;
616 f
->terminal
->reference_count
++;
617 create_tty_output (f
);
619 FRAME_FOREGROUND_PIXEL (f
) = FACE_TTY_DEFAULT_FG_COLOR
;
620 FRAME_BACKGROUND_PIXEL (f
) = FACE_TTY_DEFAULT_BG_COLOR
;
622 FRAME_CAN_HAVE_SCROLL_BARS (f
) = 0;
623 FRAME_VERTICAL_SCROLL_BAR_TYPE (f
) = vertical_scroll_bar_none
;
625 /* Set the top frame to the newly created frame. */
626 if (FRAME_TTY (f
)->top_frame
627 && FRAME_LIVE_P (XFRAME (FRAME_TTY (f
)->top_frame
)))
628 XFRAME (FRAME_TTY (f
)->top_frame
)->async_visible
= 2; /* obscured */
630 FRAME_TTY (f
)->top_frame
= frame
;
634 FRAME_FOREGROUND_PIXEL(f
) = FACE_TTY_DEFAULT_FG_COLOR
;
635 FRAME_BACKGROUND_PIXEL(f
) = FACE_TTY_DEFAULT_BG_COLOR
;
638 #endif /* WINDOWSNT */
642 init_frame_faces (f
);
647 /* Get a suitable value for frame parameter PARAMETER for a newly
648 created frame, based on (1) the user-supplied frame parameter
649 alist SUPPLIED_PARMS, (2) CURRENT_VALUE, and finally, if all else
650 fails, (3) Vdefault_frame_alist. */
653 get_future_frame_param (Lisp_Object parameter
,
654 Lisp_Object supplied_parms
,
659 result
= Fassq (parameter
, supplied_parms
);
661 result
= Fassq (parameter
, XFRAME (selected_frame
)->param_alist
);
662 if (NILP (result
) && current_value
!= NULL
)
663 result
= build_string (current_value
);
665 result
= Fassq (parameter
, Vdefault_frame_alist
);
666 if (!NILP (result
) && !STRINGP (result
))
667 result
= XCDR (result
);
668 if (NILP (result
) || !STRINGP (result
))
674 DEFUN ("make-terminal-frame", Fmake_terminal_frame
, Smake_terminal_frame
,
676 doc
: /* Create an additional terminal frame, possibly on another terminal.
677 This function takes one argument, an alist specifying frame parameters.
679 You can create multiple frames on a single text-only terminal, but
680 only one of them (the selected terminal frame) is actually displayed.
682 In practice, generally you don't need to specify any parameters,
683 except when you want to create a new frame on another terminal.
684 In that case, the `tty' parameter specifies the device file to open,
685 and the `tty-type' parameter specifies the terminal type. Example:
687 (make-terminal-frame '((tty . "/dev/pts/5") (tty-type . "xterm")))
689 Note that changing the size of one terminal frame automatically
690 affects all frames on the same terminal device. */)
695 struct terminal
*t
= NULL
;
696 Lisp_Object frame
, tem
;
697 struct frame
*sf
= SELECTED_FRAME ();
700 if (sf
->output_method
!= output_msdos_raw
701 && sf
->output_method
!= output_termcap
)
703 #else /* not MSDOS */
705 #if 0 /* #ifdef MAC_OS */
706 /* This can happen for multi-tty when using both terminal frames and
708 if (sf
->output_method
!= output_mac
)
709 error ("Not running on a Macintosh screen; cannot make a new Macintosh frame");
711 #if 0 /* This should work now! */
712 if (sf
->output_method
!= output_termcap
)
713 error ("Not using an ASCII terminal now; cannot make a new ASCII frame");
716 #endif /* not MSDOS */
719 Lisp_Object terminal
;
721 terminal
= Fassq (Qterminal
, parms
);
722 if (!NILP (terminal
))
724 terminal
= XCDR (terminal
);
725 t
= get_terminal (terminal
, 1);
731 char *name
= 0, *type
= 0;
732 Lisp_Object tty
, tty_type
;
734 tty
= get_future_frame_param
735 (Qtty
, parms
, (FRAME_TERMCAP_P (XFRAME (selected_frame
))
736 ? FRAME_TTY (XFRAME (selected_frame
))->name
740 name
= (char *) alloca (SBYTES (tty
) + 1);
741 strncpy (name
, SDATA (tty
), SBYTES (tty
));
742 name
[SBYTES (tty
)] = 0;
745 tty_type
= get_future_frame_param
746 (Qtty_type
, parms
, (FRAME_TERMCAP_P (XFRAME (selected_frame
))
747 ? FRAME_TTY (XFRAME (selected_frame
))->type
749 if (!NILP (tty_type
))
751 type
= (char *) alloca (SBYTES (tty_type
) + 1);
752 strncpy (type
, SDATA (tty_type
), SBYTES (tty_type
));
753 type
[SBYTES (tty_type
)] = 0;
756 t
= init_tty (name
, type
, 0); /* Errors are not fatal. */
759 f
= make_terminal_frame (t
);
763 get_tty_size (fileno (FRAME_TTY (f
)->input
), &width
, &height
);
764 change_frame_size (f
, height
, width
, 0, 0, 0);
769 XSETFRAME (frame
, f
);
770 Fmodify_frame_parameters (frame
, Vdefault_frame_alist
);
771 Fmodify_frame_parameters (frame
, parms
);
772 Fmodify_frame_parameters (frame
, Fcons (Fcons (Qwindow_system
, Qnil
), Qnil
));
773 Fmodify_frame_parameters (frame
, Fcons (Fcons (Qtty_type
,
774 build_string (t
->display_info
.tty
->type
)),
776 if (t
->display_info
.tty
->name
!= NULL
)
777 Fmodify_frame_parameters (frame
, Fcons (Fcons (Qtty
,
778 build_string (t
->display_info
.tty
->name
)),
781 Fmodify_frame_parameters (frame
, Fcons (Fcons (Qtty
, Qnil
), Qnil
));
783 /* Make the frame face alist be frame-specific, so that each
784 frame could change its face definitions independently. */
785 f
->face_alist
= Fcopy_alist (sf
->face_alist
);
786 /* Simple Fcopy_alist isn't enough, because we need the contents of
787 the vectors which are the CDRs of associations in face_alist to
788 be copied as well. */
789 for (tem
= f
->face_alist
; CONSP (tem
); tem
= XCDR (tem
))
790 XSETCDR (XCAR (tem
), Fcopy_sequence (XCDR (XCAR (tem
))));
795 /* Perform the switch to frame FRAME.
797 If FRAME is a switch-frame event `(switch-frame FRAME1)', use
800 If TRACK is non-zero and the frame that currently has the focus
801 redirects its focus to the selected frame, redirect that focused
802 frame's focus to FRAME instead.
804 FOR_DELETION non-zero means that the selected frame is being
805 deleted, which includes the possibility that the frame's terminal
809 do_switch_frame (frame
, track
, for_deletion
)
811 int track
, for_deletion
;
813 struct frame
*sf
= SELECTED_FRAME ();
815 /* If FRAME is a switch-frame event, extract the frame we should
818 && EQ (XCAR (frame
), Qswitch_frame
)
819 && CONSP (XCDR (frame
)))
820 frame
= XCAR (XCDR (frame
));
822 /* This used to say CHECK_LIVE_FRAME, but apparently it's possible for
823 a switch-frame event to arrive after a frame is no longer live,
824 especially when deleting the initial frame during startup. */
826 if (! FRAME_LIVE_P (XFRAME (frame
)))
829 if (sf
== XFRAME (frame
))
832 /* This is too greedy; it causes inappropriate focus redirection
833 that's hard to get rid of. */
835 /* If a frame's focus has been redirected toward the currently
836 selected frame, we should change the redirection to point to the
837 newly selected frame. This means that if the focus is redirected
838 from a minibufferless frame to a surrogate minibuffer frame, we
839 can use `other-window' to switch between all the frames using
840 that minibuffer frame, and the focus redirection will follow us
846 for (tail
= Vframe_list
; CONSP (tail
); tail
= XCDR (tail
))
850 if (!FRAMEP (XCAR (tail
)))
853 focus
= FRAME_FOCUS_FRAME (XFRAME (XCAR (tail
)));
855 if (FRAMEP (focus
) && XFRAME (focus
) == SELECTED_FRAME ())
856 Fredirect_frame_focus (XCAR (tail
), frame
);
860 /* Instead, apply it only to the frame we're pointing to. */
861 #ifdef HAVE_WINDOW_SYSTEM
862 if (track
&& FRAME_WINDOW_P (XFRAME (frame
)))
864 Lisp_Object focus
, xfocus
;
866 xfocus
= x_get_focus_frame (XFRAME (frame
));
869 focus
= FRAME_FOCUS_FRAME (XFRAME (xfocus
));
870 if (FRAMEP (focus
) && XFRAME (focus
) == SELECTED_FRAME ())
871 Fredirect_frame_focus (xfocus
, frame
);
874 #endif /* HAVE_X_WINDOWS */
877 if (!for_deletion
&& FRAME_HAS_MINIBUF_P (sf
))
878 resize_mini_window (XWINDOW (FRAME_MINIBUF_WINDOW (sf
)), 1);
880 if (FRAME_TERMCAP_P (XFRAME (selected_frame
))
881 && FRAME_TERMCAP_P (XFRAME (frame
))
882 && FRAME_TTY (XFRAME (selected_frame
)) == FRAME_TTY (XFRAME (frame
)))
884 XFRAME (selected_frame
)->async_visible
= 2; /* obscured */
885 XFRAME (frame
)->async_visible
= 1;
886 FRAME_TTY (XFRAME (frame
))->top_frame
= frame
;
889 selected_frame
= frame
;
890 if (! FRAME_MINIBUF_ONLY_P (XFRAME (selected_frame
)))
891 last_nonminibuf_frame
= XFRAME (selected_frame
);
893 Fselect_window (XFRAME (frame
)->selected_window
, Qnil
);
896 /* Make sure to switch the tty color mode to that of the newly
898 sf
= SELECTED_FRAME ();
899 if (FRAME_TERMCAP_P (sf
))
901 Lisp_Object color_mode_spec
, color_mode
;
903 color_mode_spec
= assq_no_quit (Qtty_color_mode
, sf
->param_alist
);
904 if (CONSP (color_mode_spec
))
905 color_mode
= XCDR (color_mode_spec
);
907 color_mode
= make_number (0);
908 set_tty_color_mode (sf
, color_mode
);
910 #endif /* !WINDOWSNT */
912 /* We want to make sure that the next event generates a frame-switch
913 event to the appropriate frame. This seems kludgy to me, but
914 before you take it out, make sure that evaluating something like
915 (select-window (frame-root-window (new-frame))) doesn't end up
916 with your typing being interpreted in the new frame instead of
917 the one you're actually typing in. */
918 internal_last_event_frame
= Qnil
;
923 DEFUN ("select-frame", Fselect_frame
, Sselect_frame
, 1, 1, "e",
924 doc
: /* Select the frame FRAME.
925 Subsequent editing commands apply to its selected window.
926 The selection of FRAME lasts until the next time the user does
927 something to select a different frame, or until the next time this
928 function is called. If you are using a window system, the previously
929 selected frame may be restored as the selected frame after return to
930 the command loop, because it still may have the window system's input
931 focus. On a text-only terminal, the next redisplay will display FRAME.
933 This function returns FRAME, or nil if FRAME has been deleted. */)
937 return do_switch_frame (frame
, 1, 0);
941 DEFUN ("handle-switch-frame", Fhandle_switch_frame
, Shandle_switch_frame
, 1, 1, "e",
942 doc
: /* Handle a switch-frame event EVENT.
943 Switch-frame events are usually bound to this function.
944 A switch-frame event tells Emacs that the window manager has requested
945 that the user's events be directed to the frame mentioned in the event.
946 This function selects the selected window of the frame of EVENT.
948 If EVENT is frame object, handle it as if it were a switch-frame event
953 /* Preserve prefix arg that the command loop just cleared. */
954 current_kboard
->Vprefix_arg
= Vcurrent_prefix_arg
;
955 call1 (Vrun_hooks
, Qmouse_leave_buffer_hook
);
956 return do_switch_frame (event
, 0, 0);
959 DEFUN ("selected-frame", Fselected_frame
, Sselected_frame
, 0, 0, 0,
960 doc
: /* Return the frame that is now selected. */)
963 return selected_frame
;
966 DEFUN ("window-frame", Fwindow_frame
, Swindow_frame
, 1, 1, 0,
967 doc
: /* Return the frame object that window WINDOW is on. */)
971 CHECK_LIVE_WINDOW (window
);
972 return XWINDOW (window
)->frame
;
975 DEFUN ("frame-first-window", Fframe_first_window
, Sframe_first_window
, 0, 1, 0,
976 doc
: /* Returns the topmost, leftmost window of FRAME.
977 If omitted, FRAME defaults to the currently selected frame. */)
984 w
= SELECTED_FRAME ()->root_window
;
987 CHECK_LIVE_FRAME (frame
);
988 w
= XFRAME (frame
)->root_window
;
990 while (NILP (XWINDOW (w
)->buffer
))
992 if (! NILP (XWINDOW (w
)->hchild
))
993 w
= XWINDOW (w
)->hchild
;
994 else if (! NILP (XWINDOW (w
)->vchild
))
995 w
= XWINDOW (w
)->vchild
;
1002 DEFUN ("active-minibuffer-window", Factive_minibuffer_window
,
1003 Sactive_minibuffer_window
, 0, 0, 0,
1004 doc
: /* Return the currently active minibuffer window, or nil if none. */)
1007 return minibuf_level
? minibuf_window
: Qnil
;
1010 DEFUN ("frame-root-window", Fframe_root_window
, Sframe_root_window
, 0, 1, 0,
1011 doc
: /* Returns the root-window of FRAME.
1012 If omitted, FRAME defaults to the currently selected frame. */)
1019 window
= SELECTED_FRAME ()->root_window
;
1022 CHECK_LIVE_FRAME (frame
);
1023 window
= XFRAME (frame
)->root_window
;
1029 DEFUN ("frame-selected-window", Fframe_selected_window
,
1030 Sframe_selected_window
, 0, 1, 0,
1031 doc
: /* Return the selected window of frame object FRAME.
1032 If omitted, FRAME defaults to the currently selected frame. */)
1039 window
= SELECTED_FRAME ()->selected_window
;
1042 CHECK_LIVE_FRAME (frame
);
1043 window
= XFRAME (frame
)->selected_window
;
1049 DEFUN ("set-frame-selected-window", Fset_frame_selected_window
,
1050 Sset_frame_selected_window
, 2, 2, 0,
1051 doc
: /* Set the selected window of frame object FRAME to WINDOW.
1053 If FRAME is nil, the selected frame is used.
1054 If FRAME is the selected frame, this makes WINDOW the selected window. */)
1056 Lisp_Object frame
, window
;
1059 frame
= selected_frame
;
1061 CHECK_LIVE_FRAME (frame
);
1062 CHECK_LIVE_WINDOW (window
);
1064 if (! EQ (frame
, WINDOW_FRAME (XWINDOW (window
))))
1065 error ("In `set-frame-selected-window', WINDOW is not on FRAME");
1067 if (EQ (frame
, selected_frame
))
1068 return Fselect_window (window
, Qnil
);
1070 return XFRAME (frame
)->selected_window
= window
;
1074 DEFUN ("frame-list", Fframe_list
, Sframe_list
,
1076 doc
: /* Return a list of all frames. */)
1080 frames
= Fcopy_sequence (Vframe_list
);
1081 #ifdef HAVE_WINDOW_SYSTEM
1082 if (FRAMEP (tip_frame
))
1083 frames
= Fdelq (tip_frame
, frames
);
1088 /* Return the next frame in the frame list after FRAME.
1089 If MINIBUF is nil, exclude minibuffer-only frames.
1090 If MINIBUF is a window, include only its own frame
1091 and any frame now using that window as the minibuffer.
1092 If MINIBUF is `visible', include all visible frames.
1093 If MINIBUF is 0, include all visible and iconified frames.
1094 Otherwise, include all frames. */
1097 next_frame (frame
, minibuf
)
1099 Lisp_Object minibuf
;
1104 /* There must always be at least one frame in Vframe_list. */
1105 if (! CONSP (Vframe_list
))
1108 /* If this frame is dead, it won't be in Vframe_list, and we'll loop
1109 forever. Forestall that. */
1110 CHECK_LIVE_FRAME (frame
);
1113 for (tail
= Vframe_list
; CONSP (tail
); tail
= XCDR (tail
))
1120 && ((!FRAME_TERMCAP_P (XFRAME (f
)) && !FRAME_TERMCAP_P (XFRAME (frame
))
1121 && FRAME_KBOARD (XFRAME (f
)) == FRAME_KBOARD (XFRAME (frame
)))
1122 || (FRAME_TERMCAP_P (XFRAME (f
)) && FRAME_TERMCAP_P (XFRAME (frame
))
1123 && FRAME_TTY (XFRAME (f
)) == FRAME_TTY (XFRAME (frame
)))))
1125 /* Decide whether this frame is eligible to be returned. */
1127 /* If we've looped all the way around without finding any
1128 eligible frames, return the original frame. */
1132 /* Let minibuf decide if this frame is acceptable. */
1135 if (! FRAME_MINIBUF_ONLY_P (XFRAME (f
)))
1138 else if (EQ (minibuf
, Qvisible
))
1140 FRAME_SAMPLE_VISIBILITY (XFRAME (f
));
1141 if (FRAME_VISIBLE_P (XFRAME (f
)))
1144 else if (INTEGERP (minibuf
) && XINT (minibuf
) == 0)
1146 FRAME_SAMPLE_VISIBILITY (XFRAME (f
));
1147 if (FRAME_VISIBLE_P (XFRAME (f
))
1148 || FRAME_ICONIFIED_P (XFRAME (f
)))
1151 else if (WINDOWP (minibuf
))
1153 if (EQ (FRAME_MINIBUF_WINDOW (XFRAME (f
)), minibuf
)
1154 || EQ (WINDOW_FRAME (XWINDOW (minibuf
)), f
)
1155 || EQ (WINDOW_FRAME (XWINDOW (minibuf
)),
1156 FRAME_FOCUS_FRAME (XFRAME (f
))))
1168 /* Return the previous frame in the frame list before FRAME.
1169 If MINIBUF is nil, exclude minibuffer-only frames.
1170 If MINIBUF is a window, include only its own frame
1171 and any frame now using that window as the minibuffer.
1172 If MINIBUF is `visible', include all visible frames.
1173 If MINIBUF is 0, include all visible and iconified frames.
1174 Otherwise, include all frames. */
1177 prev_frame (frame
, minibuf
)
1179 Lisp_Object minibuf
;
1184 /* There must always be at least one frame in Vframe_list. */
1185 if (! CONSP (Vframe_list
))
1189 for (tail
= Vframe_list
; CONSP (tail
); tail
= XCDR (tail
))
1197 if (EQ (frame
, f
) && !NILP (prev
))
1200 if ((!FRAME_TERMCAP_P (XFRAME (f
)) && !FRAME_TERMCAP_P (XFRAME (frame
))
1201 && FRAME_KBOARD (XFRAME (f
)) == FRAME_KBOARD (XFRAME (frame
)))
1202 || (FRAME_TERMCAP_P (XFRAME (f
)) && FRAME_TERMCAP_P (XFRAME (frame
))
1203 && FRAME_TTY (XFRAME (f
)) == FRAME_TTY (XFRAME (frame
))))
1205 /* Decide whether this frame is eligible to be returned,
1206 according to minibuf. */
1209 if (! FRAME_MINIBUF_ONLY_P (XFRAME (f
)))
1212 else if (WINDOWP (minibuf
))
1214 if (EQ (FRAME_MINIBUF_WINDOW (XFRAME (f
)), minibuf
)
1215 || EQ (WINDOW_FRAME (XWINDOW (minibuf
)), f
)
1216 || EQ (WINDOW_FRAME (XWINDOW (minibuf
)),
1217 FRAME_FOCUS_FRAME (XFRAME (f
))))
1220 else if (EQ (minibuf
, Qvisible
))
1222 FRAME_SAMPLE_VISIBILITY (XFRAME (f
));
1223 if (FRAME_VISIBLE_P (XFRAME (f
)))
1226 else if (XFASTINT (minibuf
) == 0)
1228 FRAME_SAMPLE_VISIBILITY (XFRAME (f
));
1229 if (FRAME_VISIBLE_P (XFRAME (f
))
1230 || FRAME_ICONIFIED_P (XFRAME (f
)))
1238 /* We've scanned the entire list. */
1240 /* We went through the whole frame list without finding a single
1241 acceptable frame. Return the original frame. */
1244 /* There were no acceptable frames in the list before FRAME; otherwise,
1245 we would have returned directly from the loop. Since PREV is the last
1246 acceptable frame in the list, return it. */
1251 DEFUN ("next-frame", Fnext_frame
, Snext_frame
, 0, 2, 0,
1252 doc
: /* Return the next frame in the frame list after FRAME.
1253 It considers only frames on the same terminal as FRAME.
1254 By default, skip minibuffer-only frames.
1255 If omitted, FRAME defaults to the selected frame.
1256 If optional argument MINIFRAME is nil, exclude minibuffer-only frames.
1257 If MINIFRAME is a window, include only its own frame
1258 and any frame now using that window as the minibuffer.
1259 If MINIFRAME is `visible', include all visible frames.
1260 If MINIFRAME is 0, include all visible and iconified frames.
1261 Otherwise, include all frames. */)
1263 Lisp_Object frame
, miniframe
;
1266 frame
= selected_frame
;
1268 CHECK_LIVE_FRAME (frame
);
1269 return next_frame (frame
, miniframe
);
1272 DEFUN ("previous-frame", Fprevious_frame
, Sprevious_frame
, 0, 2, 0,
1273 doc
: /* Return the previous frame in the frame list before FRAME.
1274 It considers only frames on the same terminal as FRAME.
1275 By default, skip minibuffer-only frames.
1276 If omitted, FRAME defaults to the selected frame.
1277 If optional argument MINIFRAME is nil, exclude minibuffer-only frames.
1278 If MINIFRAME is a window, include only its own frame
1279 and any frame now using that window as the minibuffer.
1280 If MINIFRAME is `visible', include all visible frames.
1281 If MINIFRAME is 0, include all visible and iconified frames.
1282 Otherwise, include all frames. */)
1284 Lisp_Object frame
, miniframe
;
1287 frame
= selected_frame
;
1288 CHECK_LIVE_FRAME (frame
);
1289 return prev_frame (frame
, miniframe
);
1292 /* Return 1 if it is ok to delete frame F;
1293 0 if all frames aside from F are invisible.
1294 (Exception: if F is the terminal frame, and we are using X, return 1.) */
1297 other_visible_frames (f
)
1300 /* We know the selected frame is visible,
1301 so if F is some other frame, it can't be the sole visible one. */
1302 if (f
== SELECTED_FRAME ())
1307 for (frames
= Vframe_list
;
1309 frames
= XCDR (frames
))
1313 this = XCAR (frames
);
1314 /* Verify that the frame's window still exists
1315 and we can still talk to it. And note any recent change
1317 #ifdef HAVE_WINDOW_SYSTEM
1318 if (FRAME_WINDOW_P (XFRAME (this)))
1320 x_sync (XFRAME (this));
1321 FRAME_SAMPLE_VISIBILITY (XFRAME (this));
1325 if (FRAME_VISIBLE_P (XFRAME (this))
1326 || FRAME_ICONIFIED_P (XFRAME (this))
1327 /* Allow deleting the terminal frame when at least
1328 one X frame exists! */
1329 || (FRAME_WINDOW_P (XFRAME (this)) && !FRAME_WINDOW_P (f
)))
1337 /* Error handler for `delete-frame-functions'. */
1339 delete_frame_handler (Lisp_Object arg
)
1341 add_to_log ("Error during `delete-frame': %s", arg
, Qnil
);
1345 DEFUN ("delete-frame", Fdelete_frame
, Sdelete_frame
, 0, 2, "",
1346 doc
: /* Delete FRAME, permanently eliminating it from use.
1347 If omitted, FRAME defaults to the selected frame.
1348 A frame may not be deleted if its minibuffer is used by other frames.
1349 Normally, you may not delete a frame if all other frames are invisible,
1350 but if the second optional argument FORCE is non-nil, you may do so.
1352 This function runs `delete-frame-functions' before actually deleting the
1353 frame, unless the frame is a tooltip.
1354 The functions are run with one arg, the frame to be deleted. */)
1356 Lisp_Object frame
, force
;
1359 struct frame
*sf
= SELECTED_FRAME ();
1362 int minibuffer_selected
;
1364 if (EQ (frame
, Qnil
))
1367 XSETFRAME (frame
, f
);
1371 CHECK_FRAME (frame
);
1375 if (! FRAME_LIVE_P (f
))
1378 if (NILP (force
) && !other_visible_frames (f
)
1380 /* Terminal frame deleted before any other visible frames are
1382 && strcmp (SDATA (f
->name
), "F1") != 0
1385 error ("Attempt to delete the sole visible or iconified frame");
1388 /* This is a nice idea, but x_connection_closed needs to be able
1389 to delete the last frame, if it is gone. */
1390 if (NILP (XCDR (Vframe_list
)))
1391 error ("Attempt to delete the only frame");
1394 /* Does this frame have a minibuffer, and is it the surrogate
1395 minibuffer for any other frame? */
1396 if (FRAME_HAS_MINIBUF_P (XFRAME (frame
)))
1400 for (frames
= Vframe_list
;
1402 frames
= XCDR (frames
))
1405 this = XCAR (frames
);
1407 if (! EQ (this, frame
)
1409 WINDOW_FRAME (XWINDOW
1410 (FRAME_MINIBUF_WINDOW (XFRAME (this))))))
1411 error ("Attempt to delete a surrogate minibuffer frame");
1415 /* Run `delete-frame-functions' unless frame is a tooltip. */
1416 if (!NILP (Vrun_hooks
)
1417 && NILP (Fframe_parameter (frame
, intern ("tooltip"))))
1419 Lisp_Object args
[2];
1420 struct gcpro gcpro1
, gcpro2
;
1422 /* Don't let a rogue function in `delete-frame-functions'
1423 prevent the frame deletion. */
1424 GCPRO2 (args
[0], args
[1]);
1425 args
[0] = intern ("delete-frame-functions");
1427 internal_condition_case_2 (Frun_hook_with_args
, 2, args
,
1428 Qt
, delete_frame_handler
);
1432 /* The hook may sometimes (indirectly) cause the frame to be deleted. */
1433 if (! FRAME_LIVE_P (f
))
1436 minibuffer_selected
= EQ (minibuf_window
, selected_window
);
1438 /* Don't let the frame remain selected. */
1441 Lisp_Object tail
, frame1
;
1443 /* Look for another visible frame on the same terminal. */
1444 frame1
= next_frame (frame
, Qvisible
);
1446 /* If there is none, find *some* other frame. */
1447 if (NILP (frame1
) || EQ (frame1
, frame
))
1449 FOR_EACH_FRAME (tail
, frame1
)
1451 if (! EQ (frame
, frame1
) && FRAME_LIVE_P (XFRAME (frame1
)))
1456 do_switch_frame (frame1
, 0, 1);
1457 sf
= SELECTED_FRAME ();
1460 /* Don't allow minibuf_window to remain on a deleted frame. */
1461 if (EQ (f
->minibuffer_window
, minibuf_window
))
1463 Fset_window_buffer (sf
->minibuffer_window
,
1464 XWINDOW (minibuf_window
)->buffer
, Qnil
);
1465 minibuf_window
= sf
->minibuffer_window
;
1467 /* If the dying minibuffer window was selected,
1468 select the new one. */
1469 if (minibuffer_selected
)
1470 Fselect_window (minibuf_window
, Qnil
);
1473 /* Don't let echo_area_window to remain on a deleted frame. */
1474 if (EQ (f
->minibuffer_window
, echo_area_window
))
1475 echo_area_window
= sf
->minibuffer_window
;
1477 /* Don't allow other frames to refer to a deleted frame in their
1478 'environment parameter. */
1480 Lisp_Object tail
, frame1
;
1481 Lisp_Object env
= get_frame_param (XFRAME (frame
), Qenvironment
);
1482 FOR_EACH_FRAME (tail
, frame1
)
1484 if (EQ (frame
, frame1
) || !FRAME_LIVE_P (XFRAME (frame1
)))
1486 if (EQ (frame
, get_frame_param (XFRAME (frame1
), Qenvironment
)))
1488 store_frame_param (XFRAME (frame1
), Qenvironment
, env
);
1495 /* Clear any X selections for this frame. */
1496 #ifdef HAVE_X_WINDOWS
1498 x_clear_frame_selections (f
);
1501 if (FRAME_MAC_P (f
))
1502 x_clear_frame_selections (f
);
1506 This function must be called before the window tree of the
1507 frame is deleted because windows contain dynamically allocated
1511 /* Mark all the windows that used to be on FRAME as deleted, and then
1512 remove the reference to them. */
1513 delete_all_subwindows (XWINDOW (f
->root_window
));
1514 f
->root_window
= Qnil
;
1516 Vframe_list
= Fdelq (frame
, Vframe_list
);
1517 FRAME_SET_VISIBLE (f
, 0);
1521 if (f
->decode_mode_spec_buffer
)
1522 xfree (f
->decode_mode_spec_buffer
);
1523 if (FRAME_INSERT_COST (f
))
1524 xfree (FRAME_INSERT_COST (f
));
1525 if (FRAME_DELETEN_COST (f
))
1526 xfree (FRAME_DELETEN_COST (f
));
1527 if (FRAME_INSERTN_COST (f
))
1528 xfree (FRAME_INSERTN_COST (f
));
1529 if (FRAME_DELETE_COST (f
))
1530 xfree (FRAME_DELETE_COST (f
));
1531 if (FRAME_MESSAGE_BUF (f
))
1532 xfree (FRAME_MESSAGE_BUF (f
));
1534 /* Since some events are handled at the interrupt level, we may get
1535 an event for f at any time; if we zero out the frame's terminal
1536 now, then we may trip up the event-handling code. Instead, we'll
1537 promise that the terminal of the frame must be valid until we
1538 have called the window-system-dependent frame destruction
1541 if (FRAME_TERMINAL (f
)->delete_frame_hook
)
1542 (*FRAME_TERMINAL (f
)->delete_frame_hook
) (f
);
1545 struct terminal
*terminal
= FRAME_TERMINAL (f
);
1546 f
->output_data
.nothing
= 0;
1547 f
->terminal
= 0; /* Now the frame is dead. */
1549 /* If needed, delete the terminal that this frame was on.
1550 (This must be done after the frame is killed.) */
1551 terminal
->reference_count
--;
1552 if (terminal
->reference_count
== 0)
1555 if (terminal
->delete_terminal_hook
)
1556 (*terminal
->delete_terminal_hook
) (terminal
);
1558 delete_terminal (terminal
);
1562 kb
= terminal
->kboard
;
1566 /* If we've deleted the last_nonminibuf_frame, then try to find
1568 if (f
== last_nonminibuf_frame
)
1572 last_nonminibuf_frame
= 0;
1574 for (frames
= Vframe_list
;
1576 frames
= XCDR (frames
))
1578 f
= XFRAME (XCAR (frames
));
1579 if (!FRAME_MINIBUF_ONLY_P (f
))
1581 last_nonminibuf_frame
= f
;
1587 /* If there's no other frame on the same kboard, get out of
1588 single-kboard state if we're in it for this kboard. */
1592 /* Some frame we found on the same kboard, or nil if there are none. */
1593 Lisp_Object frame_on_same_kboard
;
1595 frame_on_same_kboard
= Qnil
;
1597 for (frames
= Vframe_list
;
1599 frames
= XCDR (frames
))
1604 this = XCAR (frames
);
1609 if (kb
== FRAME_KBOARD (f1
))
1610 frame_on_same_kboard
= this;
1613 if (NILP (frame_on_same_kboard
))
1614 not_single_kboard_state (kb
);
1618 /* If we've deleted this keyboard's default_minibuffer_frame, try to
1619 find another one. Prefer minibuffer-only frames, but also notice
1620 frames with other windows. */
1621 if (kb
!= NULL
&& EQ (frame
, kb
->Vdefault_minibuffer_frame
))
1625 /* The last frame we saw with a minibuffer, minibuffer-only or not. */
1626 Lisp_Object frame_with_minibuf
;
1627 /* Some frame we found on the same kboard, or nil if there are none. */
1628 Lisp_Object frame_on_same_kboard
;
1630 frame_on_same_kboard
= Qnil
;
1631 frame_with_minibuf
= Qnil
;
1633 for (frames
= Vframe_list
;
1635 frames
= XCDR (frames
))
1640 this = XCAR (frames
);
1645 /* Consider only frames on the same kboard
1646 and only those with minibuffers. */
1647 if (kb
== FRAME_KBOARD (f1
)
1648 && FRAME_HAS_MINIBUF_P (f1
))
1650 frame_with_minibuf
= this;
1651 if (FRAME_MINIBUF_ONLY_P (f1
))
1655 if (kb
== FRAME_KBOARD (f1
))
1656 frame_on_same_kboard
= this;
1659 if (!NILP (frame_on_same_kboard
))
1661 /* We know that there must be some frame with a minibuffer out
1662 there. If this were not true, all of the frames present
1663 would have to be minibufferless, which implies that at some
1664 point their minibuffer frames must have been deleted, but
1665 that is prohibited at the top; you can't delete surrogate
1666 minibuffer frames. */
1667 if (NILP (frame_with_minibuf
))
1670 kb
->Vdefault_minibuffer_frame
= frame_with_minibuf
;
1673 /* No frames left on this kboard--say no minibuffer either. */
1674 kb
->Vdefault_minibuffer_frame
= Qnil
;
1677 /* Cause frame titles to update--necessary if we now have just one frame. */
1678 update_mode_lines
= 1;
1683 /* Return mouse position in character cell units. */
1685 DEFUN ("mouse-position", Fmouse_position
, Smouse_position
, 0, 0, 0,
1686 doc
: /* Return a list (FRAME X . Y) giving the current mouse frame and position.
1687 The position is given in character cells, where (0, 0) is the
1688 upper-left corner of the frame, X is the horizontal offset, and Y is
1689 the vertical offset.
1690 If Emacs is running on a mouseless terminal or hasn't been programmed
1691 to read the mouse position, it returns the selected frame for FRAME
1692 and nil for X and Y.
1693 If `mouse-position-function' is non-nil, `mouse-position' calls it,
1694 passing the normal return value to that function as an argument,
1695 and returns whatever that function returns. */)
1699 Lisp_Object lispy_dummy
;
1700 enum scroll_bar_part party_dummy
;
1701 Lisp_Object x
, y
, retval
;
1703 unsigned long long_dummy
;
1704 struct gcpro gcpro1
;
1706 f
= SELECTED_FRAME ();
1710 /* It's okay for the hook to refrain from storing anything. */
1711 if (FRAME_TERMINAL (f
)->mouse_position_hook
)
1712 (*FRAME_TERMINAL (f
)->mouse_position_hook
) (&f
, -1,
1713 &lispy_dummy
, &party_dummy
,
1720 pixel_to_glyph_coords (f
, col
, row
, &col
, &row
, NULL
, 1);
1725 XSETFRAME (lispy_dummy
, f
);
1726 retval
= Fcons (lispy_dummy
, Fcons (x
, y
));
1728 if (!NILP (Vmouse_position_function
))
1729 retval
= call1 (Vmouse_position_function
, retval
);
1730 RETURN_UNGCPRO (retval
);
1733 DEFUN ("mouse-pixel-position", Fmouse_pixel_position
,
1734 Smouse_pixel_position
, 0, 0, 0,
1735 doc
: /* Return a list (FRAME X . Y) giving the current mouse frame and position.
1736 The position is given in pixel units, where (0, 0) is the
1737 upper-left corner of the frame, X is the horizontal offset, and Y is
1738 the vertical offset.
1739 If Emacs is running on a mouseless terminal or hasn't been programmed
1740 to read the mouse position, it returns the selected frame for FRAME
1741 and nil for X and Y. */)
1745 Lisp_Object lispy_dummy
;
1746 enum scroll_bar_part party_dummy
;
1748 unsigned long long_dummy
;
1750 f
= SELECTED_FRAME ();
1754 /* It's okay for the hook to refrain from storing anything. */
1755 if (FRAME_TERMINAL (f
)->mouse_position_hook
)
1756 (*FRAME_TERMINAL (f
)->mouse_position_hook
) (&f
, -1,
1757 &lispy_dummy
, &party_dummy
,
1761 XSETFRAME (lispy_dummy
, f
);
1762 return Fcons (lispy_dummy
, Fcons (x
, y
));
1765 DEFUN ("set-mouse-position", Fset_mouse_position
, Sset_mouse_position
, 3, 3, 0,
1766 doc
: /* Move the mouse pointer to the center of character cell (X,Y) in FRAME.
1767 Coordinates are relative to the frame, not a window,
1768 so the coordinates of the top left character in the frame
1769 may be nonzero due to left-hand scroll bars or the menu bar.
1771 The position is given in character cells, where (0, 0) is the
1772 upper-left corner of the frame, X is the horizontal offset, and Y is
1773 the vertical offset.
1775 This function is a no-op for an X frame that is not visible.
1776 If you have just created a frame, you must wait for it to become visible
1777 before calling this function on it, like this.
1778 (while (not (frame-visible-p frame)) (sleep-for .5)) */)
1780 Lisp_Object frame
, x
, y
;
1782 CHECK_LIVE_FRAME (frame
);
1786 /* I think this should be done with a hook. */
1787 #ifdef HAVE_WINDOW_SYSTEM
1788 if (FRAME_WINDOW_P (XFRAME (frame
)))
1789 /* Warping the mouse will cause enternotify and focus events. */
1790 x_set_mouse_position (XFRAME (frame
), XINT (x
), XINT (y
));
1792 #if defined (MSDOS) && defined (HAVE_MOUSE)
1793 if (FRAME_MSDOS_P (XFRAME (frame
)))
1795 Fselect_frame (frame
);
1796 mouse_moveto (XINT (x
), XINT (y
));
1804 DEFUN ("set-mouse-pixel-position", Fset_mouse_pixel_position
,
1805 Sset_mouse_pixel_position
, 3, 3, 0,
1806 doc
: /* Move the mouse pointer to pixel position (X,Y) in FRAME.
1807 The position is given in pixels, where (0, 0) is the upper-left corner
1808 of the frame, X is the horizontal offset, and Y is the vertical offset.
1810 Note, this is a no-op for an X frame that is not visible.
1811 If you have just created a frame, you must wait for it to become visible
1812 before calling this function on it, like this.
1813 (while (not (frame-visible-p frame)) (sleep-for .5)) */)
1815 Lisp_Object frame
, x
, y
;
1817 CHECK_LIVE_FRAME (frame
);
1821 /* I think this should be done with a hook. */
1822 #ifdef HAVE_WINDOW_SYSTEM
1823 if (FRAME_WINDOW_P (XFRAME (frame
)))
1824 /* Warping the mouse will cause enternotify and focus events. */
1825 x_set_mouse_pixel_position (XFRAME (frame
), XINT (x
), XINT (y
));
1827 #if defined (MSDOS) && defined (HAVE_MOUSE)
1828 if (FRAME_MSDOS_P (XFRAME (frame
)))
1830 Fselect_frame (frame
);
1831 mouse_moveto (XINT (x
), XINT (y
));
1839 static void make_frame_visible_1
P_ ((Lisp_Object
));
1841 DEFUN ("make-frame-visible", Fmake_frame_visible
, Smake_frame_visible
,
1843 doc
: /* Make the frame FRAME visible (assuming it is an X window).
1844 If omitted, FRAME defaults to the currently selected frame. */)
1849 frame
= selected_frame
;
1851 CHECK_LIVE_FRAME (frame
);
1853 /* I think this should be done with a hook. */
1854 #ifdef HAVE_WINDOW_SYSTEM
1855 if (FRAME_WINDOW_P (XFRAME (frame
)))
1857 FRAME_SAMPLE_VISIBILITY (XFRAME (frame
));
1858 x_make_frame_visible (XFRAME (frame
));
1862 make_frame_visible_1 (XFRAME (frame
)->root_window
);
1864 /* Make menu bar update for the Buffers and Frames menus. */
1865 windows_or_buffers_changed
++;
1870 /* Update the display_time slot of the buffers shown in WINDOW
1871 and all its descendents. */
1874 make_frame_visible_1 (window
)
1879 for (;!NILP (window
); window
= w
->next
)
1881 w
= XWINDOW (window
);
1883 if (!NILP (w
->buffer
))
1884 XBUFFER (w
->buffer
)->display_time
= Fcurrent_time ();
1886 if (!NILP (w
->vchild
))
1887 make_frame_visible_1 (w
->vchild
);
1888 if (!NILP (w
->hchild
))
1889 make_frame_visible_1 (w
->hchild
);
1893 DEFUN ("make-frame-invisible", Fmake_frame_invisible
, Smake_frame_invisible
,
1895 doc
: /* Make the frame FRAME invisible (assuming it is an X window).
1896 If omitted, FRAME defaults to the currently selected frame.
1897 Normally you may not make FRAME invisible if all other frames are invisible,
1898 but if the second optional argument FORCE is non-nil, you may do so. */)
1900 Lisp_Object frame
, force
;
1903 frame
= selected_frame
;
1905 CHECK_LIVE_FRAME (frame
);
1907 if (NILP (force
) && !other_visible_frames (XFRAME (frame
)))
1908 error ("Attempt to make invisible the sole visible or iconified frame");
1910 #if 0 /* This isn't logically necessary, and it can do GC. */
1911 /* Don't let the frame remain selected. */
1912 if (EQ (frame
, selected_frame
))
1913 do_switch_frame (next_frame (frame
, Qt
), 0, 0)
1916 /* Don't allow minibuf_window to remain on a deleted frame. */
1917 if (EQ (XFRAME (frame
)->minibuffer_window
, minibuf_window
))
1919 struct frame
*sf
= XFRAME (selected_frame
);
1920 Fset_window_buffer (sf
->minibuffer_window
,
1921 XWINDOW (minibuf_window
)->buffer
, Qnil
);
1922 minibuf_window
= sf
->minibuffer_window
;
1925 /* I think this should be done with a hook. */
1926 #ifdef HAVE_WINDOW_SYSTEM
1927 if (FRAME_WINDOW_P (XFRAME (frame
)))
1928 x_make_frame_invisible (XFRAME (frame
));
1931 /* Make menu bar update for the Buffers and Frames menus. */
1932 windows_or_buffers_changed
++;
1937 DEFUN ("iconify-frame", Ficonify_frame
, Siconify_frame
,
1939 doc
: /* Make the frame FRAME into an icon.
1940 If omitted, FRAME defaults to the currently selected frame. */)
1945 frame
= selected_frame
;
1947 CHECK_LIVE_FRAME (frame
);
1949 #if 0 /* This isn't logically necessary, and it can do GC. */
1950 /* Don't let the frame remain selected. */
1951 if (EQ (frame
, selected_frame
))
1952 Fhandle_switch_frame (next_frame (frame
, Qt
));
1955 /* Don't allow minibuf_window to remain on a deleted frame. */
1956 if (EQ (XFRAME (frame
)->minibuffer_window
, minibuf_window
))
1958 struct frame
*sf
= XFRAME (selected_frame
);
1959 Fset_window_buffer (sf
->minibuffer_window
,
1960 XWINDOW (minibuf_window
)->buffer
, Qnil
);
1961 minibuf_window
= sf
->minibuffer_window
;
1964 /* I think this should be done with a hook. */
1965 #ifdef HAVE_WINDOW_SYSTEM
1966 if (FRAME_WINDOW_P (XFRAME (frame
)))
1967 x_iconify_frame (XFRAME (frame
));
1970 /* Make menu bar update for the Buffers and Frames menus. */
1971 windows_or_buffers_changed
++;
1976 DEFUN ("frame-visible-p", Fframe_visible_p
, Sframe_visible_p
,
1978 doc
: /* Return t if FRAME is now \"visible\" (actually in use for display).
1979 A frame that is not \"visible\" is not updated and, if it works through
1980 a window system, it may not show at all.
1981 Return the symbol `icon' if frame is visible only as an icon.
1983 On a text-only terminal, all frames are considered visible, whether
1984 they are currently being displayed or not, and this function returns t
1989 CHECK_LIVE_FRAME (frame
);
1991 FRAME_SAMPLE_VISIBILITY (XFRAME (frame
));
1993 if (FRAME_VISIBLE_P (XFRAME (frame
)))
1995 if (FRAME_ICONIFIED_P (XFRAME (frame
)))
2000 DEFUN ("visible-frame-list", Fvisible_frame_list
, Svisible_frame_list
,
2002 doc
: /* Return a list of all frames now \"visible\" (being updated). */)
2005 Lisp_Object tail
, frame
;
2010 for (tail
= Vframe_list
; CONSP (tail
); tail
= XCDR (tail
))
2012 frame
= XCAR (tail
);
2013 if (!FRAMEP (frame
))
2016 if (FRAME_VISIBLE_P (f
))
2017 value
= Fcons (frame
, value
);
2023 DEFUN ("raise-frame", Fraise_frame
, Sraise_frame
, 0, 1, "",
2024 doc
: /* Bring FRAME to the front, so it occludes any frames it overlaps.
2025 If FRAME is invisible or iconified, make it visible.
2026 If you don't specify a frame, the selected frame is used.
2027 If Emacs is displaying on an ordinary terminal or some other device which
2028 doesn't support multiple overlapping frames, this function does nothing. */)
2034 frame
= selected_frame
;
2036 CHECK_LIVE_FRAME (frame
);
2040 /* Do like the documentation says. */
2041 Fmake_frame_visible (frame
);
2043 if (FRAME_TERMINAL (f
)->frame_raise_lower_hook
)
2044 (*FRAME_TERMINAL (f
)->frame_raise_lower_hook
) (f
, 1);
2049 /* Should we have a corresponding function called Flower_Power? */
2050 DEFUN ("lower-frame", Flower_frame
, Slower_frame
, 0, 1, "",
2051 doc
: /* Send FRAME to the back, so it is occluded by any frames that overlap it.
2052 If you don't specify a frame, the selected frame is used.
2053 If Emacs is displaying on an ordinary terminal or some other device which
2054 doesn't support multiple overlapping frames, this function does nothing. */)
2061 frame
= selected_frame
;
2063 CHECK_LIVE_FRAME (frame
);
2067 if (FRAME_TERMINAL (f
)->frame_raise_lower_hook
)
2068 (*FRAME_TERMINAL (f
)->frame_raise_lower_hook
) (f
, 0);
2074 DEFUN ("redirect-frame-focus", Fredirect_frame_focus
, Sredirect_frame_focus
,
2076 doc
: /* Arrange for keystrokes typed at FRAME to be sent to FOCUS-FRAME.
2077 In other words, switch-frame events caused by events in FRAME will
2078 request a switch to FOCUS-FRAME, and `last-event-frame' will be
2079 FOCUS-FRAME after reading an event typed at FRAME.
2081 If FOCUS-FRAME is omitted or nil, any existing redirection is
2082 cancelled, and the frame again receives its own keystrokes.
2084 Focus redirection is useful for temporarily redirecting keystrokes to
2085 a surrogate minibuffer frame when a frame doesn't have its own
2088 A frame's focus redirection can be changed by `select-frame'. If frame
2089 FOO is selected, and then a different frame BAR is selected, any
2090 frames redirecting their focus to FOO are shifted to redirect their
2091 focus to BAR. This allows focus redirection to work properly when the
2092 user switches from one frame to another using `select-window'.
2094 This means that a frame whose focus is redirected to itself is treated
2095 differently from a frame whose focus is redirected to nil; the former
2096 is affected by `select-frame', while the latter is not.
2098 The redirection lasts until `redirect-frame-focus' is called to change it. */)
2099 (frame
, focus_frame
)
2100 Lisp_Object frame
, focus_frame
;
2104 /* Note that we don't check for a live frame here. It's reasonable
2105 to redirect the focus of a frame you're about to delete, if you
2106 know what other frame should receive those keystrokes. */
2107 CHECK_FRAME (frame
);
2109 if (! NILP (focus_frame
))
2110 CHECK_LIVE_FRAME (focus_frame
);
2114 f
->focus_frame
= focus_frame
;
2116 if (FRAME_TERMINAL (f
)->frame_rehighlight_hook
)
2117 (*FRAME_TERMINAL (f
)->frame_rehighlight_hook
) (f
);
2123 DEFUN ("frame-focus", Fframe_focus
, Sframe_focus
, 1, 1, 0,
2124 doc
: /* Return the frame to which FRAME's keystrokes are currently being sent.
2125 This returns nil if FRAME's focus is not redirected.
2126 See `redirect-frame-focus'. */)
2130 CHECK_LIVE_FRAME (frame
);
2132 return FRAME_FOCUS_FRAME (XFRAME (frame
));
2137 /* Return the value of frame parameter PROP in frame FRAME. */
2140 get_frame_param (frame
, prop
)
2141 register struct frame
*frame
;
2144 register Lisp_Object tem
;
2146 tem
= Fassq (prop
, frame
->param_alist
);
2152 /* Return the buffer-predicate of the selected frame. */
2155 frame_buffer_predicate (frame
)
2158 return XFRAME (frame
)->buffer_predicate
;
2161 /* Return the buffer-list of the selected frame. */
2164 frame_buffer_list (frame
)
2167 return XFRAME (frame
)->buffer_list
;
2170 /* Set the buffer-list of the selected frame. */
2173 set_frame_buffer_list (frame
, list
)
2174 Lisp_Object frame
, list
;
2176 XFRAME (frame
)->buffer_list
= list
;
2179 /* Discard BUFFER from the buffer-list and buried-buffer-list of each frame. */
2182 frames_discard_buffer (buffer
)
2185 Lisp_Object frame
, tail
;
2187 FOR_EACH_FRAME (tail
, frame
)
2189 XFRAME (frame
)->buffer_list
2190 = Fdelq (buffer
, XFRAME (frame
)->buffer_list
);
2191 XFRAME (frame
)->buried_buffer_list
2192 = Fdelq (buffer
, XFRAME (frame
)->buried_buffer_list
);
2196 /* Modify the alist in *ALISTPTR to associate PROP with VAL.
2197 If the alist already has an element for PROP, we change it. */
2200 store_in_alist (alistptr
, prop
, val
)
2201 Lisp_Object
*alistptr
, val
;
2204 register Lisp_Object tem
;
2206 tem
= Fassq (prop
, *alistptr
);
2208 *alistptr
= Fcons (Fcons (prop
, val
), *alistptr
);
2214 frame_name_fnn_p (str
, len
)
2218 if (len
> 1 && str
[0] == 'F')
2222 strtol (str
+ 1, &end_ptr
, 10);
2224 if (end_ptr
== str
+ len
)
2230 /* Set the name of the terminal frame. Also used by MSDOS frames.
2231 Modeled after x_set_name which is used for WINDOW frames. */
2234 set_term_frame_name (f
, name
)
2238 f
->explicit_name
= ! NILP (name
);
2240 /* If NAME is nil, set the name to F<num>. */
2245 /* Check for no change needed in this very common case
2246 before we do any consing. */
2247 if (frame_name_fnn_p (SDATA (f
->name
),
2252 sprintf (namebuf
, "F%d", tty_frame_count
);
2253 name
= build_string (namebuf
);
2257 CHECK_STRING (name
);
2259 /* Don't change the name if it's already NAME. */
2260 if (! NILP (Fstring_equal (name
, f
->name
)))
2263 /* Don't allow the user to set the frame name to F<num>, so it
2264 doesn't clash with the names we generate for terminal frames. */
2265 if (frame_name_fnn_p (SDATA (name
), SBYTES (name
)))
2266 error ("Frame names of the form F<num> are usurped by Emacs");
2270 update_mode_lines
= 1;
2274 store_frame_param (f
, prop
, val
)
2276 Lisp_Object prop
, val
;
2278 register Lisp_Object old_alist_elt
;
2280 /* The buffer-list parameters are stored in a special place and not
2282 if (EQ (prop
, Qbuffer_list
))
2284 f
->buffer_list
= val
;
2287 if (EQ (prop
, Qburied_buffer_list
))
2289 f
->buried_buffer_list
= val
;
2293 /* If PROP is a symbol which is supposed to have frame-local values,
2294 and it is set up based on this frame, switch to the global
2295 binding. That way, we can create or alter the frame-local binding
2296 without messing up the symbol's status. */
2299 Lisp_Object valcontents
;
2300 valcontents
= SYMBOL_VALUE (prop
);
2301 if ((BUFFER_LOCAL_VALUEP (valcontents
)
2302 || SOME_BUFFER_LOCAL_VALUEP (valcontents
))
2303 && XBUFFER_LOCAL_VALUE (valcontents
)->check_frame
2304 && XBUFFER_LOCAL_VALUE (valcontents
)->found_for_frame
2305 && XFRAME (XBUFFER_LOCAL_VALUE (valcontents
)->frame
) == f
)
2306 swap_in_global_binding (prop
);
2310 /* The tty color mode needs to be set before the frame's parameter
2311 alist is updated with the new value, because set_tty_color_mode
2312 wants to look at the old mode. */
2313 if (FRAME_TERMCAP_P (f
) && EQ (prop
, Qtty_color_mode
))
2314 set_tty_color_mode (f
, val
);
2317 /* Update the frame parameter alist. */
2318 old_alist_elt
= Fassq (prop
, f
->param_alist
);
2319 if (EQ (old_alist_elt
, Qnil
))
2320 f
->param_alist
= Fcons (Fcons (prop
, val
), f
->param_alist
);
2322 Fsetcdr (old_alist_elt
, val
);
2324 /* Update some other special parameters in their special places
2325 in addition to the alist. */
2327 if (EQ (prop
, Qbuffer_predicate
))
2328 f
->buffer_predicate
= val
;
2330 if (! FRAME_WINDOW_P (f
))
2332 if (EQ (prop
, Qmenu_bar_lines
))
2333 set_menu_bar_lines (f
, val
, make_number (FRAME_MENU_BAR_LINES (f
)));
2334 else if (EQ (prop
, Qname
))
2335 set_term_frame_name (f
, val
);
2338 if (EQ (prop
, Qminibuffer
) && WINDOWP (val
))
2340 if (! MINI_WINDOW_P (XWINDOW (val
)))
2341 error ("Surrogate minibuffer windows must be minibuffer windows");
2343 if ((FRAME_HAS_MINIBUF_P (f
) || FRAME_MINIBUF_ONLY_P (f
))
2344 && !EQ (val
, f
->minibuffer_window
))
2345 error ("Can't change the surrogate minibuffer of a frame with its own minibuffer");
2347 /* Install the chosen minibuffer window, with proper buffer. */
2348 f
->minibuffer_window
= val
;
2352 DEFUN ("frame-parameters", Fframe_parameters
, Sframe_parameters
, 0, 1, 0,
2353 doc
: /* Return the parameters-alist of frame FRAME.
2354 It is a list of elements of the form (PARM . VALUE), where PARM is a symbol.
2355 The meaningful PARMs depend on the kind of frame.
2356 If FRAME is omitted, return information on the currently selected frame. */)
2363 struct gcpro gcpro1
;
2366 frame
= selected_frame
;
2368 CHECK_FRAME (frame
);
2371 if (!FRAME_LIVE_P (f
))
2374 alist
= Fcopy_alist (f
->param_alist
);
2377 if (!FRAME_WINDOW_P (f
))
2379 int fg
= FRAME_FOREGROUND_PIXEL (f
);
2380 int bg
= FRAME_BACKGROUND_PIXEL (f
);
2383 /* If the frame's parameter alist says the colors are
2384 unspecified and reversed, take the frame's background pixel
2385 for foreground and vice versa. */
2386 elt
= Fassq (Qforeground_color
, alist
);
2387 if (!NILP (elt
) && CONSP (elt
) && STRINGP (XCDR (elt
)))
2389 if (strncmp (SDATA (XCDR (elt
)),
2391 SCHARS (XCDR (elt
))) == 0)
2392 store_in_alist (&alist
, Qforeground_color
, tty_color_name (f
, bg
));
2393 else if (strncmp (SDATA (XCDR (elt
)),
2395 SCHARS (XCDR (elt
))) == 0)
2396 store_in_alist (&alist
, Qforeground_color
, tty_color_name (f
, fg
));
2399 store_in_alist (&alist
, Qforeground_color
, tty_color_name (f
, fg
));
2400 elt
= Fassq (Qbackground_color
, alist
);
2401 if (!NILP (elt
) && CONSP (elt
) && STRINGP (XCDR (elt
)))
2403 if (strncmp (SDATA (XCDR (elt
)),
2405 SCHARS (XCDR (elt
))) == 0)
2406 store_in_alist (&alist
, Qbackground_color
, tty_color_name (f
, fg
));
2407 else if (strncmp (SDATA (XCDR (elt
)),
2409 SCHARS (XCDR (elt
))) == 0)
2410 store_in_alist (&alist
, Qbackground_color
, tty_color_name (f
, bg
));
2413 store_in_alist (&alist
, Qbackground_color
, tty_color_name (f
, bg
));
2414 store_in_alist (&alist
, intern ("font"),
2415 build_string (FRAME_MSDOS_P (f
)
2417 : FRAME_W32_P (f
) ? "w32term"
2420 store_in_alist (&alist
, Qname
, f
->name
);
2421 height
= (f
->new_text_lines
? f
->new_text_lines
: FRAME_LINES (f
));
2422 store_in_alist (&alist
, Qheight
, make_number (height
));
2423 width
= (f
->new_text_cols
? f
->new_text_cols
: FRAME_COLS (f
));
2424 store_in_alist (&alist
, Qwidth
, make_number (width
));
2425 store_in_alist (&alist
, Qmodeline
, (FRAME_WANTS_MODELINE_P (f
) ? Qt
: Qnil
));
2426 store_in_alist (&alist
, Qminibuffer
,
2427 (! FRAME_HAS_MINIBUF_P (f
) ? Qnil
2428 : FRAME_MINIBUF_ONLY_P (f
) ? Qonly
2429 : FRAME_MINIBUF_WINDOW (f
)));
2430 store_in_alist (&alist
, Qunsplittable
, (FRAME_NO_SPLIT_P (f
) ? Qt
: Qnil
));
2431 store_in_alist (&alist
, Qbuffer_list
, frame_buffer_list (frame
));
2432 store_in_alist (&alist
, Qburied_buffer_list
, XFRAME (frame
)->buried_buffer_list
);
2434 /* I think this should be done with a hook. */
2435 #ifdef HAVE_WINDOW_SYSTEM
2436 if (FRAME_WINDOW_P (f
))
2437 x_report_frame_params (f
, &alist
);
2441 /* This ought to be correct in f->param_alist for an X frame. */
2443 XSETFASTINT (lines
, FRAME_MENU_BAR_LINES (f
));
2444 store_in_alist (&alist
, Qmenu_bar_lines
, lines
);
2452 DEFUN ("frame-parameter", Fframe_parameter
, Sframe_parameter
, 2, 2, 0,
2453 doc
: /* Return FRAME's value for parameter PARAMETER.
2454 If FRAME is nil, describe the currently selected frame. */)
2456 Lisp_Object frame
, parameter
;
2462 frame
= selected_frame
;
2464 CHECK_FRAME (frame
);
2465 CHECK_SYMBOL (parameter
);
2470 if (FRAME_LIVE_P (f
))
2472 /* Avoid consing in frequent cases. */
2473 if (EQ (parameter
, Qname
))
2475 #ifdef HAVE_X_WINDOWS
2476 else if (EQ (parameter
, Qdisplay
) && FRAME_X_P (f
))
2477 value
= XCAR (FRAME_X_DISPLAY_INFO (f
)->name_list_element
);
2478 #endif /* HAVE_X_WINDOWS */
2479 else if (EQ (parameter
, Qbackground_color
)
2480 || EQ (parameter
, Qforeground_color
))
2482 value
= Fassq (parameter
, f
->param_alist
);
2485 value
= XCDR (value
);
2486 /* Fframe_parameters puts the actual fg/bg color names,
2487 even if f->param_alist says otherwise. This is
2488 important when param_alist's notion of colors is
2489 "unspecified". We need to do the same here. */
2490 if (STRINGP (value
) && !FRAME_WINDOW_P (f
))
2492 const char *color_name
;
2495 if (EQ (parameter
, Qbackground_color
))
2497 color_name
= SDATA (value
);
2498 csz
= SCHARS (value
);
2499 if (strncmp (color_name
, unspecified_bg
, csz
) == 0)
2500 value
= tty_color_name (f
, FRAME_BACKGROUND_PIXEL (f
));
2501 else if (strncmp (color_name
, unspecified_fg
, csz
) == 0)
2502 value
= tty_color_name (f
, FRAME_FOREGROUND_PIXEL (f
));
2504 else if (EQ (parameter
, Qforeground_color
))
2506 color_name
= SDATA (value
);
2507 csz
= SCHARS (value
);
2508 if (strncmp (color_name
, unspecified_fg
, csz
) == 0)
2509 value
= tty_color_name (f
, FRAME_FOREGROUND_PIXEL (f
));
2510 else if (strncmp (color_name
, unspecified_bg
, csz
) == 0)
2511 value
= tty_color_name (f
, FRAME_BACKGROUND_PIXEL (f
));
2516 value
= Fcdr (Fassq (parameter
, Fframe_parameters (frame
)));
2518 else if (EQ (parameter
, Qdisplay_type
)
2519 || EQ (parameter
, Qbackground_mode
))
2520 value
= Fcdr (Fassq (parameter
, f
->param_alist
));
2522 value
= Fcdr (Fassq (parameter
, Fframe_parameters (frame
)));
2529 DEFUN ("modify-frame-parameters", Fmodify_frame_parameters
,
2530 Smodify_frame_parameters
, 2, 2, 0,
2531 doc
: /* Modify the parameters of frame FRAME according to ALIST.
2532 If FRAME is nil, it defaults to the selected frame.
2533 ALIST is an alist of parameters to change and their new values.
2534 Each element of ALIST has the form (PARM . VALUE), where PARM is a symbol.
2535 The meaningful PARMs depend on the kind of frame.
2536 Undefined PARMs are ignored, but stored in the frame's parameter list
2537 so that `frame-parameters' will return them.
2539 The value of frame parameter FOO can also be accessed
2540 as a frame-local binding for the variable FOO, if you have
2541 enabled such bindings for that variable with `make-variable-frame-local'. */)
2543 Lisp_Object frame
, alist
;
2546 register Lisp_Object tail
, prop
, val
;
2548 if (EQ (frame
, Qnil
))
2549 frame
= selected_frame
;
2550 CHECK_LIVE_FRAME (frame
);
2553 /* I think this should be done with a hook. */
2554 #ifdef HAVE_WINDOW_SYSTEM
2555 if (FRAME_WINDOW_P (f
))
2556 x_set_frame_parameters (f
, alist
);
2560 if (FRAME_MSDOS_P (f
))
2561 IT_set_frame_parameters (f
, alist
);
2566 int length
= XINT (Flength (alist
));
2569 = (Lisp_Object
*) alloca (length
* sizeof (Lisp_Object
));
2571 = (Lisp_Object
*) alloca (length
* sizeof (Lisp_Object
));
2573 /* Extract parm names and values into those vectors. */
2576 for (tail
= alist
; CONSP (tail
); tail
= Fcdr (tail
))
2581 parms
[i
] = Fcar (elt
);
2582 values
[i
] = Fcdr (elt
);
2586 /* Now process them in reverse of specified order. */
2587 for (i
--; i
>= 0; i
--)
2591 store_frame_param (f
, prop
, val
);
2593 /* Changing the background color might change the background
2594 mode, so that we have to load new defface specs.
2595 Call frame-set-background-mode to do that. */
2596 if (EQ (prop
, Qbackground_color
))
2597 call1 (Qframe_set_background_mode
, frame
);
2602 DEFUN ("frame-with-environment", Fframe_with_environment
, Sframe_with_environment
, 0, 1, 0,
2603 doc
: /* Return the frame that has the environment variable list for FRAME.
2605 The frame-local environment variable list is normally shared between
2606 frames that were created in the same Emacsclient session. The
2607 environment list is stored in a single frame's 'environment parameter;
2608 the other frames' 'environment parameter is set to this frame. This
2609 function follows the chain of 'environment references to reach the
2610 frame that stores the actual local environment list, and returns that
2615 Lisp_Object hare
, tortoise
;
2618 frame
= selected_frame
;
2619 CHECK_FRAME (frame
);
2621 hare
= tortoise
= get_frame_param (XFRAME (frame
), Qenvironment
);
2622 while (!NILP (hare
) && FRAMEP (hare
))
2625 hare
= get_frame_param (XFRAME (hare
), Qenvironment
);
2626 if (NILP (hare
) || !FRAMEP (hare
))
2629 hare
= get_frame_param (XFRAME (hare
), Qenvironment
);
2630 tortoise
= get_frame_param (XFRAME (tortoise
), Qenvironment
);
2631 if (EQ (hare
, tortoise
))
2632 error ("Cyclic frame-local environment indirection");
2639 DEFUN ("frame-char-height", Fframe_char_height
, Sframe_char_height
,
2641 doc
: /* Height in pixels of a line in the font in frame FRAME.
2642 If FRAME is omitted, the selected frame is used.
2643 For a terminal frame, the value is always 1. */)
2650 frame
= selected_frame
;
2651 CHECK_FRAME (frame
);
2654 #ifdef HAVE_WINDOW_SYSTEM
2655 if (FRAME_WINDOW_P (f
))
2656 return make_number (x_char_height (f
));
2659 return make_number (1);
2663 DEFUN ("frame-char-width", Fframe_char_width
, Sframe_char_width
,
2665 doc
: /* Width in pixels of characters in the font in frame FRAME.
2666 If FRAME is omitted, the selected frame is used.
2667 On a graphical screen, the width is the standard width of the default font.
2668 For a terminal screen, the value is always 1. */)
2675 frame
= selected_frame
;
2676 CHECK_FRAME (frame
);
2679 #ifdef HAVE_WINDOW_SYSTEM
2680 if (FRAME_WINDOW_P (f
))
2681 return make_number (x_char_width (f
));
2684 return make_number (1);
2687 DEFUN ("frame-pixel-height", Fframe_pixel_height
,
2688 Sframe_pixel_height
, 0, 1, 0,
2689 doc
: /* Return a FRAME's height in pixels.
2690 This counts only the height available for text lines,
2691 not menu bars on window-system Emacs frames.
2692 For a terminal frame, the result really gives the height in characters.
2693 If FRAME is omitted, the selected frame is used. */)
2700 frame
= selected_frame
;
2701 CHECK_FRAME (frame
);
2704 #ifdef HAVE_WINDOW_SYSTEM
2705 if (FRAME_WINDOW_P (f
))
2706 return make_number (x_pixel_height (f
));
2709 return make_number (FRAME_LINES (f
));
2712 DEFUN ("frame-pixel-width", Fframe_pixel_width
,
2713 Sframe_pixel_width
, 0, 1, 0,
2714 doc
: /* Return FRAME's width in pixels.
2715 For a terminal frame, the result really gives the width in characters.
2716 If FRAME is omitted, the selected frame is used. */)
2723 frame
= selected_frame
;
2724 CHECK_FRAME (frame
);
2727 #ifdef HAVE_WINDOW_SYSTEM
2728 if (FRAME_WINDOW_P (f
))
2729 return make_number (x_pixel_width (f
));
2732 return make_number (FRAME_COLS (f
));
2735 DEFUN ("set-frame-height", Fset_frame_height
, Sset_frame_height
, 2, 3, 0,
2736 doc
: /* Specify that the frame FRAME has LINES lines.
2737 Optional third arg non-nil means that redisplay should use LINES lines
2738 but that the idea of the actual height of the frame should not be changed. */)
2739 (frame
, lines
, pretend
)
2740 Lisp_Object frame
, lines
, pretend
;
2742 register struct frame
*f
;
2744 CHECK_NUMBER (lines
);
2746 frame
= selected_frame
;
2747 CHECK_LIVE_FRAME (frame
);
2750 /* I think this should be done with a hook. */
2751 #ifdef HAVE_WINDOW_SYSTEM
2752 if (FRAME_WINDOW_P (f
))
2754 if (XINT (lines
) != FRAME_LINES (f
))
2755 x_set_window_size (f
, 1, FRAME_COLS (f
), XINT (lines
));
2756 do_pending_window_change (0);
2760 change_frame_size (f
, XINT (lines
), 0, !NILP (pretend
), 0, 0);
2764 DEFUN ("set-frame-width", Fset_frame_width
, Sset_frame_width
, 2, 3, 0,
2765 doc
: /* Specify that the frame FRAME has COLS columns.
2766 Optional third arg non-nil means that redisplay should use COLS columns
2767 but that the idea of the actual width of the frame should not be changed. */)
2768 (frame
, cols
, pretend
)
2769 Lisp_Object frame
, cols
, pretend
;
2771 register struct frame
*f
;
2772 CHECK_NUMBER (cols
);
2774 frame
= selected_frame
;
2775 CHECK_LIVE_FRAME (frame
);
2778 /* I think this should be done with a hook. */
2779 #ifdef HAVE_WINDOW_SYSTEM
2780 if (FRAME_WINDOW_P (f
))
2782 if (XINT (cols
) != FRAME_COLS (f
))
2783 x_set_window_size (f
, 1, XINT (cols
), FRAME_LINES (f
));
2784 do_pending_window_change (0);
2788 change_frame_size (f
, 0, XINT (cols
), !NILP (pretend
), 0, 0);
2792 DEFUN ("set-frame-size", Fset_frame_size
, Sset_frame_size
, 3, 3, 0,
2793 doc
: /* Sets size of FRAME to COLS by ROWS, measured in characters. */)
2795 Lisp_Object frame
, cols
, rows
;
2797 register struct frame
*f
;
2799 CHECK_LIVE_FRAME (frame
);
2800 CHECK_NUMBER (cols
);
2801 CHECK_NUMBER (rows
);
2804 /* I think this should be done with a hook. */
2805 #ifdef HAVE_WINDOW_SYSTEM
2806 if (FRAME_WINDOW_P (f
))
2808 if (XINT (rows
) != FRAME_LINES (f
)
2809 || XINT (cols
) != FRAME_COLS (f
)
2810 || f
->new_text_lines
|| f
->new_text_cols
)
2811 x_set_window_size (f
, 1, XINT (cols
), XINT (rows
));
2812 do_pending_window_change (0);
2816 change_frame_size (f
, XINT (rows
), XINT (cols
), 0, 0, 0);
2821 DEFUN ("set-frame-position", Fset_frame_position
,
2822 Sset_frame_position
, 3, 3, 0,
2823 doc
: /* Sets position of FRAME in pixels to XOFFSET by YOFFSET.
2824 This is actually the position of the upper left corner of the frame.
2825 Negative values for XOFFSET or YOFFSET are interpreted relative to
2826 the rightmost or bottommost possible position (that stays within the screen). */)
2827 (frame
, xoffset
, yoffset
)
2828 Lisp_Object frame
, xoffset
, yoffset
;
2830 register struct frame
*f
;
2832 CHECK_LIVE_FRAME (frame
);
2833 CHECK_NUMBER (xoffset
);
2834 CHECK_NUMBER (yoffset
);
2837 /* I think this should be done with a hook. */
2838 #ifdef HAVE_WINDOW_SYSTEM
2839 if (FRAME_WINDOW_P (f
))
2840 x_set_offset (f
, XINT (xoffset
), XINT (yoffset
), 1);
2847 /***********************************************************************
2849 ***********************************************************************/
2851 /* Connect the frame-parameter names for X frames
2852 to the ways of passing the parameter values to the window system.
2854 The name of a parameter, as a Lisp symbol,
2855 has an `x-frame-parameter' property which is an integer in Lisp
2856 that is an index in this table. */
2858 struct frame_parm_table
{
2860 Lisp_Object
*variable
;
2863 static struct frame_parm_table frame_parms
[] =
2865 {"auto-raise", &Qauto_raise
},
2866 {"auto-lower", &Qauto_lower
},
2867 {"background-color", 0},
2868 {"border-color", &Qborder_color
},
2869 {"border-width", &Qborder_width
},
2870 {"cursor-color", &Qcursor_color
},
2871 {"cursor-type", &Qcursor_type
},
2873 {"foreground-color", 0},
2874 {"icon-name", &Qicon_name
},
2875 {"icon-type", &Qicon_type
},
2876 {"internal-border-width", &Qinternal_border_width
},
2877 {"menu-bar-lines", &Qmenu_bar_lines
},
2878 {"mouse-color", &Qmouse_color
},
2880 {"scroll-bar-width", &Qscroll_bar_width
},
2882 {"unsplittable", &Qunsplittable
},
2883 {"vertical-scroll-bars", &Qvertical_scroll_bars
},
2884 {"visibility", &Qvisibility
},
2885 {"tool-bar-lines", &Qtool_bar_lines
},
2886 {"scroll-bar-foreground", &Qscroll_bar_foreground
},
2887 {"scroll-bar-background", &Qscroll_bar_background
},
2888 {"screen-gamma", &Qscreen_gamma
},
2889 {"line-spacing", &Qline_spacing
},
2890 {"left-fringe", &Qleft_fringe
},
2891 {"right-fringe", &Qright_fringe
},
2892 {"wait-for-wm", &Qwait_for_wm
},
2893 {"fullscreen", &Qfullscreen
},
2896 #ifdef HAVE_WINDOW_SYSTEM
2898 extern Lisp_Object Qbox
;
2899 extern Lisp_Object Qtop
;
2901 /* Calculate fullscreen size. Return in *TOP_POS and *LEFT_POS the
2902 wanted positions of the WM window (not Emacs window).
2903 Return in *WIDTH and *HEIGHT the wanted width and height of Emacs
2904 window (FRAME_X_WINDOW).
2908 x_fullscreen_adjust (f
, width
, height
, top_pos
, left_pos
)
2915 int newwidth
= FRAME_COLS (f
);
2916 int newheight
= FRAME_LINES (f
);
2918 *top_pos
= f
->top_pos
;
2919 *left_pos
= f
->left_pos
;
2921 if (f
->want_fullscreen
& FULLSCREEN_HEIGHT
)
2925 ph
= FRAME_X_DISPLAY_INFO (f
)->height
;
2926 newheight
= FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f
, ph
);
2927 ph
= FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f
, newheight
) - f
->y_pixels_diff
;
2928 newheight
= FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f
, ph
);
2932 if (f
->want_fullscreen
& FULLSCREEN_WIDTH
)
2936 pw
= FRAME_X_DISPLAY_INFO (f
)->width
;
2937 newwidth
= FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f
, pw
);
2938 pw
= FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f
, newwidth
) - f
->x_pixels_diff
;
2939 newwidth
= FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f
, pw
);
2944 *height
= newheight
;
2948 /* Change the parameters of frame F as specified by ALIST.
2949 If a parameter is not specially recognized, do nothing special;
2950 otherwise call the `x_set_...' function for that parameter.
2951 Except for certain geometry properties, always call store_frame_param
2952 to store the new value in the parameter alist. */
2955 x_set_frame_parameters (f
, alist
)
2961 /* If both of these parameters are present, it's more efficient to
2962 set them both at once. So we wait until we've looked at the
2963 entire list before we set them. */
2967 Lisp_Object left
, top
;
2969 /* Same with these. */
2970 Lisp_Object icon_left
, icon_top
;
2972 /* Record in these vectors all the parms specified. */
2974 Lisp_Object
*values
;
2976 int left_no_change
= 0, top_no_change
= 0;
2977 int icon_left_no_change
= 0, icon_top_no_change
= 0;
2978 int fullscreen_is_being_set
= 0;
2980 struct gcpro gcpro1
, gcpro2
;
2983 for (tail
= alist
; CONSP (tail
); tail
= Fcdr (tail
))
2986 parms
= (Lisp_Object
*) alloca (i
* sizeof (Lisp_Object
));
2987 values
= (Lisp_Object
*) alloca (i
* sizeof (Lisp_Object
));
2989 /* Extract parm names and values into those vectors. */
2992 for (tail
= alist
; CONSP (tail
); tail
= Fcdr (tail
))
2997 parms
[i
] = Fcar (elt
);
2998 values
[i
] = Fcdr (elt
);
3001 /* TAIL and ALIST are not used again below here. */
3002 alist
= tail
= Qnil
;
3004 GCPRO2 (*parms
, *values
);
3008 /* There is no need to gcpro LEFT, TOP, ICON_LEFT, or ICON_TOP,
3009 because their values appear in VALUES and strings are not valid. */
3010 top
= left
= Qunbound
;
3011 icon_left
= icon_top
= Qunbound
;
3013 /* Provide default values for HEIGHT and WIDTH. */
3014 width
= (f
->new_text_cols
? f
->new_text_cols
: FRAME_COLS (f
));
3015 height
= (f
->new_text_lines
? f
->new_text_lines
: FRAME_LINES (f
));
3017 /* Process foreground_color and background_color before anything else.
3018 They are independent of other properties, but other properties (e.g.,
3019 cursor_color) are dependent upon them. */
3020 /* Process default font as well, since fringe widths depends on it. */
3021 /* Also, process fullscreen, width and height depend upon that */
3022 for (p
= 0; p
< i
; p
++)
3024 Lisp_Object prop
, val
;
3028 if (EQ (prop
, Qforeground_color
)
3029 || EQ (prop
, Qbackground_color
)
3031 || EQ (prop
, Qfullscreen
))
3033 register Lisp_Object param_index
, old_value
;
3034 int count
= SPECPDL_INDEX ();
3036 old_value
= get_frame_param (f
, prop
);
3037 fullscreen_is_being_set
|= EQ (prop
, Qfullscreen
);
3039 if (NILP (Fequal (val
, old_value
)))
3041 /* For :font attributes, the frame_parm_handler
3042 x_set_font calls `face-set-after-frame-default'.
3043 Unless we bind inhibit-face-set-after-frame-default
3044 here, this would reset the :font attribute that we
3045 just applied to the default value for new faces. */
3046 specbind (Qinhibit_face_set_after_frame_default
, Qt
);
3048 store_frame_param (f
, prop
, val
);
3050 param_index
= Fget (prop
, Qx_frame_parameter
);
3051 if (NATNUMP (param_index
)
3052 && (XFASTINT (param_index
)
3053 < sizeof (frame_parms
)/sizeof (frame_parms
[0]))
3054 && FRAME_RIF (f
)->frame_parm_handlers
[XINT (param_index
)])
3055 (*(FRAME_RIF (f
)->frame_parm_handlers
[XINT (param_index
)])) (f
, val
, old_value
);
3056 unbind_to (count
, Qnil
);
3061 /* Now process them in reverse of specified order. */
3062 for (i
--; i
>= 0; i
--)
3064 Lisp_Object prop
, val
;
3069 if (EQ (prop
, Qwidth
) && NUMBERP (val
))
3070 width
= XFASTINT (val
);
3071 else if (EQ (prop
, Qheight
) && NUMBERP (val
))
3072 height
= XFASTINT (val
);
3073 else if (EQ (prop
, Qtop
))
3075 else if (EQ (prop
, Qleft
))
3077 else if (EQ (prop
, Qicon_top
))
3079 else if (EQ (prop
, Qicon_left
))
3081 else if (EQ (prop
, Qforeground_color
)
3082 || EQ (prop
, Qbackground_color
)
3084 || EQ (prop
, Qfullscreen
))
3085 /* Processed above. */
3089 register Lisp_Object param_index
, old_value
;
3091 old_value
= get_frame_param (f
, prop
);
3093 store_frame_param (f
, prop
, val
);
3095 param_index
= Fget (prop
, Qx_frame_parameter
);
3096 if (NATNUMP (param_index
)
3097 && (XFASTINT (param_index
)
3098 < sizeof (frame_parms
)/sizeof (frame_parms
[0]))
3099 && FRAME_RIF (f
)->frame_parm_handlers
[XINT (param_index
)])
3100 (*(FRAME_RIF (f
)->frame_parm_handlers
[XINT (param_index
)])) (f
, val
, old_value
);
3104 /* Don't die if just one of these was set. */
3105 if (EQ (left
, Qunbound
))
3108 if (f
->left_pos
< 0)
3109 left
= Fcons (Qplus
, Fcons (make_number (f
->left_pos
), Qnil
));
3111 XSETINT (left
, f
->left_pos
);
3113 if (EQ (top
, Qunbound
))
3117 top
= Fcons (Qplus
, Fcons (make_number (f
->top_pos
), Qnil
));
3119 XSETINT (top
, f
->top_pos
);
3122 /* If one of the icon positions was not set, preserve or default it. */
3123 if (EQ (icon_left
, Qunbound
) || ! INTEGERP (icon_left
))
3125 icon_left_no_change
= 1;
3126 icon_left
= Fcdr (Fassq (Qicon_left
, f
->param_alist
));
3127 if (NILP (icon_left
))
3128 XSETINT (icon_left
, 0);
3130 if (EQ (icon_top
, Qunbound
) || ! INTEGERP (icon_top
))
3132 icon_top_no_change
= 1;
3133 icon_top
= Fcdr (Fassq (Qicon_top
, f
->param_alist
));
3134 if (NILP (icon_top
))
3135 XSETINT (icon_top
, 0);
3138 if (FRAME_VISIBLE_P (f
) && fullscreen_is_being_set
)
3140 /* If the frame is visible already and the fullscreen parameter is
3141 being set, it is too late to set WM manager hints to specify
3143 Here we first get the width, height and position that applies to
3144 fullscreen. We then move the frame to the appropriate
3145 position. Resize of the frame is taken care of in the code after
3146 this if-statement. */
3147 int new_left
, new_top
;
3149 x_fullscreen_adjust (f
, &width
, &height
, &new_top
, &new_left
);
3150 if (new_top
!= f
->top_pos
|| new_left
!= f
->left_pos
)
3151 x_set_offset (f
, new_left
, new_top
, 1);
3154 /* Don't set these parameters unless they've been explicitly
3155 specified. The window might be mapped or resized while we're in
3156 this function, and we don't want to override that unless the lisp
3157 code has asked for it.
3159 Don't set these parameters unless they actually differ from the
3160 window's current parameters; the window may not actually exist
3165 check_frame_size (f
, &height
, &width
);
3167 XSETFRAME (frame
, f
);
3169 if (width
!= FRAME_COLS (f
)
3170 || height
!= FRAME_LINES (f
)
3171 || f
->new_text_lines
|| f
->new_text_cols
)
3172 Fset_frame_size (frame
, make_number (width
), make_number (height
));
3174 if ((!NILP (left
) || !NILP (top
))
3175 && ! (left_no_change
&& top_no_change
)
3176 && ! (NUMBERP (left
) && XINT (left
) == f
->left_pos
3177 && NUMBERP (top
) && XINT (top
) == f
->top_pos
))
3182 /* Record the signs. */
3183 f
->size_hint_flags
&= ~ (XNegative
| YNegative
);
3184 if (EQ (left
, Qminus
))
3185 f
->size_hint_flags
|= XNegative
;
3186 else if (INTEGERP (left
))
3188 leftpos
= XINT (left
);
3190 f
->size_hint_flags
|= XNegative
;
3192 else if (CONSP (left
) && EQ (XCAR (left
), Qminus
)
3193 && CONSP (XCDR (left
))
3194 && INTEGERP (XCAR (XCDR (left
))))
3196 leftpos
= - XINT (XCAR (XCDR (left
)));
3197 f
->size_hint_flags
|= XNegative
;
3199 else if (CONSP (left
) && EQ (XCAR (left
), Qplus
)
3200 && CONSP (XCDR (left
))
3201 && INTEGERP (XCAR (XCDR (left
))))
3203 leftpos
= XINT (XCAR (XCDR (left
)));
3206 if (EQ (top
, Qminus
))
3207 f
->size_hint_flags
|= YNegative
;
3208 else if (INTEGERP (top
))
3210 toppos
= XINT (top
);
3212 f
->size_hint_flags
|= YNegative
;
3214 else if (CONSP (top
) && EQ (XCAR (top
), Qminus
)
3215 && CONSP (XCDR (top
))
3216 && INTEGERP (XCAR (XCDR (top
))))
3218 toppos
= - XINT (XCAR (XCDR (top
)));
3219 f
->size_hint_flags
|= YNegative
;
3221 else if (CONSP (top
) && EQ (XCAR (top
), Qplus
)
3222 && CONSP (XCDR (top
))
3223 && INTEGERP (XCAR (XCDR (top
))))
3225 toppos
= XINT (XCAR (XCDR (top
)));
3229 /* Store the numeric value of the position. */
3230 f
->top_pos
= toppos
;
3231 f
->left_pos
= leftpos
;
3233 f
->win_gravity
= NorthWestGravity
;
3235 /* Actually set that position, and convert to absolute. */
3236 x_set_offset (f
, leftpos
, toppos
, -1);
3239 if ((!NILP (icon_left
) || !NILP (icon_top
))
3240 && ! (icon_left_no_change
&& icon_top_no_change
))
3241 x_wm_set_icon_position (f
, XINT (icon_left
), XINT (icon_top
));
3248 /* Insert a description of internally-recorded parameters of frame X
3249 into the parameter alist *ALISTPTR that is to be given to the user.
3250 Only parameters that are specific to the X window system
3251 and whose values are not correctly recorded in the frame's
3252 param_alist need to be considered here. */
3255 x_report_frame_params (f
, alistptr
)
3257 Lisp_Object
*alistptr
;
3262 /* Represent negative positions (off the top or left screen edge)
3263 in a way that Fmodify_frame_parameters will understand correctly. */
3264 XSETINT (tem
, f
->left_pos
);
3265 if (f
->left_pos
>= 0)
3266 store_in_alist (alistptr
, Qleft
, tem
);
3268 store_in_alist (alistptr
, Qleft
, Fcons (Qplus
, Fcons (tem
, Qnil
)));
3270 XSETINT (tem
, f
->top_pos
);
3271 if (f
->top_pos
>= 0)
3272 store_in_alist (alistptr
, Qtop
, tem
);
3274 store_in_alist (alistptr
, Qtop
, Fcons (Qplus
, Fcons (tem
, Qnil
)));
3276 store_in_alist (alistptr
, Qborder_width
,
3277 make_number (f
->border_width
));
3278 store_in_alist (alistptr
, Qinternal_border_width
,
3279 make_number (FRAME_INTERNAL_BORDER_WIDTH (f
)));
3280 store_in_alist (alistptr
, Qleft_fringe
,
3281 make_number (FRAME_LEFT_FRINGE_WIDTH (f
)));
3282 store_in_alist (alistptr
, Qright_fringe
,
3283 make_number (FRAME_RIGHT_FRINGE_WIDTH (f
)));
3284 store_in_alist (alistptr
, Qscroll_bar_width
,
3285 (! FRAME_HAS_VERTICAL_SCROLL_BARS (f
)
3287 : FRAME_CONFIG_SCROLL_BAR_WIDTH (f
) > 0
3288 ? make_number (FRAME_CONFIG_SCROLL_BAR_WIDTH (f
))
3289 /* nil means "use default width"
3290 for non-toolkit scroll bar.
3291 ruler-mode.el depends on this. */
3293 sprintf (buf
, "%ld", (long) FRAME_X_WINDOW (f
));
3294 store_in_alist (alistptr
, Qwindow_id
,
3295 build_string (buf
));
3296 #ifdef HAVE_X_WINDOWS
3297 #ifdef USE_X_TOOLKIT
3298 /* Tooltip frame may not have this widget. */
3299 if (FRAME_X_OUTPUT (f
)->widget
)
3301 sprintf (buf
, "%ld", (long) FRAME_OUTER_WINDOW (f
));
3302 store_in_alist (alistptr
, Qouter_window_id
,
3303 build_string (buf
));
3305 store_in_alist (alistptr
, Qicon_name
, f
->icon_name
);
3306 FRAME_SAMPLE_VISIBILITY (f
);
3307 store_in_alist (alistptr
, Qvisibility
,
3308 (FRAME_VISIBLE_P (f
) ? Qt
3309 : FRAME_ICONIFIED_P (f
) ? Qicon
: Qnil
));
3310 store_in_alist (alistptr
, Qdisplay
,
3311 XCAR (FRAME_X_DISPLAY_INFO (f
)->name_list_element
));
3313 if (FRAME_X_OUTPUT (f
)->parent_desc
== FRAME_X_DISPLAY_INFO (f
)->root_window
)
3316 XSETFASTINT (tem
, FRAME_X_OUTPUT (f
)->parent_desc
);
3317 store_in_alist (alistptr
, Qparent_id
, tem
);
3321 /* Change the `fullscreen' frame parameter of frame F. OLD_VALUE is
3322 the previous value of that parameter, NEW_VALUE is the new value. */
3325 x_set_fullscreen (f
, new_value
, old_value
)
3327 Lisp_Object new_value
, old_value
;
3329 if (NILP (new_value
))
3330 f
->want_fullscreen
= FULLSCREEN_NONE
;
3331 else if (EQ (new_value
, Qfullboth
))
3332 f
->want_fullscreen
= FULLSCREEN_BOTH
;
3333 else if (EQ (new_value
, Qfullwidth
))
3334 f
->want_fullscreen
= FULLSCREEN_WIDTH
;
3335 else if (EQ (new_value
, Qfullheight
))
3336 f
->want_fullscreen
= FULLSCREEN_HEIGHT
;
3338 if (FRAME_TERMINAL (f
)->fullscreen_hook
!= NULL
)
3339 FRAME_TERMINAL (f
)->fullscreen_hook (f
);
3343 /* Change the `line-spacing' frame parameter of frame F. OLD_VALUE is
3344 the previous value of that parameter, NEW_VALUE is the new value. */
3347 x_set_line_spacing (f
, new_value
, old_value
)
3349 Lisp_Object new_value
, old_value
;
3351 if (NILP (new_value
))
3352 f
->extra_line_spacing
= 0;
3353 else if (NATNUMP (new_value
))
3354 f
->extra_line_spacing
= XFASTINT (new_value
);
3356 signal_error ("Invalid line-spacing", new_value
);
3357 if (FRAME_VISIBLE_P (f
))
3362 /* Change the `screen-gamma' frame parameter of frame F. OLD_VALUE is
3363 the previous value of that parameter, NEW_VALUE is the new value. */
3366 x_set_screen_gamma (f
, new_value
, old_value
)
3368 Lisp_Object new_value
, old_value
;
3370 Lisp_Object bgcolor
;
3372 if (NILP (new_value
))
3374 else if (NUMBERP (new_value
) && XFLOATINT (new_value
) > 0)
3375 /* The value 0.4545 is the normal viewing gamma. */
3376 f
->gamma
= 1.0 / (0.4545 * XFLOATINT (new_value
));
3378 signal_error ("Invalid screen-gamma", new_value
);
3380 /* Apply the new gamma value to the frame background. */
3381 bgcolor
= Fassq (Qbackground_color
, f
->param_alist
);
3382 if (CONSP (bgcolor
) && (bgcolor
= XCDR (bgcolor
), STRINGP (bgcolor
)))
3384 Lisp_Object index
= Fget (Qbackground_color
, Qx_frame_parameter
);
3386 && (XFASTINT (index
)
3387 < sizeof (frame_parms
)/sizeof (frame_parms
[0]))
3388 && FRAME_RIF (f
)->frame_parm_handlers
[XFASTINT (index
)])
3389 (*FRAME_RIF (f
)->frame_parm_handlers
[XFASTINT (index
)])
3393 Fclear_face_cache (Qnil
);
3398 x_set_font (f
, arg
, oldval
)
3400 Lisp_Object arg
, oldval
;
3403 Lisp_Object fontset_name
;
3405 int old_fontset
= FRAME_FONTSET(f
);
3409 fontset_name
= Fquery_fontset (arg
, Qnil
);
3412 result
= (STRINGP (fontset_name
)
3413 ? x_new_fontset (f
, SDATA (fontset_name
))
3414 : x_new_font (f
, SDATA (arg
)));
3417 if (EQ (result
, Qnil
))
3418 error ("Font `%s' is not defined", SDATA (arg
));
3419 else if (EQ (result
, Qt
))
3420 error ("The characters of the given font have varying widths");
3421 else if (STRINGP (result
))
3423 set_default_ascii_font (result
);
3424 if (STRINGP (fontset_name
))
3426 /* Fontset names are built from ASCII font names, so the
3427 names may be equal despite there was a change. */
3428 if (old_fontset
== FRAME_FONTSET (f
))
3431 else if (!NILP (Fequal (result
, oldval
)))
3434 /* Recalculate toolbar height. */
3435 f
->n_tool_bar_rows
= 0;
3436 /* Ensure we redraw it. */
3437 clear_current_matrices (f
);
3439 store_frame_param (f
, Qfont
, result
);
3440 recompute_basic_faces (f
);
3445 do_pending_window_change (0);
3447 /* Don't call `face-set-after-frame-default' when faces haven't been
3448 initialized yet. This is the case when called from
3449 Fx_create_frame. In that case, the X widget or window doesn't
3450 exist either, and we can end up in x_report_frame_params with a
3451 null widget which gives a segfault. */
3452 if (FRAME_FACE_CACHE (f
))
3454 XSETFRAME (frame
, f
);
3455 call1 (Qface_set_after_frame_default
, frame
);
3461 x_set_fringe_width (f
, new_value
, old_value
)
3463 Lisp_Object new_value
, old_value
;
3465 compute_fringe_widths (f
, 1);
3469 x_set_border_width (f
, arg
, oldval
)
3471 Lisp_Object arg
, oldval
;
3475 if (XINT (arg
) == f
->border_width
)
3478 if (FRAME_X_WINDOW (f
) != 0)
3479 error ("Cannot change the border width of a frame");
3481 f
->border_width
= XINT (arg
);
3485 x_set_internal_border_width (f
, arg
, oldval
)
3487 Lisp_Object arg
, oldval
;
3489 int old
= FRAME_INTERNAL_BORDER_WIDTH (f
);
3492 FRAME_INTERNAL_BORDER_WIDTH (f
) = XINT (arg
);
3493 if (FRAME_INTERNAL_BORDER_WIDTH (f
) < 0)
3494 FRAME_INTERNAL_BORDER_WIDTH (f
) = 0;
3496 #ifdef USE_X_TOOLKIT
3497 if (FRAME_X_OUTPUT (f
)->edit_widget
)
3498 widget_store_internal_border (FRAME_X_OUTPUT (f
)->edit_widget
);
3501 if (FRAME_INTERNAL_BORDER_WIDTH (f
) == old
)
3504 if (FRAME_X_WINDOW (f
) != 0)
3506 x_set_window_size (f
, 0, FRAME_COLS (f
), FRAME_LINES (f
));
3507 SET_FRAME_GARBAGED (f
);
3508 do_pending_window_change (0);
3511 SET_FRAME_GARBAGED (f
);
3515 x_set_visibility (f
, value
, oldval
)
3517 Lisp_Object value
, oldval
;
3520 XSETFRAME (frame
, f
);
3523 Fmake_frame_invisible (frame
, Qt
);
3524 else if (EQ (value
, Qicon
))
3525 Ficonify_frame (frame
);
3527 Fmake_frame_visible (frame
);
3531 x_set_autoraise (f
, arg
, oldval
)
3533 Lisp_Object arg
, oldval
;
3535 f
->auto_raise
= !EQ (Qnil
, arg
);
3539 x_set_autolower (f
, arg
, oldval
)
3541 Lisp_Object arg
, oldval
;
3543 f
->auto_lower
= !EQ (Qnil
, arg
);
3547 x_set_unsplittable (f
, arg
, oldval
)
3549 Lisp_Object arg
, oldval
;
3551 f
->no_split
= !NILP (arg
);
3555 x_set_vertical_scroll_bars (f
, arg
, oldval
)
3557 Lisp_Object arg
, oldval
;
3559 if ((EQ (arg
, Qleft
) && FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f
))
3560 || (EQ (arg
, Qright
) && FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f
))
3561 || (NILP (arg
) && FRAME_HAS_VERTICAL_SCROLL_BARS (f
))
3562 || (!NILP (arg
) && ! FRAME_HAS_VERTICAL_SCROLL_BARS (f
)))
3564 FRAME_VERTICAL_SCROLL_BAR_TYPE (f
)
3566 ? vertical_scroll_bar_none
3568 ? vertical_scroll_bar_left
3570 ? vertical_scroll_bar_right
3571 : EQ (Qleft
, Vdefault_frame_scroll_bars
)
3572 ? vertical_scroll_bar_left
3573 : EQ (Qright
, Vdefault_frame_scroll_bars
)
3574 ? vertical_scroll_bar_right
3575 : vertical_scroll_bar_none
);
3577 /* We set this parameter before creating the X window for the
3578 frame, so we can get the geometry right from the start.
3579 However, if the window hasn't been created yet, we shouldn't
3580 call x_set_window_size. */
3581 if (FRAME_X_WINDOW (f
))
3582 x_set_window_size (f
, 0, FRAME_COLS (f
), FRAME_LINES (f
));
3583 do_pending_window_change (0);
3588 x_set_scroll_bar_width (f
, arg
, oldval
)
3590 Lisp_Object arg
, oldval
;
3592 int wid
= FRAME_COLUMN_WIDTH (f
);
3596 x_set_scroll_bar_default_width (f
);
3598 if (FRAME_X_WINDOW (f
))
3599 x_set_window_size (f
, 0, FRAME_COLS (f
), FRAME_LINES (f
));
3600 do_pending_window_change (0);
3602 else if (INTEGERP (arg
) && XINT (arg
) > 0
3603 && XFASTINT (arg
) != FRAME_CONFIG_SCROLL_BAR_WIDTH (f
))
3605 if (XFASTINT (arg
) <= 2 * VERTICAL_SCROLL_BAR_WIDTH_TRIM
)
3606 XSETINT (arg
, 2 * VERTICAL_SCROLL_BAR_WIDTH_TRIM
+ 1);
3608 FRAME_CONFIG_SCROLL_BAR_WIDTH (f
) = XFASTINT (arg
);
3609 FRAME_CONFIG_SCROLL_BAR_COLS (f
) = (XFASTINT (arg
) + wid
-1) / wid
;
3610 if (FRAME_X_WINDOW (f
))
3611 x_set_window_size (f
, 0, FRAME_COLS (f
), FRAME_LINES (f
));
3612 do_pending_window_change (0);
3615 change_frame_size (f
, 0, FRAME_COLS (f
), 0, 0, 0);
3616 XWINDOW (FRAME_SELECTED_WINDOW (f
))->cursor
.hpos
= 0;
3617 XWINDOW (FRAME_SELECTED_WINDOW (f
))->cursor
.x
= 0;
3622 /* Return non-nil if frame F wants a bitmap icon. */
3630 tem
= assq_no_quit (Qicon_type
, f
->param_alist
);
3638 /* Subroutines of creating an X frame. */
3640 /* Make sure that Vx_resource_name is set to a reasonable value.
3641 Fix it up, or set it to `emacs' if it is too hopeless. */
3644 validate_x_resource_name ()
3647 /* Number of valid characters in the resource name. */
3649 /* Number of invalid characters in the resource name. */
3654 if (!STRINGP (Vx_resource_class
))
3655 Vx_resource_class
= build_string (EMACS_CLASS
);
3657 if (STRINGP (Vx_resource_name
))
3659 unsigned char *p
= SDATA (Vx_resource_name
);
3662 len
= SBYTES (Vx_resource_name
);
3664 /* Only letters, digits, - and _ are valid in resource names.
3665 Count the valid characters and count the invalid ones. */
3666 for (i
= 0; i
< len
; i
++)
3669 if (! ((c
>= 'a' && c
<= 'z')
3670 || (c
>= 'A' && c
<= 'Z')
3671 || (c
>= '0' && c
<= '9')
3672 || c
== '-' || c
== '_'))
3679 /* Not a string => completely invalid. */
3680 bad_count
= 5, good_count
= 0;
3682 /* If name is valid already, return. */
3686 /* If name is entirely invalid, or nearly so, use `emacs'. */
3688 || (good_count
== 1 && bad_count
> 0))
3690 Vx_resource_name
= build_string ("emacs");
3694 /* Name is partly valid. Copy it and replace the invalid characters
3695 with underscores. */
3697 Vx_resource_name
= new = Fcopy_sequence (Vx_resource_name
);
3699 for (i
= 0; i
< len
; i
++)
3701 int c
= SREF (new, i
);
3702 if (! ((c
>= 'a' && c
<= 'z')
3703 || (c
>= 'A' && c
<= 'Z')
3704 || (c
>= '0' && c
<= '9')
3705 || c
== '-' || c
== '_'))
3711 extern char *x_get_string_resource
P_ ((XrmDatabase
, char *, char *));
3712 extern Display_Info
*check_x_display_info
P_ ((Lisp_Object
));
3715 /* Get specified attribute from resource database RDB.
3716 See Fx_get_resource below for other parameters. */
3719 xrdb_get_resource (rdb
, attribute
, class, component
, subclass
)
3721 Lisp_Object attribute
, class, component
, subclass
;
3723 register char *value
;
3727 CHECK_STRING (attribute
);
3728 CHECK_STRING (class);
3730 if (!NILP (component
))
3731 CHECK_STRING (component
);
3732 if (!NILP (subclass
))
3733 CHECK_STRING (subclass
);
3734 if (NILP (component
) != NILP (subclass
))
3735 error ("x-get-resource: must specify both COMPONENT and SUBCLASS or neither");
3737 validate_x_resource_name ();
3739 /* Allocate space for the components, the dots which separate them,
3740 and the final '\0'. Make them big enough for the worst case. */
3741 name_key
= (char *) alloca (SBYTES (Vx_resource_name
)
3742 + (STRINGP (component
)
3743 ? SBYTES (component
) : 0)
3744 + SBYTES (attribute
)
3747 class_key
= (char *) alloca (SBYTES (Vx_resource_class
)
3749 + (STRINGP (subclass
)
3750 ? SBYTES (subclass
) : 0)
3753 /* Start with emacs.FRAMENAME for the name (the specific one)
3754 and with `Emacs' for the class key (the general one). */
3755 strcpy (name_key
, SDATA (Vx_resource_name
));
3756 strcpy (class_key
, SDATA (Vx_resource_class
));
3758 strcat (class_key
, ".");
3759 strcat (class_key
, SDATA (class));
3761 if (!NILP (component
))
3763 strcat (class_key
, ".");
3764 strcat (class_key
, SDATA (subclass
));
3766 strcat (name_key
, ".");
3767 strcat (name_key
, SDATA (component
));
3770 strcat (name_key
, ".");
3771 strcat (name_key
, SDATA (attribute
));
3773 value
= x_get_string_resource (rdb
, name_key
, class_key
);
3775 if (value
!= (char *) 0)
3776 return build_string (value
);
3782 DEFUN ("x-get-resource", Fx_get_resource
, Sx_get_resource
, 2, 4, 0,
3783 doc
: /* Return the value of ATTRIBUTE, of class CLASS, from the X defaults database.
3784 This uses `INSTANCE.ATTRIBUTE' as the key and `Emacs.CLASS' as the
3785 class, where INSTANCE is the name under which Emacs was invoked, or
3786 the name specified by the `-name' or `-rn' command-line arguments.
3788 The optional arguments COMPONENT and SUBCLASS add to the key and the
3789 class, respectively. You must specify both of them or neither.
3790 If you specify them, the key is `INSTANCE.COMPONENT.ATTRIBUTE'
3791 and the class is `Emacs.CLASS.SUBCLASS'. */)
3792 (attribute
, class, component
, subclass
)
3793 Lisp_Object attribute
, class, component
, subclass
;
3795 #ifdef HAVE_X_WINDOWS
3799 return xrdb_get_resource (check_x_display_info (Qnil
)->xrdb
,
3800 attribute
, class, component
, subclass
);
3803 /* Get an X resource, like Fx_get_resource, but for display DPYINFO. */
3806 display_x_get_resource (dpyinfo
, attribute
, class, component
, subclass
)
3807 Display_Info
*dpyinfo
;
3808 Lisp_Object attribute
, class, component
, subclass
;
3810 return xrdb_get_resource (dpyinfo
->xrdb
,
3811 attribute
, class, component
, subclass
);
3814 /* Used when C code wants a resource value. */
3817 x_get_resource_string (attribute
, class)
3818 char *attribute
, *class;
3822 struct frame
*sf
= SELECTED_FRAME ();
3824 /* Allocate space for the components, the dots which separate them,
3825 and the final '\0'. */
3826 name_key
= (char *) alloca (SBYTES (Vinvocation_name
)
3827 + strlen (attribute
) + 2);
3828 class_key
= (char *) alloca ((sizeof (EMACS_CLASS
) - 1)
3829 + strlen (class) + 2);
3831 sprintf (name_key
, "%s.%s", SDATA (Vinvocation_name
), attribute
);
3832 sprintf (class_key
, "%s.%s", EMACS_CLASS
, class);
3834 return x_get_string_resource (FRAME_X_DISPLAY_INFO (sf
)->xrdb
,
3835 name_key
, class_key
);
3839 /* Return the value of parameter PARAM.
3841 First search ALIST, then Vdefault_frame_alist, then the X defaults
3842 database, using ATTRIBUTE as the attribute name and CLASS as its class.
3844 Convert the resource to the type specified by desired_type.
3846 If no default is specified, return Qunbound. If you call
3847 x_get_arg, make sure you deal with Qunbound in a reasonable way,
3848 and don't let it get stored in any Lisp-visible variables! */
3851 x_get_arg (dpyinfo
, alist
, param
, attribute
, class, type
)
3852 Display_Info
*dpyinfo
;
3853 Lisp_Object alist
, param
;
3856 enum resource_types type
;
3858 register Lisp_Object tem
;
3860 tem
= Fassq (param
, alist
);
3864 /* If we find this parm in ALIST, clear it out
3865 so that it won't be "left over" at the end. */
3866 #ifndef WINDOWSNT /* w32fns.c has not yet been changed to cope with this. */
3868 XSETCAR (tem
, Qnil
);
3869 /* In case the parameter appears more than once in the alist,
3871 for (tail
= alist
; CONSP (tail
); tail
= XCDR (tail
))
3872 if (CONSP (XCAR (tail
))
3873 && EQ (XCAR (XCAR (tail
)), param
))
3874 XSETCAR (XCAR (tail
), Qnil
);
3878 tem
= Fassq (param
, Vdefault_frame_alist
);
3880 /* If it wasn't specified in ALIST or the Lisp-level defaults,
3881 look in the X resources. */
3886 tem
= display_x_get_resource (dpyinfo
,
3887 build_string (attribute
),
3888 build_string (class),
3896 case RES_TYPE_NUMBER
:
3897 return make_number (atoi (SDATA (tem
)));
3899 case RES_TYPE_FLOAT
:
3900 return make_float (atof (SDATA (tem
)));
3902 case RES_TYPE_BOOLEAN
:
3903 tem
= Fdowncase (tem
);
3904 if (!strcmp (SDATA (tem
), "on")
3905 || !strcmp (SDATA (tem
), "true"))
3910 case RES_TYPE_STRING
:
3913 case RES_TYPE_SYMBOL
:
3914 /* As a special case, we map the values `true' and `on'
3915 to Qt, and `false' and `off' to Qnil. */
3918 lower
= Fdowncase (tem
);
3919 if (!strcmp (SDATA (lower
), "on")
3920 || !strcmp (SDATA (lower
), "true"))
3922 else if (!strcmp (SDATA (lower
), "off")
3923 || !strcmp (SDATA (lower
), "false"))
3926 return Fintern (tem
, Qnil
);
3940 x_frame_get_arg (f
, alist
, param
, attribute
, class, type
)
3942 Lisp_Object alist
, param
;
3945 enum resource_types type
;
3947 return x_get_arg (FRAME_X_DISPLAY_INFO (f
),
3948 alist
, param
, attribute
, class, type
);
3951 /* Like x_frame_get_arg, but also record the value in f->param_alist. */
3954 x_frame_get_and_record_arg (f
, alist
, param
, attribute
, class, type
)
3956 Lisp_Object alist
, param
;
3959 enum resource_types type
;
3963 value
= x_get_arg (FRAME_X_DISPLAY_INFO (f
), alist
, param
,
3964 attribute
, class, type
);
3965 if (! NILP (value
) && ! EQ (value
, Qunbound
))
3966 store_frame_param (f
, param
, value
);
3972 /* Record in frame F the specified or default value according to ALIST
3973 of the parameter named PROP (a Lisp symbol).
3974 If no value is specified for PROP, look for an X default for XPROP
3975 on the frame named NAME.
3976 If that is not found either, use the value DEFLT. */
3979 x_default_parameter (f
, alist
, prop
, deflt
, xprop
, xclass
, type
)
3986 enum resource_types type
;
3990 tem
= x_frame_get_arg (f
, alist
, prop
, xprop
, xclass
, type
);
3991 if (EQ (tem
, Qunbound
))
3993 x_set_frame_parameters (f
, Fcons (Fcons (prop
, tem
), Qnil
));
4000 DEFUN ("x-parse-geometry", Fx_parse_geometry
, Sx_parse_geometry
, 1, 1, 0,
4001 doc
: /* Parse an X-style geometry string STRING.
4002 Returns an alist of the form ((top . TOP), (left . LEFT) ... ).
4003 The properties returned may include `top', `left', `height', and `width'.
4004 The value of `left' or `top' may be an integer,
4005 or a list (+ N) meaning N pixels relative to top/left corner,
4006 or a list (- N) meaning -N pixels relative to bottom/right corner. */)
4011 unsigned int width
, height
;
4014 CHECK_STRING (string
);
4016 geometry
= XParseGeometry ((char *) SDATA (string
),
4017 &x
, &y
, &width
, &height
);
4020 if (!!(geometry
& XValue
) != !!(geometry
& YValue
))
4021 error ("Must specify both x and y position, or neither");
4025 if (geometry
& XValue
)
4027 Lisp_Object element
;
4029 if (x
>= 0 && (geometry
& XNegative
))
4030 element
= Fcons (Qleft
, Fcons (Qminus
, Fcons (make_number (-x
), Qnil
)));
4031 else if (x
< 0 && ! (geometry
& XNegative
))
4032 element
= Fcons (Qleft
, Fcons (Qplus
, Fcons (make_number (x
), Qnil
)));
4034 element
= Fcons (Qleft
, make_number (x
));
4035 result
= Fcons (element
, result
);
4038 if (geometry
& YValue
)
4040 Lisp_Object element
;
4042 if (y
>= 0 && (geometry
& YNegative
))
4043 element
= Fcons (Qtop
, Fcons (Qminus
, Fcons (make_number (-y
), Qnil
)));
4044 else if (y
< 0 && ! (geometry
& YNegative
))
4045 element
= Fcons (Qtop
, Fcons (Qplus
, Fcons (make_number (y
), Qnil
)));
4047 element
= Fcons (Qtop
, make_number (y
));
4048 result
= Fcons (element
, result
);
4051 if (geometry
& WidthValue
)
4052 result
= Fcons (Fcons (Qwidth
, make_number (width
)), result
);
4053 if (geometry
& HeightValue
)
4054 result
= Fcons (Fcons (Qheight
, make_number (height
)), result
);
4059 /* Calculate the desired size and position of frame F.
4060 Return the flags saying which aspects were specified.
4062 Also set the win_gravity and size_hint_flags of F.
4064 Adjust height for toolbar if TOOLBAR_P is 1.
4066 This function does not make the coordinates positive. */
4068 #define DEFAULT_ROWS 40
4069 #define DEFAULT_COLS 80
4072 x_figure_window_size (f
, parms
, toolbar_p
)
4077 register Lisp_Object tem0
, tem1
, tem2
;
4078 long window_prompting
= 0;
4079 Display_Info
*dpyinfo
= FRAME_X_DISPLAY_INFO (f
);
4081 /* Default values if we fall through.
4082 Actually, if that happens we should get
4083 window manager prompting. */
4084 SET_FRAME_COLS (f
, DEFAULT_COLS
);
4085 FRAME_LINES (f
) = DEFAULT_ROWS
;
4086 /* Window managers expect that if program-specified
4087 positions are not (0,0), they're intentional, not defaults. */
4091 /* Ensure that old new_text_cols and new_text_lines will not override the
4093 /* ++KFS: This was specific to W32, but seems ok for all platforms */
4094 f
->new_text_cols
= f
->new_text_lines
= 0;
4096 tem0
= x_get_arg (dpyinfo
, parms
, Qheight
, 0, 0, RES_TYPE_NUMBER
);
4097 tem1
= x_get_arg (dpyinfo
, parms
, Qwidth
, 0, 0, RES_TYPE_NUMBER
);
4098 tem2
= x_get_arg (dpyinfo
, parms
, Quser_size
, 0, 0, RES_TYPE_NUMBER
);
4099 if (! EQ (tem0
, Qunbound
) || ! EQ (tem1
, Qunbound
))
4101 if (!EQ (tem0
, Qunbound
))
4103 CHECK_NUMBER (tem0
);
4104 FRAME_LINES (f
) = XINT (tem0
);
4106 if (!EQ (tem1
, Qunbound
))
4108 CHECK_NUMBER (tem1
);
4109 SET_FRAME_COLS (f
, XINT (tem1
));
4111 if (!NILP (tem2
) && !EQ (tem2
, Qunbound
))
4112 window_prompting
|= USSize
;
4114 window_prompting
|= PSize
;
4117 f
->scroll_bar_actual_width
4118 = FRAME_SCROLL_BAR_COLS (f
) * FRAME_COLUMN_WIDTH (f
);
4120 /* This used to be done _before_ calling x_figure_window_size, but
4121 since the height is reset here, this was really a no-op. I
4122 assume that moving it here does what Gerd intended (although he
4123 no longer can remember what that was... ++KFS, 2003-03-25. */
4125 /* Add the tool-bar height to the initial frame height so that the
4126 user gets a text display area of the size he specified with -g or
4127 via .Xdefaults. Later changes of the tool-bar height don't
4128 change the frame size. This is done so that users can create
4129 tall Emacs frames without having to guess how tall the tool-bar
4131 if (toolbar_p
&& FRAME_TOOL_BAR_LINES (f
))
4133 int margin
, relief
, bar_height
;
4135 relief
= (tool_bar_button_relief
>= 0
4136 ? tool_bar_button_relief
4137 : DEFAULT_TOOL_BAR_BUTTON_RELIEF
);
4139 if (INTEGERP (Vtool_bar_button_margin
)
4140 && XINT (Vtool_bar_button_margin
) > 0)
4141 margin
= XFASTINT (Vtool_bar_button_margin
);
4142 else if (CONSP (Vtool_bar_button_margin
)
4143 && INTEGERP (XCDR (Vtool_bar_button_margin
))
4144 && XINT (XCDR (Vtool_bar_button_margin
)) > 0)
4145 margin
= XFASTINT (XCDR (Vtool_bar_button_margin
));
4149 bar_height
= DEFAULT_TOOL_BAR_IMAGE_HEIGHT
+ 2 * margin
+ 2 * relief
;
4150 FRAME_LINES (f
) += (bar_height
+ FRAME_LINE_HEIGHT (f
) - 1) / FRAME_LINE_HEIGHT (f
);
4153 compute_fringe_widths (f
, 0);
4155 FRAME_PIXEL_WIDTH (f
) = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f
, FRAME_COLS (f
));
4156 FRAME_PIXEL_HEIGHT (f
) = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f
, FRAME_LINES (f
));
4158 tem0
= x_get_arg (dpyinfo
, parms
, Qtop
, 0, 0, RES_TYPE_NUMBER
);
4159 tem1
= x_get_arg (dpyinfo
, parms
, Qleft
, 0, 0, RES_TYPE_NUMBER
);
4160 tem2
= x_get_arg (dpyinfo
, parms
, Quser_position
, 0, 0, RES_TYPE_NUMBER
);
4161 if (! EQ (tem0
, Qunbound
) || ! EQ (tem1
, Qunbound
))
4163 if (EQ (tem0
, Qminus
))
4166 window_prompting
|= YNegative
;
4168 else if (CONSP (tem0
) && EQ (XCAR (tem0
), Qminus
)
4169 && CONSP (XCDR (tem0
))
4170 && INTEGERP (XCAR (XCDR (tem0
))))
4172 f
->top_pos
= - XINT (XCAR (XCDR (tem0
)));
4173 window_prompting
|= YNegative
;
4175 else if (CONSP (tem0
) && EQ (XCAR (tem0
), Qplus
)
4176 && CONSP (XCDR (tem0
))
4177 && INTEGERP (XCAR (XCDR (tem0
))))
4179 f
->top_pos
= XINT (XCAR (XCDR (tem0
)));
4181 else if (EQ (tem0
, Qunbound
))
4185 CHECK_NUMBER (tem0
);
4186 f
->top_pos
= XINT (tem0
);
4188 window_prompting
|= YNegative
;
4191 if (EQ (tem1
, Qminus
))
4194 window_prompting
|= XNegative
;
4196 else if (CONSP (tem1
) && EQ (XCAR (tem1
), Qminus
)
4197 && CONSP (XCDR (tem1
))
4198 && INTEGERP (XCAR (XCDR (tem1
))))
4200 f
->left_pos
= - XINT (XCAR (XCDR (tem1
)));
4201 window_prompting
|= XNegative
;
4203 else if (CONSP (tem1
) && EQ (XCAR (tem1
), Qplus
)
4204 && CONSP (XCDR (tem1
))
4205 && INTEGERP (XCAR (XCDR (tem1
))))
4207 f
->left_pos
= XINT (XCAR (XCDR (tem1
)));
4209 else if (EQ (tem1
, Qunbound
))
4213 CHECK_NUMBER (tem1
);
4214 f
->left_pos
= XINT (tem1
);
4215 if (f
->left_pos
< 0)
4216 window_prompting
|= XNegative
;
4219 if (!NILP (tem2
) && ! EQ (tem2
, Qunbound
))
4220 window_prompting
|= USPosition
;
4222 window_prompting
|= PPosition
;
4225 if (f
->want_fullscreen
!= FULLSCREEN_NONE
)
4230 /* It takes both for some WM:s to place it where we want */
4231 window_prompting
= USPosition
| PPosition
;
4232 x_fullscreen_adjust (f
, &width
, &height
, &top
, &left
);
4233 FRAME_COLS (f
) = width
;
4234 FRAME_LINES (f
) = height
;
4235 FRAME_PIXEL_WIDTH (f
) = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f
, width
);
4236 FRAME_PIXEL_HEIGHT (f
) = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f
, height
);
4241 if (window_prompting
& XNegative
)
4243 if (window_prompting
& YNegative
)
4244 f
->win_gravity
= SouthEastGravity
;
4246 f
->win_gravity
= NorthEastGravity
;
4250 if (window_prompting
& YNegative
)
4251 f
->win_gravity
= SouthWestGravity
;
4253 f
->win_gravity
= NorthWestGravity
;
4256 f
->size_hint_flags
= window_prompting
;
4258 return window_prompting
;
4263 #endif /* HAVE_WINDOW_SYSTEM */
4267 /***********************************************************************
4269 ***********************************************************************/
4274 Qframep
= intern ("framep");
4275 staticpro (&Qframep
);
4276 Qframe_live_p
= intern ("frame-live-p");
4277 staticpro (&Qframe_live_p
);
4278 Qheight
= intern ("height");
4279 staticpro (&Qheight
);
4280 Qicon
= intern ("icon");
4282 Qminibuffer
= intern ("minibuffer");
4283 staticpro (&Qminibuffer
);
4284 Qmodeline
= intern ("modeline");
4285 staticpro (&Qmodeline
);
4286 Qonly
= intern ("only");
4288 Qwidth
= intern ("width");
4289 staticpro (&Qwidth
);
4290 Qgeometry
= intern ("geometry");
4291 staticpro (&Qgeometry
);
4292 Qicon_left
= intern ("icon-left");
4293 staticpro (&Qicon_left
);
4294 Qicon_top
= intern ("icon-top");
4295 staticpro (&Qicon_top
);
4296 Qleft
= intern ("left");
4298 Qright
= intern ("right");
4299 staticpro (&Qright
);
4300 Quser_position
= intern ("user-position");
4301 staticpro (&Quser_position
);
4302 Quser_size
= intern ("user-size");
4303 staticpro (&Quser_size
);
4304 Qwindow_id
= intern ("window-id");
4305 staticpro (&Qwindow_id
);
4306 #ifdef HAVE_X_WINDOWS
4307 Qouter_window_id
= intern ("outer-window-id");
4308 staticpro (&Qouter_window_id
);
4310 Qparent_id
= intern ("parent-id");
4311 staticpro (&Qparent_id
);
4314 Qw32
= intern ("w32");
4316 Qpc
= intern ("pc");
4318 Qmac
= intern ("mac");
4320 Qvisible
= intern ("visible");
4321 staticpro (&Qvisible
);
4322 Qbuffer_predicate
= intern ("buffer-predicate");
4323 staticpro (&Qbuffer_predicate
);
4324 Qbuffer_list
= intern ("buffer-list");
4325 staticpro (&Qbuffer_list
);
4326 Qburied_buffer_list
= intern ("buried-buffer-list");
4327 staticpro (&Qburied_buffer_list
);
4328 Qdisplay_type
= intern ("display-type");
4329 staticpro (&Qdisplay_type
);
4330 Qbackground_mode
= intern ("background-mode");
4331 staticpro (&Qbackground_mode
);
4332 Qtty_color_mode
= intern ("tty-color-mode");
4333 staticpro (&Qtty_color_mode
);
4334 Qtty
= intern ("tty");
4336 Qtty_type
= intern ("tty-type");
4337 staticpro (&Qtty_type
);
4338 Qwindow_system
= intern ("window-system");
4339 staticpro (&Qwindow_system
);
4340 Qenvironment
= intern ("environment");
4341 staticpro (&Qenvironment
);
4343 Qface_set_after_frame_default
= intern ("face-set-after-frame-default");
4344 staticpro (&Qface_set_after_frame_default
);
4346 Qinhibit_face_set_after_frame_default
4347 = intern ("inhibit-face-set-after-frame-default");
4348 staticpro (&Qinhibit_face_set_after_frame_default
);
4350 Qfullwidth
= intern ("fullwidth");
4351 staticpro (&Qfullwidth
);
4352 Qfullheight
= intern ("fullheight");
4353 staticpro (&Qfullheight
);
4354 Qfullboth
= intern ("fullboth");
4355 staticpro (&Qfullboth
);
4356 Qx_resource_name
= intern ("x-resource-name");
4357 staticpro (&Qx_resource_name
);
4359 Qx_frame_parameter
= intern ("x-frame-parameter");
4360 staticpro (&Qx_frame_parameter
);
4362 Qterminal
= intern ("terminal");
4363 staticpro (&Qterminal
);
4364 Qterminal_live_p
= intern ("terminal-live-p");
4365 staticpro (&Qterminal_live_p
);
4370 for (i
= 0; i
< sizeof (frame_parms
) / sizeof (frame_parms
[0]); i
++)
4372 Lisp_Object v
= intern (frame_parms
[i
].name
);
4373 if (frame_parms
[i
].variable
)
4375 *frame_parms
[i
].variable
= v
;
4376 staticpro (frame_parms
[i
].variable
);
4378 Fput (v
, Qx_frame_parameter
, make_number (i
));
4382 #ifdef HAVE_WINDOW_SYSTEM
4383 DEFVAR_LISP ("x-resource-name", &Vx_resource_name
,
4384 doc
: /* The name Emacs uses to look up X resources.
4385 `x-get-resource' uses this as the first component of the instance name
4386 when requesting resource values.
4387 Emacs initially sets `x-resource-name' to the name under which Emacs
4388 was invoked, or to the value specified with the `-name' or `-rn'
4389 switches, if present.
4391 It may be useful to bind this variable locally around a call
4392 to `x-get-resource'. See also the variable `x-resource-class'. */);
4393 Vx_resource_name
= Qnil
;
4395 DEFVAR_LISP ("x-resource-class", &Vx_resource_class
,
4396 doc
: /* The class Emacs uses to look up X resources.
4397 `x-get-resource' uses this as the first component of the instance class
4398 when requesting resource values.
4400 Emacs initially sets `x-resource-class' to "Emacs".
4402 Setting this variable permanently is not a reasonable thing to do,
4403 but binding this variable locally around a call to `x-get-resource'
4404 is a reasonable practice. See also the variable `x-resource-name'. */);
4405 Vx_resource_class
= build_string (EMACS_CLASS
);
4408 DEFVAR_LISP ("default-frame-alist", &Vdefault_frame_alist
,
4409 doc
: /* Alist of default values for frame creation.
4410 These may be set in your init file, like this:
4411 (setq default-frame-alist '((width . 80) (height . 55) (menu-bar-lines . 1)))
4412 These override values given in window system configuration data,
4413 including X Windows' defaults database.
4414 For values specific to the first Emacs frame, see `initial-frame-alist'.
4415 For window-system specific values, see `window-system-default-frame-alist'.
4416 For values specific to the separate minibuffer frame, see
4417 `minibuffer-frame-alist'.
4418 The `menu-bar-lines' element of the list controls whether new frames
4419 have menu bars; `menu-bar-mode' works by altering this element.
4420 Setting this variable does not affect existing frames, only new ones. */);
4421 Vdefault_frame_alist
= Qnil
;
4423 DEFVAR_LISP ("default-frame-scroll-bars", &Vdefault_frame_scroll_bars
,
4424 doc
: /* Default position of scroll bars on this window-system. */);
4425 #ifdef HAVE_WINDOW_SYSTEM
4426 #if defined(HAVE_NTGUI) || defined(MAC_OS)
4427 /* MS-Windows has scroll bars on the right by default. */
4428 Vdefault_frame_scroll_bars
= Qright
;
4430 Vdefault_frame_scroll_bars
= Qleft
;
4433 Vdefault_frame_scroll_bars
= Qnil
;
4436 DEFVAR_LISP ("terminal-frame", &Vterminal_frame
,
4437 doc
: /* The initial frame-object, which represents Emacs's stdout. */);
4439 DEFVAR_LISP ("emacs-iconified", &Vemacs_iconified
,
4440 doc
: /* Non-nil if all of Emacs is iconified and frame updates are not needed. */);
4441 Vemacs_iconified
= Qnil
;
4443 DEFVAR_LISP ("mouse-position-function", &Vmouse_position_function
,
4444 doc
: /* If non-nil, function to transform normal value of `mouse-position'.
4445 `mouse-position' calls this function, passing its usual return value as
4446 argument, and returns whatever this function returns.
4447 This abnormal hook exists for the benefit of packages like `xt-mouse.el'
4448 which need to do mouse handling at the Lisp level. */);
4449 Vmouse_position_function
= Qnil
;
4451 DEFVAR_LISP ("mouse-highlight", &Vmouse_highlight
,
4452 doc
: /* If non-nil, clickable text is highlighted when mouse is over it.
4453 If the value is an integer, highlighting is only shown after moving the
4454 mouse, while keyboard input turns off the highlight even when the mouse
4455 is over the clickable text. However, the mouse shape still indicates
4456 when the mouse is over clickable text. */);
4457 Vmouse_highlight
= Qt
;
4459 DEFVAR_LISP ("delete-frame-functions", &Vdelete_frame_functions
,
4460 doc
: /* Functions to be run before deleting a frame.
4461 The functions are run with one arg, the frame to be deleted.
4464 Note that functions in this list may be called twice on the same
4465 frame. In the second invocation, the frame is already deleted, and
4466 the function should do nothing. (You can use `frame-live-p' to check
4467 for this.) This wrinkle happens when an earlier function in
4468 `delete-frame-functions' (indirectly) calls delete-frame
4470 Vdelete_frame_functions
= Qnil
;
4472 DEFVAR_KBOARD ("default-minibuffer-frame", Vdefault_minibuffer_frame
,
4473 doc
: /* Minibufferless frames use this frame's minibuffer.
4475 Emacs cannot create minibufferless frames unless this is set to an
4476 appropriate surrogate.
4478 Emacs consults this variable only when creating minibufferless
4479 frames; once the frame is created, it sticks with its assigned
4480 minibuffer, no matter what this variable is set to. This means that
4481 this variable doesn't necessarily say anything meaningful about the
4482 current set of frames, or where the minibuffer is currently being
4485 This variable is local to the current terminal and cannot be buffer-local. */);
4487 staticpro (&Vframe_list
);
4489 defsubr (&Sactive_minibuffer_window
);
4491 defsubr (&Sframe_live_p
);
4492 defsubr (&Swindow_system
);
4493 defsubr (&Smake_terminal_frame
);
4494 defsubr (&Shandle_switch_frame
);
4495 defsubr (&Sselect_frame
);
4496 defsubr (&Sselected_frame
);
4497 defsubr (&Swindow_frame
);
4498 defsubr (&Sframe_root_window
);
4499 defsubr (&Sframe_first_window
);
4500 defsubr (&Sframe_selected_window
);
4501 defsubr (&Sset_frame_selected_window
);
4502 defsubr (&Sframe_list
);
4503 defsubr (&Snext_frame
);
4504 defsubr (&Sprevious_frame
);
4505 defsubr (&Sdelete_frame
);
4506 defsubr (&Smouse_position
);
4507 defsubr (&Smouse_pixel_position
);
4508 defsubr (&Sset_mouse_position
);
4509 defsubr (&Sset_mouse_pixel_position
);
4511 defsubr (&Sframe_configuration
);
4512 defsubr (&Srestore_frame_configuration
);
4514 defsubr (&Smake_frame_visible
);
4515 defsubr (&Smake_frame_invisible
);
4516 defsubr (&Siconify_frame
);
4517 defsubr (&Sframe_visible_p
);
4518 defsubr (&Svisible_frame_list
);
4519 defsubr (&Sraise_frame
);
4520 defsubr (&Slower_frame
);
4521 defsubr (&Sredirect_frame_focus
);
4522 defsubr (&Sframe_focus
);
4523 defsubr (&Sframe_parameters
);
4524 defsubr (&Sframe_parameter
);
4525 defsubr (&Smodify_frame_parameters
);
4526 defsubr (&Sframe_with_environment
);
4527 defsubr (&Sframe_char_height
);
4528 defsubr (&Sframe_char_width
);
4529 defsubr (&Sframe_pixel_height
);
4530 defsubr (&Sframe_pixel_width
);
4531 defsubr (&Sset_frame_height
);
4532 defsubr (&Sset_frame_width
);
4533 defsubr (&Sset_frame_size
);
4534 defsubr (&Sset_frame_position
);
4536 #ifdef HAVE_WINDOW_SYSTEM
4537 defsubr (&Sx_get_resource
);
4538 defsubr (&Sx_parse_geometry
);
4543 /* arch-tag: 7dbf2c69-9aad-45f8-8296-db893d6dd039
4544 (do not change this comment) */