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 */
706 if (sf
->output_method
!= output_mac
)
707 error ("Not running on a Macintosh screen; cannot make a new Macintosh frame");
709 #if 0 /* This should work now! */
710 if (sf
->output_method
!= output_termcap
)
711 error ("Not using an ASCII terminal now; cannot make a new ASCII frame");
714 #endif /* not MSDOS */
717 Lisp_Object terminal
;
719 terminal
= Fassq (Qterminal
, parms
);
720 if (!NILP (terminal
))
722 terminal
= XCDR (terminal
);
723 t
= get_terminal (terminal
, 1);
729 char *name
= 0, *type
= 0;
730 Lisp_Object tty
, tty_type
;
732 tty
= get_future_frame_param
733 (Qtty
, parms
, (FRAME_TERMCAP_P (XFRAME (selected_frame
))
734 ? FRAME_TTY (XFRAME (selected_frame
))->name
738 name
= (char *) alloca (SBYTES (tty
) + 1);
739 strncpy (name
, SDATA (tty
), SBYTES (tty
));
740 name
[SBYTES (tty
)] = 0;
743 tty_type
= get_future_frame_param
744 (Qtty_type
, parms
, (FRAME_TERMCAP_P (XFRAME (selected_frame
))
745 ? FRAME_TTY (XFRAME (selected_frame
))->type
747 if (!NILP (tty_type
))
749 type
= (char *) alloca (SBYTES (tty_type
) + 1);
750 strncpy (type
, SDATA (tty_type
), SBYTES (tty_type
));
751 type
[SBYTES (tty_type
)] = 0;
754 t
= init_tty (name
, type
, 0); /* Errors are not fatal. */
757 f
= make_terminal_frame (t
);
761 get_tty_size (fileno (FRAME_TTY (f
)->input
), &width
, &height
);
762 change_frame_size (f
, height
, width
, 0, 0, 0);
767 XSETFRAME (frame
, f
);
768 Fmodify_frame_parameters (frame
, Vdefault_frame_alist
);
769 Fmodify_frame_parameters (frame
, parms
);
770 Fmodify_frame_parameters (frame
, Fcons (Fcons (Qwindow_system
, Qnil
), Qnil
));
771 Fmodify_frame_parameters (frame
, Fcons (Fcons (Qtty_type
,
772 build_string (t
->display_info
.tty
->type
)),
774 if (t
->display_info
.tty
->name
!= NULL
)
775 Fmodify_frame_parameters (frame
, Fcons (Fcons (Qtty
,
776 build_string (t
->display_info
.tty
->name
)),
779 Fmodify_frame_parameters (frame
, Fcons (Fcons (Qtty
, Qnil
), Qnil
));
781 /* Make the frame face alist be frame-specific, so that each
782 frame could change its face definitions independently. */
783 f
->face_alist
= Fcopy_alist (sf
->face_alist
);
784 /* Simple Fcopy_alist isn't enough, because we need the contents of
785 the vectors which are the CDRs of associations in face_alist to
786 be copied as well. */
787 for (tem
= f
->face_alist
; CONSP (tem
); tem
= XCDR (tem
))
788 XSETCDR (XCAR (tem
), Fcopy_sequence (XCDR (XCAR (tem
))));
793 /* Perform the switch to frame FRAME.
795 If FRAME is a switch-frame event `(switch-frame FRAME1)', use
798 If TRACK is non-zero and the frame that currently has the focus
799 redirects its focus to the selected frame, redirect that focused
800 frame's focus to FRAME instead.
802 FOR_DELETION non-zero means that the selected frame is being
803 deleted, which includes the possibility that the frame's terminal
807 do_switch_frame (frame
, track
, for_deletion
)
809 int track
, for_deletion
;
811 struct frame
*sf
= SELECTED_FRAME ();
813 /* If FRAME is a switch-frame event, extract the frame we should
816 && EQ (XCAR (frame
), Qswitch_frame
)
817 && CONSP (XCDR (frame
)))
818 frame
= XCAR (XCDR (frame
));
820 /* This used to say CHECK_LIVE_FRAME, but apparently it's possible for
821 a switch-frame event to arrive after a frame is no longer live,
822 especially when deleting the initial frame during startup. */
824 if (! FRAME_LIVE_P (XFRAME (frame
)))
827 if (sf
== XFRAME (frame
))
830 /* This is too greedy; it causes inappropriate focus redirection
831 that's hard to get rid of. */
833 /* If a frame's focus has been redirected toward the currently
834 selected frame, we should change the redirection to point to the
835 newly selected frame. This means that if the focus is redirected
836 from a minibufferless frame to a surrogate minibuffer frame, we
837 can use `other-window' to switch between all the frames using
838 that minibuffer frame, and the focus redirection will follow us
844 for (tail
= Vframe_list
; CONSP (tail
); tail
= XCDR (tail
))
848 if (!FRAMEP (XCAR (tail
)))
851 focus
= FRAME_FOCUS_FRAME (XFRAME (XCAR (tail
)));
853 if (FRAMEP (focus
) && XFRAME (focus
) == SELECTED_FRAME ())
854 Fredirect_frame_focus (XCAR (tail
), frame
);
858 /* Instead, apply it only to the frame we're pointing to. */
859 #ifdef HAVE_WINDOW_SYSTEM
860 if (track
&& FRAME_WINDOW_P (XFRAME (frame
)))
862 Lisp_Object focus
, xfocus
;
864 xfocus
= x_get_focus_frame (XFRAME (frame
));
867 focus
= FRAME_FOCUS_FRAME (XFRAME (xfocus
));
868 if (FRAMEP (focus
) && XFRAME (focus
) == SELECTED_FRAME ())
869 Fredirect_frame_focus (xfocus
, frame
);
872 #endif /* HAVE_X_WINDOWS */
875 if (!for_deletion
&& FRAME_HAS_MINIBUF_P (sf
))
876 resize_mini_window (XWINDOW (FRAME_MINIBUF_WINDOW (sf
)), 1);
878 if (FRAME_TERMCAP_P (XFRAME (selected_frame
))
879 && FRAME_TERMCAP_P (XFRAME (frame
))
880 && FRAME_TTY (XFRAME (selected_frame
)) == FRAME_TTY (XFRAME (frame
)))
882 XFRAME (selected_frame
)->async_visible
= 2; /* obscured */
883 XFRAME (frame
)->async_visible
= 1;
884 FRAME_TTY (XFRAME (frame
))->top_frame
= frame
;
887 selected_frame
= frame
;
888 if (! FRAME_MINIBUF_ONLY_P (XFRAME (selected_frame
)))
889 last_nonminibuf_frame
= XFRAME (selected_frame
);
891 Fselect_window (XFRAME (frame
)->selected_window
, Qnil
);
894 /* Make sure to switch the tty color mode to that of the newly
896 sf
= SELECTED_FRAME ();
897 if (FRAME_TERMCAP_P (sf
))
899 Lisp_Object color_mode_spec
, color_mode
;
901 color_mode_spec
= assq_no_quit (Qtty_color_mode
, sf
->param_alist
);
902 if (CONSP (color_mode_spec
))
903 color_mode
= XCDR (color_mode_spec
);
905 color_mode
= make_number (0);
906 set_tty_color_mode (sf
, color_mode
);
908 #endif /* !WINDOWSNT */
910 /* We want to make sure that the next event generates a frame-switch
911 event to the appropriate frame. This seems kludgy to me, but
912 before you take it out, make sure that evaluating something like
913 (select-window (frame-root-window (new-frame))) doesn't end up
914 with your typing being interpreted in the new frame instead of
915 the one you're actually typing in. */
916 internal_last_event_frame
= Qnil
;
921 DEFUN ("select-frame", Fselect_frame
, Sselect_frame
, 1, 1, "e",
922 doc
: /* Select the frame FRAME.
923 Subsequent editing commands apply to its selected window.
924 The selection of FRAME lasts until the next time the user does
925 something to select a different frame, or until the next time this
926 function is called. If you are using a window system, the previously
927 selected frame may be restored as the selected frame after return to
928 the command loop, because it still may have the window system's input
929 focus. On a text-only terminal, the next redisplay will display FRAME.
931 This function returns FRAME, or nil if FRAME has been deleted. */)
935 return do_switch_frame (frame
, 1, 0);
939 DEFUN ("handle-switch-frame", Fhandle_switch_frame
, Shandle_switch_frame
, 1, 1, "e",
940 doc
: /* Handle a switch-frame event EVENT.
941 Switch-frame events are usually bound to this function.
942 A switch-frame event tells Emacs that the window manager has requested
943 that the user's events be directed to the frame mentioned in the event.
944 This function selects the selected window of the frame of EVENT.
946 If EVENT is frame object, handle it as if it were a switch-frame event
951 /* Preserve prefix arg that the command loop just cleared. */
952 current_kboard
->Vprefix_arg
= Vcurrent_prefix_arg
;
953 call1 (Vrun_hooks
, Qmouse_leave_buffer_hook
);
954 return do_switch_frame (event
, 0, 0);
957 DEFUN ("selected-frame", Fselected_frame
, Sselected_frame
, 0, 0, 0,
958 doc
: /* Return the frame that is now selected. */)
961 return selected_frame
;
964 DEFUN ("window-frame", Fwindow_frame
, Swindow_frame
, 1, 1, 0,
965 doc
: /* Return the frame object that window WINDOW is on. */)
969 CHECK_LIVE_WINDOW (window
);
970 return XWINDOW (window
)->frame
;
973 DEFUN ("frame-first-window", Fframe_first_window
, Sframe_first_window
, 0, 1, 0,
974 doc
: /* Returns the topmost, leftmost window of FRAME.
975 If omitted, FRAME defaults to the currently selected frame. */)
982 w
= SELECTED_FRAME ()->root_window
;
985 CHECK_LIVE_FRAME (frame
);
986 w
= XFRAME (frame
)->root_window
;
988 while (NILP (XWINDOW (w
)->buffer
))
990 if (! NILP (XWINDOW (w
)->hchild
))
991 w
= XWINDOW (w
)->hchild
;
992 else if (! NILP (XWINDOW (w
)->vchild
))
993 w
= XWINDOW (w
)->vchild
;
1000 DEFUN ("active-minibuffer-window", Factive_minibuffer_window
,
1001 Sactive_minibuffer_window
, 0, 0, 0,
1002 doc
: /* Return the currently active minibuffer window, or nil if none. */)
1005 return minibuf_level
? minibuf_window
: Qnil
;
1008 DEFUN ("frame-root-window", Fframe_root_window
, Sframe_root_window
, 0, 1, 0,
1009 doc
: /* Returns the root-window of FRAME.
1010 If omitted, FRAME defaults to the currently selected frame. */)
1017 window
= SELECTED_FRAME ()->root_window
;
1020 CHECK_LIVE_FRAME (frame
);
1021 window
= XFRAME (frame
)->root_window
;
1027 DEFUN ("frame-selected-window", Fframe_selected_window
,
1028 Sframe_selected_window
, 0, 1, 0,
1029 doc
: /* Return the selected window of frame object FRAME.
1030 If omitted, FRAME defaults to the currently selected frame. */)
1037 window
= SELECTED_FRAME ()->selected_window
;
1040 CHECK_LIVE_FRAME (frame
);
1041 window
= XFRAME (frame
)->selected_window
;
1047 DEFUN ("set-frame-selected-window", Fset_frame_selected_window
,
1048 Sset_frame_selected_window
, 2, 2, 0,
1049 doc
: /* Set the selected window of frame object FRAME to WINDOW.
1051 If FRAME is nil, the selected frame is used.
1052 If FRAME is the selected frame, this makes WINDOW the selected window. */)
1054 Lisp_Object frame
, window
;
1057 frame
= selected_frame
;
1059 CHECK_LIVE_FRAME (frame
);
1060 CHECK_LIVE_WINDOW (window
);
1062 if (! EQ (frame
, WINDOW_FRAME (XWINDOW (window
))))
1063 error ("In `set-frame-selected-window', WINDOW is not on FRAME");
1065 if (EQ (frame
, selected_frame
))
1066 return Fselect_window (window
, Qnil
);
1068 return XFRAME (frame
)->selected_window
= window
;
1072 DEFUN ("frame-list", Fframe_list
, Sframe_list
,
1074 doc
: /* Return a list of all frames. */)
1078 frames
= Fcopy_sequence (Vframe_list
);
1079 #ifdef HAVE_WINDOW_SYSTEM
1080 if (FRAMEP (tip_frame
))
1081 frames
= Fdelq (tip_frame
, frames
);
1086 /* Return the next frame in the frame list after FRAME.
1087 If MINIBUF is nil, exclude minibuffer-only frames.
1088 If MINIBUF is a window, include only its own frame
1089 and any frame now using that window as the minibuffer.
1090 If MINIBUF is `visible', include all visible frames.
1091 If MINIBUF is 0, include all visible and iconified frames.
1092 Otherwise, include all frames. */
1095 next_frame (frame
, minibuf
)
1097 Lisp_Object minibuf
;
1102 /* There must always be at least one frame in Vframe_list. */
1103 if (! CONSP (Vframe_list
))
1106 /* If this frame is dead, it won't be in Vframe_list, and we'll loop
1107 forever. Forestall that. */
1108 CHECK_LIVE_FRAME (frame
);
1111 for (tail
= Vframe_list
; CONSP (tail
); tail
= XCDR (tail
))
1118 && ((!FRAME_TERMCAP_P (XFRAME (f
)) && !FRAME_TERMCAP_P (XFRAME (frame
))
1119 && FRAME_KBOARD (XFRAME (f
)) == FRAME_KBOARD (XFRAME (frame
)))
1120 || (FRAME_TERMCAP_P (XFRAME (f
)) && FRAME_TERMCAP_P (XFRAME (frame
))
1121 && FRAME_TTY (XFRAME (f
)) == FRAME_TTY (XFRAME (frame
)))))
1123 /* Decide whether this frame is eligible to be returned. */
1125 /* If we've looped all the way around without finding any
1126 eligible frames, return the original frame. */
1130 /* Let minibuf decide if this frame is acceptable. */
1133 if (! FRAME_MINIBUF_ONLY_P (XFRAME (f
)))
1136 else if (EQ (minibuf
, Qvisible
))
1138 FRAME_SAMPLE_VISIBILITY (XFRAME (f
));
1139 if (FRAME_VISIBLE_P (XFRAME (f
)))
1142 else if (INTEGERP (minibuf
) && XINT (minibuf
) == 0)
1144 FRAME_SAMPLE_VISIBILITY (XFRAME (f
));
1145 if (FRAME_VISIBLE_P (XFRAME (f
))
1146 || FRAME_ICONIFIED_P (XFRAME (f
)))
1149 else if (WINDOWP (minibuf
))
1151 if (EQ (FRAME_MINIBUF_WINDOW (XFRAME (f
)), minibuf
)
1152 || EQ (WINDOW_FRAME (XWINDOW (minibuf
)), f
)
1153 || EQ (WINDOW_FRAME (XWINDOW (minibuf
)),
1154 FRAME_FOCUS_FRAME (XFRAME (f
))))
1166 /* Return the previous frame in the frame list before FRAME.
1167 If MINIBUF is nil, exclude minibuffer-only frames.
1168 If MINIBUF is a window, include only its own frame
1169 and any frame now using that window as the minibuffer.
1170 If MINIBUF is `visible', include all visible frames.
1171 If MINIBUF is 0, include all visible and iconified frames.
1172 Otherwise, include all frames. */
1175 prev_frame (frame
, minibuf
)
1177 Lisp_Object minibuf
;
1182 /* There must always be at least one frame in Vframe_list. */
1183 if (! CONSP (Vframe_list
))
1187 for (tail
= Vframe_list
; CONSP (tail
); tail
= XCDR (tail
))
1195 if (EQ (frame
, f
) && !NILP (prev
))
1198 if ((!FRAME_TERMCAP_P (XFRAME (f
)) && !FRAME_TERMCAP_P (XFRAME (frame
))
1199 && FRAME_KBOARD (XFRAME (f
)) == FRAME_KBOARD (XFRAME (frame
)))
1200 || (FRAME_TERMCAP_P (XFRAME (f
)) && FRAME_TERMCAP_P (XFRAME (frame
))
1201 && FRAME_TTY (XFRAME (f
)) == FRAME_TTY (XFRAME (frame
))))
1203 /* Decide whether this frame is eligible to be returned,
1204 according to minibuf. */
1207 if (! FRAME_MINIBUF_ONLY_P (XFRAME (f
)))
1210 else if (WINDOWP (minibuf
))
1212 if (EQ (FRAME_MINIBUF_WINDOW (XFRAME (f
)), minibuf
)
1213 || EQ (WINDOW_FRAME (XWINDOW (minibuf
)), f
)
1214 || EQ (WINDOW_FRAME (XWINDOW (minibuf
)),
1215 FRAME_FOCUS_FRAME (XFRAME (f
))))
1218 else if (EQ (minibuf
, Qvisible
))
1220 FRAME_SAMPLE_VISIBILITY (XFRAME (f
));
1221 if (FRAME_VISIBLE_P (XFRAME (f
)))
1224 else if (XFASTINT (minibuf
) == 0)
1226 FRAME_SAMPLE_VISIBILITY (XFRAME (f
));
1227 if (FRAME_VISIBLE_P (XFRAME (f
))
1228 || FRAME_ICONIFIED_P (XFRAME (f
)))
1236 /* We've scanned the entire list. */
1238 /* We went through the whole frame list without finding a single
1239 acceptable frame. Return the original frame. */
1242 /* There were no acceptable frames in the list before FRAME; otherwise,
1243 we would have returned directly from the loop. Since PREV is the last
1244 acceptable frame in the list, return it. */
1249 DEFUN ("next-frame", Fnext_frame
, Snext_frame
, 0, 2, 0,
1250 doc
: /* Return the next frame in the frame list after FRAME.
1251 It considers only frames on the same terminal as FRAME.
1252 By default, skip minibuffer-only frames.
1253 If omitted, FRAME defaults to the selected frame.
1254 If optional argument MINIFRAME is nil, exclude minibuffer-only frames.
1255 If MINIFRAME is a window, include only its own frame
1256 and any frame now using that window as the minibuffer.
1257 If MINIFRAME is `visible', include all visible frames.
1258 If MINIFRAME is 0, include all visible and iconified frames.
1259 Otherwise, include all frames. */)
1261 Lisp_Object frame
, miniframe
;
1264 frame
= selected_frame
;
1266 CHECK_LIVE_FRAME (frame
);
1267 return next_frame (frame
, miniframe
);
1270 DEFUN ("previous-frame", Fprevious_frame
, Sprevious_frame
, 0, 2, 0,
1271 doc
: /* Return the previous frame in the frame list before FRAME.
1272 It considers only frames on the same terminal as FRAME.
1273 By default, skip minibuffer-only frames.
1274 If omitted, FRAME defaults to the selected frame.
1275 If optional argument MINIFRAME is nil, exclude minibuffer-only frames.
1276 If MINIFRAME is a window, include only its own frame
1277 and any frame now using that window as the minibuffer.
1278 If MINIFRAME is `visible', include all visible frames.
1279 If MINIFRAME is 0, include all visible and iconified frames.
1280 Otherwise, include all frames. */)
1282 Lisp_Object frame
, miniframe
;
1285 frame
= selected_frame
;
1286 CHECK_LIVE_FRAME (frame
);
1287 return prev_frame (frame
, miniframe
);
1290 /* Return 1 if it is ok to delete frame F;
1291 0 if all frames aside from F are invisible.
1292 (Exception: if F is the terminal frame, and we are using X, return 1.) */
1295 other_visible_frames (f
)
1298 /* We know the selected frame is visible,
1299 so if F is some other frame, it can't be the sole visible one. */
1300 if (f
== SELECTED_FRAME ())
1305 for (frames
= Vframe_list
;
1307 frames
= XCDR (frames
))
1311 this = XCAR (frames
);
1312 /* Verify that the frame's window still exists
1313 and we can still talk to it. And note any recent change
1315 #ifdef HAVE_WINDOW_SYSTEM
1316 if (FRAME_WINDOW_P (XFRAME (this)))
1318 x_sync (XFRAME (this));
1319 FRAME_SAMPLE_VISIBILITY (XFRAME (this));
1323 if (FRAME_VISIBLE_P (XFRAME (this))
1324 || FRAME_ICONIFIED_P (XFRAME (this))
1325 /* Allow deleting the terminal frame when at least
1326 one X frame exists! */
1327 || (FRAME_WINDOW_P (XFRAME (this)) && !FRAME_WINDOW_P (f
)))
1335 /* Error handler for `delete-frame-functions'. */
1337 delete_frame_handler (Lisp_Object arg
)
1339 add_to_log ("Error during `delete-frame': %s", arg
, Qnil
);
1343 DEFUN ("delete-frame", Fdelete_frame
, Sdelete_frame
, 0, 2, "",
1344 doc
: /* Delete FRAME, permanently eliminating it from use.
1345 If omitted, FRAME defaults to the selected frame.
1346 A frame may not be deleted if its minibuffer is used by other frames.
1347 Normally, you may not delete a frame if all other frames are invisible,
1348 but if the second optional argument FORCE is non-nil, you may do so.
1350 This function runs `delete-frame-functions' before actually deleting the
1351 frame, unless the frame is a tooltip.
1352 The functions are run with one arg, the frame to be deleted. */)
1354 Lisp_Object frame
, force
;
1357 struct frame
*sf
= SELECTED_FRAME ();
1360 int minibuffer_selected
;
1362 if (EQ (frame
, Qnil
))
1365 XSETFRAME (frame
, f
);
1369 CHECK_FRAME (frame
);
1373 if (! FRAME_LIVE_P (f
))
1376 if (NILP (force
) && !other_visible_frames (f
)
1378 /* Terminal frame deleted before any other visible frames are
1380 && strcmp (SDATA (f
->name
), "F1") != 0
1383 error ("Attempt to delete the sole visible or iconified frame");
1386 /* This is a nice idea, but x_connection_closed needs to be able
1387 to delete the last frame, if it is gone. */
1388 if (NILP (XCDR (Vframe_list
)))
1389 error ("Attempt to delete the only frame");
1392 /* Does this frame have a minibuffer, and is it the surrogate
1393 minibuffer for any other frame? */
1394 if (FRAME_HAS_MINIBUF_P (XFRAME (frame
)))
1398 for (frames
= Vframe_list
;
1400 frames
= XCDR (frames
))
1403 this = XCAR (frames
);
1405 if (! EQ (this, frame
)
1407 WINDOW_FRAME (XWINDOW
1408 (FRAME_MINIBUF_WINDOW (XFRAME (this))))))
1409 error ("Attempt to delete a surrogate minibuffer frame");
1413 /* Run `delete-frame-functions' unless frame is a tooltip. */
1414 if (!NILP (Vrun_hooks
)
1415 && NILP (Fframe_parameter (frame
, intern ("tooltip"))))
1417 Lisp_Object args
[2];
1418 struct gcpro gcpro1
, gcpro2
;
1420 /* Don't let a rogue function in `delete-frame-functions'
1421 prevent the frame deletion. */
1422 GCPRO2 (args
[0], args
[1]);
1423 args
[0] = intern ("delete-frame-functions");
1425 internal_condition_case_2 (Frun_hook_with_args
, 2, args
,
1426 Qt
, delete_frame_handler
);
1430 /* The hook may sometimes (indirectly) cause the frame to be deleted. */
1431 if (! FRAME_LIVE_P (f
))
1434 minibuffer_selected
= EQ (minibuf_window
, selected_window
);
1436 /* Don't let the frame remain selected. */
1439 Lisp_Object tail
, frame1
;
1441 /* Look for another visible frame on the same terminal. */
1442 frame1
= next_frame (frame
, Qvisible
);
1444 /* If there is none, find *some* other frame. */
1445 if (NILP (frame1
) || EQ (frame1
, frame
))
1447 FOR_EACH_FRAME (tail
, frame1
)
1449 if (! EQ (frame
, frame1
) && FRAME_LIVE_P (XFRAME (frame1
)))
1454 do_switch_frame (frame1
, 0, 1);
1455 sf
= SELECTED_FRAME ();
1458 /* Don't allow minibuf_window to remain on a deleted frame. */
1459 if (EQ (f
->minibuffer_window
, minibuf_window
))
1461 Fset_window_buffer (sf
->minibuffer_window
,
1462 XWINDOW (minibuf_window
)->buffer
, Qnil
);
1463 minibuf_window
= sf
->minibuffer_window
;
1465 /* If the dying minibuffer window was selected,
1466 select the new one. */
1467 if (minibuffer_selected
)
1468 Fselect_window (minibuf_window
, Qnil
);
1471 /* Don't let echo_area_window to remain on a deleted frame. */
1472 if (EQ (f
->minibuffer_window
, echo_area_window
))
1473 echo_area_window
= sf
->minibuffer_window
;
1475 /* Don't allow other frames to refer to a deleted frame in their
1476 'environment parameter. */
1478 Lisp_Object tail
, frame1
;
1479 Lisp_Object env
= get_frame_param (XFRAME (frame
), Qenvironment
);
1480 FOR_EACH_FRAME (tail
, frame1
)
1482 if (EQ (frame
, frame1
) || !FRAME_LIVE_P (XFRAME (frame1
)))
1484 if (EQ (frame
, get_frame_param (XFRAME (frame1
), Qenvironment
)))
1486 store_frame_param (XFRAME (frame1
), Qenvironment
, env
);
1493 /* Clear any X selections for this frame. */
1494 #ifdef HAVE_X_WINDOWS
1496 x_clear_frame_selections (f
);
1499 if (FRAME_MAC_P (f
))
1500 x_clear_frame_selections (f
);
1504 This function must be called before the window tree of the
1505 frame is deleted because windows contain dynamically allocated
1509 /* Mark all the windows that used to be on FRAME as deleted, and then
1510 remove the reference to them. */
1511 delete_all_subwindows (XWINDOW (f
->root_window
));
1512 f
->root_window
= Qnil
;
1514 Vframe_list
= Fdelq (frame
, Vframe_list
);
1515 FRAME_SET_VISIBLE (f
, 0);
1519 if (f
->decode_mode_spec_buffer
)
1520 xfree (f
->decode_mode_spec_buffer
);
1521 if (FRAME_INSERT_COST (f
))
1522 xfree (FRAME_INSERT_COST (f
));
1523 if (FRAME_DELETEN_COST (f
))
1524 xfree (FRAME_DELETEN_COST (f
));
1525 if (FRAME_INSERTN_COST (f
))
1526 xfree (FRAME_INSERTN_COST (f
));
1527 if (FRAME_DELETE_COST (f
))
1528 xfree (FRAME_DELETE_COST (f
));
1529 if (FRAME_MESSAGE_BUF (f
))
1530 xfree (FRAME_MESSAGE_BUF (f
));
1532 /* Since some events are handled at the interrupt level, we may get
1533 an event for f at any time; if we zero out the frame's terminal
1534 now, then we may trip up the event-handling code. Instead, we'll
1535 promise that the terminal of the frame must be valid until we
1536 have called the window-system-dependent frame destruction
1539 if (FRAME_TERMINAL (f
)->delete_frame_hook
)
1540 (*FRAME_TERMINAL (f
)->delete_frame_hook
) (f
);
1543 struct terminal
*terminal
= FRAME_TERMINAL (f
);
1544 f
->output_data
.nothing
= 0;
1545 f
->terminal
= 0; /* Now the frame is dead. */
1547 /* If needed, delete the terminal that this frame was on.
1548 (This must be done after the frame is killed.) */
1549 terminal
->reference_count
--;
1550 if (terminal
->reference_count
== 0)
1553 if (terminal
->delete_terminal_hook
)
1554 (*terminal
->delete_terminal_hook
) (terminal
);
1556 delete_terminal (terminal
);
1560 kb
= terminal
->kboard
;
1564 /* If we've deleted the last_nonminibuf_frame, then try to find
1566 if (f
== last_nonminibuf_frame
)
1570 last_nonminibuf_frame
= 0;
1572 for (frames
= Vframe_list
;
1574 frames
= XCDR (frames
))
1576 f
= XFRAME (XCAR (frames
));
1577 if (!FRAME_MINIBUF_ONLY_P (f
))
1579 last_nonminibuf_frame
= f
;
1585 /* If there's no other frame on the same kboard, get out of
1586 single-kboard state if we're in it for this kboard. */
1590 /* Some frame we found on the same kboard, or nil if there are none. */
1591 Lisp_Object frame_on_same_kboard
;
1593 frame_on_same_kboard
= Qnil
;
1595 for (frames
= Vframe_list
;
1597 frames
= XCDR (frames
))
1602 this = XCAR (frames
);
1607 if (kb
== FRAME_KBOARD (f1
))
1608 frame_on_same_kboard
= this;
1611 if (NILP (frame_on_same_kboard
))
1612 not_single_kboard_state (kb
);
1616 /* If we've deleted this keyboard's default_minibuffer_frame, try to
1617 find another one. Prefer minibuffer-only frames, but also notice
1618 frames with other windows. */
1619 if (kb
!= NULL
&& EQ (frame
, kb
->Vdefault_minibuffer_frame
))
1623 /* The last frame we saw with a minibuffer, minibuffer-only or not. */
1624 Lisp_Object frame_with_minibuf
;
1625 /* Some frame we found on the same kboard, or nil if there are none. */
1626 Lisp_Object frame_on_same_kboard
;
1628 frame_on_same_kboard
= Qnil
;
1629 frame_with_minibuf
= Qnil
;
1631 for (frames
= Vframe_list
;
1633 frames
= XCDR (frames
))
1638 this = XCAR (frames
);
1643 /* Consider only frames on the same kboard
1644 and only those with minibuffers. */
1645 if (kb
== FRAME_KBOARD (f1
)
1646 && FRAME_HAS_MINIBUF_P (f1
))
1648 frame_with_minibuf
= this;
1649 if (FRAME_MINIBUF_ONLY_P (f1
))
1653 if (kb
== FRAME_KBOARD (f1
))
1654 frame_on_same_kboard
= this;
1657 if (!NILP (frame_on_same_kboard
))
1659 /* We know that there must be some frame with a minibuffer out
1660 there. If this were not true, all of the frames present
1661 would have to be minibufferless, which implies that at some
1662 point their minibuffer frames must have been deleted, but
1663 that is prohibited at the top; you can't delete surrogate
1664 minibuffer frames. */
1665 if (NILP (frame_with_minibuf
))
1668 kb
->Vdefault_minibuffer_frame
= frame_with_minibuf
;
1671 /* No frames left on this kboard--say no minibuffer either. */
1672 kb
->Vdefault_minibuffer_frame
= Qnil
;
1675 /* Cause frame titles to update--necessary if we now have just one frame. */
1676 update_mode_lines
= 1;
1681 /* Return mouse position in character cell units. */
1683 DEFUN ("mouse-position", Fmouse_position
, Smouse_position
, 0, 0, 0,
1684 doc
: /* Return a list (FRAME X . Y) giving the current mouse frame and position.
1685 The position is given in character cells, where (0, 0) is the
1686 upper-left corner of the frame, X is the horizontal offset, and Y is
1687 the vertical offset.
1688 If Emacs is running on a mouseless terminal or hasn't been programmed
1689 to read the mouse position, it returns the selected frame for FRAME
1690 and nil for X and Y.
1691 If `mouse-position-function' is non-nil, `mouse-position' calls it,
1692 passing the normal return value to that function as an argument,
1693 and returns whatever that function returns. */)
1697 Lisp_Object lispy_dummy
;
1698 enum scroll_bar_part party_dummy
;
1699 Lisp_Object x
, y
, retval
;
1701 unsigned long long_dummy
;
1702 struct gcpro gcpro1
;
1704 f
= SELECTED_FRAME ();
1708 /* It's okay for the hook to refrain from storing anything. */
1709 if (FRAME_TERMINAL (f
)->mouse_position_hook
)
1710 (*FRAME_TERMINAL (f
)->mouse_position_hook
) (&f
, -1,
1711 &lispy_dummy
, &party_dummy
,
1718 pixel_to_glyph_coords (f
, col
, row
, &col
, &row
, NULL
, 1);
1723 XSETFRAME (lispy_dummy
, f
);
1724 retval
= Fcons (lispy_dummy
, Fcons (x
, y
));
1726 if (!NILP (Vmouse_position_function
))
1727 retval
= call1 (Vmouse_position_function
, retval
);
1728 RETURN_UNGCPRO (retval
);
1731 DEFUN ("mouse-pixel-position", Fmouse_pixel_position
,
1732 Smouse_pixel_position
, 0, 0, 0,
1733 doc
: /* Return a list (FRAME X . Y) giving the current mouse frame and position.
1734 The position is given in pixel units, where (0, 0) is the
1735 upper-left corner of the frame, X is the horizontal offset, and Y is
1736 the vertical offset.
1737 If Emacs is running on a mouseless terminal or hasn't been programmed
1738 to read the mouse position, it returns the selected frame for FRAME
1739 and nil for X and Y. */)
1743 Lisp_Object lispy_dummy
;
1744 enum scroll_bar_part party_dummy
;
1746 unsigned long long_dummy
;
1748 f
= SELECTED_FRAME ();
1752 /* It's okay for the hook to refrain from storing anything. */
1753 if (FRAME_TERMINAL (f
)->mouse_position_hook
)
1754 (*FRAME_TERMINAL (f
)->mouse_position_hook
) (&f
, -1,
1755 &lispy_dummy
, &party_dummy
,
1759 XSETFRAME (lispy_dummy
, f
);
1760 return Fcons (lispy_dummy
, Fcons (x
, y
));
1763 DEFUN ("set-mouse-position", Fset_mouse_position
, Sset_mouse_position
, 3, 3, 0,
1764 doc
: /* Move the mouse pointer to the center of character cell (X,Y) in FRAME.
1765 Coordinates are relative to the frame, not a window,
1766 so the coordinates of the top left character in the frame
1767 may be nonzero due to left-hand scroll bars or the menu bar.
1769 The position is given in character cells, where (0, 0) is the
1770 upper-left corner of the frame, X is the horizontal offset, and Y is
1771 the vertical offset.
1773 This function is a no-op for an X frame that is not visible.
1774 If you have just created a frame, you must wait for it to become visible
1775 before calling this function on it, like this.
1776 (while (not (frame-visible-p frame)) (sleep-for .5)) */)
1778 Lisp_Object frame
, x
, y
;
1780 CHECK_LIVE_FRAME (frame
);
1784 /* I think this should be done with a hook. */
1785 #ifdef HAVE_WINDOW_SYSTEM
1786 if (FRAME_WINDOW_P (XFRAME (frame
)))
1787 /* Warping the mouse will cause enternotify and focus events. */
1788 x_set_mouse_position (XFRAME (frame
), XINT (x
), XINT (y
));
1790 #if defined (MSDOS) && defined (HAVE_MOUSE)
1791 if (FRAME_MSDOS_P (XFRAME (frame
)))
1793 Fselect_frame (frame
);
1794 mouse_moveto (XINT (x
), XINT (y
));
1802 DEFUN ("set-mouse-pixel-position", Fset_mouse_pixel_position
,
1803 Sset_mouse_pixel_position
, 3, 3, 0,
1804 doc
: /* Move the mouse pointer to pixel position (X,Y) in FRAME.
1805 The position is given in pixels, where (0, 0) is the upper-left corner
1806 of the frame, X is the horizontal offset, and Y is the vertical offset.
1808 Note, this is a no-op for an X frame that is not visible.
1809 If you have just created a frame, you must wait for it to become visible
1810 before calling this function on it, like this.
1811 (while (not (frame-visible-p frame)) (sleep-for .5)) */)
1813 Lisp_Object frame
, x
, y
;
1815 CHECK_LIVE_FRAME (frame
);
1819 /* I think this should be done with a hook. */
1820 #ifdef HAVE_WINDOW_SYSTEM
1821 if (FRAME_WINDOW_P (XFRAME (frame
)))
1822 /* Warping the mouse will cause enternotify and focus events. */
1823 x_set_mouse_pixel_position (XFRAME (frame
), XINT (x
), XINT (y
));
1825 #if defined (MSDOS) && defined (HAVE_MOUSE)
1826 if (FRAME_MSDOS_P (XFRAME (frame
)))
1828 Fselect_frame (frame
);
1829 mouse_moveto (XINT (x
), XINT (y
));
1837 static void make_frame_visible_1
P_ ((Lisp_Object
));
1839 DEFUN ("make-frame-visible", Fmake_frame_visible
, Smake_frame_visible
,
1841 doc
: /* Make the frame FRAME visible (assuming it is an X window).
1842 If omitted, FRAME defaults to the currently selected frame. */)
1847 frame
= selected_frame
;
1849 CHECK_LIVE_FRAME (frame
);
1851 /* I think this should be done with a hook. */
1852 #ifdef HAVE_WINDOW_SYSTEM
1853 if (FRAME_WINDOW_P (XFRAME (frame
)))
1855 FRAME_SAMPLE_VISIBILITY (XFRAME (frame
));
1856 x_make_frame_visible (XFRAME (frame
));
1860 make_frame_visible_1 (XFRAME (frame
)->root_window
);
1862 /* Make menu bar update for the Buffers and Frames menus. */
1863 windows_or_buffers_changed
++;
1868 /* Update the display_time slot of the buffers shown in WINDOW
1869 and all its descendents. */
1872 make_frame_visible_1 (window
)
1877 for (;!NILP (window
); window
= w
->next
)
1879 w
= XWINDOW (window
);
1881 if (!NILP (w
->buffer
))
1882 XBUFFER (w
->buffer
)->display_time
= Fcurrent_time ();
1884 if (!NILP (w
->vchild
))
1885 make_frame_visible_1 (w
->vchild
);
1886 if (!NILP (w
->hchild
))
1887 make_frame_visible_1 (w
->hchild
);
1891 DEFUN ("make-frame-invisible", Fmake_frame_invisible
, Smake_frame_invisible
,
1893 doc
: /* Make the frame FRAME invisible (assuming it is an X window).
1894 If omitted, FRAME defaults to the currently selected frame.
1895 Normally you may not make FRAME invisible if all other frames are invisible,
1896 but if the second optional argument FORCE is non-nil, you may do so. */)
1898 Lisp_Object frame
, force
;
1901 frame
= selected_frame
;
1903 CHECK_LIVE_FRAME (frame
);
1905 if (NILP (force
) && !other_visible_frames (XFRAME (frame
)))
1906 error ("Attempt to make invisible the sole visible or iconified frame");
1908 #if 0 /* This isn't logically necessary, and it can do GC. */
1909 /* Don't let the frame remain selected. */
1910 if (EQ (frame
, selected_frame
))
1911 do_switch_frame (next_frame (frame
, Qt
), 0, 0)
1914 /* Don't allow minibuf_window to remain on a deleted frame. */
1915 if (EQ (XFRAME (frame
)->minibuffer_window
, minibuf_window
))
1917 struct frame
*sf
= XFRAME (selected_frame
);
1918 Fset_window_buffer (sf
->minibuffer_window
,
1919 XWINDOW (minibuf_window
)->buffer
, Qnil
);
1920 minibuf_window
= sf
->minibuffer_window
;
1923 /* I think this should be done with a hook. */
1924 #ifdef HAVE_WINDOW_SYSTEM
1925 if (FRAME_WINDOW_P (XFRAME (frame
)))
1926 x_make_frame_invisible (XFRAME (frame
));
1929 /* Make menu bar update for the Buffers and Frames menus. */
1930 windows_or_buffers_changed
++;
1935 DEFUN ("iconify-frame", Ficonify_frame
, Siconify_frame
,
1937 doc
: /* Make the frame FRAME into an icon.
1938 If omitted, FRAME defaults to the currently selected frame. */)
1943 frame
= selected_frame
;
1945 CHECK_LIVE_FRAME (frame
);
1947 #if 0 /* This isn't logically necessary, and it can do GC. */
1948 /* Don't let the frame remain selected. */
1949 if (EQ (frame
, selected_frame
))
1950 Fhandle_switch_frame (next_frame (frame
, Qt
));
1953 /* Don't allow minibuf_window to remain on a deleted frame. */
1954 if (EQ (XFRAME (frame
)->minibuffer_window
, minibuf_window
))
1956 struct frame
*sf
= XFRAME (selected_frame
);
1957 Fset_window_buffer (sf
->minibuffer_window
,
1958 XWINDOW (minibuf_window
)->buffer
, Qnil
);
1959 minibuf_window
= sf
->minibuffer_window
;
1962 /* I think this should be done with a hook. */
1963 #ifdef HAVE_WINDOW_SYSTEM
1964 if (FRAME_WINDOW_P (XFRAME (frame
)))
1965 x_iconify_frame (XFRAME (frame
));
1968 /* Make menu bar update for the Buffers and Frames menus. */
1969 windows_or_buffers_changed
++;
1974 DEFUN ("frame-visible-p", Fframe_visible_p
, Sframe_visible_p
,
1976 doc
: /* Return t if FRAME is now \"visible\" (actually in use for display).
1977 A frame that is not \"visible\" is not updated and, if it works through
1978 a window system, it may not show at all.
1979 Return the symbol `icon' if frame is visible only as an icon.
1981 On a text-only terminal, all frames are considered visible, whether
1982 they are currently being displayed or not, and this function returns t
1987 CHECK_LIVE_FRAME (frame
);
1989 FRAME_SAMPLE_VISIBILITY (XFRAME (frame
));
1991 if (FRAME_VISIBLE_P (XFRAME (frame
)))
1993 if (FRAME_ICONIFIED_P (XFRAME (frame
)))
1998 DEFUN ("visible-frame-list", Fvisible_frame_list
, Svisible_frame_list
,
2000 doc
: /* Return a list of all frames now \"visible\" (being updated). */)
2003 Lisp_Object tail
, frame
;
2008 for (tail
= Vframe_list
; CONSP (tail
); tail
= XCDR (tail
))
2010 frame
= XCAR (tail
);
2011 if (!FRAMEP (frame
))
2014 if (FRAME_VISIBLE_P (f
))
2015 value
= Fcons (frame
, value
);
2021 DEFUN ("raise-frame", Fraise_frame
, Sraise_frame
, 0, 1, "",
2022 doc
: /* Bring FRAME to the front, so it occludes any frames it overlaps.
2023 If FRAME is invisible or iconified, make it visible.
2024 If you don't specify a frame, the selected frame is used.
2025 If Emacs is displaying on an ordinary terminal or some other device which
2026 doesn't support multiple overlapping frames, this function does nothing. */)
2032 frame
= selected_frame
;
2034 CHECK_LIVE_FRAME (frame
);
2038 /* Do like the documentation says. */
2039 Fmake_frame_visible (frame
);
2041 if (FRAME_TERMINAL (f
)->frame_raise_lower_hook
)
2042 (*FRAME_TERMINAL (f
)->frame_raise_lower_hook
) (f
, 1);
2047 /* Should we have a corresponding function called Flower_Power? */
2048 DEFUN ("lower-frame", Flower_frame
, Slower_frame
, 0, 1, "",
2049 doc
: /* Send FRAME to the back, so it is occluded by any frames that overlap it.
2050 If you don't specify a frame, the selected frame is used.
2051 If Emacs is displaying on an ordinary terminal or some other device which
2052 doesn't support multiple overlapping frames, this function does nothing. */)
2059 frame
= selected_frame
;
2061 CHECK_LIVE_FRAME (frame
);
2065 if (FRAME_TERMINAL (f
)->frame_raise_lower_hook
)
2066 (*FRAME_TERMINAL (f
)->frame_raise_lower_hook
) (f
, 0);
2072 DEFUN ("redirect-frame-focus", Fredirect_frame_focus
, Sredirect_frame_focus
,
2074 doc
: /* Arrange for keystrokes typed at FRAME to be sent to FOCUS-FRAME.
2075 In other words, switch-frame events caused by events in FRAME will
2076 request a switch to FOCUS-FRAME, and `last-event-frame' will be
2077 FOCUS-FRAME after reading an event typed at FRAME.
2079 If FOCUS-FRAME is omitted or nil, any existing redirection is
2080 cancelled, and the frame again receives its own keystrokes.
2082 Focus redirection is useful for temporarily redirecting keystrokes to
2083 a surrogate minibuffer frame when a frame doesn't have its own
2086 A frame's focus redirection can be changed by `select-frame'. If frame
2087 FOO is selected, and then a different frame BAR is selected, any
2088 frames redirecting their focus to FOO are shifted to redirect their
2089 focus to BAR. This allows focus redirection to work properly when the
2090 user switches from one frame to another using `select-window'.
2092 This means that a frame whose focus is redirected to itself is treated
2093 differently from a frame whose focus is redirected to nil; the former
2094 is affected by `select-frame', while the latter is not.
2096 The redirection lasts until `redirect-frame-focus' is called to change it. */)
2097 (frame
, focus_frame
)
2098 Lisp_Object frame
, focus_frame
;
2102 /* Note that we don't check for a live frame here. It's reasonable
2103 to redirect the focus of a frame you're about to delete, if you
2104 know what other frame should receive those keystrokes. */
2105 CHECK_FRAME (frame
);
2107 if (! NILP (focus_frame
))
2108 CHECK_LIVE_FRAME (focus_frame
);
2112 f
->focus_frame
= focus_frame
;
2114 if (FRAME_TERMINAL (f
)->frame_rehighlight_hook
)
2115 (*FRAME_TERMINAL (f
)->frame_rehighlight_hook
) (f
);
2121 DEFUN ("frame-focus", Fframe_focus
, Sframe_focus
, 1, 1, 0,
2122 doc
: /* Return the frame to which FRAME's keystrokes are currently being sent.
2123 This returns nil if FRAME's focus is not redirected.
2124 See `redirect-frame-focus'. */)
2128 CHECK_LIVE_FRAME (frame
);
2130 return FRAME_FOCUS_FRAME (XFRAME (frame
));
2135 /* Return the value of frame parameter PROP in frame FRAME. */
2138 get_frame_param (frame
, prop
)
2139 register struct frame
*frame
;
2142 register Lisp_Object tem
;
2144 tem
= Fassq (prop
, frame
->param_alist
);
2150 /* Return the buffer-predicate of the selected frame. */
2153 frame_buffer_predicate (frame
)
2156 return XFRAME (frame
)->buffer_predicate
;
2159 /* Return the buffer-list of the selected frame. */
2162 frame_buffer_list (frame
)
2165 return XFRAME (frame
)->buffer_list
;
2168 /* Set the buffer-list of the selected frame. */
2171 set_frame_buffer_list (frame
, list
)
2172 Lisp_Object frame
, list
;
2174 XFRAME (frame
)->buffer_list
= list
;
2177 /* Discard BUFFER from the buffer-list and buried-buffer-list of each frame. */
2180 frames_discard_buffer (buffer
)
2183 Lisp_Object frame
, tail
;
2185 FOR_EACH_FRAME (tail
, frame
)
2187 XFRAME (frame
)->buffer_list
2188 = Fdelq (buffer
, XFRAME (frame
)->buffer_list
);
2189 XFRAME (frame
)->buried_buffer_list
2190 = Fdelq (buffer
, XFRAME (frame
)->buried_buffer_list
);
2194 /* Modify the alist in *ALISTPTR to associate PROP with VAL.
2195 If the alist already has an element for PROP, we change it. */
2198 store_in_alist (alistptr
, prop
, val
)
2199 Lisp_Object
*alistptr
, val
;
2202 register Lisp_Object tem
;
2204 tem
= Fassq (prop
, *alistptr
);
2206 *alistptr
= Fcons (Fcons (prop
, val
), *alistptr
);
2212 frame_name_fnn_p (str
, len
)
2216 if (len
> 1 && str
[0] == 'F')
2220 strtol (str
+ 1, &end_ptr
, 10);
2222 if (end_ptr
== str
+ len
)
2228 /* Set the name of the terminal frame. Also used by MSDOS frames.
2229 Modeled after x_set_name which is used for WINDOW frames. */
2232 set_term_frame_name (f
, name
)
2236 f
->explicit_name
= ! NILP (name
);
2238 /* If NAME is nil, set the name to F<num>. */
2243 /* Check for no change needed in this very common case
2244 before we do any consing. */
2245 if (frame_name_fnn_p (SDATA (f
->name
),
2250 sprintf (namebuf
, "F%d", tty_frame_count
);
2251 name
= build_string (namebuf
);
2255 CHECK_STRING (name
);
2257 /* Don't change the name if it's already NAME. */
2258 if (! NILP (Fstring_equal (name
, f
->name
)))
2261 /* Don't allow the user to set the frame name to F<num>, so it
2262 doesn't clash with the names we generate for terminal frames. */
2263 if (frame_name_fnn_p (SDATA (name
), SBYTES (name
)))
2264 error ("Frame names of the form F<num> are usurped by Emacs");
2268 update_mode_lines
= 1;
2272 store_frame_param (f
, prop
, val
)
2274 Lisp_Object prop
, val
;
2276 register Lisp_Object old_alist_elt
;
2278 /* The buffer-list parameters are stored in a special place and not
2280 if (EQ (prop
, Qbuffer_list
))
2282 f
->buffer_list
= val
;
2285 if (EQ (prop
, Qburied_buffer_list
))
2287 f
->buried_buffer_list
= val
;
2291 /* If PROP is a symbol which is supposed to have frame-local values,
2292 and it is set up based on this frame, switch to the global
2293 binding. That way, we can create or alter the frame-local binding
2294 without messing up the symbol's status. */
2297 Lisp_Object valcontents
;
2298 valcontents
= SYMBOL_VALUE (prop
);
2299 if ((BUFFER_LOCAL_VALUEP (valcontents
)
2300 || SOME_BUFFER_LOCAL_VALUEP (valcontents
))
2301 && XBUFFER_LOCAL_VALUE (valcontents
)->check_frame
2302 && XBUFFER_LOCAL_VALUE (valcontents
)->found_for_frame
2303 && XFRAME (XBUFFER_LOCAL_VALUE (valcontents
)->frame
) == f
)
2304 swap_in_global_binding (prop
);
2308 /* The tty color mode needs to be set before the frame's parameter
2309 alist is updated with the new value, because set_tty_color_mode
2310 wants to look at the old mode. */
2311 if (FRAME_TERMCAP_P (f
) && EQ (prop
, Qtty_color_mode
))
2312 set_tty_color_mode (f
, val
);
2315 /* Update the frame parameter alist. */
2316 old_alist_elt
= Fassq (prop
, f
->param_alist
);
2317 if (EQ (old_alist_elt
, Qnil
))
2318 f
->param_alist
= Fcons (Fcons (prop
, val
), f
->param_alist
);
2320 Fsetcdr (old_alist_elt
, val
);
2322 /* Update some other special parameters in their special places
2323 in addition to the alist. */
2325 if (EQ (prop
, Qbuffer_predicate
))
2326 f
->buffer_predicate
= val
;
2328 if (! FRAME_WINDOW_P (f
))
2330 if (EQ (prop
, Qmenu_bar_lines
))
2331 set_menu_bar_lines (f
, val
, make_number (FRAME_MENU_BAR_LINES (f
)));
2332 else if (EQ (prop
, Qname
))
2333 set_term_frame_name (f
, val
);
2336 if (EQ (prop
, Qminibuffer
) && WINDOWP (val
))
2338 if (! MINI_WINDOW_P (XWINDOW (val
)))
2339 error ("Surrogate minibuffer windows must be minibuffer windows");
2341 if ((FRAME_HAS_MINIBUF_P (f
) || FRAME_MINIBUF_ONLY_P (f
))
2342 && !EQ (val
, f
->minibuffer_window
))
2343 error ("Can't change the surrogate minibuffer of a frame with its own minibuffer");
2345 /* Install the chosen minibuffer window, with proper buffer. */
2346 f
->minibuffer_window
= val
;
2350 DEFUN ("frame-parameters", Fframe_parameters
, Sframe_parameters
, 0, 1, 0,
2351 doc
: /* Return the parameters-alist of frame FRAME.
2352 It is a list of elements of the form (PARM . VALUE), where PARM is a symbol.
2353 The meaningful PARMs depend on the kind of frame.
2354 If FRAME is omitted, return information on the currently selected frame. */)
2361 struct gcpro gcpro1
;
2364 frame
= selected_frame
;
2366 CHECK_FRAME (frame
);
2369 if (!FRAME_LIVE_P (f
))
2372 alist
= Fcopy_alist (f
->param_alist
);
2375 if (!FRAME_WINDOW_P (f
))
2377 int fg
= FRAME_FOREGROUND_PIXEL (f
);
2378 int bg
= FRAME_BACKGROUND_PIXEL (f
);
2381 /* If the frame's parameter alist says the colors are
2382 unspecified and reversed, take the frame's background pixel
2383 for foreground and vice versa. */
2384 elt
= Fassq (Qforeground_color
, alist
);
2385 if (!NILP (elt
) && CONSP (elt
) && STRINGP (XCDR (elt
)))
2387 if (strncmp (SDATA (XCDR (elt
)),
2389 SCHARS (XCDR (elt
))) == 0)
2390 store_in_alist (&alist
, Qforeground_color
, tty_color_name (f
, bg
));
2391 else if (strncmp (SDATA (XCDR (elt
)),
2393 SCHARS (XCDR (elt
))) == 0)
2394 store_in_alist (&alist
, Qforeground_color
, tty_color_name (f
, fg
));
2397 store_in_alist (&alist
, Qforeground_color
, tty_color_name (f
, fg
));
2398 elt
= Fassq (Qbackground_color
, alist
);
2399 if (!NILP (elt
) && CONSP (elt
) && STRINGP (XCDR (elt
)))
2401 if (strncmp (SDATA (XCDR (elt
)),
2403 SCHARS (XCDR (elt
))) == 0)
2404 store_in_alist (&alist
, Qbackground_color
, tty_color_name (f
, fg
));
2405 else if (strncmp (SDATA (XCDR (elt
)),
2407 SCHARS (XCDR (elt
))) == 0)
2408 store_in_alist (&alist
, Qbackground_color
, tty_color_name (f
, bg
));
2411 store_in_alist (&alist
, Qbackground_color
, tty_color_name (f
, bg
));
2412 store_in_alist (&alist
, intern ("font"),
2413 build_string (FRAME_MSDOS_P (f
)
2415 : FRAME_W32_P (f
) ? "w32term"
2418 store_in_alist (&alist
, Qname
, f
->name
);
2419 height
= (f
->new_text_lines
? f
->new_text_lines
: FRAME_LINES (f
));
2420 store_in_alist (&alist
, Qheight
, make_number (height
));
2421 width
= (f
->new_text_cols
? f
->new_text_cols
: FRAME_COLS (f
));
2422 store_in_alist (&alist
, Qwidth
, make_number (width
));
2423 store_in_alist (&alist
, Qmodeline
, (FRAME_WANTS_MODELINE_P (f
) ? Qt
: Qnil
));
2424 store_in_alist (&alist
, Qminibuffer
,
2425 (! FRAME_HAS_MINIBUF_P (f
) ? Qnil
2426 : FRAME_MINIBUF_ONLY_P (f
) ? Qonly
2427 : FRAME_MINIBUF_WINDOW (f
)));
2428 store_in_alist (&alist
, Qunsplittable
, (FRAME_NO_SPLIT_P (f
) ? Qt
: Qnil
));
2429 store_in_alist (&alist
, Qbuffer_list
, frame_buffer_list (frame
));
2430 store_in_alist (&alist
, Qburied_buffer_list
, XFRAME (frame
)->buried_buffer_list
);
2432 /* I think this should be done with a hook. */
2433 #ifdef HAVE_WINDOW_SYSTEM
2434 if (FRAME_WINDOW_P (f
))
2435 x_report_frame_params (f
, &alist
);
2439 /* This ought to be correct in f->param_alist for an X frame. */
2441 XSETFASTINT (lines
, FRAME_MENU_BAR_LINES (f
));
2442 store_in_alist (&alist
, Qmenu_bar_lines
, lines
);
2450 DEFUN ("frame-parameter", Fframe_parameter
, Sframe_parameter
, 2, 2, 0,
2451 doc
: /* Return FRAME's value for parameter PARAMETER.
2452 If FRAME is nil, describe the currently selected frame. */)
2454 Lisp_Object frame
, parameter
;
2460 frame
= selected_frame
;
2462 CHECK_FRAME (frame
);
2463 CHECK_SYMBOL (parameter
);
2468 if (FRAME_LIVE_P (f
))
2470 /* Avoid consing in frequent cases. */
2471 if (EQ (parameter
, Qname
))
2473 #ifdef HAVE_X_WINDOWS
2474 else if (EQ (parameter
, Qdisplay
) && FRAME_X_P (f
))
2475 value
= XCAR (FRAME_X_DISPLAY_INFO (f
)->name_list_element
);
2476 #endif /* HAVE_X_WINDOWS */
2477 else if (EQ (parameter
, Qbackground_color
)
2478 || EQ (parameter
, Qforeground_color
))
2480 value
= Fassq (parameter
, f
->param_alist
);
2483 value
= XCDR (value
);
2484 /* Fframe_parameters puts the actual fg/bg color names,
2485 even if f->param_alist says otherwise. This is
2486 important when param_alist's notion of colors is
2487 "unspecified". We need to do the same here. */
2488 if (STRINGP (value
) && !FRAME_WINDOW_P (f
))
2490 const char *color_name
;
2493 if (EQ (parameter
, Qbackground_color
))
2495 color_name
= SDATA (value
);
2496 csz
= SCHARS (value
);
2497 if (strncmp (color_name
, unspecified_bg
, csz
) == 0)
2498 value
= tty_color_name (f
, FRAME_BACKGROUND_PIXEL (f
));
2499 else if (strncmp (color_name
, unspecified_fg
, csz
) == 0)
2500 value
= tty_color_name (f
, FRAME_FOREGROUND_PIXEL (f
));
2502 else if (EQ (parameter
, Qforeground_color
))
2504 color_name
= SDATA (value
);
2505 csz
= SCHARS (value
);
2506 if (strncmp (color_name
, unspecified_fg
, csz
) == 0)
2507 value
= tty_color_name (f
, FRAME_FOREGROUND_PIXEL (f
));
2508 else if (strncmp (color_name
, unspecified_bg
, csz
) == 0)
2509 value
= tty_color_name (f
, FRAME_BACKGROUND_PIXEL (f
));
2514 value
= Fcdr (Fassq (parameter
, Fframe_parameters (frame
)));
2516 else if (EQ (parameter
, Qdisplay_type
)
2517 || EQ (parameter
, Qbackground_mode
))
2518 value
= Fcdr (Fassq (parameter
, f
->param_alist
));
2520 value
= Fcdr (Fassq (parameter
, Fframe_parameters (frame
)));
2527 DEFUN ("modify-frame-parameters", Fmodify_frame_parameters
,
2528 Smodify_frame_parameters
, 2, 2, 0,
2529 doc
: /* Modify the parameters of frame FRAME according to ALIST.
2530 If FRAME is nil, it defaults to the selected frame.
2531 ALIST is an alist of parameters to change and their new values.
2532 Each element of ALIST has the form (PARM . VALUE), where PARM is a symbol.
2533 The meaningful PARMs depend on the kind of frame.
2534 Undefined PARMs are ignored, but stored in the frame's parameter list
2535 so that `frame-parameters' will return them.
2537 The value of frame parameter FOO can also be accessed
2538 as a frame-local binding for the variable FOO, if you have
2539 enabled such bindings for that variable with `make-variable-frame-local'. */)
2541 Lisp_Object frame
, alist
;
2544 register Lisp_Object tail
, prop
, val
;
2546 if (EQ (frame
, Qnil
))
2547 frame
= selected_frame
;
2548 CHECK_LIVE_FRAME (frame
);
2551 /* I think this should be done with a hook. */
2552 #ifdef HAVE_WINDOW_SYSTEM
2553 if (FRAME_WINDOW_P (f
))
2554 x_set_frame_parameters (f
, alist
);
2558 if (FRAME_MSDOS_P (f
))
2559 IT_set_frame_parameters (f
, alist
);
2564 int length
= XINT (Flength (alist
));
2567 = (Lisp_Object
*) alloca (length
* sizeof (Lisp_Object
));
2569 = (Lisp_Object
*) alloca (length
* sizeof (Lisp_Object
));
2571 /* Extract parm names and values into those vectors. */
2574 for (tail
= alist
; CONSP (tail
); tail
= Fcdr (tail
))
2579 parms
[i
] = Fcar (elt
);
2580 values
[i
] = Fcdr (elt
);
2584 /* Now process them in reverse of specified order. */
2585 for (i
--; i
>= 0; i
--)
2589 store_frame_param (f
, prop
, val
);
2591 /* Changing the background color might change the background
2592 mode, so that we have to load new defface specs.
2593 Call frame-set-background-mode to do that. */
2594 if (EQ (prop
, Qbackground_color
))
2595 call1 (Qframe_set_background_mode
, frame
);
2600 DEFUN ("frame-with-environment", Fframe_with_environment
, Sframe_with_environment
, 0, 1, 0,
2601 doc
: /* Return the frame that has the environment variable list for FRAME.
2603 The frame-local environment variable list is normally shared between
2604 frames that were created in the same Emacsclient session. The
2605 environment list is stored in a single frame's 'environment parameter;
2606 the other frames' 'environment parameter is set to this frame. This
2607 function follows the chain of 'environment references to reach the
2608 frame that stores the actual local environment list, and returns that
2613 Lisp_Object hare
, tortoise
;
2616 frame
= selected_frame
;
2617 CHECK_FRAME (frame
);
2619 hare
= tortoise
= get_frame_param (XFRAME (frame
), Qenvironment
);
2620 while (!NILP (hare
) && FRAMEP (hare
))
2623 hare
= get_frame_param (XFRAME (hare
), Qenvironment
);
2624 if (NILP (hare
) || !FRAMEP (hare
))
2627 hare
= get_frame_param (XFRAME (hare
), Qenvironment
);
2628 tortoise
= get_frame_param (XFRAME (tortoise
), Qenvironment
);
2629 if (EQ (hare
, tortoise
))
2630 error ("Cyclic frame-local environment indirection");
2637 DEFUN ("frame-char-height", Fframe_char_height
, Sframe_char_height
,
2639 doc
: /* Height in pixels of a line in the font in frame FRAME.
2640 If FRAME is omitted, the selected frame is used.
2641 For a terminal frame, the value is always 1. */)
2648 frame
= selected_frame
;
2649 CHECK_FRAME (frame
);
2652 #ifdef HAVE_WINDOW_SYSTEM
2653 if (FRAME_WINDOW_P (f
))
2654 return make_number (x_char_height (f
));
2657 return make_number (1);
2661 DEFUN ("frame-char-width", Fframe_char_width
, Sframe_char_width
,
2663 doc
: /* Width in pixels of characters in the font in frame FRAME.
2664 If FRAME is omitted, the selected frame is used.
2665 On a graphical screen, the width is the standard width of the default font.
2666 For a terminal screen, the value is always 1. */)
2673 frame
= selected_frame
;
2674 CHECK_FRAME (frame
);
2677 #ifdef HAVE_WINDOW_SYSTEM
2678 if (FRAME_WINDOW_P (f
))
2679 return make_number (x_char_width (f
));
2682 return make_number (1);
2685 DEFUN ("frame-pixel-height", Fframe_pixel_height
,
2686 Sframe_pixel_height
, 0, 1, 0,
2687 doc
: /* Return a FRAME's height in pixels.
2688 This counts only the height available for text lines,
2689 not menu bars on window-system Emacs frames.
2690 For a terminal frame, the result really gives the height in characters.
2691 If FRAME is omitted, the selected frame is used. */)
2698 frame
= selected_frame
;
2699 CHECK_FRAME (frame
);
2702 #ifdef HAVE_WINDOW_SYSTEM
2703 if (FRAME_WINDOW_P (f
))
2704 return make_number (x_pixel_height (f
));
2707 return make_number (FRAME_LINES (f
));
2710 DEFUN ("frame-pixel-width", Fframe_pixel_width
,
2711 Sframe_pixel_width
, 0, 1, 0,
2712 doc
: /* Return FRAME's width in pixels.
2713 For a terminal frame, the result really gives the width in characters.
2714 If FRAME is omitted, the selected frame is used. */)
2721 frame
= selected_frame
;
2722 CHECK_FRAME (frame
);
2725 #ifdef HAVE_WINDOW_SYSTEM
2726 if (FRAME_WINDOW_P (f
))
2727 return make_number (x_pixel_width (f
));
2730 return make_number (FRAME_COLS (f
));
2733 DEFUN ("set-frame-height", Fset_frame_height
, Sset_frame_height
, 2, 3, 0,
2734 doc
: /* Specify that the frame FRAME has LINES lines.
2735 Optional third arg non-nil means that redisplay should use LINES lines
2736 but that the idea of the actual height of the frame should not be changed. */)
2737 (frame
, lines
, pretend
)
2738 Lisp_Object frame
, lines
, pretend
;
2740 register struct frame
*f
;
2742 CHECK_NUMBER (lines
);
2744 frame
= selected_frame
;
2745 CHECK_LIVE_FRAME (frame
);
2748 /* I think this should be done with a hook. */
2749 #ifdef HAVE_WINDOW_SYSTEM
2750 if (FRAME_WINDOW_P (f
))
2752 if (XINT (lines
) != FRAME_LINES (f
))
2753 x_set_window_size (f
, 1, FRAME_COLS (f
), XINT (lines
));
2754 do_pending_window_change (0);
2758 change_frame_size (f
, XINT (lines
), 0, !NILP (pretend
), 0, 0);
2762 DEFUN ("set-frame-width", Fset_frame_width
, Sset_frame_width
, 2, 3, 0,
2763 doc
: /* Specify that the frame FRAME has COLS columns.
2764 Optional third arg non-nil means that redisplay should use COLS columns
2765 but that the idea of the actual width of the frame should not be changed. */)
2766 (frame
, cols
, pretend
)
2767 Lisp_Object frame
, cols
, pretend
;
2769 register struct frame
*f
;
2770 CHECK_NUMBER (cols
);
2772 frame
= selected_frame
;
2773 CHECK_LIVE_FRAME (frame
);
2776 /* I think this should be done with a hook. */
2777 #ifdef HAVE_WINDOW_SYSTEM
2778 if (FRAME_WINDOW_P (f
))
2780 if (XINT (cols
) != FRAME_COLS (f
))
2781 x_set_window_size (f
, 1, XINT (cols
), FRAME_LINES (f
));
2782 do_pending_window_change (0);
2786 change_frame_size (f
, 0, XINT (cols
), !NILP (pretend
), 0, 0);
2790 DEFUN ("set-frame-size", Fset_frame_size
, Sset_frame_size
, 3, 3, 0,
2791 doc
: /* Sets size of FRAME to COLS by ROWS, measured in characters. */)
2793 Lisp_Object frame
, cols
, rows
;
2795 register struct frame
*f
;
2797 CHECK_LIVE_FRAME (frame
);
2798 CHECK_NUMBER (cols
);
2799 CHECK_NUMBER (rows
);
2802 /* I think this should be done with a hook. */
2803 #ifdef HAVE_WINDOW_SYSTEM
2804 if (FRAME_WINDOW_P (f
))
2806 if (XINT (rows
) != FRAME_LINES (f
)
2807 || XINT (cols
) != FRAME_COLS (f
)
2808 || f
->new_text_lines
|| f
->new_text_cols
)
2809 x_set_window_size (f
, 1, XINT (cols
), XINT (rows
));
2810 do_pending_window_change (0);
2814 change_frame_size (f
, XINT (rows
), XINT (cols
), 0, 0, 0);
2819 DEFUN ("set-frame-position", Fset_frame_position
,
2820 Sset_frame_position
, 3, 3, 0,
2821 doc
: /* Sets position of FRAME in pixels to XOFFSET by YOFFSET.
2822 This is actually the position of the upper left corner of the frame.
2823 Negative values for XOFFSET or YOFFSET are interpreted relative to
2824 the rightmost or bottommost possible position (that stays within the screen). */)
2825 (frame
, xoffset
, yoffset
)
2826 Lisp_Object frame
, xoffset
, yoffset
;
2828 register struct frame
*f
;
2830 CHECK_LIVE_FRAME (frame
);
2831 CHECK_NUMBER (xoffset
);
2832 CHECK_NUMBER (yoffset
);
2835 /* I think this should be done with a hook. */
2836 #ifdef HAVE_WINDOW_SYSTEM
2837 if (FRAME_WINDOW_P (f
))
2838 x_set_offset (f
, XINT (xoffset
), XINT (yoffset
), 1);
2845 /***********************************************************************
2847 ***********************************************************************/
2849 /* Connect the frame-parameter names for X frames
2850 to the ways of passing the parameter values to the window system.
2852 The name of a parameter, as a Lisp symbol,
2853 has an `x-frame-parameter' property which is an integer in Lisp
2854 that is an index in this table. */
2856 struct frame_parm_table
{
2858 Lisp_Object
*variable
;
2861 static struct frame_parm_table frame_parms
[] =
2863 {"auto-raise", &Qauto_raise
},
2864 {"auto-lower", &Qauto_lower
},
2865 {"background-color", 0},
2866 {"border-color", &Qborder_color
},
2867 {"border-width", &Qborder_width
},
2868 {"cursor-color", &Qcursor_color
},
2869 {"cursor-type", &Qcursor_type
},
2871 {"foreground-color", 0},
2872 {"icon-name", &Qicon_name
},
2873 {"icon-type", &Qicon_type
},
2874 {"internal-border-width", &Qinternal_border_width
},
2875 {"menu-bar-lines", &Qmenu_bar_lines
},
2876 {"mouse-color", &Qmouse_color
},
2878 {"scroll-bar-width", &Qscroll_bar_width
},
2880 {"unsplittable", &Qunsplittable
},
2881 {"vertical-scroll-bars", &Qvertical_scroll_bars
},
2882 {"visibility", &Qvisibility
},
2883 {"tool-bar-lines", &Qtool_bar_lines
},
2884 {"scroll-bar-foreground", &Qscroll_bar_foreground
},
2885 {"scroll-bar-background", &Qscroll_bar_background
},
2886 {"screen-gamma", &Qscreen_gamma
},
2887 {"line-spacing", &Qline_spacing
},
2888 {"left-fringe", &Qleft_fringe
},
2889 {"right-fringe", &Qright_fringe
},
2890 {"wait-for-wm", &Qwait_for_wm
},
2891 {"fullscreen", &Qfullscreen
},
2894 #ifdef HAVE_WINDOW_SYSTEM
2896 extern Lisp_Object Qbox
;
2897 extern Lisp_Object Qtop
;
2899 /* Calculate fullscreen size. Return in *TOP_POS and *LEFT_POS the
2900 wanted positions of the WM window (not Emacs window).
2901 Return in *WIDTH and *HEIGHT the wanted width and height of Emacs
2902 window (FRAME_X_WINDOW).
2906 x_fullscreen_adjust (f
, width
, height
, top_pos
, left_pos
)
2913 int newwidth
= FRAME_COLS (f
);
2914 int newheight
= FRAME_LINES (f
);
2916 *top_pos
= f
->top_pos
;
2917 *left_pos
= f
->left_pos
;
2919 if (f
->want_fullscreen
& FULLSCREEN_HEIGHT
)
2923 ph
= FRAME_X_DISPLAY_INFO (f
)->height
;
2924 newheight
= FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f
, ph
);
2925 ph
= FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f
, newheight
) - f
->y_pixels_diff
;
2926 newheight
= FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f
, ph
);
2930 if (f
->want_fullscreen
& FULLSCREEN_WIDTH
)
2934 pw
= FRAME_X_DISPLAY_INFO (f
)->width
;
2935 newwidth
= FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f
, pw
);
2936 pw
= FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f
, newwidth
) - f
->x_pixels_diff
;
2937 newwidth
= FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f
, pw
);
2942 *height
= newheight
;
2946 /* Change the parameters of frame F as specified by ALIST.
2947 If a parameter is not specially recognized, do nothing special;
2948 otherwise call the `x_set_...' function for that parameter.
2949 Except for certain geometry properties, always call store_frame_param
2950 to store the new value in the parameter alist. */
2953 x_set_frame_parameters (f
, alist
)
2959 /* If both of these parameters are present, it's more efficient to
2960 set them both at once. So we wait until we've looked at the
2961 entire list before we set them. */
2965 Lisp_Object left
, top
;
2967 /* Same with these. */
2968 Lisp_Object icon_left
, icon_top
;
2970 /* Record in these vectors all the parms specified. */
2972 Lisp_Object
*values
;
2974 int left_no_change
= 0, top_no_change
= 0;
2975 int icon_left_no_change
= 0, icon_top_no_change
= 0;
2976 int fullscreen_is_being_set
= 0;
2978 struct gcpro gcpro1
, gcpro2
;
2981 for (tail
= alist
; CONSP (tail
); tail
= Fcdr (tail
))
2984 parms
= (Lisp_Object
*) alloca (i
* sizeof (Lisp_Object
));
2985 values
= (Lisp_Object
*) alloca (i
* sizeof (Lisp_Object
));
2987 /* Extract parm names and values into those vectors. */
2990 for (tail
= alist
; CONSP (tail
); tail
= Fcdr (tail
))
2995 parms
[i
] = Fcar (elt
);
2996 values
[i
] = Fcdr (elt
);
2999 /* TAIL and ALIST are not used again below here. */
3000 alist
= tail
= Qnil
;
3002 GCPRO2 (*parms
, *values
);
3006 /* There is no need to gcpro LEFT, TOP, ICON_LEFT, or ICON_TOP,
3007 because their values appear in VALUES and strings are not valid. */
3008 top
= left
= Qunbound
;
3009 icon_left
= icon_top
= Qunbound
;
3011 /* Provide default values for HEIGHT and WIDTH. */
3012 width
= (f
->new_text_cols
? f
->new_text_cols
: FRAME_COLS (f
));
3013 height
= (f
->new_text_lines
? f
->new_text_lines
: FRAME_LINES (f
));
3015 /* Process foreground_color and background_color before anything else.
3016 They are independent of other properties, but other properties (e.g.,
3017 cursor_color) are dependent upon them. */
3018 /* Process default font as well, since fringe widths depends on it. */
3019 /* Also, process fullscreen, width and height depend upon that */
3020 for (p
= 0; p
< i
; p
++)
3022 Lisp_Object prop
, val
;
3026 if (EQ (prop
, Qforeground_color
)
3027 || EQ (prop
, Qbackground_color
)
3029 || EQ (prop
, Qfullscreen
))
3031 register Lisp_Object param_index
, old_value
;
3032 int count
= SPECPDL_INDEX ();
3034 old_value
= get_frame_param (f
, prop
);
3035 fullscreen_is_being_set
|= EQ (prop
, Qfullscreen
);
3037 if (NILP (Fequal (val
, old_value
)))
3039 /* For :font attributes, the frame_parm_handler
3040 x_set_font calls `face-set-after-frame-default'.
3041 Unless we bind inhibit-face-set-after-frame-default
3042 here, this would reset the :font attribute that we
3043 just applied to the default value for new faces. */
3044 specbind (Qinhibit_face_set_after_frame_default
, Qt
);
3046 store_frame_param (f
, prop
, val
);
3048 param_index
= Fget (prop
, Qx_frame_parameter
);
3049 if (NATNUMP (param_index
)
3050 && (XFASTINT (param_index
)
3051 < sizeof (frame_parms
)/sizeof (frame_parms
[0]))
3052 && FRAME_RIF (f
)->frame_parm_handlers
[XINT (param_index
)])
3053 (*(FRAME_RIF (f
)->frame_parm_handlers
[XINT (param_index
)])) (f
, val
, old_value
);
3054 unbind_to (count
, Qnil
);
3059 /* Now process them in reverse of specified order. */
3060 for (i
--; i
>= 0; i
--)
3062 Lisp_Object prop
, val
;
3067 if (EQ (prop
, Qwidth
) && NUMBERP (val
))
3068 width
= XFASTINT (val
);
3069 else if (EQ (prop
, Qheight
) && NUMBERP (val
))
3070 height
= XFASTINT (val
);
3071 else if (EQ (prop
, Qtop
))
3073 else if (EQ (prop
, Qleft
))
3075 else if (EQ (prop
, Qicon_top
))
3077 else if (EQ (prop
, Qicon_left
))
3079 else if (EQ (prop
, Qforeground_color
)
3080 || EQ (prop
, Qbackground_color
)
3082 || EQ (prop
, Qfullscreen
))
3083 /* Processed above. */
3087 register Lisp_Object param_index
, old_value
;
3089 old_value
= get_frame_param (f
, prop
);
3091 store_frame_param (f
, prop
, val
);
3093 param_index
= Fget (prop
, Qx_frame_parameter
);
3094 if (NATNUMP (param_index
)
3095 && (XFASTINT (param_index
)
3096 < sizeof (frame_parms
)/sizeof (frame_parms
[0]))
3097 && FRAME_RIF (f
)->frame_parm_handlers
[XINT (param_index
)])
3098 (*(FRAME_RIF (f
)->frame_parm_handlers
[XINT (param_index
)])) (f
, val
, old_value
);
3102 /* Don't die if just one of these was set. */
3103 if (EQ (left
, Qunbound
))
3106 if (f
->left_pos
< 0)
3107 left
= Fcons (Qplus
, Fcons (make_number (f
->left_pos
), Qnil
));
3109 XSETINT (left
, f
->left_pos
);
3111 if (EQ (top
, Qunbound
))
3115 top
= Fcons (Qplus
, Fcons (make_number (f
->top_pos
), Qnil
));
3117 XSETINT (top
, f
->top_pos
);
3120 /* If one of the icon positions was not set, preserve or default it. */
3121 if (EQ (icon_left
, Qunbound
) || ! INTEGERP (icon_left
))
3123 icon_left_no_change
= 1;
3124 icon_left
= Fcdr (Fassq (Qicon_left
, f
->param_alist
));
3125 if (NILP (icon_left
))
3126 XSETINT (icon_left
, 0);
3128 if (EQ (icon_top
, Qunbound
) || ! INTEGERP (icon_top
))
3130 icon_top_no_change
= 1;
3131 icon_top
= Fcdr (Fassq (Qicon_top
, f
->param_alist
));
3132 if (NILP (icon_top
))
3133 XSETINT (icon_top
, 0);
3136 if (FRAME_VISIBLE_P (f
) && fullscreen_is_being_set
)
3138 /* If the frame is visible already and the fullscreen parameter is
3139 being set, it is too late to set WM manager hints to specify
3141 Here we first get the width, height and position that applies to
3142 fullscreen. We then move the frame to the appropriate
3143 position. Resize of the frame is taken care of in the code after
3144 this if-statement. */
3145 int new_left
, new_top
;
3147 x_fullscreen_adjust (f
, &width
, &height
, &new_top
, &new_left
);
3148 if (new_top
!= f
->top_pos
|| new_left
!= f
->left_pos
)
3149 x_set_offset (f
, new_left
, new_top
, 1);
3152 /* Don't set these parameters unless they've been explicitly
3153 specified. The window might be mapped or resized while we're in
3154 this function, and we don't want to override that unless the lisp
3155 code has asked for it.
3157 Don't set these parameters unless they actually differ from the
3158 window's current parameters; the window may not actually exist
3163 check_frame_size (f
, &height
, &width
);
3165 XSETFRAME (frame
, f
);
3167 if (width
!= FRAME_COLS (f
)
3168 || height
!= FRAME_LINES (f
)
3169 || f
->new_text_lines
|| f
->new_text_cols
)
3170 Fset_frame_size (frame
, make_number (width
), make_number (height
));
3172 if ((!NILP (left
) || !NILP (top
))
3173 && ! (left_no_change
&& top_no_change
)
3174 && ! (NUMBERP (left
) && XINT (left
) == f
->left_pos
3175 && NUMBERP (top
) && XINT (top
) == f
->top_pos
))
3180 /* Record the signs. */
3181 f
->size_hint_flags
&= ~ (XNegative
| YNegative
);
3182 if (EQ (left
, Qminus
))
3183 f
->size_hint_flags
|= XNegative
;
3184 else if (INTEGERP (left
))
3186 leftpos
= XINT (left
);
3188 f
->size_hint_flags
|= XNegative
;
3190 else if (CONSP (left
) && EQ (XCAR (left
), Qminus
)
3191 && CONSP (XCDR (left
))
3192 && INTEGERP (XCAR (XCDR (left
))))
3194 leftpos
= - XINT (XCAR (XCDR (left
)));
3195 f
->size_hint_flags
|= XNegative
;
3197 else if (CONSP (left
) && EQ (XCAR (left
), Qplus
)
3198 && CONSP (XCDR (left
))
3199 && INTEGERP (XCAR (XCDR (left
))))
3201 leftpos
= XINT (XCAR (XCDR (left
)));
3204 if (EQ (top
, Qminus
))
3205 f
->size_hint_flags
|= YNegative
;
3206 else if (INTEGERP (top
))
3208 toppos
= XINT (top
);
3210 f
->size_hint_flags
|= YNegative
;
3212 else if (CONSP (top
) && EQ (XCAR (top
), Qminus
)
3213 && CONSP (XCDR (top
))
3214 && INTEGERP (XCAR (XCDR (top
))))
3216 toppos
= - XINT (XCAR (XCDR (top
)));
3217 f
->size_hint_flags
|= YNegative
;
3219 else if (CONSP (top
) && EQ (XCAR (top
), Qplus
)
3220 && CONSP (XCDR (top
))
3221 && INTEGERP (XCAR (XCDR (top
))))
3223 toppos
= XINT (XCAR (XCDR (top
)));
3227 /* Store the numeric value of the position. */
3228 f
->top_pos
= toppos
;
3229 f
->left_pos
= leftpos
;
3231 f
->win_gravity
= NorthWestGravity
;
3233 /* Actually set that position, and convert to absolute. */
3234 x_set_offset (f
, leftpos
, toppos
, -1);
3237 if ((!NILP (icon_left
) || !NILP (icon_top
))
3238 && ! (icon_left_no_change
&& icon_top_no_change
))
3239 x_wm_set_icon_position (f
, XINT (icon_left
), XINT (icon_top
));
3246 /* Insert a description of internally-recorded parameters of frame X
3247 into the parameter alist *ALISTPTR that is to be given to the user.
3248 Only parameters that are specific to the X window system
3249 and whose values are not correctly recorded in the frame's
3250 param_alist need to be considered here. */
3253 x_report_frame_params (f
, alistptr
)
3255 Lisp_Object
*alistptr
;
3260 /* Represent negative positions (off the top or left screen edge)
3261 in a way that Fmodify_frame_parameters will understand correctly. */
3262 XSETINT (tem
, f
->left_pos
);
3263 if (f
->left_pos
>= 0)
3264 store_in_alist (alistptr
, Qleft
, tem
);
3266 store_in_alist (alistptr
, Qleft
, Fcons (Qplus
, Fcons (tem
, Qnil
)));
3268 XSETINT (tem
, f
->top_pos
);
3269 if (f
->top_pos
>= 0)
3270 store_in_alist (alistptr
, Qtop
, tem
);
3272 store_in_alist (alistptr
, Qtop
, Fcons (Qplus
, Fcons (tem
, Qnil
)));
3274 store_in_alist (alistptr
, Qborder_width
,
3275 make_number (f
->border_width
));
3276 store_in_alist (alistptr
, Qinternal_border_width
,
3277 make_number (FRAME_INTERNAL_BORDER_WIDTH (f
)));
3278 store_in_alist (alistptr
, Qleft_fringe
,
3279 make_number (FRAME_LEFT_FRINGE_WIDTH (f
)));
3280 store_in_alist (alistptr
, Qright_fringe
,
3281 make_number (FRAME_RIGHT_FRINGE_WIDTH (f
)));
3282 store_in_alist (alistptr
, Qscroll_bar_width
,
3283 (! FRAME_HAS_VERTICAL_SCROLL_BARS (f
)
3285 : FRAME_CONFIG_SCROLL_BAR_WIDTH (f
) > 0
3286 ? make_number (FRAME_CONFIG_SCROLL_BAR_WIDTH (f
))
3287 /* nil means "use default width"
3288 for non-toolkit scroll bar.
3289 ruler-mode.el depends on this. */
3291 sprintf (buf
, "%ld", (long) FRAME_X_WINDOW (f
));
3292 store_in_alist (alistptr
, Qwindow_id
,
3293 build_string (buf
));
3294 #ifdef HAVE_X_WINDOWS
3295 #ifdef USE_X_TOOLKIT
3296 /* Tooltip frame may not have this widget. */
3297 if (FRAME_X_OUTPUT (f
)->widget
)
3299 sprintf (buf
, "%ld", (long) FRAME_OUTER_WINDOW (f
));
3300 store_in_alist (alistptr
, Qouter_window_id
,
3301 build_string (buf
));
3303 store_in_alist (alistptr
, Qicon_name
, f
->icon_name
);
3304 FRAME_SAMPLE_VISIBILITY (f
);
3305 store_in_alist (alistptr
, Qvisibility
,
3306 (FRAME_VISIBLE_P (f
) ? Qt
3307 : FRAME_ICONIFIED_P (f
) ? Qicon
: Qnil
));
3308 store_in_alist (alistptr
, Qdisplay
,
3309 XCAR (FRAME_X_DISPLAY_INFO (f
)->name_list_element
));
3311 if (FRAME_X_OUTPUT (f
)->parent_desc
== FRAME_X_DISPLAY_INFO (f
)->root_window
)
3314 XSETFASTINT (tem
, FRAME_X_OUTPUT (f
)->parent_desc
);
3315 store_in_alist (alistptr
, Qparent_id
, tem
);
3319 /* Change the `fullscreen' frame parameter of frame F. OLD_VALUE is
3320 the previous value of that parameter, NEW_VALUE is the new value. */
3323 x_set_fullscreen (f
, new_value
, old_value
)
3325 Lisp_Object new_value
, old_value
;
3327 if (NILP (new_value
))
3328 f
->want_fullscreen
= FULLSCREEN_NONE
;
3329 else if (EQ (new_value
, Qfullboth
))
3330 f
->want_fullscreen
= FULLSCREEN_BOTH
;
3331 else if (EQ (new_value
, Qfullwidth
))
3332 f
->want_fullscreen
= FULLSCREEN_WIDTH
;
3333 else if (EQ (new_value
, Qfullheight
))
3334 f
->want_fullscreen
= FULLSCREEN_HEIGHT
;
3336 if (FRAME_TERMINAL (f
)->fullscreen_hook
!= NULL
)
3337 FRAME_TERMINAL (f
)->fullscreen_hook (f
);
3341 /* Change the `line-spacing' frame parameter of frame F. OLD_VALUE is
3342 the previous value of that parameter, NEW_VALUE is the new value. */
3345 x_set_line_spacing (f
, new_value
, old_value
)
3347 Lisp_Object new_value
, old_value
;
3349 if (NILP (new_value
))
3350 f
->extra_line_spacing
= 0;
3351 else if (NATNUMP (new_value
))
3352 f
->extra_line_spacing
= XFASTINT (new_value
);
3354 signal_error ("Invalid line-spacing", new_value
);
3355 if (FRAME_VISIBLE_P (f
))
3360 /* Change the `screen-gamma' frame parameter of frame F. OLD_VALUE is
3361 the previous value of that parameter, NEW_VALUE is the new value. */
3364 x_set_screen_gamma (f
, new_value
, old_value
)
3366 Lisp_Object new_value
, old_value
;
3368 Lisp_Object bgcolor
;
3370 if (NILP (new_value
))
3372 else if (NUMBERP (new_value
) && XFLOATINT (new_value
) > 0)
3373 /* The value 0.4545 is the normal viewing gamma. */
3374 f
->gamma
= 1.0 / (0.4545 * XFLOATINT (new_value
));
3376 signal_error ("Invalid screen-gamma", new_value
);
3378 /* Apply the new gamma value to the frame background. */
3379 bgcolor
= Fassq (Qbackground_color
, f
->param_alist
);
3380 if (CONSP (bgcolor
) && (bgcolor
= XCDR (bgcolor
), STRINGP (bgcolor
)))
3382 Lisp_Object index
= Fget (Qbackground_color
, Qx_frame_parameter
);
3384 && (XFASTINT (index
)
3385 < sizeof (frame_parms
)/sizeof (frame_parms
[0]))
3386 && FRAME_RIF (f
)->frame_parm_handlers
[XFASTINT (index
)])
3387 (*FRAME_RIF (f
)->frame_parm_handlers
[XFASTINT (index
)])
3391 Fclear_face_cache (Qnil
);
3396 x_set_font (f
, arg
, oldval
)
3398 Lisp_Object arg
, oldval
;
3401 Lisp_Object fontset_name
;
3403 int old_fontset
= FRAME_FONTSET(f
);
3407 fontset_name
= Fquery_fontset (arg
, Qnil
);
3410 result
= (STRINGP (fontset_name
)
3411 ? x_new_fontset (f
, SDATA (fontset_name
))
3412 : x_new_font (f
, SDATA (arg
)));
3415 if (EQ (result
, Qnil
))
3416 error ("Font `%s' is not defined", SDATA (arg
));
3417 else if (EQ (result
, Qt
))
3418 error ("The characters of the given font have varying widths");
3419 else if (STRINGP (result
))
3421 set_default_ascii_font (result
);
3422 if (STRINGP (fontset_name
))
3424 /* Fontset names are built from ASCII font names, so the
3425 names may be equal despite there was a change. */
3426 if (old_fontset
== FRAME_FONTSET (f
))
3429 else if (!NILP (Fequal (result
, oldval
)))
3432 /* Recalculate toolbar height. */
3433 f
->n_tool_bar_rows
= 0;
3434 /* Ensure we redraw it. */
3435 clear_current_matrices (f
);
3437 store_frame_param (f
, Qfont
, result
);
3438 recompute_basic_faces (f
);
3443 do_pending_window_change (0);
3445 /* Don't call `face-set-after-frame-default' when faces haven't been
3446 initialized yet. This is the case when called from
3447 Fx_create_frame. In that case, the X widget or window doesn't
3448 exist either, and we can end up in x_report_frame_params with a
3449 null widget which gives a segfault. */
3450 if (FRAME_FACE_CACHE (f
))
3452 XSETFRAME (frame
, f
);
3453 call1 (Qface_set_after_frame_default
, frame
);
3459 x_set_fringe_width (f
, new_value
, old_value
)
3461 Lisp_Object new_value
, old_value
;
3463 compute_fringe_widths (f
, 1);
3467 x_set_border_width (f
, arg
, oldval
)
3469 Lisp_Object arg
, oldval
;
3473 if (XINT (arg
) == f
->border_width
)
3476 if (FRAME_X_WINDOW (f
) != 0)
3477 error ("Cannot change the border width of a frame");
3479 f
->border_width
= XINT (arg
);
3483 x_set_internal_border_width (f
, arg
, oldval
)
3485 Lisp_Object arg
, oldval
;
3487 int old
= FRAME_INTERNAL_BORDER_WIDTH (f
);
3490 FRAME_INTERNAL_BORDER_WIDTH (f
) = XINT (arg
);
3491 if (FRAME_INTERNAL_BORDER_WIDTH (f
) < 0)
3492 FRAME_INTERNAL_BORDER_WIDTH (f
) = 0;
3494 #ifdef USE_X_TOOLKIT
3495 if (FRAME_X_OUTPUT (f
)->edit_widget
)
3496 widget_store_internal_border (FRAME_X_OUTPUT (f
)->edit_widget
);
3499 if (FRAME_INTERNAL_BORDER_WIDTH (f
) == old
)
3502 if (FRAME_X_WINDOW (f
) != 0)
3504 x_set_window_size (f
, 0, FRAME_COLS (f
), FRAME_LINES (f
));
3505 SET_FRAME_GARBAGED (f
);
3506 do_pending_window_change (0);
3509 SET_FRAME_GARBAGED (f
);
3513 x_set_visibility (f
, value
, oldval
)
3515 Lisp_Object value
, oldval
;
3518 XSETFRAME (frame
, f
);
3521 Fmake_frame_invisible (frame
, Qt
);
3522 else if (EQ (value
, Qicon
))
3523 Ficonify_frame (frame
);
3525 Fmake_frame_visible (frame
);
3529 x_set_autoraise (f
, arg
, oldval
)
3531 Lisp_Object arg
, oldval
;
3533 f
->auto_raise
= !EQ (Qnil
, arg
);
3537 x_set_autolower (f
, arg
, oldval
)
3539 Lisp_Object arg
, oldval
;
3541 f
->auto_lower
= !EQ (Qnil
, arg
);
3545 x_set_unsplittable (f
, arg
, oldval
)
3547 Lisp_Object arg
, oldval
;
3549 f
->no_split
= !NILP (arg
);
3553 x_set_vertical_scroll_bars (f
, arg
, oldval
)
3555 Lisp_Object arg
, oldval
;
3557 if ((EQ (arg
, Qleft
) && FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f
))
3558 || (EQ (arg
, Qright
) && FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f
))
3559 || (NILP (arg
) && FRAME_HAS_VERTICAL_SCROLL_BARS (f
))
3560 || (!NILP (arg
) && ! FRAME_HAS_VERTICAL_SCROLL_BARS (f
)))
3562 FRAME_VERTICAL_SCROLL_BAR_TYPE (f
)
3564 ? vertical_scroll_bar_none
3566 ? vertical_scroll_bar_left
3568 ? vertical_scroll_bar_right
3569 : EQ (Qleft
, Vdefault_frame_scroll_bars
)
3570 ? vertical_scroll_bar_left
3571 : EQ (Qright
, Vdefault_frame_scroll_bars
)
3572 ? vertical_scroll_bar_right
3573 : vertical_scroll_bar_none
);
3575 /* We set this parameter before creating the X window for the
3576 frame, so we can get the geometry right from the start.
3577 However, if the window hasn't been created yet, we shouldn't
3578 call x_set_window_size. */
3579 if (FRAME_X_WINDOW (f
))
3580 x_set_window_size (f
, 0, FRAME_COLS (f
), FRAME_LINES (f
));
3581 do_pending_window_change (0);
3586 x_set_scroll_bar_width (f
, arg
, oldval
)
3588 Lisp_Object arg
, oldval
;
3590 int wid
= FRAME_COLUMN_WIDTH (f
);
3594 x_set_scroll_bar_default_width (f
);
3596 if (FRAME_X_WINDOW (f
))
3597 x_set_window_size (f
, 0, FRAME_COLS (f
), FRAME_LINES (f
));
3598 do_pending_window_change (0);
3600 else if (INTEGERP (arg
) && XINT (arg
) > 0
3601 && XFASTINT (arg
) != FRAME_CONFIG_SCROLL_BAR_WIDTH (f
))
3603 if (XFASTINT (arg
) <= 2 * VERTICAL_SCROLL_BAR_WIDTH_TRIM
)
3604 XSETINT (arg
, 2 * VERTICAL_SCROLL_BAR_WIDTH_TRIM
+ 1);
3606 FRAME_CONFIG_SCROLL_BAR_WIDTH (f
) = XFASTINT (arg
);
3607 FRAME_CONFIG_SCROLL_BAR_COLS (f
) = (XFASTINT (arg
) + wid
-1) / wid
;
3608 if (FRAME_X_WINDOW (f
))
3609 x_set_window_size (f
, 0, FRAME_COLS (f
), FRAME_LINES (f
));
3610 do_pending_window_change (0);
3613 change_frame_size (f
, 0, FRAME_COLS (f
), 0, 0, 0);
3614 XWINDOW (FRAME_SELECTED_WINDOW (f
))->cursor
.hpos
= 0;
3615 XWINDOW (FRAME_SELECTED_WINDOW (f
))->cursor
.x
= 0;
3620 /* Return non-nil if frame F wants a bitmap icon. */
3628 tem
= assq_no_quit (Qicon_type
, f
->param_alist
);
3636 /* Subroutines of creating an X frame. */
3638 /* Make sure that Vx_resource_name is set to a reasonable value.
3639 Fix it up, or set it to `emacs' if it is too hopeless. */
3642 validate_x_resource_name ()
3645 /* Number of valid characters in the resource name. */
3647 /* Number of invalid characters in the resource name. */
3652 if (!STRINGP (Vx_resource_class
))
3653 Vx_resource_class
= build_string (EMACS_CLASS
);
3655 if (STRINGP (Vx_resource_name
))
3657 unsigned char *p
= SDATA (Vx_resource_name
);
3660 len
= SBYTES (Vx_resource_name
);
3662 /* Only letters, digits, - and _ are valid in resource names.
3663 Count the valid characters and count the invalid ones. */
3664 for (i
= 0; i
< len
; i
++)
3667 if (! ((c
>= 'a' && c
<= 'z')
3668 || (c
>= 'A' && c
<= 'Z')
3669 || (c
>= '0' && c
<= '9')
3670 || c
== '-' || c
== '_'))
3677 /* Not a string => completely invalid. */
3678 bad_count
= 5, good_count
= 0;
3680 /* If name is valid already, return. */
3684 /* If name is entirely invalid, or nearly so, use `emacs'. */
3686 || (good_count
== 1 && bad_count
> 0))
3688 Vx_resource_name
= build_string ("emacs");
3692 /* Name is partly valid. Copy it and replace the invalid characters
3693 with underscores. */
3695 Vx_resource_name
= new = Fcopy_sequence (Vx_resource_name
);
3697 for (i
= 0; i
< len
; i
++)
3699 int c
= SREF (new, i
);
3700 if (! ((c
>= 'a' && c
<= 'z')
3701 || (c
>= 'A' && c
<= 'Z')
3702 || (c
>= '0' && c
<= '9')
3703 || c
== '-' || c
== '_'))
3709 extern char *x_get_string_resource
P_ ((XrmDatabase
, char *, char *));
3710 extern Display_Info
*check_x_display_info
P_ ((Lisp_Object
));
3713 /* Get specified attribute from resource database RDB.
3714 See Fx_get_resource below for other parameters. */
3717 xrdb_get_resource (rdb
, attribute
, class, component
, subclass
)
3719 Lisp_Object attribute
, class, component
, subclass
;
3721 register char *value
;
3725 CHECK_STRING (attribute
);
3726 CHECK_STRING (class);
3728 if (!NILP (component
))
3729 CHECK_STRING (component
);
3730 if (!NILP (subclass
))
3731 CHECK_STRING (subclass
);
3732 if (NILP (component
) != NILP (subclass
))
3733 error ("x-get-resource: must specify both COMPONENT and SUBCLASS or neither");
3735 validate_x_resource_name ();
3737 /* Allocate space for the components, the dots which separate them,
3738 and the final '\0'. Make them big enough for the worst case. */
3739 name_key
= (char *) alloca (SBYTES (Vx_resource_name
)
3740 + (STRINGP (component
)
3741 ? SBYTES (component
) : 0)
3742 + SBYTES (attribute
)
3745 class_key
= (char *) alloca (SBYTES (Vx_resource_class
)
3747 + (STRINGP (subclass
)
3748 ? SBYTES (subclass
) : 0)
3751 /* Start with emacs.FRAMENAME for the name (the specific one)
3752 and with `Emacs' for the class key (the general one). */
3753 strcpy (name_key
, SDATA (Vx_resource_name
));
3754 strcpy (class_key
, SDATA (Vx_resource_class
));
3756 strcat (class_key
, ".");
3757 strcat (class_key
, SDATA (class));
3759 if (!NILP (component
))
3761 strcat (class_key
, ".");
3762 strcat (class_key
, SDATA (subclass
));
3764 strcat (name_key
, ".");
3765 strcat (name_key
, SDATA (component
));
3768 strcat (name_key
, ".");
3769 strcat (name_key
, SDATA (attribute
));
3771 value
= x_get_string_resource (rdb
, name_key
, class_key
);
3773 if (value
!= (char *) 0)
3774 return build_string (value
);
3780 DEFUN ("x-get-resource", Fx_get_resource
, Sx_get_resource
, 2, 4, 0,
3781 doc
: /* Return the value of ATTRIBUTE, of class CLASS, from the X defaults database.
3782 This uses `INSTANCE.ATTRIBUTE' as the key and `Emacs.CLASS' as the
3783 class, where INSTANCE is the name under which Emacs was invoked, or
3784 the name specified by the `-name' or `-rn' command-line arguments.
3786 The optional arguments COMPONENT and SUBCLASS add to the key and the
3787 class, respectively. You must specify both of them or neither.
3788 If you specify them, the key is `INSTANCE.COMPONENT.ATTRIBUTE'
3789 and the class is `Emacs.CLASS.SUBCLASS'. */)
3790 (attribute
, class, component
, subclass
)
3791 Lisp_Object attribute
, class, component
, subclass
;
3793 #ifdef HAVE_X_WINDOWS
3797 return xrdb_get_resource (check_x_display_info (Qnil
)->xrdb
,
3798 attribute
, class, component
, subclass
);
3801 /* Get an X resource, like Fx_get_resource, but for display DPYINFO. */
3804 display_x_get_resource (dpyinfo
, attribute
, class, component
, subclass
)
3805 Display_Info
*dpyinfo
;
3806 Lisp_Object attribute
, class, component
, subclass
;
3808 return xrdb_get_resource (dpyinfo
->xrdb
,
3809 attribute
, class, component
, subclass
);
3812 /* Used when C code wants a resource value. */
3815 x_get_resource_string (attribute
, class)
3816 char *attribute
, *class;
3820 struct frame
*sf
= SELECTED_FRAME ();
3822 /* Allocate space for the components, the dots which separate them,
3823 and the final '\0'. */
3824 name_key
= (char *) alloca (SBYTES (Vinvocation_name
)
3825 + strlen (attribute
) + 2);
3826 class_key
= (char *) alloca ((sizeof (EMACS_CLASS
) - 1)
3827 + strlen (class) + 2);
3829 sprintf (name_key
, "%s.%s", SDATA (Vinvocation_name
), attribute
);
3830 sprintf (class_key
, "%s.%s", EMACS_CLASS
, class);
3832 return x_get_string_resource (FRAME_X_DISPLAY_INFO (sf
)->xrdb
,
3833 name_key
, class_key
);
3837 /* Return the value of parameter PARAM.
3839 First search ALIST, then Vdefault_frame_alist, then the X defaults
3840 database, using ATTRIBUTE as the attribute name and CLASS as its class.
3842 Convert the resource to the type specified by desired_type.
3844 If no default is specified, return Qunbound. If you call
3845 x_get_arg, make sure you deal with Qunbound in a reasonable way,
3846 and don't let it get stored in any Lisp-visible variables! */
3849 x_get_arg (dpyinfo
, alist
, param
, attribute
, class, type
)
3850 Display_Info
*dpyinfo
;
3851 Lisp_Object alist
, param
;
3854 enum resource_types type
;
3856 register Lisp_Object tem
;
3858 tem
= Fassq (param
, alist
);
3862 /* If we find this parm in ALIST, clear it out
3863 so that it won't be "left over" at the end. */
3864 #ifndef WINDOWSNT /* w32fns.c has not yet been changed to cope with this. */
3866 XSETCAR (tem
, Qnil
);
3867 /* In case the parameter appears more than once in the alist,
3869 for (tail
= alist
; CONSP (tail
); tail
= XCDR (tail
))
3870 if (CONSP (XCAR (tail
))
3871 && EQ (XCAR (XCAR (tail
)), param
))
3872 XSETCAR (XCAR (tail
), Qnil
);
3876 tem
= Fassq (param
, Vdefault_frame_alist
);
3878 /* If it wasn't specified in ALIST or the Lisp-level defaults,
3879 look in the X resources. */
3884 tem
= display_x_get_resource (dpyinfo
,
3885 build_string (attribute
),
3886 build_string (class),
3894 case RES_TYPE_NUMBER
:
3895 return make_number (atoi (SDATA (tem
)));
3897 case RES_TYPE_FLOAT
:
3898 return make_float (atof (SDATA (tem
)));
3900 case RES_TYPE_BOOLEAN
:
3901 tem
= Fdowncase (tem
);
3902 if (!strcmp (SDATA (tem
), "on")
3903 || !strcmp (SDATA (tem
), "true"))
3908 case RES_TYPE_STRING
:
3911 case RES_TYPE_SYMBOL
:
3912 /* As a special case, we map the values `true' and `on'
3913 to Qt, and `false' and `off' to Qnil. */
3916 lower
= Fdowncase (tem
);
3917 if (!strcmp (SDATA (lower
), "on")
3918 || !strcmp (SDATA (lower
), "true"))
3920 else if (!strcmp (SDATA (lower
), "off")
3921 || !strcmp (SDATA (lower
), "false"))
3924 return Fintern (tem
, Qnil
);
3938 x_frame_get_arg (f
, alist
, param
, attribute
, class, type
)
3940 Lisp_Object alist
, param
;
3943 enum resource_types type
;
3945 return x_get_arg (FRAME_X_DISPLAY_INFO (f
),
3946 alist
, param
, attribute
, class, type
);
3949 /* Like x_frame_get_arg, but also record the value in f->param_alist. */
3952 x_frame_get_and_record_arg (f
, alist
, param
, attribute
, class, type
)
3954 Lisp_Object alist
, param
;
3957 enum resource_types type
;
3961 value
= x_get_arg (FRAME_X_DISPLAY_INFO (f
), alist
, param
,
3962 attribute
, class, type
);
3963 if (! NILP (value
) && ! EQ (value
, Qunbound
))
3964 store_frame_param (f
, param
, value
);
3970 /* Record in frame F the specified or default value according to ALIST
3971 of the parameter named PROP (a Lisp symbol).
3972 If no value is specified for PROP, look for an X default for XPROP
3973 on the frame named NAME.
3974 If that is not found either, use the value DEFLT. */
3977 x_default_parameter (f
, alist
, prop
, deflt
, xprop
, xclass
, type
)
3984 enum resource_types type
;
3988 tem
= x_frame_get_arg (f
, alist
, prop
, xprop
, xclass
, type
);
3989 if (EQ (tem
, Qunbound
))
3991 x_set_frame_parameters (f
, Fcons (Fcons (prop
, tem
), Qnil
));
3998 DEFUN ("x-parse-geometry", Fx_parse_geometry
, Sx_parse_geometry
, 1, 1, 0,
3999 doc
: /* Parse an X-style geometry string STRING.
4000 Returns an alist of the form ((top . TOP), (left . LEFT) ... ).
4001 The properties returned may include `top', `left', `height', and `width'.
4002 The value of `left' or `top' may be an integer,
4003 or a list (+ N) meaning N pixels relative to top/left corner,
4004 or a list (- N) meaning -N pixels relative to bottom/right corner. */)
4009 unsigned int width
, height
;
4012 CHECK_STRING (string
);
4014 geometry
= XParseGeometry ((char *) SDATA (string
),
4015 &x
, &y
, &width
, &height
);
4018 if (!!(geometry
& XValue
) != !!(geometry
& YValue
))
4019 error ("Must specify both x and y position, or neither");
4023 if (geometry
& XValue
)
4025 Lisp_Object element
;
4027 if (x
>= 0 && (geometry
& XNegative
))
4028 element
= Fcons (Qleft
, Fcons (Qminus
, Fcons (make_number (-x
), Qnil
)));
4029 else if (x
< 0 && ! (geometry
& XNegative
))
4030 element
= Fcons (Qleft
, Fcons (Qplus
, Fcons (make_number (x
), Qnil
)));
4032 element
= Fcons (Qleft
, make_number (x
));
4033 result
= Fcons (element
, result
);
4036 if (geometry
& YValue
)
4038 Lisp_Object element
;
4040 if (y
>= 0 && (geometry
& YNegative
))
4041 element
= Fcons (Qtop
, Fcons (Qminus
, Fcons (make_number (-y
), Qnil
)));
4042 else if (y
< 0 && ! (geometry
& YNegative
))
4043 element
= Fcons (Qtop
, Fcons (Qplus
, Fcons (make_number (y
), Qnil
)));
4045 element
= Fcons (Qtop
, make_number (y
));
4046 result
= Fcons (element
, result
);
4049 if (geometry
& WidthValue
)
4050 result
= Fcons (Fcons (Qwidth
, make_number (width
)), result
);
4051 if (geometry
& HeightValue
)
4052 result
= Fcons (Fcons (Qheight
, make_number (height
)), result
);
4057 /* Calculate the desired size and position of frame F.
4058 Return the flags saying which aspects were specified.
4060 Also set the win_gravity and size_hint_flags of F.
4062 Adjust height for toolbar if TOOLBAR_P is 1.
4064 This function does not make the coordinates positive. */
4066 #define DEFAULT_ROWS 40
4067 #define DEFAULT_COLS 80
4070 x_figure_window_size (f
, parms
, toolbar_p
)
4075 register Lisp_Object tem0
, tem1
, tem2
;
4076 long window_prompting
= 0;
4077 Display_Info
*dpyinfo
= FRAME_X_DISPLAY_INFO (f
);
4079 /* Default values if we fall through.
4080 Actually, if that happens we should get
4081 window manager prompting. */
4082 SET_FRAME_COLS (f
, DEFAULT_COLS
);
4083 FRAME_LINES (f
) = DEFAULT_ROWS
;
4084 /* Window managers expect that if program-specified
4085 positions are not (0,0), they're intentional, not defaults. */
4089 /* Ensure that old new_text_cols and new_text_lines will not override the
4091 /* ++KFS: This was specific to W32, but seems ok for all platforms */
4092 f
->new_text_cols
= f
->new_text_lines
= 0;
4094 tem0
= x_get_arg (dpyinfo
, parms
, Qheight
, 0, 0, RES_TYPE_NUMBER
);
4095 tem1
= x_get_arg (dpyinfo
, parms
, Qwidth
, 0, 0, RES_TYPE_NUMBER
);
4096 tem2
= x_get_arg (dpyinfo
, parms
, Quser_size
, 0, 0, RES_TYPE_NUMBER
);
4097 if (! EQ (tem0
, Qunbound
) || ! EQ (tem1
, Qunbound
))
4099 if (!EQ (tem0
, Qunbound
))
4101 CHECK_NUMBER (tem0
);
4102 FRAME_LINES (f
) = XINT (tem0
);
4104 if (!EQ (tem1
, Qunbound
))
4106 CHECK_NUMBER (tem1
);
4107 SET_FRAME_COLS (f
, XINT (tem1
));
4109 if (!NILP (tem2
) && !EQ (tem2
, Qunbound
))
4110 window_prompting
|= USSize
;
4112 window_prompting
|= PSize
;
4115 f
->scroll_bar_actual_width
4116 = FRAME_SCROLL_BAR_COLS (f
) * FRAME_COLUMN_WIDTH (f
);
4118 /* This used to be done _before_ calling x_figure_window_size, but
4119 since the height is reset here, this was really a no-op. I
4120 assume that moving it here does what Gerd intended (although he
4121 no longer can remember what that was... ++KFS, 2003-03-25. */
4123 /* Add the tool-bar height to the initial frame height so that the
4124 user gets a text display area of the size he specified with -g or
4125 via .Xdefaults. Later changes of the tool-bar height don't
4126 change the frame size. This is done so that users can create
4127 tall Emacs frames without having to guess how tall the tool-bar
4129 if (toolbar_p
&& FRAME_TOOL_BAR_LINES (f
))
4131 int margin
, relief
, bar_height
;
4133 relief
= (tool_bar_button_relief
>= 0
4134 ? tool_bar_button_relief
4135 : DEFAULT_TOOL_BAR_BUTTON_RELIEF
);
4137 if (INTEGERP (Vtool_bar_button_margin
)
4138 && XINT (Vtool_bar_button_margin
) > 0)
4139 margin
= XFASTINT (Vtool_bar_button_margin
);
4140 else if (CONSP (Vtool_bar_button_margin
)
4141 && INTEGERP (XCDR (Vtool_bar_button_margin
))
4142 && XINT (XCDR (Vtool_bar_button_margin
)) > 0)
4143 margin
= XFASTINT (XCDR (Vtool_bar_button_margin
));
4147 bar_height
= DEFAULT_TOOL_BAR_IMAGE_HEIGHT
+ 2 * margin
+ 2 * relief
;
4148 FRAME_LINES (f
) += (bar_height
+ FRAME_LINE_HEIGHT (f
) - 1) / FRAME_LINE_HEIGHT (f
);
4151 compute_fringe_widths (f
, 0);
4153 FRAME_PIXEL_WIDTH (f
) = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f
, FRAME_COLS (f
));
4154 FRAME_PIXEL_HEIGHT (f
) = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f
, FRAME_LINES (f
));
4156 tem0
= x_get_arg (dpyinfo
, parms
, Qtop
, 0, 0, RES_TYPE_NUMBER
);
4157 tem1
= x_get_arg (dpyinfo
, parms
, Qleft
, 0, 0, RES_TYPE_NUMBER
);
4158 tem2
= x_get_arg (dpyinfo
, parms
, Quser_position
, 0, 0, RES_TYPE_NUMBER
);
4159 if (! EQ (tem0
, Qunbound
) || ! EQ (tem1
, Qunbound
))
4161 if (EQ (tem0
, Qminus
))
4164 window_prompting
|= YNegative
;
4166 else if (CONSP (tem0
) && EQ (XCAR (tem0
), Qminus
)
4167 && CONSP (XCDR (tem0
))
4168 && INTEGERP (XCAR (XCDR (tem0
))))
4170 f
->top_pos
= - XINT (XCAR (XCDR (tem0
)));
4171 window_prompting
|= YNegative
;
4173 else if (CONSP (tem0
) && EQ (XCAR (tem0
), Qplus
)
4174 && CONSP (XCDR (tem0
))
4175 && INTEGERP (XCAR (XCDR (tem0
))))
4177 f
->top_pos
= XINT (XCAR (XCDR (tem0
)));
4179 else if (EQ (tem0
, Qunbound
))
4183 CHECK_NUMBER (tem0
);
4184 f
->top_pos
= XINT (tem0
);
4186 window_prompting
|= YNegative
;
4189 if (EQ (tem1
, Qminus
))
4192 window_prompting
|= XNegative
;
4194 else if (CONSP (tem1
) && EQ (XCAR (tem1
), Qminus
)
4195 && CONSP (XCDR (tem1
))
4196 && INTEGERP (XCAR (XCDR (tem1
))))
4198 f
->left_pos
= - XINT (XCAR (XCDR (tem1
)));
4199 window_prompting
|= XNegative
;
4201 else if (CONSP (tem1
) && EQ (XCAR (tem1
), Qplus
)
4202 && CONSP (XCDR (tem1
))
4203 && INTEGERP (XCAR (XCDR (tem1
))))
4205 f
->left_pos
= XINT (XCAR (XCDR (tem1
)));
4207 else if (EQ (tem1
, Qunbound
))
4211 CHECK_NUMBER (tem1
);
4212 f
->left_pos
= XINT (tem1
);
4213 if (f
->left_pos
< 0)
4214 window_prompting
|= XNegative
;
4217 if (!NILP (tem2
) && ! EQ (tem2
, Qunbound
))
4218 window_prompting
|= USPosition
;
4220 window_prompting
|= PPosition
;
4223 if (f
->want_fullscreen
!= FULLSCREEN_NONE
)
4228 /* It takes both for some WM:s to place it where we want */
4229 window_prompting
= USPosition
| PPosition
;
4230 x_fullscreen_adjust (f
, &width
, &height
, &top
, &left
);
4231 FRAME_COLS (f
) = width
;
4232 FRAME_LINES (f
) = height
;
4233 FRAME_PIXEL_WIDTH (f
) = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f
, width
);
4234 FRAME_PIXEL_HEIGHT (f
) = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f
, height
);
4239 if (window_prompting
& XNegative
)
4241 if (window_prompting
& YNegative
)
4242 f
->win_gravity
= SouthEastGravity
;
4244 f
->win_gravity
= NorthEastGravity
;
4248 if (window_prompting
& YNegative
)
4249 f
->win_gravity
= SouthWestGravity
;
4251 f
->win_gravity
= NorthWestGravity
;
4254 f
->size_hint_flags
= window_prompting
;
4256 return window_prompting
;
4261 #endif /* HAVE_WINDOW_SYSTEM */
4265 /***********************************************************************
4267 ***********************************************************************/
4272 Qframep
= intern ("framep");
4273 staticpro (&Qframep
);
4274 Qframe_live_p
= intern ("frame-live-p");
4275 staticpro (&Qframe_live_p
);
4276 Qheight
= intern ("height");
4277 staticpro (&Qheight
);
4278 Qicon
= intern ("icon");
4280 Qminibuffer
= intern ("minibuffer");
4281 staticpro (&Qminibuffer
);
4282 Qmodeline
= intern ("modeline");
4283 staticpro (&Qmodeline
);
4284 Qonly
= intern ("only");
4286 Qwidth
= intern ("width");
4287 staticpro (&Qwidth
);
4288 Qgeometry
= intern ("geometry");
4289 staticpro (&Qgeometry
);
4290 Qicon_left
= intern ("icon-left");
4291 staticpro (&Qicon_left
);
4292 Qicon_top
= intern ("icon-top");
4293 staticpro (&Qicon_top
);
4294 Qleft
= intern ("left");
4296 Qright
= intern ("right");
4297 staticpro (&Qright
);
4298 Quser_position
= intern ("user-position");
4299 staticpro (&Quser_position
);
4300 Quser_size
= intern ("user-size");
4301 staticpro (&Quser_size
);
4302 Qwindow_id
= intern ("window-id");
4303 staticpro (&Qwindow_id
);
4304 #ifdef HAVE_X_WINDOWS
4305 Qouter_window_id
= intern ("outer-window-id");
4306 staticpro (&Qouter_window_id
);
4308 Qparent_id
= intern ("parent-id");
4309 staticpro (&Qparent_id
);
4312 Qw32
= intern ("w32");
4314 Qpc
= intern ("pc");
4316 Qmac
= intern ("mac");
4318 Qvisible
= intern ("visible");
4319 staticpro (&Qvisible
);
4320 Qbuffer_predicate
= intern ("buffer-predicate");
4321 staticpro (&Qbuffer_predicate
);
4322 Qbuffer_list
= intern ("buffer-list");
4323 staticpro (&Qbuffer_list
);
4324 Qburied_buffer_list
= intern ("buried-buffer-list");
4325 staticpro (&Qburied_buffer_list
);
4326 Qdisplay_type
= intern ("display-type");
4327 staticpro (&Qdisplay_type
);
4328 Qbackground_mode
= intern ("background-mode");
4329 staticpro (&Qbackground_mode
);
4330 Qtty_color_mode
= intern ("tty-color-mode");
4331 staticpro (&Qtty_color_mode
);
4332 Qtty
= intern ("tty");
4334 Qtty_type
= intern ("tty-type");
4335 staticpro (&Qtty_type
);
4336 Qwindow_system
= intern ("window-system");
4337 staticpro (&Qwindow_system
);
4338 Qenvironment
= intern ("environment");
4339 staticpro (&Qenvironment
);
4341 Qface_set_after_frame_default
= intern ("face-set-after-frame-default");
4342 staticpro (&Qface_set_after_frame_default
);
4344 Qinhibit_face_set_after_frame_default
4345 = intern ("inhibit-face-set-after-frame-default");
4346 staticpro (&Qinhibit_face_set_after_frame_default
);
4348 Qfullwidth
= intern ("fullwidth");
4349 staticpro (&Qfullwidth
);
4350 Qfullheight
= intern ("fullheight");
4351 staticpro (&Qfullheight
);
4352 Qfullboth
= intern ("fullboth");
4353 staticpro (&Qfullboth
);
4354 Qx_resource_name
= intern ("x-resource-name");
4355 staticpro (&Qx_resource_name
);
4357 Qx_frame_parameter
= intern ("x-frame-parameter");
4358 staticpro (&Qx_frame_parameter
);
4360 Qterminal
= intern ("terminal");
4361 staticpro (&Qterminal
);
4362 Qterminal_live_p
= intern ("terminal-live-p");
4363 staticpro (&Qterminal_live_p
);
4368 for (i
= 0; i
< sizeof (frame_parms
) / sizeof (frame_parms
[0]); i
++)
4370 Lisp_Object v
= intern (frame_parms
[i
].name
);
4371 if (frame_parms
[i
].variable
)
4373 *frame_parms
[i
].variable
= v
;
4374 staticpro (frame_parms
[i
].variable
);
4376 Fput (v
, Qx_frame_parameter
, make_number (i
));
4380 #ifdef HAVE_WINDOW_SYSTEM
4381 DEFVAR_LISP ("x-resource-name", &Vx_resource_name
,
4382 doc
: /* The name Emacs uses to look up X resources.
4383 `x-get-resource' uses this as the first component of the instance name
4384 when requesting resource values.
4385 Emacs initially sets `x-resource-name' to the name under which Emacs
4386 was invoked, or to the value specified with the `-name' or `-rn'
4387 switches, if present.
4389 It may be useful to bind this variable locally around a call
4390 to `x-get-resource'. See also the variable `x-resource-class'. */);
4391 Vx_resource_name
= Qnil
;
4393 DEFVAR_LISP ("x-resource-class", &Vx_resource_class
,
4394 doc
: /* The class Emacs uses to look up X resources.
4395 `x-get-resource' uses this as the first component of the instance class
4396 when requesting resource values.
4398 Emacs initially sets `x-resource-class' to "Emacs".
4400 Setting this variable permanently is not a reasonable thing to do,
4401 but binding this variable locally around a call to `x-get-resource'
4402 is a reasonable practice. See also the variable `x-resource-name'. */);
4403 Vx_resource_class
= build_string (EMACS_CLASS
);
4406 DEFVAR_LISP ("default-frame-alist", &Vdefault_frame_alist
,
4407 doc
: /* Alist of default values for frame creation.
4408 These may be set in your init file, like this:
4409 (setq default-frame-alist '((width . 80) (height . 55) (menu-bar-lines . 1)))
4410 These override values given in window system configuration data,
4411 including X Windows' defaults database.
4412 For values specific to the first Emacs frame, see `initial-frame-alist'.
4413 For window-system specific values, see `window-system-default-frame-alist'.
4414 For values specific to the separate minibuffer frame, see
4415 `minibuffer-frame-alist'.
4416 The `menu-bar-lines' element of the list controls whether new frames
4417 have menu bars; `menu-bar-mode' works by altering this element.
4418 Setting this variable does not affect existing frames, only new ones. */);
4419 Vdefault_frame_alist
= Qnil
;
4421 DEFVAR_LISP ("default-frame-scroll-bars", &Vdefault_frame_scroll_bars
,
4422 doc
: /* Default position of scroll bars on this window-system. */);
4423 #ifdef HAVE_WINDOW_SYSTEM
4424 #if defined(HAVE_NTGUI) || defined(MAC_OS)
4425 /* MS-Windows has scroll bars on the right by default. */
4426 Vdefault_frame_scroll_bars
= Qright
;
4428 Vdefault_frame_scroll_bars
= Qleft
;
4431 Vdefault_frame_scroll_bars
= Qnil
;
4434 DEFVAR_LISP ("terminal-frame", &Vterminal_frame
,
4435 doc
: /* The initial frame-object, which represents Emacs's stdout. */);
4437 DEFVAR_LISP ("emacs-iconified", &Vemacs_iconified
,
4438 doc
: /* Non-nil if all of Emacs is iconified and frame updates are not needed. */);
4439 Vemacs_iconified
= Qnil
;
4441 DEFVAR_LISP ("mouse-position-function", &Vmouse_position_function
,
4442 doc
: /* If non-nil, function to transform normal value of `mouse-position'.
4443 `mouse-position' calls this function, passing its usual return value as
4444 argument, and returns whatever this function returns.
4445 This abnormal hook exists for the benefit of packages like `xt-mouse.el'
4446 which need to do mouse handling at the Lisp level. */);
4447 Vmouse_position_function
= Qnil
;
4449 DEFVAR_LISP ("mouse-highlight", &Vmouse_highlight
,
4450 doc
: /* If non-nil, clickable text is highlighted when mouse is over it.
4451 If the value is an integer, highlighting is only shown after moving the
4452 mouse, while keyboard input turns off the highlight even when the mouse
4453 is over the clickable text. However, the mouse shape still indicates
4454 when the mouse is over clickable text. */);
4455 Vmouse_highlight
= Qt
;
4457 DEFVAR_LISP ("delete-frame-functions", &Vdelete_frame_functions
,
4458 doc
: /* Functions to be run before deleting a frame.
4459 The functions are run with one arg, the frame to be deleted.
4462 Note that functions in this list may be called twice on the same
4463 frame. In the second invocation, the frame is already deleted, and
4464 the function should do nothing. (You can use `frame-live-p' to check
4465 for this.) This wrinkle happens when an earlier function in
4466 `delete-frame-functions' (indirectly) calls delete-frame
4468 Vdelete_frame_functions
= Qnil
;
4470 DEFVAR_KBOARD ("default-minibuffer-frame", Vdefault_minibuffer_frame
,
4471 doc
: /* Minibufferless frames use this frame's minibuffer.
4473 Emacs cannot create minibufferless frames unless this is set to an
4474 appropriate surrogate.
4476 Emacs consults this variable only when creating minibufferless
4477 frames; once the frame is created, it sticks with its assigned
4478 minibuffer, no matter what this variable is set to. This means that
4479 this variable doesn't necessarily say anything meaningful about the
4480 current set of frames, or where the minibuffer is currently being
4483 This variable is local to the current terminal and cannot be buffer-local. */);
4485 staticpro (&Vframe_list
);
4487 defsubr (&Sactive_minibuffer_window
);
4489 defsubr (&Sframe_live_p
);
4490 defsubr (&Swindow_system
);
4491 defsubr (&Smake_terminal_frame
);
4492 defsubr (&Shandle_switch_frame
);
4493 defsubr (&Sselect_frame
);
4494 defsubr (&Sselected_frame
);
4495 defsubr (&Swindow_frame
);
4496 defsubr (&Sframe_root_window
);
4497 defsubr (&Sframe_first_window
);
4498 defsubr (&Sframe_selected_window
);
4499 defsubr (&Sset_frame_selected_window
);
4500 defsubr (&Sframe_list
);
4501 defsubr (&Snext_frame
);
4502 defsubr (&Sprevious_frame
);
4503 defsubr (&Sdelete_frame
);
4504 defsubr (&Smouse_position
);
4505 defsubr (&Smouse_pixel_position
);
4506 defsubr (&Sset_mouse_position
);
4507 defsubr (&Sset_mouse_pixel_position
);
4509 defsubr (&Sframe_configuration
);
4510 defsubr (&Srestore_frame_configuration
);
4512 defsubr (&Smake_frame_visible
);
4513 defsubr (&Smake_frame_invisible
);
4514 defsubr (&Siconify_frame
);
4515 defsubr (&Sframe_visible_p
);
4516 defsubr (&Svisible_frame_list
);
4517 defsubr (&Sraise_frame
);
4518 defsubr (&Slower_frame
);
4519 defsubr (&Sredirect_frame_focus
);
4520 defsubr (&Sframe_focus
);
4521 defsubr (&Sframe_parameters
);
4522 defsubr (&Sframe_parameter
);
4523 defsubr (&Smodify_frame_parameters
);
4524 defsubr (&Sframe_with_environment
);
4525 defsubr (&Sframe_char_height
);
4526 defsubr (&Sframe_char_width
);
4527 defsubr (&Sframe_pixel_height
);
4528 defsubr (&Sframe_pixel_width
);
4529 defsubr (&Sset_frame_height
);
4530 defsubr (&Sset_frame_width
);
4531 defsubr (&Sset_frame_size
);
4532 defsubr (&Sset_frame_position
);
4534 #ifdef HAVE_WINDOW_SYSTEM
4535 defsubr (&Sx_get_resource
);
4536 defsubr (&Sx_parse_geometry
);
4541 /* arch-tag: 7dbf2c69-9aad-45f8-8296-db893d6dd039
4542 (do not change this comment) */