1 /* Generic frame functions.
3 Copyright (C) 1993-1995, 1997, 1999-2016 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 3 of the License, or (at
10 your option) any later version.
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. If not, see <http://www.gnu.org/licenses/>. */
30 #ifdef HAVE_WINDOW_SYSTEM
32 #endif /* HAVE_WINDOW_SYSTEM */
35 /* These help us bind and responding to switch-frame events. */
38 #include "blockinput.h"
40 #include "termhooks.h"
41 #include "dispextern.h"
43 #ifdef HAVE_WINDOW_SYSTEM
55 /* The currently selected frame. */
57 Lisp_Object selected_frame
;
59 /* A frame which is not just a mini-buffer, or NULL if there are no such
60 frames. This is usually the most recent such frame that was selected. */
62 static struct frame
*last_nonminibuf_frame
;
64 /* False means there are no visible garbaged frames. */
67 /* The default tool bar height for future frames. */
68 #if defined USE_GTK || defined HAVE_NS
69 enum { frame_default_tool_bar_height
= 0 };
71 int frame_default_tool_bar_height
;
74 #ifdef HAVE_WINDOW_SYSTEM
75 static void x_report_frame_params (struct frame
*, Lisp_Object
*);
78 /* These setters are used only in this file, so they can be private. */
80 fset_buffer_predicate (struct frame
*f
, Lisp_Object val
)
82 f
->buffer_predicate
= val
;
85 fset_minibuffer_window (struct frame
*f
, Lisp_Object val
)
87 f
->minibuffer_window
= val
;
91 decode_live_frame (register Lisp_Object frame
)
94 frame
= selected_frame
;
95 CHECK_LIVE_FRAME (frame
);
96 return XFRAME (frame
);
100 decode_any_frame (register Lisp_Object frame
)
103 frame
= selected_frame
;
105 return XFRAME (frame
);
108 #ifdef HAVE_WINDOW_SYSTEM
111 window_system_available (struct frame
*f
)
113 return f
? FRAME_WINDOW_P (f
) || FRAME_MSDOS_P (f
) : x_display_list
!= NULL
;
116 #endif /* HAVE_WINDOW_SYSTEM */
119 decode_window_system_frame (Lisp_Object frame
)
121 struct frame
*f
= decode_live_frame (frame
);
123 if (!window_system_available (f
))
124 error ("Window system frame should be used");
129 check_window_system (struct frame
*f
)
131 if (!window_system_available (f
))
132 error (f
? "Window system frame should be used"
133 : "Window system is not in use or not initialized");
136 /* Return the value of frame parameter PROP in frame FRAME. */
139 get_frame_param (register struct frame
*frame
, Lisp_Object prop
)
141 register Lisp_Object tem
;
143 tem
= Fassq (prop
, frame
->param_alist
);
151 frame_size_history_add (struct frame
*f
, Lisp_Object fun_symbol
,
152 int width
, int height
, Lisp_Object rest
)
156 XSETFRAME (frame
, f
);
157 if (CONSP (frame_size_history
)
158 && INTEGERP (XCAR (frame_size_history
))
159 && 0 < XINT (XCAR (frame_size_history
)))
161 Fcons (make_number (XINT (XCAR (frame_size_history
)) - 1),
165 ? list4 (make_number (FRAME_TEXT_WIDTH (f
)),
166 make_number (FRAME_TEXT_HEIGHT (f
)),
168 make_number (height
))
171 XCDR (frame_size_history
)));
175 /* Return 1 if `frame-inhibit-implied-resize' is non-nil or fullscreen
176 state of frame F would be affected by a vertical (horizontal if
177 HORIZONTAL is true) resize. PARAMETER is the symbol of the frame
178 parameter that is changed. */
180 frame_inhibit_resize (struct frame
*f
, bool horizontal
, Lisp_Object parameter
)
182 Lisp_Object fullscreen
= get_frame_param (f
, Qfullscreen
);
184 = (f
->after_make_frame
185 ? (EQ (frame_inhibit_implied_resize
, Qt
)
186 || (CONSP (frame_inhibit_implied_resize
)
187 && !NILP (Fmemq (parameter
, frame_inhibit_implied_resize
)))
189 && !EQ (fullscreen
, Qnil
) && !EQ (fullscreen
, Qfullheight
))
191 && !EQ (fullscreen
, Qnil
) && !EQ (fullscreen
, Qfullwidth
))
192 || FRAME_TERMCAP_P (f
) || FRAME_MSDOS_P (f
))
193 : ((horizontal
&& f
->inhibit_horizontal_resize
)
194 || (!horizontal
&& f
->inhibit_vertical_resize
)));
195 if (inhibit
&& !FRAME_TERMCAP_P (f
) && !FRAME_MSDOS_P (f
))
196 frame_size_history_add
197 (f
, Qframe_inhibit_resize
, 0, 0,
198 list5 (horizontal
? Qt
: Qnil
, parameter
,
199 f
->after_make_frame
? Qt
: Qnil
,
200 frame_inhibit_implied_resize
,
207 set_menu_bar_lines (struct frame
*f
, Lisp_Object value
, Lisp_Object oldval
)
210 int olines
= FRAME_MENU_BAR_LINES (f
);
212 /* Right now, menu bars don't work properly in minibuf-only frames;
213 most of the commands try to apply themselves to the minibuffer
214 frame itself, and get an error because you can't switch buffers
215 in or split the minibuffer window. */
216 if (FRAME_MINIBUF_ONLY_P (f
))
219 if (TYPE_RANGED_INTEGERP (int, value
))
220 nlines
= XINT (value
);
224 if (nlines
!= olines
)
226 windows_or_buffers_changed
= 14;
227 FRAME_MENU_BAR_LINES (f
) = nlines
;
228 FRAME_MENU_BAR_HEIGHT (f
) = nlines
* FRAME_LINE_HEIGHT (f
);
229 change_frame_size (f
, FRAME_COLS (f
),
230 FRAME_LINES (f
) + olines
- nlines
,
235 Lisp_Object Vframe_list
;
238 DEFUN ("framep", Fframep
, Sframep
, 1, 1, 0,
239 doc
: /* Return non-nil if OBJECT is a frame.
241 t for a termcap frame (a character-only terminal),
242 `x' for an Emacs frame that is really an X window,
243 `w32' for an Emacs frame that is a window on MS-Windows display,
244 `ns' for an Emacs frame on a GNUstep or Macintosh Cocoa display,
245 `pc' for a direct-write MS-DOS frame.
246 See also `frame-live-p'. */)
249 if (!FRAMEP (object
))
251 switch (XFRAME (object
)->output_method
)
253 case output_initial
: /* The initial frame is like a termcap frame. */
256 case output_x_window
:
260 case output_msdos_raw
:
269 DEFUN ("frame-live-p", Fframe_live_p
, Sframe_live_p
, 1, 1, 0,
270 doc
: /* Return non-nil if OBJECT is a frame which has not been deleted.
271 Value is nil if OBJECT is not a live frame. If object is a live
272 frame, the return value indicates what sort of terminal device it is
273 displayed on. See the documentation of `framep' for possible
277 return ((FRAMEP (object
)
278 && FRAME_LIVE_P (XFRAME (object
)))
283 DEFUN ("window-system", Fwindow_system
, Swindow_system
, 0, 1, 0,
284 doc
: /* The name of the window system that FRAME is displaying through.
285 The value is a symbol:
286 nil for a termcap frame (a character-only terminal),
287 `x' for an Emacs frame that is really an X window,
288 `w32' for an Emacs frame that is a window on MS-Windows display,
289 `ns' for an Emacs frame on a GNUstep or Macintosh Cocoa display,
290 `pc' for a direct-write MS-DOS frame.
292 FRAME defaults to the currently selected frame.
294 Use of this function as a predicate is deprecated. Instead,
295 use `display-graphic-p' or any of the other `display-*-p'
296 predicates which report frame's specific UI-related capabilities. */)
301 frame
= selected_frame
;
303 type
= Fframep (frame
);
306 wrong_type_argument (Qframep
, frame
);
314 /* Placeholder used by temacs -nw before window.el is loaded. */
315 DEFUN ("frame-windows-min-size", Fframe_windows_min_size
,
316 Sframe_windows_min_size
, 4, 4, 0,
319 (Lisp_Object frame
, Lisp_Object horizontal
,
320 Lisp_Object ignore
, Lisp_Object pixelwise
)
322 return make_number (0);
326 frame_windows_min_size (Lisp_Object frame
, Lisp_Object horizontal
,
327 Lisp_Object ignore
, Lisp_Object pixelwise
)
329 return XINT (call4 (Qframe_windows_min_size
, frame
, horizontal
,
334 /* Make sure windows sizes of frame F are OK. new_width and new_height
335 are in pixels. A value of -1 means no change is requested for that
336 size (but the frame may still have to be resized to accommodate
337 windows with their minimum sizes). This can either issue a request
338 to resize the frame externally (via x_set_window_size), to resize the
339 frame internally (via resize_frame_windows) or do nothing at all.
341 The argument INHIBIT can assume the following values:
343 0 means to unconditionally call x_set_window_size even if sizes
344 apparently do not change. Fx_create_frame uses this to pass the
345 initial size to the window manager.
347 1 means to call x_set_window_size if the outer frame size really
348 changes. Fset_frame_size, Fset_frame_height, ... use this.
350 2 means to call x_set_window_size provided frame_inhibit_resize
351 allows it. The menu and tool bar code use this ("3" won't work
352 here in general because menu and tool bar are often not counted in
353 the frame's text height).
355 3 means call x_set_window_size if window minimum sizes must be
356 preserved or frame_inhibit_resize allows it. x_set_left_fringe,
357 x_set_scroll_bar_width, x_new_font ... use (or should use) this.
359 4 means call x_set_window_size only if window minimum sizes must be
360 preserved. x_set_right_divider_width, x_set_border_width and the
361 code responsible for wrapping the tool bar use this.
363 5 means to never call x_set_window_size. change_frame_size uses
366 Note that even when x_set_window_size is not called, individual
367 windows may have to be resized (via `window--sanitize-window-sizes')
368 in order to support minimum size constraints.
370 PRETEND is as for change_frame_size. PARAMETER, if non-nil, is the
371 symbol of the parameter changed (like `menu-bar-lines', `font', ...).
372 This is passed on to frame_inhibit_resize to let the latter decide on
373 a case-by-case basis whether the frame may be resized externally. */
375 adjust_frame_size (struct frame
*f
, int new_width
, int new_height
, int inhibit
,
376 bool pretend
, Lisp_Object parameter
)
378 int unit_width
= FRAME_COLUMN_WIDTH (f
);
379 int unit_height
= FRAME_LINE_HEIGHT (f
);
380 int old_pixel_width
= FRAME_PIXEL_WIDTH (f
);
381 int old_pixel_height
= FRAME_PIXEL_HEIGHT (f
);
382 int old_cols
= FRAME_COLS (f
);
383 int old_lines
= FRAME_LINES (f
);
384 int new_pixel_width
, new_pixel_height
;
385 /* The following two values are calculated from the old frame pixel
386 sizes and any "new" settings for tool bar, menu bar and internal
387 borders. We do it this way to detect whether we have to call
388 x_set_window_size as consequence of the new settings. */
389 int windows_width
= FRAME_WINDOWS_WIDTH (f
);
390 int windows_height
= FRAME_WINDOWS_HEIGHT (f
);
391 int min_windows_width
, min_windows_height
;
392 /* These are a bit tedious, maybe we should use a macro. */
393 struct window
*r
= XWINDOW (FRAME_ROOT_WINDOW (f
));
394 int old_windows_width
= WINDOW_PIXEL_WIDTH (r
);
395 int old_windows_height
396 = (WINDOW_PIXEL_HEIGHT (r
)
397 + ((FRAME_HAS_MINIBUF_P (f
) && !FRAME_MINIBUF_ONLY_P (f
))
398 ? WINDOW_PIXEL_HEIGHT (XWINDOW (FRAME_MINIBUF_WINDOW (f
)))
400 int new_windows_width
, new_windows_height
;
401 int old_text_width
= FRAME_TEXT_WIDTH (f
);
402 int old_text_height
= FRAME_TEXT_HEIGHT (f
);
403 /* If a size is < 0 use the old value. */
404 int new_text_width
= (new_width
>= 0) ? new_width
: old_text_width
;
405 int new_text_height
= (new_height
>= 0) ? new_height
: old_text_height
;
406 int new_cols
, new_lines
;
407 bool inhibit_horizontal
, inhibit_vertical
;
410 XSETFRAME (frame
, f
);
412 frame_size_history_add
413 (f
, Qadjust_frame_size_1
, new_text_width
, new_text_height
,
414 list2 (parameter
, make_number (inhibit
)));
416 /* The following two values are calculated from the old window body
417 sizes and any "new" settings for scroll bars, dividers, fringes and
418 margins (though the latter should have been processed already). */
420 = frame_windows_min_size (frame
, Qt
, (inhibit
== 5) ? Qt
: Qnil
, Qt
);
422 = frame_windows_min_size (frame
, Qnil
, (inhibit
== 5) ? Qt
: Qnil
, Qt
);
424 if (inhibit
>= 2 && inhibit
<= 4)
425 /* When INHIBIT is in [2..4] inhibit if the "old" window sizes stay
426 within the limits and either resizing is inhibited or INHIBIT
429 inhibit_horizontal
= (windows_width
>= min_windows_width
431 || frame_inhibit_resize (f
, true, parameter
)));
432 inhibit_vertical
= (windows_height
>= min_windows_height
434 || frame_inhibit_resize (f
, false, parameter
)));
437 /* Otherwise inhibit if INHIBIT equals 5. */
438 inhibit_horizontal
= inhibit_vertical
= inhibit
== 5;
440 new_pixel_width
= ((inhibit_horizontal
&& (inhibit
< 5))
442 : max (FRAME_TEXT_TO_PIXEL_WIDTH (f
, new_text_width
),
444 + 2 * FRAME_INTERNAL_BORDER_WIDTH (f
)));
445 new_windows_width
= new_pixel_width
- 2 * FRAME_INTERNAL_BORDER_WIDTH (f
);
446 new_text_width
= FRAME_PIXEL_TO_TEXT_WIDTH (f
, new_pixel_width
);
447 new_cols
= new_text_width
/ unit_width
;
449 new_pixel_height
= ((inhibit_vertical
&& (inhibit
< 5))
451 : max (FRAME_TEXT_TO_PIXEL_HEIGHT (f
, new_text_height
),
453 + FRAME_TOP_MARGIN_HEIGHT (f
)
454 + 2 * FRAME_INTERNAL_BORDER_WIDTH (f
)));
455 new_windows_height
= (new_pixel_height
456 - FRAME_TOP_MARGIN_HEIGHT (f
)
457 - 2 * FRAME_INTERNAL_BORDER_WIDTH (f
));
458 new_text_height
= FRAME_PIXEL_TO_TEXT_HEIGHT (f
, new_pixel_height
);
459 new_lines
= new_text_height
/ unit_height
;
461 #ifdef HAVE_WINDOW_SYSTEM
462 if (FRAME_WINDOW_P (f
)
463 && f
->can_x_set_window_size
464 && ((!inhibit_horizontal
465 && (new_pixel_width
!= old_pixel_width
466 || inhibit
== 0 || inhibit
== 2))
467 || (!inhibit_vertical
468 && (new_pixel_height
!= old_pixel_height
469 || inhibit
== 0 || inhibit
== 2))))
470 /* We are either allowed to change the frame size or the minimum
471 sizes request such a change. Do not care for fixing minimum
472 sizes here, we do that eventually when we're called from
473 change_frame_size. */
475 /* Make sure we respect fullheight and fullwidth. */
476 if (inhibit_horizontal
)
477 new_text_width
= old_text_width
;
478 else if (inhibit_vertical
)
479 new_text_height
= old_text_height
;
481 frame_size_history_add
482 (f
, Qadjust_frame_size_2
, new_text_width
, new_text_height
,
483 list2 (inhibit_horizontal
? Qt
: Qnil
,
484 inhibit_vertical
? Qt
: Qnil
));
486 x_set_window_size (f
, 0, new_text_width
, new_text_height
, 1);
493 if (new_text_width
== old_text_width
494 && new_text_height
== old_text_height
495 && new_windows_width
== old_windows_width
496 && new_windows_height
== old_windows_height
497 && new_pixel_width
== old_pixel_width
498 && new_pixel_height
== old_pixel_height
499 && new_cols
== old_cols
500 && new_lines
== old_lines
)
501 /* No change. Sanitize window sizes and return. */
503 sanitize_window_sizes (frame
, Qt
);
504 sanitize_window_sizes (frame
, Qnil
);
512 /* We only can set screen dimensions to certain values supported
513 by our video hardware. Try to find the smallest size greater
514 or equal to the requested dimensions. */
515 dos_set_window_size (&new_lines
, &new_cols
);
518 if (new_windows_width
!= old_windows_width
)
520 resize_frame_windows (f
, new_windows_width
, 1, 1);
522 /* MSDOS frames cannot PRETEND, as they change frame size by
523 manipulating video hardware. */
524 if ((FRAME_TERMCAP_P (f
) && !pretend
) || FRAME_MSDOS_P (f
))
525 FrameCols (FRAME_TTY (f
)) = new_cols
;
527 #if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
528 if (WINDOWP (f
->tool_bar_window
))
530 XWINDOW (f
->tool_bar_window
)->pixel_width
= new_windows_width
;
531 XWINDOW (f
->tool_bar_window
)->total_cols
532 = new_windows_width
/ unit_width
;
536 else if (new_cols
!= old_cols
)
537 call2 (Qwindow_pixel_to_total
, frame
, Qt
);
539 if (new_windows_height
!= old_windows_height
540 /* When the top margin has changed we have to recalculate the top
541 edges of all windows. No such calculation is necessary for the
543 || WINDOW_TOP_PIXEL_EDGE (r
) != FRAME_TOP_MARGIN_HEIGHT (f
))
545 resize_frame_windows (f
, new_windows_height
, 0, 1);
547 /* MSDOS frames cannot PRETEND, as they change frame size by
548 manipulating video hardware. */
549 if ((FRAME_TERMCAP_P (f
) && !pretend
) || FRAME_MSDOS_P (f
))
550 FrameRows (FRAME_TTY (f
)) = new_lines
+ FRAME_TOP_MARGIN (f
);
552 else if (new_lines
!= old_lines
)
553 call2 (Qwindow_pixel_to_total
, frame
, Qnil
);
555 frame_size_history_add
556 (f
, Qadjust_frame_size_3
, new_text_width
, new_text_height
,
557 list4 (make_number (old_pixel_width
), make_number (old_pixel_height
),
558 make_number (new_pixel_width
), make_number (new_pixel_height
)));
560 /* Assign new sizes. */
561 FRAME_TEXT_WIDTH (f
) = new_text_width
;
562 FRAME_TEXT_HEIGHT (f
) = new_text_height
;
563 FRAME_PIXEL_WIDTH (f
) = new_pixel_width
;
564 FRAME_PIXEL_HEIGHT (f
) = new_pixel_height
;
565 SET_FRAME_COLS (f
, new_cols
);
566 SET_FRAME_LINES (f
, new_lines
);
569 struct window
*w
= XWINDOW (FRAME_SELECTED_WINDOW (f
));
570 int text_area_x
, text_area_y
, text_area_width
, text_area_height
;
572 window_box (w
, TEXT_AREA
, &text_area_x
, &text_area_y
, &text_area_width
,
574 if (w
->cursor
.x
>= text_area_x
+ text_area_width
)
575 w
->cursor
.hpos
= w
->cursor
.x
= 0;
576 if (w
->cursor
.y
>= text_area_y
+ text_area_height
)
577 w
->cursor
.vpos
= w
->cursor
.y
= 0;
580 /* Sanitize window sizes. */
581 sanitize_window_sizes (frame
, Qt
);
582 sanitize_window_sizes (frame
, Qnil
);
584 adjust_frame_glyphs (f
);
586 SET_FRAME_GARBAGED (f
);
588 /* A frame was "resized" if one of its pixelsizes changed, even if its
589 X window wasn't resized at all. */
590 f
->resized_p
= (new_pixel_width
!= old_pixel_width
591 || new_pixel_height
!= old_pixel_height
);
596 /* Allocate basically initialized frame. */
598 static struct frame
*
599 allocate_frame (void)
601 return ALLOCATE_ZEROED_PSEUDOVECTOR (struct frame
, face_cache
, PVEC_FRAME
);
605 make_frame (bool mini_p
)
609 struct window
*rw
, *mw
IF_LINT (= NULL
);
610 Lisp_Object root_window
;
611 Lisp_Object mini_window
;
613 f
= allocate_frame ();
614 XSETFRAME (frame
, f
);
617 /* Initialize Lisp data. Note that allocate_frame initializes all
618 Lisp data to nil, so do it only for slots which should not be nil. */
619 fset_tool_bar_position (f
, Qtop
);
622 /* Initialize non-Lisp data. Note that allocate_frame zeroes out all
623 non-Lisp data, so do it only for slots which should not be zero.
624 To avoid subtle bugs and for the sake of readability, it's better to
625 initialize enum members explicitly even if their values are zero. */
626 f
->wants_modeline
= true;
629 f
->can_x_set_window_size
= false;
630 f
->after_make_frame
= false;
631 f
->inhibit_horizontal_resize
= false;
632 f
->inhibit_vertical_resize
= false;
633 f
->tool_bar_redisplayed
= false;
634 f
->tool_bar_resized
= false;
635 f
->column_width
= 1; /* !FRAME_WINDOW_P value. */
636 f
->line_height
= 1; /* !FRAME_WINDOW_P value. */
637 #ifdef HAVE_WINDOW_SYSTEM
638 f
->vertical_scroll_bar_type
= vertical_scroll_bar_none
;
639 f
->horizontal_scroll_bars
= false;
640 f
->want_fullscreen
= FULLSCREEN_NONE
;
641 #if ! defined (USE_GTK) && ! defined (HAVE_NS)
642 f
->last_tool_bar_item
= -1;
646 root_window
= make_window ();
647 rw
= XWINDOW (root_window
);
650 mini_window
= make_window ();
651 mw
= XWINDOW (mini_window
);
652 wset_next (rw
, mini_window
);
653 wset_prev (mw
, root_window
);
655 wset_frame (mw
, frame
);
656 fset_minibuffer_window (f
, mini_window
);
661 wset_next (rw
, Qnil
);
662 fset_minibuffer_window (f
, Qnil
);
665 wset_frame (rw
, frame
);
668 just so that there is "something there."
669 Correct size will be set up later with adjust_frame_size. */
671 SET_FRAME_COLS (f
, 10);
672 SET_FRAME_LINES (f
, 10);
673 SET_FRAME_WIDTH (f
, FRAME_COLS (f
) * FRAME_COLUMN_WIDTH (f
));
674 SET_FRAME_HEIGHT (f
, FRAME_LINES (f
) * FRAME_LINE_HEIGHT (f
));
677 rw
->pixel_width
= rw
->total_cols
* FRAME_COLUMN_WIDTH (f
);
678 rw
->total_lines
= mini_p
? 9 : 10;
679 rw
->pixel_height
= rw
->total_lines
* FRAME_LINE_HEIGHT (f
);
683 mw
->top_line
= rw
->total_lines
;
684 mw
->pixel_top
= rw
->pixel_height
;
685 mw
->total_cols
= rw
->total_cols
;
686 mw
->pixel_width
= rw
->pixel_width
;
688 mw
->pixel_height
= FRAME_LINE_HEIGHT (f
);
691 /* Choose a buffer for the frame's root window. */
693 Lisp_Object buf
= Fcurrent_buffer ();
695 /* If current buffer is hidden, try to find another one. */
696 if (BUFFER_HIDDEN_P (XBUFFER (buf
)))
697 buf
= other_buffer_safely (buf
);
699 /* Use set_window_buffer, not Fset_window_buffer, and don't let
700 hooks be run by it. The reason is that the whole frame/window
701 arrangement is not yet fully initialized at this point. Windows
702 don't have the right size, glyph matrices aren't initialized
703 etc. Running Lisp functions at this point surely ends in a
705 set_window_buffer (root_window
, buf
, 0, 0);
706 fset_buffer_list (f
, list1 (buf
));
711 set_window_buffer (mini_window
,
712 (NILP (Vminibuffer_list
)
714 : Fcar (Vminibuffer_list
)),
716 /* No horizontal scroll bars in minibuffers. */
717 wset_horizontal_scroll_bar (mw
, Qnil
);
720 fset_root_window (f
, root_window
);
721 fset_selected_window (f
, root_window
);
722 /* Make sure this window seems more recently used than
723 a newly-created, never-selected window. */
724 XWINDOW (f
->selected_window
)->use_time
= ++window_select_count
;
729 #ifdef HAVE_WINDOW_SYSTEM
730 /* Make a frame using a separate minibuffer window on another frame.
731 MINI_WINDOW is the minibuffer window to use. nil means use the
732 default (the global minibuffer). */
735 make_frame_without_minibuffer (Lisp_Object mini_window
, KBOARD
*kb
,
740 if (!NILP (mini_window
))
741 CHECK_LIVE_WINDOW (mini_window
);
743 if (!NILP (mini_window
)
744 && FRAME_KBOARD (XFRAME (XWINDOW (mini_window
)->frame
)) != kb
)
745 error ("Frame and minibuffer must be on the same terminal");
747 /* Make a frame containing just a root window. */
750 if (NILP (mini_window
))
752 /* Use default-minibuffer-frame if possible. */
753 if (!FRAMEP (KVAR (kb
, Vdefault_minibuffer_frame
))
754 || ! FRAME_LIVE_P (XFRAME (KVAR (kb
, Vdefault_minibuffer_frame
))))
756 Lisp_Object frame_dummy
;
758 XSETFRAME (frame_dummy
, f
);
759 /* If there's no minibuffer frame to use, create one. */
760 kset_default_minibuffer_frame
761 (kb
, call1 (intern ("make-initial-minibuffer-frame"), display
));
765 = XFRAME (KVAR (kb
, Vdefault_minibuffer_frame
))->minibuffer_window
;
768 fset_minibuffer_window (f
, mini_window
);
770 /* Make the chosen minibuffer window display the proper minibuffer,
771 unless it is already showing a minibuffer. */
772 if (NILP (Fmemq (XWINDOW (mini_window
)->contents
, Vminibuffer_list
)))
773 /* Use set_window_buffer instead of Fset_window_buffer (see
774 discussion of bug#11984, bug#12025, bug#12026). */
775 set_window_buffer (mini_window
,
776 (NILP (Vminibuffer_list
)
778 : Fcar (Vminibuffer_list
)), 0, 0);
782 /* Make a frame containing only a minibuffer window. */
785 make_minibuffer_frame (void)
787 /* First make a frame containing just a root window, no minibuffer. */
789 register struct frame
*f
= make_frame (0);
790 register Lisp_Object mini_window
;
791 register Lisp_Object frame
;
793 XSETFRAME (frame
, f
);
798 f
->wants_modeline
= 0;
800 /* Now label the root window as also being the minibuffer.
801 Avoid infinite looping on the window chain by marking next pointer
804 mini_window
= f
->root_window
;
805 fset_minibuffer_window (f
, mini_window
);
806 XWINDOW (mini_window
)->mini
= 1;
807 wset_next (XWINDOW (mini_window
), Qnil
);
808 wset_prev (XWINDOW (mini_window
), Qnil
);
809 wset_frame (XWINDOW (mini_window
), frame
);
811 /* Put the proper buffer in that window. */
813 /* Use set_window_buffer instead of Fset_window_buffer (see
814 discussion of bug#11984, bug#12025, bug#12026). */
815 set_window_buffer (mini_window
,
816 (NILP (Vminibuffer_list
)
818 : Fcar (Vminibuffer_list
)), 0, 0);
821 #endif /* HAVE_WINDOW_SYSTEM */
823 /* Construct a frame that refers to a terminal. */
825 static printmax_t tty_frame_count
;
828 make_initial_frame (void)
831 struct terminal
*terminal
;
834 eassert (initial_kboard
);
836 /* The first call must initialize Vframe_list. */
837 if (! (NILP (Vframe_list
) || CONSP (Vframe_list
)))
840 terminal
= init_initial_terminal ();
843 XSETFRAME (frame
, f
);
845 Vframe_list
= Fcons (frame
, Vframe_list
);
848 fset_name (f
, build_pure_c_string ("F1"));
850 SET_FRAME_VISIBLE (f
, 1);
852 f
->output_method
= terminal
->type
;
853 f
->terminal
= terminal
;
854 f
->terminal
->reference_count
++;
855 f
->output_data
.nothing
= 0;
857 FRAME_FOREGROUND_PIXEL (f
) = FACE_TTY_DEFAULT_FG_COLOR
;
858 FRAME_BACKGROUND_PIXEL (f
) = FACE_TTY_DEFAULT_BG_COLOR
;
860 #ifdef HAVE_WINDOW_SYSTEM
861 f
->vertical_scroll_bar_type
= vertical_scroll_bar_none
;
862 f
->horizontal_scroll_bars
= false;
865 /* The default value of menu-bar-mode is t. */
866 set_menu_bar_lines (f
, make_number (1), Qnil
);
868 /* Allocate glyph matrices. */
869 adjust_frame_glyphs (f
);
872 init_frame_faces (f
);
874 last_nonminibuf_frame
= f
;
876 f
->can_x_set_window_size
= true;
877 f
->after_make_frame
= true;
883 static struct frame
*
884 make_terminal_frame (struct terminal
*terminal
)
886 register struct frame
*f
;
888 char name
[sizeof "F" + INT_STRLEN_BOUND (printmax_t
)];
891 error ("Terminal is not live, can't create new frames on it");
895 XSETFRAME (frame
, f
);
896 Vframe_list
= Fcons (frame
, Vframe_list
);
898 fset_name (f
, make_formatted_string (name
, "F%"pMd
, ++tty_frame_count
));
900 SET_FRAME_VISIBLE (f
, 1);
902 f
->terminal
= terminal
;
903 f
->terminal
->reference_count
++;
905 f
->output_data
.tty
->display_info
= &the_only_display_info
;
906 if (!inhibit_window_system
907 && (!FRAMEP (selected_frame
) || !FRAME_LIVE_P (XFRAME (selected_frame
))
908 || XFRAME (selected_frame
)->output_method
== output_msdos_raw
))
909 f
->output_method
= output_msdos_raw
;
911 f
->output_method
= output_termcap
;
912 #else /* not MSDOS */
913 f
->output_method
= output_termcap
;
914 create_tty_output (f
);
915 FRAME_FOREGROUND_PIXEL (f
) = FACE_TTY_DEFAULT_FG_COLOR
;
916 FRAME_BACKGROUND_PIXEL (f
) = FACE_TTY_DEFAULT_BG_COLOR
;
917 #endif /* not MSDOS */
919 #ifdef HAVE_WINDOW_SYSTEM
920 f
->vertical_scroll_bar_type
= vertical_scroll_bar_none
;
921 f
->horizontal_scroll_bars
= false;
924 FRAME_MENU_BAR_LINES (f
) = NILP (Vmenu_bar_mode
) ? 0 : 1;
925 FRAME_LINES (f
) = FRAME_LINES (f
) - FRAME_MENU_BAR_LINES (f
);
926 FRAME_MENU_BAR_HEIGHT (f
) = FRAME_MENU_BAR_LINES (f
) * FRAME_LINE_HEIGHT (f
);
927 FRAME_TEXT_HEIGHT (f
) = FRAME_TEXT_HEIGHT (f
) - FRAME_MENU_BAR_HEIGHT (f
);
929 /* Set the top frame to the newly created frame. */
930 if (FRAMEP (FRAME_TTY (f
)->top_frame
)
931 && FRAME_LIVE_P (XFRAME (FRAME_TTY (f
)->top_frame
)))
932 SET_FRAME_VISIBLE (XFRAME (FRAME_TTY (f
)->top_frame
), 2); /* obscured */
934 FRAME_TTY (f
)->top_frame
= frame
;
937 init_frame_faces (f
);
942 /* Get a suitable value for frame parameter PARAMETER for a newly
943 created frame, based on (1) the user-supplied frame parameter
944 alist SUPPLIED_PARMS, and (2) CURRENT_VALUE. */
947 get_future_frame_param (Lisp_Object parameter
,
948 Lisp_Object supplied_parms
,
953 result
= Fassq (parameter
, supplied_parms
);
955 result
= Fassq (parameter
, XFRAME (selected_frame
)->param_alist
);
956 if (NILP (result
) && current_value
!= NULL
)
957 result
= build_string (current_value
);
958 if (!NILP (result
) && !STRINGP (result
))
959 result
= XCDR (result
);
960 if (NILP (result
) || !STRINGP (result
))
966 DEFUN ("make-terminal-frame", Fmake_terminal_frame
, Smake_terminal_frame
,
968 doc
: /* Create an additional terminal frame, possibly on another terminal.
969 This function takes one argument, an alist specifying frame parameters.
971 You can create multiple frames on a single text terminal, but only one
972 of them (the selected terminal frame) is actually displayed.
974 In practice, generally you don't need to specify any parameters,
975 except when you want to create a new frame on another terminal.
976 In that case, the `tty' parameter specifies the device file to open,
977 and the `tty-type' parameter specifies the terminal type. Example:
979 (make-terminal-frame \\='((tty . "/dev/pts/5") (tty-type . "xterm")))
981 Note that changing the size of one terminal frame automatically
982 affects all frames on the same terminal device. */)
986 struct terminal
*t
= NULL
;
987 Lisp_Object frame
, tem
;
988 struct frame
*sf
= SELECTED_FRAME ();
991 if (sf
->output_method
!= output_msdos_raw
992 && sf
->output_method
!= output_termcap
)
994 #else /* not MSDOS */
996 #ifdef WINDOWSNT /* This should work now! */
997 if (sf
->output_method
!= output_termcap
)
998 error ("Not using an ASCII terminal now; cannot make a new ASCII frame");
1000 #endif /* not MSDOS */
1003 Lisp_Object terminal
;
1005 terminal
= Fassq (Qterminal
, parms
);
1006 if (CONSP (terminal
))
1008 terminal
= XCDR (terminal
);
1009 t
= decode_live_terminal (terminal
);
1012 if (t
&& t
!= the_only_display_info
.terminal
)
1013 /* msdos.c assumes a single tty_display_info object. */
1014 error ("Multiple terminals are not supported on this platform");
1016 t
= the_only_display_info
.terminal
;
1022 char *name
= 0, *type
= 0;
1023 Lisp_Object tty
, tty_type
;
1026 tty
= get_future_frame_param
1027 (Qtty
, parms
, (FRAME_TERMCAP_P (XFRAME (selected_frame
))
1028 ? FRAME_TTY (XFRAME (selected_frame
))->name
1031 SAFE_ALLOCA_STRING (name
, tty
);
1033 tty_type
= get_future_frame_param
1034 (Qtty_type
, parms
, (FRAME_TERMCAP_P (XFRAME (selected_frame
))
1035 ? FRAME_TTY (XFRAME (selected_frame
))->type
1037 if (!NILP (tty_type
))
1038 SAFE_ALLOCA_STRING (type
, tty_type
);
1040 t
= init_tty (name
, type
, 0); /* Errors are not fatal. */
1044 f
= make_terminal_frame (t
);
1048 get_tty_size (fileno (FRAME_TTY (f
)->input
), &width
, &height
);
1049 adjust_frame_size (f
, width
, height
- FRAME_MENU_BAR_LINES (f
),
1050 5, 0, Qterminal_frame
);
1053 adjust_frame_glyphs (f
);
1054 calculate_costs (f
);
1055 XSETFRAME (frame
, f
);
1057 store_in_alist (&parms
, Qtty_type
, build_string (t
->display_info
.tty
->type
));
1058 store_in_alist (&parms
, Qtty
,
1059 (t
->display_info
.tty
->name
1060 ? build_string (t
->display_info
.tty
->name
)
1062 Fmodify_frame_parameters (frame
, parms
);
1064 /* Make the frame face alist be frame-specific, so that each
1065 frame could change its face definitions independently. */
1066 fset_face_alist (f
, Fcopy_alist (sf
->face_alist
));
1067 /* Simple Fcopy_alist isn't enough, because we need the contents of
1068 the vectors which are the CDRs of associations in face_alist to
1069 be copied as well. */
1070 for (tem
= f
->face_alist
; CONSP (tem
); tem
= XCDR (tem
))
1071 XSETCDR (XCAR (tem
), Fcopy_sequence (XCDR (XCAR (tem
))));
1073 f
->can_x_set_window_size
= true;
1074 f
->after_make_frame
= true;
1080 /* Perform the switch to frame FRAME.
1082 If FRAME is a switch-frame event `(switch-frame FRAME1)', use
1085 If TRACK is non-zero and the frame that currently has the focus
1086 redirects its focus to the selected frame, redirect that focused
1087 frame's focus to FRAME instead.
1089 FOR_DELETION non-zero means that the selected frame is being
1090 deleted, which includes the possibility that the frame's terminal
1093 The value of NORECORD is passed as argument to Fselect_window. */
1096 do_switch_frame (Lisp_Object frame
, int track
, int for_deletion
, Lisp_Object norecord
)
1098 struct frame
*sf
= SELECTED_FRAME ();
1100 /* If FRAME is a switch-frame event, extract the frame we should
1103 && EQ (XCAR (frame
), Qswitch_frame
)
1104 && CONSP (XCDR (frame
)))
1105 frame
= XCAR (XCDR (frame
));
1107 /* This used to say CHECK_LIVE_FRAME, but apparently it's possible for
1108 a switch-frame event to arrive after a frame is no longer live,
1109 especially when deleting the initial frame during startup. */
1110 CHECK_FRAME (frame
);
1111 if (! FRAME_LIVE_P (XFRAME (frame
)))
1114 if (sf
== XFRAME (frame
))
1117 /* If a frame's focus has been redirected toward the currently
1118 selected frame, we should change the redirection to point to the
1119 newly selected frame. This means that if the focus is redirected
1120 from a minibufferless frame to a surrogate minibuffer frame, we
1121 can use `other-window' to switch between all the frames using
1122 that minibuffer frame, and the focus redirection will follow us
1125 /* This is too greedy; it causes inappropriate focus redirection
1126 that's hard to get rid of. */
1131 for (tail
= Vframe_list
; CONSP (tail
); tail
= XCDR (tail
))
1135 if (!FRAMEP (XCAR (tail
)))
1138 focus
= FRAME_FOCUS_FRAME (XFRAME (XCAR (tail
)));
1140 if (FRAMEP (focus
) && XFRAME (focus
) == SELECTED_FRAME ())
1141 Fredirect_frame_focus (XCAR (tail
), frame
);
1145 /* Instead, apply it only to the frame we're pointing to. */
1146 #ifdef HAVE_WINDOW_SYSTEM
1147 if (track
&& FRAME_WINDOW_P (XFRAME (frame
)))
1149 Lisp_Object focus
, xfocus
;
1151 xfocus
= x_get_focus_frame (XFRAME (frame
));
1152 if (FRAMEP (xfocus
))
1154 focus
= FRAME_FOCUS_FRAME (XFRAME (xfocus
));
1155 if (FRAMEP (focus
) && XFRAME (focus
) == SELECTED_FRAME ())
1156 Fredirect_frame_focus (xfocus
, frame
);
1159 #endif /* HAVE_X_WINDOWS */
1162 if (!for_deletion
&& FRAME_HAS_MINIBUF_P (sf
))
1163 resize_mini_window (XWINDOW (FRAME_MINIBUF_WINDOW (sf
)), 1);
1165 if (FRAME_TERMCAP_P (XFRAME (frame
)) || FRAME_MSDOS_P (XFRAME (frame
)))
1167 struct frame
*f
= XFRAME (frame
);
1168 struct tty_display_info
*tty
= FRAME_TTY (f
);
1169 Lisp_Object top_frame
= tty
->top_frame
;
1171 /* Don't mark the frame garbaged and/or obscured if we are
1172 switching to the frame that is already the top frame of that
1174 if (!EQ (frame
, top_frame
))
1176 if (FRAMEP (top_frame
))
1177 /* Mark previously displayed frame as now obscured. */
1178 SET_FRAME_VISIBLE (XFRAME (top_frame
), 2);
1179 SET_FRAME_VISIBLE (f
, 1);
1180 /* If the new TTY frame changed dimensions, we need to
1181 resync term.c's idea of the frame size with the new
1183 if (FRAME_COLS (f
) != FrameCols (tty
))
1184 FrameCols (tty
) = FRAME_COLS (f
);
1185 if (FRAME_TOTAL_LINES (f
) != FrameRows (tty
))
1186 FrameRows (tty
) = FRAME_TOTAL_LINES (f
);
1188 tty
->top_frame
= frame
;
1191 selected_frame
= frame
;
1192 if (! FRAME_MINIBUF_ONLY_P (XFRAME (selected_frame
)))
1193 last_nonminibuf_frame
= XFRAME (selected_frame
);
1195 Fselect_window (XFRAME (frame
)->selected_window
, norecord
);
1197 /* We want to make sure that the next event generates a frame-switch
1198 event to the appropriate frame. This seems kludgy to me, but
1199 before you take it out, make sure that evaluating something like
1200 (select-window (frame-root-window (new-frame))) doesn't end up
1201 with your typing being interpreted in the new frame instead of
1202 the one you're actually typing in. */
1203 internal_last_event_frame
= Qnil
;
1208 DEFUN ("select-frame", Fselect_frame
, Sselect_frame
, 1, 2, "e",
1209 doc
: /* Select FRAME.
1210 Subsequent editing commands apply to its selected window.
1211 Optional argument NORECORD means to neither change the order of
1212 recently selected windows nor the buffer list.
1214 The selection of FRAME lasts until the next time the user does
1215 something to select a different frame, or until the next time
1216 this function is called. If you are using a window system, the
1217 previously selected frame may be restored as the selected frame
1218 when returning to the command loop, because it still may have
1219 the window system's input focus. On a text terminal, the next
1220 redisplay will display FRAME.
1222 This function returns FRAME, or nil if FRAME has been deleted. */)
1223 (Lisp_Object frame
, Lisp_Object norecord
)
1225 return do_switch_frame (frame
, 1, 0, norecord
);
1228 DEFUN ("handle-switch-frame", Fhandle_switch_frame
, Shandle_switch_frame
, 1, 1, "^e",
1229 doc
: /* Handle a switch-frame event EVENT.
1230 Switch-frame events are usually bound to this function.
1231 A switch-frame event tells Emacs that the window manager has requested
1232 that the user's events be directed to the frame mentioned in the event.
1233 This function selects the selected window of the frame of EVENT.
1235 If EVENT is frame object, handle it as if it were a switch-frame event
1239 /* Preserve prefix arg that the command loop just cleared. */
1240 kset_prefix_arg (current_kboard
, Vcurrent_prefix_arg
);
1241 run_hook (Qmouse_leave_buffer_hook
);
1242 /* `switch-frame' implies a focus in. */
1243 call1 (intern ("handle-focus-in"), event
);
1244 return do_switch_frame (event
, 0, 0, Qnil
);
1247 DEFUN ("selected-frame", Fselected_frame
, Sselected_frame
, 0, 0, 0,
1248 doc
: /* Return the frame that is now selected. */)
1251 return selected_frame
;
1254 DEFUN ("frame-list", Fframe_list
, Sframe_list
,
1256 doc
: /* Return a list of all live frames. */)
1260 frames
= Fcopy_sequence (Vframe_list
);
1261 #ifdef HAVE_WINDOW_SYSTEM
1262 if (FRAMEP (tip_frame
))
1263 frames
= Fdelq (tip_frame
, frames
);
1268 /* Return CANDIDATE if it can be used as 'other-than-FRAME' frame on the
1269 same tty (for tty frames) or among frames which uses FRAME's keyboard.
1270 If MINIBUF is nil, do not consider minibuffer-only candidate.
1271 If MINIBUF is `visible', do not consider an invisible candidate.
1272 If MINIBUF is a window, consider only its own frame and candidate now
1273 using that window as the minibuffer.
1274 If MINIBUF is 0, consider candidate if it is visible or iconified.
1275 Otherwise consider any candidate and return nil if CANDIDATE is not
1279 candidate_frame (Lisp_Object candidate
, Lisp_Object frame
, Lisp_Object minibuf
)
1281 struct frame
*c
= XFRAME (candidate
), *f
= XFRAME (frame
);
1283 if ((!FRAME_TERMCAP_P (c
) && !FRAME_TERMCAP_P (f
)
1284 && FRAME_KBOARD (c
) == FRAME_KBOARD (f
))
1285 || (FRAME_TERMCAP_P (c
) && FRAME_TERMCAP_P (f
)
1286 && FRAME_TTY (c
) == FRAME_TTY (f
)))
1290 if (!FRAME_MINIBUF_ONLY_P (c
))
1293 else if (EQ (minibuf
, Qvisible
))
1295 if (FRAME_VISIBLE_P (c
))
1298 else if (WINDOWP (minibuf
))
1300 if (EQ (FRAME_MINIBUF_WINDOW (c
), minibuf
)
1301 || EQ (WINDOW_FRAME (XWINDOW (minibuf
)), candidate
)
1302 || EQ (WINDOW_FRAME (XWINDOW (minibuf
)),
1303 FRAME_FOCUS_FRAME (c
)))
1306 else if (XFASTINT (minibuf
) == 0)
1308 if (FRAME_VISIBLE_P (c
) || FRAME_ICONIFIED_P (c
))
1317 /* Return the next frame in the frame list after FRAME. */
1320 next_frame (Lisp_Object frame
, Lisp_Object minibuf
)
1322 Lisp_Object f
, tail
;
1325 /* There must always be at least one frame in Vframe_list. */
1326 eassert (CONSP (Vframe_list
));
1329 FOR_EACH_FRAME (tail
, f
)
1333 f
= candidate_frame (f
, frame
, minibuf
);
1343 /* Return the previous frame in the frame list before FRAME. */
1346 prev_frame (Lisp_Object frame
, Lisp_Object minibuf
)
1348 Lisp_Object f
, tail
, prev
= Qnil
;
1350 /* There must always be at least one frame in Vframe_list. */
1351 eassert (CONSP (Vframe_list
));
1353 FOR_EACH_FRAME (tail
, f
)
1355 if (EQ (frame
, f
) && !NILP (prev
))
1357 f
= candidate_frame (f
, frame
, minibuf
);
1362 /* We've scanned the entire list. */
1364 /* We went through the whole frame list without finding a single
1365 acceptable frame. Return the original frame. */
1368 /* There were no acceptable frames in the list before FRAME; otherwise,
1369 we would have returned directly from the loop. Since PREV is the last
1370 acceptable frame in the list, return it. */
1375 DEFUN ("next-frame", Fnext_frame
, Snext_frame
, 0, 2, 0,
1376 doc
: /* Return the next frame in the frame list after FRAME.
1377 It considers only frames on the same terminal as FRAME.
1378 By default, skip minibuffer-only frames.
1379 If omitted, FRAME defaults to the selected frame.
1380 If optional argument MINIFRAME is nil, exclude minibuffer-only frames.
1381 If MINIFRAME is a window, include only its own frame
1382 and any frame now using that window as the minibuffer.
1383 If MINIFRAME is `visible', include all visible frames.
1384 If MINIFRAME is 0, include all visible and iconified frames.
1385 Otherwise, include all frames. */)
1386 (Lisp_Object frame
, Lisp_Object miniframe
)
1389 frame
= selected_frame
;
1390 CHECK_LIVE_FRAME (frame
);
1391 return next_frame (frame
, miniframe
);
1394 DEFUN ("previous-frame", Fprevious_frame
, Sprevious_frame
, 0, 2, 0,
1395 doc
: /* Return the previous frame in the frame list before FRAME.
1396 It considers only frames on the same terminal as FRAME.
1397 By default, skip minibuffer-only frames.
1398 If omitted, FRAME defaults to the selected frame.
1399 If optional argument MINIFRAME is nil, exclude minibuffer-only frames.
1400 If MINIFRAME is a window, include only its own frame
1401 and any frame now using that window as the minibuffer.
1402 If MINIFRAME is `visible', include all visible frames.
1403 If MINIFRAME is 0, include all visible and iconified frames.
1404 Otherwise, include all frames. */)
1405 (Lisp_Object frame
, Lisp_Object miniframe
)
1408 frame
= selected_frame
;
1409 CHECK_LIVE_FRAME (frame
);
1410 return prev_frame (frame
, miniframe
);
1413 DEFUN ("last-nonminibuffer-frame", Flast_nonminibuf_frame
,
1414 Slast_nonminibuf_frame
, 0, 0, 0,
1415 doc
: /* Return last non-minibuffer frame selected. */)
1418 Lisp_Object frame
= Qnil
;
1420 if (last_nonminibuf_frame
)
1421 XSETFRAME (frame
, last_nonminibuf_frame
);
1426 /* Return 1 if it is ok to delete frame F;
1427 0 if all frames aside from F are invisible.
1428 (Exception: if F is the terminal frame, and we are using X, return 1.) */
1431 other_visible_frames (struct frame
*f
)
1433 Lisp_Object frames
, this;
1435 FOR_EACH_FRAME (frames
, this)
1437 if (f
== XFRAME (this))
1440 /* Verify that we can still talk to the frame's X window,
1441 and note any recent change in visibility. */
1442 #ifdef HAVE_X_WINDOWS
1443 if (FRAME_WINDOW_P (XFRAME (this)))
1444 x_sync (XFRAME (this));
1447 if (FRAME_VISIBLE_P (XFRAME (this))
1448 || FRAME_ICONIFIED_P (XFRAME (this))
1449 /* Allow deleting the terminal frame when at least one X
1451 || (FRAME_WINDOW_P (XFRAME (this)) && !FRAME_WINDOW_P (f
)))
1457 /* Make sure that minibuf_window doesn't refer to FRAME's minibuffer
1458 window. Preferably use the selected frame's minibuffer window
1459 instead. If the selected frame doesn't have one, get some other
1460 frame's minibuffer window. SELECT non-zero means select the new
1461 minibuffer window. */
1463 check_minibuf_window (Lisp_Object frame
, int select
)
1465 struct frame
*f
= decode_live_frame (frame
);
1467 XSETFRAME (frame
, f
);
1469 if (WINDOWP (minibuf_window
) && EQ (f
->minibuffer_window
, minibuf_window
))
1471 Lisp_Object frames
, this, window
= make_number (0);
1473 if (!EQ (frame
, selected_frame
)
1474 && FRAME_HAS_MINIBUF_P (XFRAME (selected_frame
)))
1475 window
= FRAME_MINIBUF_WINDOW (XFRAME (selected_frame
));
1477 FOR_EACH_FRAME (frames
, this)
1479 if (!EQ (this, frame
) && FRAME_HAS_MINIBUF_P (XFRAME (this)))
1481 window
= FRAME_MINIBUF_WINDOW (XFRAME (this));
1486 /* Don't abort if no window was found (Bug#15247). */
1487 if (WINDOWP (window
))
1489 /* Use set_window_buffer instead of Fset_window_buffer (see
1490 discussion of bug#11984, bug#12025, bug#12026). */
1491 set_window_buffer (window
, XWINDOW (minibuf_window
)->contents
, 0, 0);
1492 minibuf_window
= window
;
1494 /* SELECT non-zero usually means that FRAME's minibuffer
1495 window was selected; select the new one. */
1497 Fselect_window (minibuf_window
, Qnil
);
1503 /* Delete FRAME. When FORCE equals Qnoelisp, delete FRAME
1504 unconditionally. x_connection_closed and delete_terminal use
1505 this. Any other value of FORCE implements the semantics
1506 described for Fdelete_frame. */
1508 delete_frame (Lisp_Object frame
, Lisp_Object force
)
1510 struct frame
*f
= decode_any_frame (frame
);
1514 int minibuffer_selected
, is_tooltip_frame
;
1516 if (! FRAME_LIVE_P (f
))
1519 if (NILP (force
) && !other_visible_frames (f
))
1520 error ("Attempt to delete the sole visible or iconified frame");
1522 /* x_connection_closed must have set FORCE to `noelisp' in order
1523 to delete the last frame, if it is gone. */
1524 if (NILP (XCDR (Vframe_list
)) && !EQ (force
, Qnoelisp
))
1525 error ("Attempt to delete the only frame");
1527 XSETFRAME (frame
, f
);
1529 /* Does this frame have a minibuffer, and is it the surrogate
1530 minibuffer for any other frame? */
1531 if (FRAME_HAS_MINIBUF_P (f
))
1533 Lisp_Object frames
, this;
1535 FOR_EACH_FRAME (frames
, this)
1539 if (EQ (this, frame
))
1542 fminiw
= FRAME_MINIBUF_WINDOW (XFRAME (this));
1544 if (WINDOWP (fminiw
) && EQ (frame
, WINDOW_FRAME (XWINDOW (fminiw
))))
1546 /* If we MUST delete this frame, delete the other first.
1547 But do this only if FORCE equals `noelisp'. */
1548 if (EQ (force
, Qnoelisp
))
1549 delete_frame (this, Qnoelisp
);
1551 error ("Attempt to delete a surrogate minibuffer frame");
1556 is_tooltip_frame
= !NILP (Fframe_parameter (frame
, Qtooltip
));
1558 /* Run `delete-frame-functions' unless FORCE is `noelisp' or
1559 frame is a tooltip. FORCE is set to `noelisp' when handling
1560 a disconnect from the terminal, so we don't dare call Lisp
1562 if (NILP (Vrun_hooks
) || is_tooltip_frame
)
1564 else if (EQ (force
, Qnoelisp
))
1566 = Fcons (list3 (Qrun_hook_with_args
, Qdelete_frame_functions
, frame
),
1570 #ifdef HAVE_X_WINDOWS
1571 /* Also, save clipboard to the clipboard manager. */
1572 x_clipboard_manager_save_frame (frame
);
1575 safe_call2 (Qrun_hook_with_args
, Qdelete_frame_functions
, frame
);
1578 /* The hook may sometimes (indirectly) cause the frame to be deleted. */
1579 if (! FRAME_LIVE_P (f
))
1582 /* At this point, we are committed to deleting the frame.
1583 There is no more chance for errors to prevent it. */
1585 minibuffer_selected
= EQ (minibuf_window
, selected_window
);
1586 sf
= SELECTED_FRAME ();
1587 /* Don't let the frame remain selected. */
1591 Lisp_Object frame1
= Qnil
;
1593 /* Look for another visible frame on the same terminal.
1594 Do not call next_frame here because it may loop forever.
1595 See http://debbugs.gnu.org/cgi/bugreport.cgi?bug=15025. */
1596 FOR_EACH_FRAME (tail
, frame1
)
1597 if (!EQ (frame
, frame1
)
1598 && (FRAME_TERMINAL (XFRAME (frame
))
1599 == FRAME_TERMINAL (XFRAME (frame1
)))
1600 && FRAME_VISIBLE_P (XFRAME (frame1
)))
1603 /* If there is none, find *some* other frame. */
1604 if (NILP (frame1
) || EQ (frame1
, frame
))
1606 FOR_EACH_FRAME (tail
, frame1
)
1608 if (! EQ (frame
, frame1
) && FRAME_LIVE_P (XFRAME (frame1
)))
1610 /* Do not change a text terminal's top-frame. */
1611 struct frame
*f1
= XFRAME (frame1
);
1612 if (FRAME_TERMCAP_P (f1
) || FRAME_MSDOS_P (f1
))
1614 Lisp_Object top_frame
= FRAME_TTY (f1
)->top_frame
;
1615 if (!EQ (top_frame
, frame
))
1622 #ifdef NS_IMPL_COCOA
1624 /* Under NS, there is no system mechanism for choosing a new
1625 window to get focus -- it is left to application code.
1626 So the portion of THIS application interfacing with NS
1627 needs to know about it. We call Fraise_frame, but the
1628 purpose is really to transfer focus. */
1629 Fraise_frame (frame1
);
1632 do_switch_frame (frame1
, 0, 1, Qnil
);
1633 sf
= SELECTED_FRAME ();
1636 /* Don't allow minibuf_window to remain on a deleted frame. */
1637 check_minibuf_window (frame
, minibuffer_selected
);
1639 /* Don't let echo_area_window to remain on a deleted frame. */
1640 if (EQ (f
->minibuffer_window
, echo_area_window
))
1641 echo_area_window
= sf
->minibuffer_window
;
1643 /* Clear any X selections for this frame. */
1644 #ifdef HAVE_X_WINDOWS
1646 x_clear_frame_selections (f
);
1650 This function must be called before the window tree of the
1651 frame is deleted because windows contain dynamically allocated
1655 #ifdef HAVE_WINDOW_SYSTEM
1656 /* Give chance to each font driver to free a frame specific data. */
1657 font_update_drivers (f
, Qnil
);
1660 /* Mark all the windows that used to be on FRAME as deleted, and then
1661 remove the reference to them. */
1662 delete_all_child_windows (f
->root_window
);
1663 fset_root_window (f
, Qnil
);
1665 Vframe_list
= Fdelq (frame
, Vframe_list
);
1666 SET_FRAME_VISIBLE (f
, 0);
1668 /* Allow the vector of menu bar contents to be freed in the next
1669 garbage collection. The frame object itself may not be garbage
1670 collected until much later, because recent_keys and other data
1671 structures can still refer to it. */
1672 fset_menu_bar_vector (f
, Qnil
);
1674 /* If FRAME's buffer lists contains killed
1675 buffers, this helps GC to reclaim them. */
1676 fset_buffer_list (f
, Qnil
);
1677 fset_buried_buffer_list (f
, Qnil
);
1679 free_font_driver_list (f
);
1680 #if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI)
1683 xfree (f
->decode_mode_spec_buffer
);
1684 xfree (FRAME_INSERT_COST (f
));
1685 xfree (FRAME_DELETEN_COST (f
));
1686 xfree (FRAME_INSERTN_COST (f
));
1687 xfree (FRAME_DELETE_COST (f
));
1689 /* Since some events are handled at the interrupt level, we may get
1690 an event for f at any time; if we zero out the frame's terminal
1691 now, then we may trip up the event-handling code. Instead, we'll
1692 promise that the terminal of the frame must be valid until we
1693 have called the window-system-dependent frame destruction
1698 struct terminal
*terminal
;
1700 if (FRAME_TERMINAL (f
)->delete_frame_hook
)
1701 (*FRAME_TERMINAL (f
)->delete_frame_hook
) (f
);
1702 terminal
= FRAME_TERMINAL (f
);
1703 f
->output_data
.nothing
= 0;
1704 f
->terminal
= 0; /* Now the frame is dead. */
1707 /* If needed, delete the terminal that this frame was on.
1708 (This must be done after the frame is killed.) */
1709 terminal
->reference_count
--;
1711 /* FIXME: Deleting the terminal crashes emacs because of a GTK
1713 http://lists.gnu.org/archive/html/emacs-devel/2011-10/msg00363.html */
1714 if (terminal
->reference_count
== 0 && terminal
->type
== output_x_window
)
1715 terminal
->reference_count
= 1;
1716 #endif /* USE_GTK */
1717 if (terminal
->reference_count
== 0)
1720 XSETTERMINAL (tmp
, terminal
);
1723 Fdelete_terminal (tmp
, NILP (force
) ? Qt
: force
);
1726 kb
= terminal
->kboard
;
1729 /* If we've deleted the last_nonminibuf_frame, then try to find
1731 if (f
== last_nonminibuf_frame
)
1733 Lisp_Object frames
, this;
1735 last_nonminibuf_frame
= 0;
1737 FOR_EACH_FRAME (frames
, this)
1740 if (!FRAME_MINIBUF_ONLY_P (f
))
1742 last_nonminibuf_frame
= f
;
1748 /* If there's no other frame on the same kboard, get out of
1749 single-kboard state if we're in it for this kboard. */
1752 Lisp_Object frames
, this;
1753 /* Some frame we found on the same kboard, or nil if there are none. */
1754 Lisp_Object frame_on_same_kboard
= Qnil
;
1756 FOR_EACH_FRAME (frames
, this)
1757 if (kb
== FRAME_KBOARD (XFRAME (this)))
1758 frame_on_same_kboard
= this;
1760 if (NILP (frame_on_same_kboard
))
1761 not_single_kboard_state (kb
);
1765 /* If we've deleted this keyboard's default_minibuffer_frame, try to
1766 find another one. Prefer minibuffer-only frames, but also notice
1767 frames with other windows. */
1768 if (kb
!= NULL
&& EQ (frame
, KVAR (kb
, Vdefault_minibuffer_frame
)))
1770 Lisp_Object frames
, this;
1772 /* The last frame we saw with a minibuffer, minibuffer-only or not. */
1773 Lisp_Object frame_with_minibuf
= Qnil
;
1774 /* Some frame we found on the same kboard, or nil if there are none. */
1775 Lisp_Object frame_on_same_kboard
= Qnil
;
1777 FOR_EACH_FRAME (frames
, this)
1779 struct frame
*f1
= XFRAME (this);
1781 /* Consider only frames on the same kboard
1782 and only those with minibuffers. */
1783 if (kb
== FRAME_KBOARD (f1
)
1784 && FRAME_HAS_MINIBUF_P (f1
))
1786 frame_with_minibuf
= this;
1787 if (FRAME_MINIBUF_ONLY_P (f1
))
1791 if (kb
== FRAME_KBOARD (f1
))
1792 frame_on_same_kboard
= this;
1795 if (!NILP (frame_on_same_kboard
))
1797 /* We know that there must be some frame with a minibuffer out
1798 there. If this were not true, all of the frames present
1799 would have to be minibufferless, which implies that at some
1800 point their minibuffer frames must have been deleted, but
1801 that is prohibited at the top; you can't delete surrogate
1802 minibuffer frames. */
1803 if (NILP (frame_with_minibuf
))
1806 kset_default_minibuffer_frame (kb
, frame_with_minibuf
);
1809 /* No frames left on this kboard--say no minibuffer either. */
1810 kset_default_minibuffer_frame (kb
, Qnil
);
1813 /* Cause frame titles to update--necessary if we now have just one frame. */
1814 if (!is_tooltip_frame
)
1815 update_mode_lines
= 15;
1820 DEFUN ("delete-frame", Fdelete_frame
, Sdelete_frame
, 0, 2, "",
1821 doc
: /* Delete FRAME, permanently eliminating it from use.
1822 FRAME defaults to the selected frame.
1824 A frame may not be deleted if its minibuffer serves as surrogate
1825 minibuffer for another frame. Normally, you may not delete a frame if
1826 all other frames are invisible, but if the second optional argument
1827 FORCE is non-nil, you may do so.
1829 This function runs `delete-frame-functions' before actually
1830 deleting the frame, unless the frame is a tooltip.
1831 The functions are run with one argument, the frame to be deleted. */)
1832 (Lisp_Object frame
, Lisp_Object force
)
1834 return delete_frame (frame
, !NILP (force
) ? Qt
: Qnil
);
1838 /* Return mouse position in character cell units. */
1840 DEFUN ("mouse-position", Fmouse_position
, Smouse_position
, 0, 0, 0,
1841 doc
: /* Return a list (FRAME X . Y) giving the current mouse frame and position.
1842 The position is given in canonical character cells, where (0, 0) is the
1843 upper-left corner of the frame, X is the horizontal offset, and Y is the
1844 vertical offset, measured in units of the frame's default character size.
1845 If Emacs is running on a mouseless terminal or hasn't been programmed
1846 to read the mouse position, it returns the selected frame for FRAME
1847 and nil for X and Y.
1848 If `mouse-position-function' is non-nil, `mouse-position' calls it,
1849 passing the normal return value to that function as an argument,
1850 and returns whatever that function returns. */)
1854 Lisp_Object lispy_dummy
;
1855 Lisp_Object x
, y
, retval
;
1857 f
= SELECTED_FRAME ();
1860 /* It's okay for the hook to refrain from storing anything. */
1861 if (FRAME_TERMINAL (f
)->mouse_position_hook
)
1863 enum scroll_bar_part party_dummy
;
1865 (*FRAME_TERMINAL (f
)->mouse_position_hook
) (&f
, -1,
1866 &lispy_dummy
, &party_dummy
,
1875 pixel_to_glyph_coords (f
, col
, row
, &col
, &row
, NULL
, 1);
1879 XSETFRAME (lispy_dummy
, f
);
1880 retval
= Fcons (lispy_dummy
, Fcons (x
, y
));
1881 if (!NILP (Vmouse_position_function
))
1882 retval
= call1 (Vmouse_position_function
, retval
);
1886 DEFUN ("mouse-pixel-position", Fmouse_pixel_position
,
1887 Smouse_pixel_position
, 0, 0, 0,
1888 doc
: /* Return a list (FRAME X . Y) giving the current mouse frame and position.
1889 The position is given in pixel units, where (0, 0) is the
1890 upper-left corner of the frame, X is the horizontal offset, and Y is
1891 the vertical offset.
1892 If Emacs is running on a mouseless terminal or hasn't been programmed
1893 to read the mouse position, it returns the selected frame for FRAME
1894 and nil for X and Y. */)
1898 Lisp_Object lispy_dummy
;
1899 Lisp_Object x
, y
, retval
;
1901 f
= SELECTED_FRAME ();
1904 /* It's okay for the hook to refrain from storing anything. */
1905 if (FRAME_TERMINAL (f
)->mouse_position_hook
)
1907 enum scroll_bar_part party_dummy
;
1909 (*FRAME_TERMINAL (f
)->mouse_position_hook
) (&f
, -1,
1910 &lispy_dummy
, &party_dummy
,
1915 XSETFRAME (lispy_dummy
, f
);
1916 retval
= Fcons (lispy_dummy
, Fcons (x
, y
));
1917 if (!NILP (Vmouse_position_function
))
1918 retval
= call1 (Vmouse_position_function
, retval
);
1922 #ifdef HAVE_WINDOW_SYSTEM
1924 /* On frame F, convert character coordinates X and Y to pixel
1925 coordinates *PIX_X and *PIX_Y. */
1928 frame_char_to_pixel_position (struct frame
*f
, int x
, int y
,
1929 int *pix_x
, int *pix_y
)
1931 *pix_x
= FRAME_COL_TO_PIXEL_X (f
, x
) + FRAME_COLUMN_WIDTH (f
) / 2;
1932 *pix_y
= FRAME_LINE_TO_PIXEL_Y (f
, y
) + FRAME_LINE_HEIGHT (f
) / 2;
1936 if (*pix_x
> FRAME_PIXEL_WIDTH (f
))
1937 *pix_x
= FRAME_PIXEL_WIDTH (f
);
1941 if (*pix_y
> FRAME_PIXEL_HEIGHT (f
))
1942 *pix_y
= FRAME_PIXEL_HEIGHT (f
);
1945 /* On frame F, reposition mouse pointer to character coordinates X and Y. */
1948 frame_set_mouse_position (struct frame
*f
, int x
, int y
)
1952 frame_char_to_pixel_position (f
, x
, y
, &pix_x
, &pix_y
);
1953 frame_set_mouse_pixel_position (f
, pix_x
, pix_y
);
1956 #endif /* HAVE_WINDOW_SYSTEM */
1958 DEFUN ("set-mouse-position", Fset_mouse_position
, Sset_mouse_position
, 3, 3, 0,
1959 doc
: /* Move the mouse pointer to the center of character cell (X,Y) in FRAME.
1960 Coordinates are relative to the frame, not a window,
1961 so the coordinates of the top left character in the frame
1962 may be nonzero due to left-hand scroll bars or the menu bar.
1964 The position is given in canonical character cells, where (0, 0) is
1965 the upper-left corner of the frame, X is the horizontal offset, and
1966 Y is the vertical offset, measured in units of the frame's default
1969 This function is a no-op for an X frame that is not visible.
1970 If you have just created a frame, you must wait for it to become visible
1971 before calling this function on it, like this.
1972 (while (not (frame-visible-p frame)) (sleep-for .5)) */)
1973 (Lisp_Object frame
, Lisp_Object x
, Lisp_Object y
)
1975 CHECK_LIVE_FRAME (frame
);
1976 CHECK_TYPE_RANGED_INTEGER (int, x
);
1977 CHECK_TYPE_RANGED_INTEGER (int, y
);
1979 /* I think this should be done with a hook. */
1980 #ifdef HAVE_WINDOW_SYSTEM
1981 if (FRAME_WINDOW_P (XFRAME (frame
)))
1982 /* Warping the mouse will cause enternotify and focus events. */
1983 frame_set_mouse_position (XFRAME (frame
), XINT (x
), XINT (y
));
1986 if (FRAME_MSDOS_P (XFRAME (frame
)))
1988 Fselect_frame (frame
, Qnil
);
1989 mouse_moveto (XINT (x
), XINT (y
));
1994 Fselect_frame (frame
, Qnil
);
1995 term_mouse_moveto (XINT (x
), XINT (y
));
2004 DEFUN ("set-mouse-pixel-position", Fset_mouse_pixel_position
,
2005 Sset_mouse_pixel_position
, 3, 3, 0,
2006 doc
: /* Move the mouse pointer to pixel position (X,Y) in FRAME.
2007 The position is given in pixels, where (0, 0) is the upper-left corner
2008 of the frame, X is the horizontal offset, and Y is the vertical offset.
2010 Note, this is a no-op for an X frame that is not visible.
2011 If you have just created a frame, you must wait for it to become visible
2012 before calling this function on it, like this.
2013 (while (not (frame-visible-p frame)) (sleep-for .5)) */)
2014 (Lisp_Object frame
, Lisp_Object x
, Lisp_Object y
)
2016 CHECK_LIVE_FRAME (frame
);
2017 CHECK_TYPE_RANGED_INTEGER (int, x
);
2018 CHECK_TYPE_RANGED_INTEGER (int, y
);
2020 /* I think this should be done with a hook. */
2021 #ifdef HAVE_WINDOW_SYSTEM
2022 if (FRAME_WINDOW_P (XFRAME (frame
)))
2023 /* Warping the mouse will cause enternotify and focus events. */
2024 frame_set_mouse_pixel_position (XFRAME (frame
), XINT (x
), XINT (y
));
2027 if (FRAME_MSDOS_P (XFRAME (frame
)))
2029 Fselect_frame (frame
, Qnil
);
2030 mouse_moveto (XINT (x
), XINT (y
));
2035 Fselect_frame (frame
, Qnil
);
2036 term_mouse_moveto (XINT (x
), XINT (y
));
2045 static void make_frame_visible_1 (Lisp_Object
);
2047 DEFUN ("make-frame-visible", Fmake_frame_visible
, Smake_frame_visible
,
2049 doc
: /* Make the frame FRAME visible (assuming it is an X window).
2050 If omitted, FRAME defaults to the currently selected frame. */)
2053 struct frame
*f
= decode_live_frame (frame
);
2055 /* I think this should be done with a hook. */
2056 #ifdef HAVE_WINDOW_SYSTEM
2057 if (FRAME_WINDOW_P (f
))
2058 x_make_frame_visible (f
);
2061 make_frame_visible_1 (f
->root_window
);
2063 /* Make menu bar update for the Buffers and Frames menus. */
2064 /* windows_or_buffers_changed = 15; FIXME: Why? */
2066 XSETFRAME (frame
, f
);
2070 /* Update the display_time slot of the buffers shown in WINDOW
2071 and all its descendants. */
2074 make_frame_visible_1 (Lisp_Object window
)
2078 for (; !NILP (window
); window
= w
->next
)
2080 w
= XWINDOW (window
);
2081 if (WINDOWP (w
->contents
))
2082 make_frame_visible_1 (w
->contents
);
2084 bset_display_time (XBUFFER (w
->contents
), Fcurrent_time ());
2088 DEFUN ("make-frame-invisible", Fmake_frame_invisible
, Smake_frame_invisible
,
2090 doc
: /* Make the frame FRAME invisible.
2091 If omitted, FRAME defaults to the currently selected frame.
2092 On graphical displays, invisible frames are not updated and are
2093 usually not displayed at all, even in a window system's \"taskbar\".
2095 Normally you may not make FRAME invisible if all other frames are invisible,
2096 but if the second optional argument FORCE is non-nil, you may do so.
2098 This function has no effect on text terminal frames. Such frames are
2099 always considered visible, whether or not they are currently being
2100 displayed in the terminal. */)
2101 (Lisp_Object frame
, Lisp_Object force
)
2103 struct frame
*f
= decode_live_frame (frame
);
2105 if (NILP (force
) && !other_visible_frames (f
))
2106 error ("Attempt to make invisible the sole visible or iconified frame");
2108 /* Don't allow minibuf_window to remain on an invisible frame. */
2109 check_minibuf_window (frame
, EQ (minibuf_window
, selected_window
));
2111 /* I think this should be done with a hook. */
2112 #ifdef HAVE_WINDOW_SYSTEM
2113 if (FRAME_WINDOW_P (f
))
2114 x_make_frame_invisible (f
);
2117 /* Make menu bar update for the Buffers and Frames menus. */
2118 windows_or_buffers_changed
= 16;
2123 DEFUN ("iconify-frame", Ficonify_frame
, Siconify_frame
,
2125 doc
: /* Make the frame FRAME into an icon.
2126 If omitted, FRAME defaults to the currently selected frame. */)
2129 struct frame
*f
= decode_live_frame (frame
);
2131 /* Don't allow minibuf_window to remain on an iconified frame. */
2132 check_minibuf_window (frame
, EQ (minibuf_window
, selected_window
));
2134 /* I think this should be done with a hook. */
2135 #ifdef HAVE_WINDOW_SYSTEM
2136 if (FRAME_WINDOW_P (f
))
2137 x_iconify_frame (f
);
2140 /* Make menu bar update for the Buffers and Frames menus. */
2141 windows_or_buffers_changed
= 17;
2146 DEFUN ("frame-visible-p", Fframe_visible_p
, Sframe_visible_p
,
2148 doc
: /* Return t if FRAME is \"visible\" (actually in use for display).
2149 Return the symbol `icon' if FRAME is iconified or \"minimized\".
2150 Return nil if FRAME was made invisible, via `make-frame-invisible'.
2151 On graphical displays, invisible frames are not updated and are
2152 usually not displayed at all, even in a window system's \"taskbar\".
2154 If FRAME is a text terminal frame, this always returns t.
2155 Such frames are always considered visible, whether or not they are
2156 currently being displayed on the terminal. */)
2159 CHECK_LIVE_FRAME (frame
);
2161 if (FRAME_VISIBLE_P (XFRAME (frame
)))
2163 if (FRAME_ICONIFIED_P (XFRAME (frame
)))
2168 DEFUN ("visible-frame-list", Fvisible_frame_list
, Svisible_frame_list
,
2170 doc
: /* Return a list of all frames now \"visible\" (being updated). */)
2173 Lisp_Object tail
, frame
, value
= Qnil
;
2175 FOR_EACH_FRAME (tail
, frame
)
2176 if (FRAME_VISIBLE_P (XFRAME (frame
)))
2177 value
= Fcons (frame
, value
);
2183 DEFUN ("raise-frame", Fraise_frame
, Sraise_frame
, 0, 1, "",
2184 doc
: /* Bring FRAME to the front, so it occludes any frames it overlaps.
2185 If FRAME is invisible or iconified, make it visible.
2186 If you don't specify a frame, the selected frame is used.
2187 If Emacs is displaying on an ordinary terminal or some other device which
2188 doesn't support multiple overlapping frames, this function selects FRAME. */)
2191 struct frame
*f
= decode_live_frame (frame
);
2193 XSETFRAME (frame
, f
);
2195 if (FRAME_TERMCAP_P (f
))
2196 /* On a text terminal select FRAME. */
2197 Fselect_frame (frame
, Qnil
);
2199 /* Do like the documentation says. */
2200 Fmake_frame_visible (frame
);
2202 if (FRAME_TERMINAL (f
)->frame_raise_lower_hook
)
2203 (*FRAME_TERMINAL (f
)->frame_raise_lower_hook
) (f
, 1);
2208 /* Should we have a corresponding function called Flower_Power? */
2209 DEFUN ("lower-frame", Flower_frame
, Slower_frame
, 0, 1, "",
2210 doc
: /* Send FRAME to the back, so it is occluded by any frames that overlap it.
2211 If you don't specify a frame, the selected frame is used.
2212 If Emacs is displaying on an ordinary terminal or some other device which
2213 doesn't support multiple overlapping frames, this function does nothing. */)
2216 struct frame
*f
= decode_live_frame (frame
);
2218 if (FRAME_TERMINAL (f
)->frame_raise_lower_hook
)
2219 (*FRAME_TERMINAL (f
)->frame_raise_lower_hook
) (f
, 0);
2225 DEFUN ("redirect-frame-focus", Fredirect_frame_focus
, Sredirect_frame_focus
,
2227 doc
: /* Arrange for keystrokes typed at FRAME to be sent to FOCUS-FRAME.
2228 In other words, switch-frame events caused by events in FRAME will
2229 request a switch to FOCUS-FRAME, and `last-event-frame' will be
2230 FOCUS-FRAME after reading an event typed at FRAME.
2232 If FOCUS-FRAME is nil, any existing redirection is canceled, and the
2233 frame again receives its own keystrokes.
2235 Focus redirection is useful for temporarily redirecting keystrokes to
2236 a surrogate minibuffer frame when a frame doesn't have its own
2239 A frame's focus redirection can be changed by `select-frame'. If frame
2240 FOO is selected, and then a different frame BAR is selected, any
2241 frames redirecting their focus to FOO are shifted to redirect their
2242 focus to BAR. This allows focus redirection to work properly when the
2243 user switches from one frame to another using `select-window'.
2245 This means that a frame whose focus is redirected to itself is treated
2246 differently from a frame whose focus is redirected to nil; the former
2247 is affected by `select-frame', while the latter is not.
2249 The redirection lasts until `redirect-frame-focus' is called to change it. */)
2250 (Lisp_Object frame
, Lisp_Object focus_frame
)
2252 /* Note that we don't check for a live frame here. It's reasonable
2253 to redirect the focus of a frame you're about to delete, if you
2254 know what other frame should receive those keystrokes. */
2255 struct frame
*f
= decode_any_frame (frame
);
2257 if (! NILP (focus_frame
))
2258 CHECK_LIVE_FRAME (focus_frame
);
2260 fset_focus_frame (f
, focus_frame
);
2262 if (FRAME_TERMINAL (f
)->frame_rehighlight_hook
)
2263 (*FRAME_TERMINAL (f
)->frame_rehighlight_hook
) (f
);
2269 DEFUN ("frame-focus", Fframe_focus
, Sframe_focus
, 0, 1, 0,
2270 doc
: /* Return the frame to which FRAME's keystrokes are currently being sent.
2271 If FRAME is omitted or nil, the selected frame is used.
2272 Return nil if FRAME's focus is not redirected.
2273 See `redirect-frame-focus'. */)
2276 return FRAME_FOCUS_FRAME (decode_live_frame (frame
));
2279 DEFUN ("x-focus-frame", Fx_focus_frame
, Sx_focus_frame
, 1, 1, 0,
2280 doc
: /* Set the input focus to FRAME.
2281 FRAME nil means use the selected frame.
2282 If there is no window system support, this function does nothing. */)
2285 #ifdef HAVE_WINDOW_SYSTEM
2286 x_focus_frame (decode_window_system_frame (frame
));
2291 DEFUN ("frame-after-make-frame",
2292 Fframe_after_make_frame
,
2293 Sframe_after_make_frame
, 2, 2, 0,
2294 doc
: /* Mark FRAME as made.
2295 FRAME nil means use the selected frame. Second argument MADE non-nil
2296 means functions on `window-configuration-change-hook' are called
2297 whenever the window configuration of FRAME changes. MADE nil means
2298 these functions are not called.
2300 This function is currently called by `make-frame' only and should be
2301 otherwise used with utter care to avoid that running functions on
2302 `window-configuration-change-hook' is impeded forever. */)
2303 (Lisp_Object frame
, Lisp_Object made
)
2305 struct frame
*f
= decode_live_frame (frame
);
2306 f
->after_make_frame
= !NILP (made
);
2307 f
->inhibit_horizontal_resize
= false;
2308 f
->inhibit_vertical_resize
= false;
2313 /* Discard BUFFER from the buffer-list and buried-buffer-list of each frame. */
2316 frames_discard_buffer (Lisp_Object buffer
)
2318 Lisp_Object frame
, tail
;
2320 FOR_EACH_FRAME (tail
, frame
)
2323 (XFRAME (frame
), Fdelq (buffer
, XFRAME (frame
)->buffer_list
));
2324 fset_buried_buffer_list
2325 (XFRAME (frame
), Fdelq (buffer
, XFRAME (frame
)->buried_buffer_list
));
2329 /* Modify the alist in *ALISTPTR to associate PROP with VAL.
2330 If the alist already has an element for PROP, we change it. */
2333 store_in_alist (Lisp_Object
*alistptr
, Lisp_Object prop
, Lisp_Object val
)
2335 register Lisp_Object tem
;
2337 tem
= Fassq (prop
, *alistptr
);
2339 *alistptr
= Fcons (Fcons (prop
, val
), *alistptr
);
2345 frame_name_fnn_p (char *str
, ptrdiff_t len
)
2347 if (len
> 1 && str
[0] == 'F' && '0' <= str
[1] && str
[1] <= '9')
2350 while ('0' <= *p
&& *p
<= '9')
2358 /* Set the name of the terminal frame. Also used by MSDOS frames.
2359 Modeled after x_set_name which is used for WINDOW frames. */
2362 set_term_frame_name (struct frame
*f
, Lisp_Object name
)
2364 f
->explicit_name
= ! NILP (name
);
2366 /* If NAME is nil, set the name to F<num>. */
2369 char namebuf
[sizeof "F" + INT_STRLEN_BOUND (printmax_t
)];
2371 /* Check for no change needed in this very common case
2372 before we do any consing. */
2373 if (frame_name_fnn_p (SSDATA (f
->name
), SBYTES (f
->name
)))
2376 name
= make_formatted_string (namebuf
, "F%"pMd
, ++tty_frame_count
);
2380 CHECK_STRING (name
);
2382 /* Don't change the name if it's already NAME. */
2383 if (! NILP (Fstring_equal (name
, f
->name
)))
2386 /* Don't allow the user to set the frame name to F<num>, so it
2387 doesn't clash with the names we generate for terminal frames. */
2388 if (frame_name_fnn_p (SSDATA (name
), SBYTES (name
)))
2389 error ("Frame names of the form F<num> are usurped by Emacs");
2392 fset_name (f
, name
);
2393 update_mode_lines
= 16;
2397 store_frame_param (struct frame
*f
, Lisp_Object prop
, Lisp_Object val
)
2399 register Lisp_Object old_alist_elt
;
2401 /* The buffer-list parameters are stored in a special place and not
2402 in the alist. All buffers must be live. */
2403 if (EQ (prop
, Qbuffer_list
))
2405 Lisp_Object list
= Qnil
;
2406 for (; CONSP (val
); val
= XCDR (val
))
2407 if (!NILP (Fbuffer_live_p (XCAR (val
))))
2408 list
= Fcons (XCAR (val
), list
);
2409 fset_buffer_list (f
, Fnreverse (list
));
2412 if (EQ (prop
, Qburied_buffer_list
))
2414 Lisp_Object list
= Qnil
;
2415 for (; CONSP (val
); val
= XCDR (val
))
2416 if (!NILP (Fbuffer_live_p (XCAR (val
))))
2417 list
= Fcons (XCAR (val
), list
);
2418 fset_buried_buffer_list (f
, Fnreverse (list
));
2422 /* If PROP is a symbol which is supposed to have frame-local values,
2423 and it is set up based on this frame, switch to the global
2424 binding. That way, we can create or alter the frame-local binding
2425 without messing up the symbol's status. */
2428 struct Lisp_Symbol
*sym
= XSYMBOL (prop
);
2430 switch (sym
->redirect
)
2432 case SYMBOL_VARALIAS
: sym
= indirect_variable (sym
); goto start
;
2433 case SYMBOL_PLAINVAL
: case SYMBOL_FORWARDED
: break;
2434 case SYMBOL_LOCALIZED
:
2435 { struct Lisp_Buffer_Local_Value
*blv
= sym
->val
.blv
;
2436 if (blv
->frame_local
&& blv_found (blv
) && XFRAME (blv
->where
) == f
)
2437 swap_in_global_binding (sym
);
2440 default: emacs_abort ();
2444 /* The tty color needed to be set before the frame's parameter
2445 alist was updated with the new value. This is not true any more,
2446 but we still do this test early on. */
2447 if (FRAME_TERMCAP_P (f
) && EQ (prop
, Qtty_color_mode
)
2448 && f
== FRAME_TTY (f
)->previous_frame
)
2449 /* Force redisplay of this tty. */
2450 FRAME_TTY (f
)->previous_frame
= NULL
;
2452 /* Update the frame parameter alist. */
2453 old_alist_elt
= Fassq (prop
, f
->param_alist
);
2454 if (EQ (old_alist_elt
, Qnil
))
2455 fset_param_alist (f
, Fcons (Fcons (prop
, val
), f
->param_alist
));
2457 Fsetcdr (old_alist_elt
, val
);
2459 /* Update some other special parameters in their special places
2460 in addition to the alist. */
2462 if (EQ (prop
, Qbuffer_predicate
))
2463 fset_buffer_predicate (f
, val
);
2465 if (! FRAME_WINDOW_P (f
))
2467 if (EQ (prop
, Qmenu_bar_lines
))
2468 set_menu_bar_lines (f
, val
, make_number (FRAME_MENU_BAR_LINES (f
)));
2469 else if (EQ (prop
, Qname
))
2470 set_term_frame_name (f
, val
);
2473 if (EQ (prop
, Qminibuffer
) && WINDOWP (val
))
2475 if (! MINI_WINDOW_P (XWINDOW (val
)))
2476 error ("Surrogate minibuffer windows must be minibuffer windows");
2478 if ((FRAME_HAS_MINIBUF_P (f
) || FRAME_MINIBUF_ONLY_P (f
))
2479 && !EQ (val
, f
->minibuffer_window
))
2480 error ("Can't change the surrogate minibuffer of a frame with its own minibuffer");
2482 /* Install the chosen minibuffer window, with proper buffer. */
2483 fset_minibuffer_window (f
, val
);
2487 /* Return color matches UNSPEC on frame F or nil if UNSPEC
2488 is not an unspecified foreground or background color. */
2491 frame_unspecified_color (struct frame
*f
, Lisp_Object unspec
)
2493 return (!strncmp (SSDATA (unspec
), unspecified_bg
, SBYTES (unspec
))
2494 ? tty_color_name (f
, FRAME_BACKGROUND_PIXEL (f
))
2495 : (!strncmp (SSDATA (unspec
), unspecified_fg
, SBYTES (unspec
))
2496 ? tty_color_name (f
, FRAME_FOREGROUND_PIXEL (f
)) : Qnil
));
2499 DEFUN ("frame-parameters", Fframe_parameters
, Sframe_parameters
, 0, 1, 0,
2500 doc
: /* Return the parameters-alist of frame FRAME.
2501 It is a list of elements of the form (PARM . VALUE), where PARM is a symbol.
2502 The meaningful PARMs depend on the kind of frame.
2503 If FRAME is omitted or nil, return information on the currently selected frame. */)
2507 struct frame
*f
= decode_any_frame (frame
);
2510 if (!FRAME_LIVE_P (f
))
2513 alist
= Fcopy_alist (f
->param_alist
);
2515 if (!FRAME_WINDOW_P (f
))
2519 /* If the frame's parameter alist says the colors are
2520 unspecified and reversed, take the frame's background pixel
2521 for foreground and vice versa. */
2522 elt
= Fassq (Qforeground_color
, alist
);
2523 if (CONSP (elt
) && STRINGP (XCDR (elt
)))
2525 elt
= frame_unspecified_color (f
, XCDR (elt
));
2527 store_in_alist (&alist
, Qforeground_color
, elt
);
2530 store_in_alist (&alist
, Qforeground_color
,
2531 tty_color_name (f
, FRAME_FOREGROUND_PIXEL (f
)));
2532 elt
= Fassq (Qbackground_color
, alist
);
2533 if (CONSP (elt
) && STRINGP (XCDR (elt
)))
2535 elt
= frame_unspecified_color (f
, XCDR (elt
));
2537 store_in_alist (&alist
, Qbackground_color
, elt
);
2540 store_in_alist (&alist
, Qbackground_color
,
2541 tty_color_name (f
, FRAME_BACKGROUND_PIXEL (f
)));
2542 store_in_alist (&alist
, Qfont
,
2543 build_string (FRAME_MSDOS_P (f
)
2545 : FRAME_W32_P (f
) ? "w32term"
2548 store_in_alist (&alist
, Qname
, f
->name
);
2549 height
= (f
->new_height
2551 ? (f
->new_height
/ FRAME_LINE_HEIGHT (f
))
2554 store_in_alist (&alist
, Qheight
, make_number (height
));
2555 width
= (f
->new_width
2557 ? (f
->new_width
/ FRAME_COLUMN_WIDTH (f
))
2560 store_in_alist (&alist
, Qwidth
, make_number (width
));
2561 store_in_alist (&alist
, Qmodeline
, (FRAME_WANTS_MODELINE_P (f
) ? Qt
: Qnil
));
2562 store_in_alist (&alist
, Qminibuffer
,
2563 (! FRAME_HAS_MINIBUF_P (f
) ? Qnil
2564 : FRAME_MINIBUF_ONLY_P (f
) ? Qonly
2565 : FRAME_MINIBUF_WINDOW (f
)));
2566 store_in_alist (&alist
, Qunsplittable
, (FRAME_NO_SPLIT_P (f
) ? Qt
: Qnil
));
2567 store_in_alist (&alist
, Qbuffer_list
, f
->buffer_list
);
2568 store_in_alist (&alist
, Qburied_buffer_list
, f
->buried_buffer_list
);
2570 /* I think this should be done with a hook. */
2571 #ifdef HAVE_WINDOW_SYSTEM
2572 if (FRAME_WINDOW_P (f
))
2573 x_report_frame_params (f
, &alist
);
2577 /* This ought to be correct in f->param_alist for an X frame. */
2579 XSETFASTINT (lines
, FRAME_MENU_BAR_LINES (f
));
2580 store_in_alist (&alist
, Qmenu_bar_lines
, lines
);
2587 DEFUN ("frame-parameter", Fframe_parameter
, Sframe_parameter
, 2, 2, 0,
2588 doc
: /* Return FRAME's value for parameter PARAMETER.
2589 If FRAME is nil, describe the currently selected frame. */)
2590 (Lisp_Object frame
, Lisp_Object parameter
)
2592 struct frame
*f
= decode_any_frame (frame
);
2593 Lisp_Object value
= Qnil
;
2595 CHECK_SYMBOL (parameter
);
2597 XSETFRAME (frame
, f
);
2599 if (FRAME_LIVE_P (f
))
2601 /* Avoid consing in frequent cases. */
2602 if (EQ (parameter
, Qname
))
2604 #ifdef HAVE_X_WINDOWS
2605 else if (EQ (parameter
, Qdisplay
) && FRAME_X_P (f
))
2606 value
= XCAR (FRAME_DISPLAY_INFO (f
)->name_list_element
);
2607 #endif /* HAVE_X_WINDOWS */
2608 else if (EQ (parameter
, Qbackground_color
)
2609 || EQ (parameter
, Qforeground_color
))
2611 value
= Fassq (parameter
, f
->param_alist
);
2614 value
= XCDR (value
);
2615 /* Fframe_parameters puts the actual fg/bg color names,
2616 even if f->param_alist says otherwise. This is
2617 important when param_alist's notion of colors is
2618 "unspecified". We need to do the same here. */
2619 if (STRINGP (value
) && !FRAME_WINDOW_P (f
))
2621 Lisp_Object tem
= frame_unspecified_color (f
, value
);
2628 value
= Fcdr (Fassq (parameter
, Fframe_parameters (frame
)));
2630 else if (EQ (parameter
, Qdisplay_type
)
2631 || EQ (parameter
, Qbackground_mode
))
2632 value
= Fcdr (Fassq (parameter
, f
->param_alist
));
2634 /* FIXME: Avoid this code path at all (as well as code duplication)
2635 by sharing more code with Fframe_parameters. */
2636 value
= Fcdr (Fassq (parameter
, Fframe_parameters (frame
)));
2643 DEFUN ("modify-frame-parameters", Fmodify_frame_parameters
,
2644 Smodify_frame_parameters
, 2, 2, 0,
2645 doc
: /* Modify FRAME according to new values of its parameters in ALIST.
2646 If FRAME is nil, it defaults to the selected frame.
2647 ALIST is an alist of parameters to change and their new values.
2648 Each element of ALIST has the form (PARM . VALUE), where PARM is a symbol.
2649 Which PARMs are meaningful depends on the kind of frame.
2650 The meaningful parameters are acted upon, i.e. the frame is changed
2651 according to their new values, and are also stored in the frame's
2652 parameter list so that `frame-parameters' will return them.
2653 PARMs that are not meaningful are still stored in the frame's parameter
2654 list, but are otherwise ignored.
2656 The value of frame parameter FOO can also be accessed
2657 as a frame-local binding for the variable FOO, if you have
2658 enabled such bindings for that variable with `make-variable-frame-local'.
2659 Note that this functionality is obsolete as of Emacs 22.2, and its
2660 use is not recommended. Explicitly check for a frame-parameter instead. */)
2661 (Lisp_Object frame
, Lisp_Object alist
)
2663 struct frame
*f
= decode_live_frame (frame
);
2664 register Lisp_Object prop
, val
;
2668 /* I think this should be done with a hook. */
2669 #ifdef HAVE_WINDOW_SYSTEM
2670 if (FRAME_WINDOW_P (f
))
2671 x_set_frame_parameters (f
, alist
);
2675 if (FRAME_MSDOS_P (f
))
2676 IT_set_frame_parameters (f
, alist
);
2681 EMACS_INT length
= XFASTINT (Flength (alist
));
2684 Lisp_Object
*values
;
2686 SAFE_ALLOCA_LISP (parms
, 2 * length
);
2687 values
= parms
+ length
;
2689 /* Extract parm names and values into those vectors. */
2691 for (i
= 0; CONSP (alist
); alist
= XCDR (alist
))
2696 parms
[i
] = Fcar (elt
);
2697 values
[i
] = Fcdr (elt
);
2701 /* Now process them in reverse of specified order. */
2706 store_frame_param (f
, prop
, val
);
2708 if (EQ (prop
, Qforeground_color
)
2709 || EQ (prop
, Qbackground_color
))
2710 update_face_from_frame_parameter (f
, prop
, val
);
2718 DEFUN ("frame-char-height", Fframe_char_height
, Sframe_char_height
,
2720 doc
: /* Height in pixels of a line in the font in frame FRAME.
2721 If FRAME is omitted or nil, the selected frame is used.
2722 For a terminal frame, the value is always 1. */)
2725 #ifdef HAVE_WINDOW_SYSTEM
2726 struct frame
*f
= decode_any_frame (frame
);
2728 if (FRAME_WINDOW_P (f
))
2729 return make_number (FRAME_LINE_HEIGHT (f
));
2732 return make_number (1);
2736 DEFUN ("frame-char-width", Fframe_char_width
, Sframe_char_width
,
2738 doc
: /* Width in pixels of characters in the font in frame FRAME.
2739 If FRAME is omitted or nil, the selected frame is used.
2740 On a graphical screen, the width is the standard width of the default font.
2741 For a terminal screen, the value is always 1. */)
2744 #ifdef HAVE_WINDOW_SYSTEM
2745 struct frame
*f
= decode_any_frame (frame
);
2747 if (FRAME_WINDOW_P (f
))
2748 return make_number (FRAME_COLUMN_WIDTH (f
));
2751 return make_number (1);
2754 DEFUN ("frame-pixel-height", Fframe_pixel_height
,
2755 Sframe_pixel_height
, 0, 1, 0,
2756 doc
: /* Return a FRAME's height in pixels.
2757 If FRAME is omitted or nil, the selected frame is used. The exact value
2758 of the result depends on the window-system and toolkit in use:
2760 In the Gtk+ version of Emacs, it includes only any window (including
2761 the minibuffer or echo area), mode line, and header line. It does not
2762 include the tool bar or menu bar.
2764 With other graphical versions, it also includes the tool bar and the
2767 For a text terminal, it includes the menu bar. In this case, the
2768 result is really in characters rather than pixels (i.e., is identical
2769 to `frame-height'). */)
2772 struct frame
*f
= decode_any_frame (frame
);
2774 #ifdef HAVE_WINDOW_SYSTEM
2775 if (FRAME_WINDOW_P (f
))
2776 return make_number (FRAME_PIXEL_HEIGHT (f
));
2779 return make_number (FRAME_TOTAL_LINES (f
));
2782 DEFUN ("frame-pixel-width", Fframe_pixel_width
,
2783 Sframe_pixel_width
, 0, 1, 0,
2784 doc
: /* Return FRAME's width in pixels.
2785 For a terminal frame, the result really gives the width in characters.
2786 If FRAME is omitted or nil, the selected frame is used. */)
2789 struct frame
*f
= decode_any_frame (frame
);
2791 #ifdef HAVE_WINDOW_SYSTEM
2792 if (FRAME_WINDOW_P (f
))
2793 return make_number (FRAME_PIXEL_WIDTH (f
));
2796 return make_number (FRAME_TOTAL_COLS (f
));
2799 DEFUN ("tool-bar-pixel-width", Ftool_bar_pixel_width
,
2800 Stool_bar_pixel_width
, 0, 1, 0,
2801 doc
: /* Return width in pixels of FRAME's tool bar.
2802 The result is greater than zero only when the tool bar is on the left
2803 or right side of FRAME. If FRAME is omitted or nil, the selected frame
2807 #ifdef FRAME_TOOLBAR_WIDTH
2808 struct frame
*f
= decode_any_frame (frame
);
2810 if (FRAME_WINDOW_P (f
))
2811 return make_number (FRAME_TOOLBAR_WIDTH (f
));
2813 return make_number (0);
2816 DEFUN ("frame-text-cols", Fframe_text_cols
, Sframe_text_cols
, 0, 1, 0,
2817 doc
: /* Return width in columns of FRAME's text area. */)
2820 return make_number (FRAME_COLS (decode_any_frame (frame
)));
2823 DEFUN ("frame-text-lines", Fframe_text_lines
, Sframe_text_lines
, 0, 1, 0,
2824 doc
: /* Return height in lines of FRAME's text area. */)
2827 return make_number (FRAME_LINES (decode_any_frame (frame
)));
2830 DEFUN ("frame-total-cols", Fframe_total_cols
, Sframe_total_cols
, 0, 1, 0,
2831 doc
: /* Return number of total columns of FRAME. */)
2834 return make_number (FRAME_TOTAL_COLS (decode_any_frame (frame
)));
2837 DEFUN ("frame-total-lines", Fframe_total_lines
, Sframe_total_lines
, 0, 1, 0,
2838 doc
: /* Return number of total lines of FRAME. */)
2841 return make_number (FRAME_TOTAL_LINES (decode_any_frame (frame
)));
2844 DEFUN ("frame-text-width", Fframe_text_width
, Sframe_text_width
, 0, 1, 0,
2845 doc
: /* Return text area width of FRAME in pixels. */)
2848 return make_number (FRAME_TEXT_WIDTH (decode_any_frame (frame
)));
2851 DEFUN ("frame-text-height", Fframe_text_height
, Sframe_text_height
, 0, 1, 0,
2852 doc
: /* Return text area height of FRAME in pixels. */)
2855 return make_number (FRAME_TEXT_HEIGHT (decode_any_frame (frame
)));
2858 DEFUN ("frame-scroll-bar-width", Fscroll_bar_width
, Sscroll_bar_width
, 0, 1, 0,
2859 doc
: /* Return scroll bar width of FRAME in pixels. */)
2862 return make_number (FRAME_SCROLL_BAR_AREA_WIDTH (decode_any_frame (frame
)));
2865 DEFUN ("frame-scroll-bar-height", Fscroll_bar_height
, Sscroll_bar_height
, 0, 1, 0,
2866 doc
: /* Return scroll bar height of FRAME in pixels. */)
2869 return make_number (FRAME_SCROLL_BAR_AREA_HEIGHT (decode_any_frame (frame
)));
2872 DEFUN ("frame-fringe-width", Ffringe_width
, Sfringe_width
, 0, 1, 0,
2873 doc
: /* Return fringe width of FRAME in pixels. */)
2876 return make_number (FRAME_TOTAL_FRINGE_WIDTH (decode_any_frame (frame
)));
2879 DEFUN ("frame-border-width", Fborder_width
, Sborder_width
, 0, 1, 0,
2880 doc
: /* Return border width of FRAME in pixels. */)
2883 return make_number (FRAME_INTERNAL_BORDER_WIDTH (decode_any_frame (frame
)));
2886 DEFUN ("frame-right-divider-width", Fright_divider_width
, Sright_divider_width
, 0, 1, 0,
2887 doc
: /* Return width (in pixels) of vertical window dividers on FRAME. */)
2890 return make_number (FRAME_RIGHT_DIVIDER_WIDTH (decode_any_frame (frame
)));
2893 DEFUN ("frame-bottom-divider-width", Fbottom_divider_width
, Sbottom_divider_width
, 0, 1, 0,
2894 doc
: /* Return width (in pixels) of horizontal window dividers on FRAME. */)
2897 return make_number (FRAME_BOTTOM_DIVIDER_WIDTH (decode_any_frame (frame
)));
2900 DEFUN ("set-frame-height", Fset_frame_height
, Sset_frame_height
, 2, 4, 0,
2901 doc
: /* Set text height of frame FRAME to HEIGHT lines.
2902 Optional third arg PRETEND non-nil means that redisplay should use
2903 HEIGHT lines but that the idea of the actual height of the frame should
2906 Optional fourth argument PIXELWISE non-nil means that FRAME should be
2907 HEIGHT pixels high. Note: When `frame-resize-pixelwise' is nil, some
2908 window managers may refuse to honor a HEIGHT that is not an integer
2909 multiple of the default frame font height. */)
2910 (Lisp_Object frame
, Lisp_Object height
, Lisp_Object pretend
, Lisp_Object pixelwise
)
2912 struct frame
*f
= decode_live_frame (frame
);
2915 CHECK_TYPE_RANGED_INTEGER (int, height
);
2917 pixel_height
= (!NILP (pixelwise
)
2919 : XINT (height
) * FRAME_LINE_HEIGHT (f
));
2920 adjust_frame_size (f
, -1, pixel_height
, 1, !NILP (pretend
), Qheight
);
2925 DEFUN ("set-frame-width", Fset_frame_width
, Sset_frame_width
, 2, 4, 0,
2926 doc
: /* Set text width of frame FRAME to WIDTH columns.
2927 Optional third arg PRETEND non-nil means that redisplay should use WIDTH
2928 columns but that the idea of the actual width of the frame should not
2931 Optional fourth argument PIXELWISE non-nil means that FRAME should be
2932 WIDTH pixels wide. Note: When `frame-resize-pixelwise' is nil, some
2933 window managers may refuse to honor a WIDTH that is not an integer
2934 multiple of the default frame font width. */)
2935 (Lisp_Object frame
, Lisp_Object width
, Lisp_Object pretend
, Lisp_Object pixelwise
)
2937 struct frame
*f
= decode_live_frame (frame
);
2940 CHECK_TYPE_RANGED_INTEGER (int, width
);
2942 pixel_width
= (!NILP (pixelwise
)
2944 : XINT (width
) * FRAME_COLUMN_WIDTH (f
));
2945 adjust_frame_size (f
, pixel_width
, -1, 1, !NILP (pretend
), Qwidth
);
2950 DEFUN ("set-frame-size", Fset_frame_size
, Sset_frame_size
, 3, 4, 0,
2951 doc
: /* Set text size of FRAME to WIDTH by HEIGHT, measured in characters.
2952 Optional argument PIXELWISE non-nil means to measure in pixels. Note:
2953 When `frame-resize-pixelwise' is nil, some window managers may refuse to
2954 honor a WIDTH that is not an integer multiple of the default frame font
2955 width or a HEIGHT that is not an integer multiple of the default frame
2957 (Lisp_Object frame
, Lisp_Object width
, Lisp_Object height
, Lisp_Object pixelwise
)
2959 struct frame
*f
= decode_live_frame (frame
);
2960 int pixel_width
, pixel_height
;
2962 CHECK_TYPE_RANGED_INTEGER (int, width
);
2963 CHECK_TYPE_RANGED_INTEGER (int, height
);
2965 pixel_width
= (!NILP (pixelwise
)
2967 : XINT (width
) * FRAME_COLUMN_WIDTH (f
));
2968 pixel_height
= (!NILP (pixelwise
)
2970 : XINT (height
) * FRAME_LINE_HEIGHT (f
));
2971 adjust_frame_size (f
, pixel_width
, pixel_height
, 1, 0, Qsize
);
2976 DEFUN ("frame-position", Fframe_position
,
2977 Sframe_position
, 0, 1, 0,
2978 doc
: /* Return top left corner of FRAME in pixels.
2979 FRAME must be a live frame and defaults to the selected one. The return
2980 value is a cons (x, y) of the coordinates of the top left corner of
2981 FRAME's outer frame, in pixels relative to an origin (0, 0) of FRAME's
2985 register struct frame
*f
= decode_live_frame (frame
);
2987 return Fcons (make_number (f
->left_pos
), make_number (f
->top_pos
));
2990 DEFUN ("set-frame-position", Fset_frame_position
,
2991 Sset_frame_position
, 3, 3, 0,
2992 doc
: /* Set position of FRAME to (X, Y).
2993 FRAME must be a live frame and defaults to the selected one. X and Y,
2994 if positive, specify the coordinate of the left and top edge of FRAME's
2995 outer frame in pixels relative to an origin (0, 0) of FRAME's display.
2996 If any of X or Y is negative, it specifies the coordinates of the right
2997 or bottom edge of the outer frame of FRAME relative to the right or
2998 bottom edge of FRAME's display. */)
2999 (Lisp_Object frame
, Lisp_Object x
, Lisp_Object y
)
3001 register struct frame
*f
= decode_live_frame (frame
);
3003 CHECK_TYPE_RANGED_INTEGER (int, x
);
3004 CHECK_TYPE_RANGED_INTEGER (int, y
);
3006 /* I think this should be done with a hook. */
3007 #ifdef HAVE_WINDOW_SYSTEM
3008 if (FRAME_WINDOW_P (f
))
3009 x_set_offset (f
, XINT (x
), XINT (y
), 1);
3016 /***********************************************************************
3018 ***********************************************************************/
3020 /* Connect the frame-parameter names for X frames
3021 to the ways of passing the parameter values to the window system.
3023 The name of a parameter, as a Lisp symbol,
3024 has an `x-frame-parameter' property which is an integer in Lisp
3025 that is an index in this table. */
3027 struct frame_parm_table
{
3032 static const struct frame_parm_table frame_parms
[] =
3034 {"auto-raise", SYMBOL_INDEX (Qauto_raise
)},
3035 {"auto-lower", SYMBOL_INDEX (Qauto_lower
)},
3036 {"background-color", -1},
3037 {"border-color", SYMBOL_INDEX (Qborder_color
)},
3038 {"border-width", SYMBOL_INDEX (Qborder_width
)},
3039 {"cursor-color", SYMBOL_INDEX (Qcursor_color
)},
3040 {"cursor-type", SYMBOL_INDEX (Qcursor_type
)},
3042 {"foreground-color", -1},
3043 {"icon-name", SYMBOL_INDEX (Qicon_name
)},
3044 {"icon-type", SYMBOL_INDEX (Qicon_type
)},
3045 {"internal-border-width", SYMBOL_INDEX (Qinternal_border_width
)},
3046 {"right-divider-width", SYMBOL_INDEX (Qright_divider_width
)},
3047 {"bottom-divider-width", SYMBOL_INDEX (Qbottom_divider_width
)},
3048 {"menu-bar-lines", SYMBOL_INDEX (Qmenu_bar_lines
)},
3049 {"mouse-color", SYMBOL_INDEX (Qmouse_color
)},
3050 {"name", SYMBOL_INDEX (Qname
)},
3051 {"scroll-bar-width", SYMBOL_INDEX (Qscroll_bar_width
)},
3052 {"scroll-bar-height", SYMBOL_INDEX (Qscroll_bar_height
)},
3053 {"title", SYMBOL_INDEX (Qtitle
)},
3054 {"unsplittable", SYMBOL_INDEX (Qunsplittable
)},
3055 {"vertical-scroll-bars", SYMBOL_INDEX (Qvertical_scroll_bars
)},
3056 {"horizontal-scroll-bars", SYMBOL_INDEX (Qhorizontal_scroll_bars
)},
3057 {"visibility", SYMBOL_INDEX (Qvisibility
)},
3058 {"tool-bar-lines", SYMBOL_INDEX (Qtool_bar_lines
)},
3059 {"scroll-bar-foreground", SYMBOL_INDEX (Qscroll_bar_foreground
)},
3060 {"scroll-bar-background", SYMBOL_INDEX (Qscroll_bar_background
)},
3061 {"screen-gamma", SYMBOL_INDEX (Qscreen_gamma
)},
3062 {"line-spacing", SYMBOL_INDEX (Qline_spacing
)},
3063 {"left-fringe", SYMBOL_INDEX (Qleft_fringe
)},
3064 {"right-fringe", SYMBOL_INDEX (Qright_fringe
)},
3065 {"wait-for-wm", SYMBOL_INDEX (Qwait_for_wm
)},
3066 {"fullscreen", SYMBOL_INDEX (Qfullscreen
)},
3067 {"font-backend", SYMBOL_INDEX (Qfont_backend
)},
3068 {"alpha", SYMBOL_INDEX (Qalpha
)},
3069 {"sticky", SYMBOL_INDEX (Qsticky
)},
3070 {"tool-bar-position", SYMBOL_INDEX (Qtool_bar_position
)},
3073 #ifdef HAVE_WINDOW_SYSTEM
3075 /* Change the parameters of frame F as specified by ALIST.
3076 If a parameter is not specially recognized, do nothing special;
3077 otherwise call the `x_set_...' function for that parameter.
3078 Except for certain geometry properties, always call store_frame_param
3079 to store the new value in the parameter alist. */
3082 x_set_frame_parameters (struct frame
*f
, Lisp_Object alist
)
3086 /* If both of these parameters are present, it's more efficient to
3087 set them both at once. So we wait until we've looked at the
3088 entire list before we set them. */
3089 int width
IF_LINT (= 0), height
IF_LINT (= 0);
3090 bool width_change
= false, height_change
= false;
3093 Lisp_Object left
, top
;
3095 /* Same with these. */
3096 Lisp_Object icon_left
, icon_top
;
3098 /* And with this. */
3099 Lisp_Object fullscreen
;
3100 bool fullscreen_change
= false;
3102 /* Record in these vectors all the parms specified. */
3104 Lisp_Object
*values
;
3106 bool left_no_change
= 0, top_no_change
= 0;
3107 #ifdef HAVE_X_WINDOWS
3108 bool icon_left_no_change
= 0, icon_top_no_change
= 0;
3112 for (tail
= alist
; CONSP (tail
); tail
= XCDR (tail
))
3116 SAFE_ALLOCA_LISP (parms
, 2 * i
);
3119 /* Extract parm names and values into those vectors. */
3122 for (tail
= alist
; CONSP (tail
); tail
= XCDR (tail
))
3127 parms
[i
] = Fcar (elt
);
3128 values
[i
] = Fcdr (elt
);
3131 /* TAIL and ALIST are not used again below here. */
3132 alist
= tail
= Qnil
;
3134 top
= left
= Qunbound
;
3135 icon_left
= icon_top
= Qunbound
;
3137 /* Process foreground_color and background_color before anything else.
3138 They are independent of other properties, but other properties (e.g.,
3139 cursor_color) are dependent upon them. */
3140 /* Process default font as well, since fringe widths depends on it. */
3141 for (p
= 0; p
< i
; p
++)
3143 Lisp_Object prop
, val
;
3147 if (EQ (prop
, Qforeground_color
)
3148 || EQ (prop
, Qbackground_color
)
3149 || EQ (prop
, Qfont
))
3151 register Lisp_Object param_index
, old_value
;
3153 old_value
= get_frame_param (f
, prop
);
3154 if (NILP (Fequal (val
, old_value
)))
3156 store_frame_param (f
, prop
, val
);
3158 param_index
= Fget (prop
, Qx_frame_parameter
);
3159 if (NATNUMP (param_index
)
3160 && XFASTINT (param_index
) < ARRAYELTS (frame_parms
)
3161 && FRAME_RIF (f
)->frame_parm_handlers
[XINT (param_index
)])
3162 (*(FRAME_RIF (f
)->frame_parm_handlers
[XINT (param_index
)])) (f
, val
, old_value
);
3167 /* Now process them in reverse of specified order. */
3170 Lisp_Object prop
, val
;
3175 if (EQ (prop
, Qwidth
))
3177 if (RANGED_INTEGERP (0, val
, INT_MAX
))
3179 width
= XFASTINT (val
) * FRAME_COLUMN_WIDTH (f
) ;
3180 width_change
= true;
3182 else if (CONSP (val
) && EQ (XCAR (val
), Qtext_pixels
)
3183 && RANGED_INTEGERP (0, XCDR (val
), INT_MAX
))
3185 width
= XFASTINT (XCDR (val
));
3186 width_change
= true;
3189 else if (EQ (prop
, Qheight
))
3191 if (RANGED_INTEGERP (0, val
, INT_MAX
))
3193 height
= XFASTINT (val
) * FRAME_LINE_HEIGHT (f
);
3194 height_change
= true;
3196 else if (CONSP (val
) && EQ (XCAR (val
), Qtext_pixels
)
3197 && RANGED_INTEGERP (0, XCDR (val
), INT_MAX
))
3199 height
= XFASTINT (XCDR (val
));
3200 height_change
= true;
3203 else if (EQ (prop
, Qtop
))
3205 else if (EQ (prop
, Qleft
))
3207 else if (EQ (prop
, Qicon_top
))
3209 else if (EQ (prop
, Qicon_left
))
3211 else if (EQ (prop
, Qfullscreen
))
3214 fullscreen_change
= true;
3216 else if (EQ (prop
, Qforeground_color
)
3217 || EQ (prop
, Qbackground_color
)
3218 || EQ (prop
, Qfont
))
3219 /* Processed above. */
3223 register Lisp_Object param_index
, old_value
;
3225 old_value
= get_frame_param (f
, prop
);
3227 store_frame_param (f
, prop
, val
);
3229 param_index
= Fget (prop
, Qx_frame_parameter
);
3230 if (NATNUMP (param_index
)
3231 && XFASTINT (param_index
) < ARRAYELTS (frame_parms
)
3232 && FRAME_RIF (f
)->frame_parm_handlers
[XINT (param_index
)])
3233 (*(FRAME_RIF (f
)->frame_parm_handlers
[XINT (param_index
)])) (f
, val
, old_value
);
3237 /* Don't die if just one of these was set. */
3238 if (EQ (left
, Qunbound
))
3241 if (f
->left_pos
< 0)
3242 left
= list2 (Qplus
, make_number (f
->left_pos
));
3244 XSETINT (left
, f
->left_pos
);
3246 if (EQ (top
, Qunbound
))
3250 top
= list2 (Qplus
, make_number (f
->top_pos
));
3252 XSETINT (top
, f
->top_pos
);
3255 /* If one of the icon positions was not set, preserve or default it. */
3256 if (! TYPE_RANGED_INTEGERP (int, icon_left
))
3258 #ifdef HAVE_X_WINDOWS
3259 icon_left_no_change
= 1;
3261 icon_left
= Fcdr (Fassq (Qicon_left
, f
->param_alist
));
3262 if (NILP (icon_left
))
3263 XSETINT (icon_left
, 0);
3265 if (! TYPE_RANGED_INTEGERP (int, icon_top
))
3267 #ifdef HAVE_X_WINDOWS
3268 icon_top_no_change
= 1;
3270 icon_top
= Fcdr (Fassq (Qicon_top
, f
->param_alist
));
3271 if (NILP (icon_top
))
3272 XSETINT (icon_top
, 0);
3275 /* Don't set these parameters unless they've been explicitly
3276 specified. The window might be mapped or resized while we're in
3277 this function, and we don't want to override that unless the lisp
3278 code has asked for it.
3280 Don't set these parameters unless they actually differ from the
3281 window's current parameters; the window may not actually exist
3286 XSETFRAME (frame
, f
);
3288 if ((width_change
&& width
!= FRAME_TEXT_WIDTH (f
))
3289 || (height_change
&& height
!= FRAME_TEXT_HEIGHT (f
)))
3290 /* We could consider checking f->after_make_frame here, but I
3291 don't have the faintest idea why the following is needed at
3292 all. With the old setting it can get a Heisenbug when
3293 EmacsFrameResize intermittently provokes a delayed
3294 change_frame_size in the middle of adjust_frame_size. */
3295 /** || (f->can_x_set_window_size && (f->new_height || f->new_width))) **/
3296 adjust_frame_size (f
, width_change
? width
: -1,
3297 height_change
? height
: -1, 1, 0, Qx_set_frame_parameters
);
3299 if ((!NILP (left
) || !NILP (top
))
3300 && ! (left_no_change
&& top_no_change
)
3301 && ! (NUMBERP (left
) && XINT (left
) == f
->left_pos
3302 && NUMBERP (top
) && XINT (top
) == f
->top_pos
))
3307 /* Record the signs. */
3308 f
->size_hint_flags
&= ~ (XNegative
| YNegative
);
3309 if (EQ (left
, Qminus
))
3310 f
->size_hint_flags
|= XNegative
;
3311 else if (TYPE_RANGED_INTEGERP (int, left
))
3313 leftpos
= XINT (left
);
3315 f
->size_hint_flags
|= XNegative
;
3317 else if (CONSP (left
) && EQ (XCAR (left
), Qminus
)
3318 && CONSP (XCDR (left
))
3319 && RANGED_INTEGERP (-INT_MAX
, XCAR (XCDR (left
)), INT_MAX
))
3321 leftpos
= - XINT (XCAR (XCDR (left
)));
3322 f
->size_hint_flags
|= XNegative
;
3324 else if (CONSP (left
) && EQ (XCAR (left
), Qplus
)
3325 && CONSP (XCDR (left
))
3326 && TYPE_RANGED_INTEGERP (int, XCAR (XCDR (left
))))
3328 leftpos
= XINT (XCAR (XCDR (left
)));
3331 if (EQ (top
, Qminus
))
3332 f
->size_hint_flags
|= YNegative
;
3333 else if (TYPE_RANGED_INTEGERP (int, top
))
3335 toppos
= XINT (top
);
3337 f
->size_hint_flags
|= YNegative
;
3339 else if (CONSP (top
) && EQ (XCAR (top
), Qminus
)
3340 && CONSP (XCDR (top
))
3341 && RANGED_INTEGERP (-INT_MAX
, XCAR (XCDR (top
)), INT_MAX
))
3343 toppos
= - XINT (XCAR (XCDR (top
)));
3344 f
->size_hint_flags
|= YNegative
;
3346 else if (CONSP (top
) && EQ (XCAR (top
), Qplus
)
3347 && CONSP (XCDR (top
))
3348 && TYPE_RANGED_INTEGERP (int, XCAR (XCDR (top
))))
3350 toppos
= XINT (XCAR (XCDR (top
)));
3354 /* Store the numeric value of the position. */
3355 f
->top_pos
= toppos
;
3356 f
->left_pos
= leftpos
;
3358 f
->win_gravity
= NorthWestGravity
;
3360 /* Actually set that position, and convert to absolute. */
3361 x_set_offset (f
, leftpos
, toppos
, -1);
3364 if (fullscreen_change
)
3366 Lisp_Object old_value
= get_frame_param (f
, Qfullscreen
);
3368 frame_size_history_add
3369 (f
, Qx_set_fullscreen
, 0, 0, list2 (old_value
, fullscreen
));
3371 store_frame_param (f
, Qfullscreen
, fullscreen
);
3372 if (!EQ (fullscreen
, old_value
))
3373 x_set_fullscreen (f
, fullscreen
, old_value
);
3377 #ifdef HAVE_X_WINDOWS
3378 if ((!NILP (icon_left
) || !NILP (icon_top
))
3379 && ! (icon_left_no_change
&& icon_top_no_change
))
3380 x_wm_set_icon_position (f
, XINT (icon_left
), XINT (icon_top
));
3381 #endif /* HAVE_X_WINDOWS */
3388 /* Insert a description of internally-recorded parameters of frame X
3389 into the parameter alist *ALISTPTR that is to be given to the user.
3390 Only parameters that are specific to the X window system
3391 and whose values are not correctly recorded in the frame's
3392 param_alist need to be considered here. */
3395 x_report_frame_params (struct frame
*f
, Lisp_Object
*alistptr
)
3399 char buf
[INT_BUFSIZE_BOUND (w
)];
3401 /* Represent negative positions (off the top or left screen edge)
3402 in a way that Fmodify_frame_parameters will understand correctly. */
3403 XSETINT (tem
, f
->left_pos
);
3404 if (f
->left_pos
>= 0)
3405 store_in_alist (alistptr
, Qleft
, tem
);
3407 store_in_alist (alistptr
, Qleft
, list2 (Qplus
, tem
));
3409 XSETINT (tem
, f
->top_pos
);
3410 if (f
->top_pos
>= 0)
3411 store_in_alist (alistptr
, Qtop
, tem
);
3413 store_in_alist (alistptr
, Qtop
, list2 (Qplus
, tem
));
3415 store_in_alist (alistptr
, Qborder_width
,
3416 make_number (f
->border_width
));
3417 store_in_alist (alistptr
, Qinternal_border_width
,
3418 make_number (FRAME_INTERNAL_BORDER_WIDTH (f
)));
3419 store_in_alist (alistptr
, Qright_divider_width
,
3420 make_number (FRAME_RIGHT_DIVIDER_WIDTH (f
)));
3421 store_in_alist (alistptr
, Qbottom_divider_width
,
3422 make_number (FRAME_BOTTOM_DIVIDER_WIDTH (f
)));
3423 store_in_alist (alistptr
, Qleft_fringe
,
3424 make_number (FRAME_LEFT_FRINGE_WIDTH (f
)));
3425 store_in_alist (alistptr
, Qright_fringe
,
3426 make_number (FRAME_RIGHT_FRINGE_WIDTH (f
)));
3427 store_in_alist (alistptr
, Qscroll_bar_width
,
3428 (! FRAME_HAS_VERTICAL_SCROLL_BARS (f
)
3430 : FRAME_CONFIG_SCROLL_BAR_WIDTH (f
) > 0
3431 ? make_number (FRAME_CONFIG_SCROLL_BAR_WIDTH (f
))
3432 /* nil means "use default width"
3433 for non-toolkit scroll bar.
3434 ruler-mode.el depends on this. */
3436 store_in_alist (alistptr
, Qscroll_bar_height
,
3437 (! FRAME_HAS_HORIZONTAL_SCROLL_BARS (f
)
3439 : FRAME_CONFIG_SCROLL_BAR_HEIGHT (f
) > 0
3440 ? make_number (FRAME_CONFIG_SCROLL_BAR_HEIGHT (f
))
3441 /* nil means "use default height"
3442 for non-toolkit scroll bar. */
3444 /* FRAME_X_WINDOW is not guaranteed to return an integer. E.g., on
3445 MS-Windows it returns a value whose type is HANDLE, which is
3446 actually a pointer. Explicit casting avoids compiler
3448 w
= (uintptr_t) FRAME_X_WINDOW (f
);
3449 store_in_alist (alistptr
, Qwindow_id
,
3450 make_formatted_string (buf
, "%"pMu
, w
));
3451 #ifdef HAVE_X_WINDOWS
3452 #ifdef USE_X_TOOLKIT
3453 /* Tooltip frame may not have this widget. */
3454 if (FRAME_X_OUTPUT (f
)->widget
)
3456 w
= (uintptr_t) FRAME_OUTER_WINDOW (f
);
3457 store_in_alist (alistptr
, Qouter_window_id
,
3458 make_formatted_string (buf
, "%"pMu
, w
));
3460 store_in_alist (alistptr
, Qicon_name
, f
->icon_name
);
3461 store_in_alist (alistptr
, Qvisibility
,
3462 (FRAME_VISIBLE_P (f
) ? Qt
3463 : FRAME_ICONIFIED_P (f
) ? Qicon
: Qnil
));
3464 store_in_alist (alistptr
, Qdisplay
,
3465 XCAR (FRAME_DISPLAY_INFO (f
)->name_list_element
));
3467 if (FRAME_X_OUTPUT (f
)->parent_desc
== FRAME_DISPLAY_INFO (f
)->root_window
)
3470 tem
= make_natnum ((uintptr_t) FRAME_X_OUTPUT (f
)->parent_desc
);
3471 store_in_alist (alistptr
, Qexplicit_name
, (f
->explicit_name
? Qt
: Qnil
));
3472 store_in_alist (alistptr
, Qparent_id
, tem
);
3473 store_in_alist (alistptr
, Qtool_bar_position
, FRAME_TOOL_BAR_POSITION (f
));
3477 /* Change the `fullscreen' frame parameter of frame F. OLD_VALUE is
3478 the previous value of that parameter, NEW_VALUE is the new value. */
3481 x_set_fullscreen (struct frame
*f
, Lisp_Object new_value
, Lisp_Object old_value
)
3483 if (NILP (new_value
))
3484 f
->want_fullscreen
= FULLSCREEN_NONE
;
3485 else if (EQ (new_value
, Qfullboth
) || EQ (new_value
, Qfullscreen
))
3486 f
->want_fullscreen
= FULLSCREEN_BOTH
;
3487 else if (EQ (new_value
, Qfullwidth
))
3488 f
->want_fullscreen
= FULLSCREEN_WIDTH
;
3489 else if (EQ (new_value
, Qfullheight
))
3490 f
->want_fullscreen
= FULLSCREEN_HEIGHT
;
3491 else if (EQ (new_value
, Qmaximized
))
3492 f
->want_fullscreen
= FULLSCREEN_MAXIMIZED
;
3494 if (FRAME_TERMINAL (f
)->fullscreen_hook
!= NULL
)
3495 FRAME_TERMINAL (f
)->fullscreen_hook (f
);
3499 /* Change the `line-spacing' frame parameter of frame F. OLD_VALUE is
3500 the previous value of that parameter, NEW_VALUE is the new value. */
3503 x_set_line_spacing (struct frame
*f
, Lisp_Object new_value
, Lisp_Object old_value
)
3505 if (NILP (new_value
))
3506 f
->extra_line_spacing
= 0;
3507 else if (RANGED_INTEGERP (0, new_value
, INT_MAX
))
3508 f
->extra_line_spacing
= XFASTINT (new_value
);
3509 else if (FLOATP (new_value
))
3511 int new_spacing
= XFLOAT_DATA (new_value
) * FRAME_LINE_HEIGHT (f
) + 0.5;
3513 if (new_spacing
>= 0)
3514 f
->extra_line_spacing
= new_spacing
;
3516 signal_error ("Invalid line-spacing", new_value
);
3519 signal_error ("Invalid line-spacing", new_value
);
3520 if (FRAME_VISIBLE_P (f
))
3525 /* Change the `screen-gamma' frame parameter of frame F. OLD_VALUE is
3526 the previous value of that parameter, NEW_VALUE is the new value. */
3529 x_set_screen_gamma (struct frame
*f
, Lisp_Object new_value
, Lisp_Object old_value
)
3531 Lisp_Object bgcolor
;
3533 if (NILP (new_value
))
3535 else if (NUMBERP (new_value
) && XFLOATINT (new_value
) > 0)
3536 /* The value 0.4545 is the normal viewing gamma. */
3537 f
->gamma
= 1.0 / (0.4545 * XFLOATINT (new_value
));
3539 signal_error ("Invalid screen-gamma", new_value
);
3541 /* Apply the new gamma value to the frame background. */
3542 bgcolor
= Fassq (Qbackground_color
, f
->param_alist
);
3543 if (CONSP (bgcolor
) && (bgcolor
= XCDR (bgcolor
), STRINGP (bgcolor
)))
3545 Lisp_Object parm_index
= Fget (Qbackground_color
, Qx_frame_parameter
);
3546 if (NATNUMP (parm_index
)
3547 && XFASTINT (parm_index
) < ARRAYELTS (frame_parms
)
3548 && FRAME_RIF (f
)->frame_parm_handlers
[XFASTINT (parm_index
)])
3549 (*FRAME_RIF (f
)->frame_parm_handlers
[XFASTINT (parm_index
)])
3553 clear_face_cache (true); /* FIXME: Why of all frames? */
3559 x_set_font (struct frame
*f
, Lisp_Object arg
, Lisp_Object oldval
)
3561 Lisp_Object font_object
;
3563 #ifdef HAVE_X_WINDOWS
3564 Lisp_Object font_param
= arg
;
3567 /* Set the frame parameter back to the old value because we may
3568 fail to use ARG as the new parameter value. */
3569 store_frame_param (f
, Qfont
, oldval
);
3571 /* ARG is a fontset name, a font name, a cons of fontset name and a
3572 font object, or a font object. In the last case, this function
3576 fontset
= fs_query_fontset (arg
, 0);
3579 font_object
= font_open_by_name (f
, arg
);
3580 if (NILP (font_object
))
3581 error ("Font `%s' is not defined", SSDATA (arg
));
3582 arg
= AREF (font_object
, FONT_NAME_INDEX
);
3584 else if (fontset
> 0)
3586 font_object
= font_open_by_name (f
, fontset_ascii (fontset
));
3587 if (NILP (font_object
))
3588 error ("Font `%s' is not defined", SDATA (arg
));
3589 arg
= AREF (font_object
, FONT_NAME_INDEX
);
3592 error ("The default fontset can't be used for a frame font");
3594 else if (CONSP (arg
) && STRINGP (XCAR (arg
)) && FONT_OBJECT_P (XCDR (arg
)))
3596 /* This is the case that the ASCII font of F's fontset XCAR
3597 (arg) is changed to the font XCDR (arg) by
3598 `set-fontset-font'. */
3599 fontset
= fs_query_fontset (XCAR (arg
), 0);
3601 error ("Unknown fontset: %s", SDATA (XCAR (arg
)));
3602 font_object
= XCDR (arg
);
3603 arg
= AREF (font_object
, FONT_NAME_INDEX
);
3604 #ifdef HAVE_X_WINDOWS
3605 font_param
= Ffont_get (font_object
, QCname
);
3608 else if (FONT_OBJECT_P (arg
))
3611 #ifdef HAVE_X_WINDOWS
3612 font_param
= Ffont_get (font_object
, QCname
);
3614 /* This is to store the XLFD font name in the frame parameter for
3615 backward compatibility. We should store the font-object
3616 itself in the future. */
3617 arg
= AREF (font_object
, FONT_NAME_INDEX
);
3618 fontset
= FRAME_FONTSET (f
);
3619 /* Check if we can use the current fontset. If not, set FONTSET
3620 to -1 to generate a new fontset from FONT-OBJECT. */
3623 Lisp_Object ascii_font
= fontset_ascii (fontset
);
3624 Lisp_Object spec
= font_spec_from_name (ascii_font
);
3626 /* SPEC might be nil because ASCII_FONT's name doesn't parse
3627 according to stupid XLFD rules, which, for example,
3628 disallow font names that include a dash followed by a
3629 number. So in those cases we simply request x_new_font
3630 below to generate a new fontset. */
3631 if (NILP (spec
) || ! font_match_p (spec
, font_object
))
3636 signal_error ("Invalid font", arg
);
3638 if (! NILP (Fequal (font_object
, oldval
)))
3641 x_new_font (f
, font_object
, fontset
);
3642 store_frame_param (f
, Qfont
, arg
);
3643 #ifdef HAVE_X_WINDOWS
3644 store_frame_param (f
, Qfont_param
, font_param
);
3646 /* Recalculate toolbar height. */
3647 f
->n_tool_bar_rows
= 0;
3649 /* Ensure we redraw it. */
3650 clear_current_matrices (f
);
3652 /* Attempt to hunt down bug#16028. */
3653 SET_FRAME_GARBAGED (f
);
3655 /* This is important if we are called by some Lisp as part of
3656 redisplaying the frame, see redisplay_internal. */
3657 f
->fonts_changed
= true;
3659 recompute_basic_faces (f
);
3661 do_pending_window_change (0);
3663 /* We used to call face-set-after-frame-default here, but it leads to
3664 recursive calls (since that function can set the `default' face's
3665 font which in turns changes the frame's `font' parameter).
3666 Also I don't know what this call is meant to do, but it seems the
3667 wrong way to do it anyway (it does a lot more work than what seems
3668 reasonable in response to a change to `font'). */
3673 x_set_font_backend (struct frame
*f
, Lisp_Object new_value
, Lisp_Object old_value
)
3675 if (! NILP (new_value
)
3676 && !CONSP (new_value
))
3680 CHECK_STRING (new_value
);
3681 p0
= p1
= SSDATA (new_value
);
3685 while (*p1
&& ! c_isspace (*p1
) && *p1
!= ',') p1
++;
3687 new_value
= Fcons (Fintern (make_string (p0
, p1
- p0
), Qnil
),
3693 while ((c
= *++p1
) && c_isspace (c
));
3697 new_value
= Fnreverse (new_value
);
3700 if (! NILP (old_value
) && ! NILP (Fequal (old_value
, new_value
)))
3704 free_all_realized_faces (Qnil
);
3706 new_value
= font_update_drivers (f
, NILP (new_value
) ? Qt
: new_value
);
3707 if (NILP (new_value
))
3709 if (NILP (old_value
))
3710 error ("No font backend available");
3711 font_update_drivers (f
, old_value
);
3712 error ("None of specified font backends are available");
3714 store_frame_param (f
, Qfont_backend
, new_value
);
3720 XSETFRAME (frame
, f
);
3721 x_set_font (f
, Fframe_parameter (frame
, Qfont
), Qnil
);
3723 windows_or_buffers_changed
= 18;
3728 x_set_left_fringe (struct frame
*f
, Lisp_Object new_value
, Lisp_Object old_value
)
3730 int unit
= FRAME_COLUMN_WIDTH (f
);
3731 int old_width
= FRAME_LEFT_FRINGE_WIDTH (f
);
3734 new_width
= (RANGED_INTEGERP (-INT_MAX
, new_value
, INT_MAX
)
3735 ? eabs (XINT (new_value
)) : 8);
3737 if (new_width
!= old_width
)
3739 FRAME_LEFT_FRINGE_WIDTH (f
) = new_width
;
3740 FRAME_FRINGE_COLS (f
) /* Round up. */
3741 = (new_width
+ FRAME_RIGHT_FRINGE_WIDTH (f
) + unit
- 1) / unit
;
3743 if (FRAME_X_WINDOW (f
) != 0)
3744 adjust_frame_size (f
, -1, -1, 3, 0, Qleft_fringe
);
3746 SET_FRAME_GARBAGED (f
);
3752 x_set_right_fringe (struct frame
*f
, Lisp_Object new_value
, Lisp_Object old_value
)
3754 int unit
= FRAME_COLUMN_WIDTH (f
);
3755 int old_width
= FRAME_RIGHT_FRINGE_WIDTH (f
);
3758 new_width
= (RANGED_INTEGERP (-INT_MAX
, new_value
, INT_MAX
)
3759 ? eabs (XINT (new_value
)) : 8);
3761 if (new_width
!= old_width
)
3763 FRAME_RIGHT_FRINGE_WIDTH (f
) = new_width
;
3764 FRAME_FRINGE_COLS (f
) /* Round up. */
3765 = (new_width
+ FRAME_LEFT_FRINGE_WIDTH (f
) + unit
- 1) / unit
;
3767 if (FRAME_X_WINDOW (f
) != 0)
3768 adjust_frame_size (f
, -1, -1, 3, 0, Qright_fringe
);
3770 SET_FRAME_GARBAGED (f
);
3776 x_set_border_width (struct frame
*f
, Lisp_Object arg
, Lisp_Object oldval
)
3778 CHECK_TYPE_RANGED_INTEGER (int, arg
);
3780 if (XINT (arg
) == f
->border_width
)
3783 if (FRAME_X_WINDOW (f
) != 0)
3784 error ("Cannot change the border width of a frame");
3786 f
->border_width
= XINT (arg
);
3790 x_set_right_divider_width (struct frame
*f
, Lisp_Object arg
, Lisp_Object oldval
)
3792 int old
= FRAME_RIGHT_DIVIDER_WIDTH (f
);
3794 CHECK_TYPE_RANGED_INTEGER (int, arg
);
3795 FRAME_RIGHT_DIVIDER_WIDTH (f
) = XINT (arg
);
3796 if (FRAME_RIGHT_DIVIDER_WIDTH (f
) < 0)
3797 FRAME_RIGHT_DIVIDER_WIDTH (f
) = 0;
3798 if (FRAME_RIGHT_DIVIDER_WIDTH (f
) != old
)
3800 adjust_frame_size (f
, -1, -1, 4, 0, Qright_divider_width
);
3801 adjust_frame_glyphs (f
);
3802 SET_FRAME_GARBAGED (f
);
3808 x_set_bottom_divider_width (struct frame
*f
, Lisp_Object arg
, Lisp_Object oldval
)
3810 int old
= FRAME_BOTTOM_DIVIDER_WIDTH (f
);
3812 CHECK_TYPE_RANGED_INTEGER (int, arg
);
3813 FRAME_BOTTOM_DIVIDER_WIDTH (f
) = XINT (arg
);
3814 if (FRAME_BOTTOM_DIVIDER_WIDTH (f
) < 0)
3815 FRAME_BOTTOM_DIVIDER_WIDTH (f
) = 0;
3816 if (FRAME_BOTTOM_DIVIDER_WIDTH (f
) != old
)
3818 adjust_frame_size (f
, -1, -1, 4, 0, Qbottom_divider_width
);
3819 adjust_frame_glyphs (f
);
3820 SET_FRAME_GARBAGED (f
);
3825 x_set_visibility (struct frame
*f
, Lisp_Object value
, Lisp_Object oldval
)
3828 XSETFRAME (frame
, f
);
3831 Fmake_frame_invisible (frame
, Qt
);
3832 else if (EQ (value
, Qicon
))
3833 Ficonify_frame (frame
);
3835 Fmake_frame_visible (frame
);
3839 x_set_autoraise (struct frame
*f
, Lisp_Object arg
, Lisp_Object oldval
)
3841 f
->auto_raise
= !EQ (Qnil
, arg
);
3845 x_set_autolower (struct frame
*f
, Lisp_Object arg
, Lisp_Object oldval
)
3847 f
->auto_lower
= !EQ (Qnil
, arg
);
3851 x_set_unsplittable (struct frame
*f
, Lisp_Object arg
, Lisp_Object oldval
)
3853 f
->no_split
= !NILP (arg
);
3857 x_set_vertical_scroll_bars (struct frame
*f
, Lisp_Object arg
, Lisp_Object oldval
)
3859 if ((EQ (arg
, Qleft
) && FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f
))
3860 || (EQ (arg
, Qright
) && FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f
))
3861 || (NILP (arg
) && FRAME_HAS_VERTICAL_SCROLL_BARS (f
))
3862 || (!NILP (arg
) && !FRAME_HAS_VERTICAL_SCROLL_BARS (f
)))
3864 FRAME_VERTICAL_SCROLL_BAR_TYPE (f
)
3866 ? vertical_scroll_bar_none
3868 ? vertical_scroll_bar_left
3870 ? vertical_scroll_bar_right
3871 : EQ (Qleft
, Vdefault_frame_scroll_bars
)
3872 ? vertical_scroll_bar_left
3873 : EQ (Qright
, Vdefault_frame_scroll_bars
)
3874 ? vertical_scroll_bar_right
3875 : vertical_scroll_bar_none
);
3877 /* We set this parameter before creating the X window for the
3878 frame, so we can get the geometry right from the start.
3879 However, if the window hasn't been created yet, we shouldn't
3880 call x_set_window_size. */
3881 if (FRAME_X_WINDOW (f
))
3882 adjust_frame_size (f
, -1, -1, 3, 0, Qvertical_scroll_bars
);
3884 SET_FRAME_GARBAGED (f
);
3889 x_set_horizontal_scroll_bars (struct frame
*f
, Lisp_Object arg
, Lisp_Object oldval
)
3891 #if USE_HORIZONTAL_SCROLL_BARS
3892 if ((NILP (arg
) && FRAME_HAS_HORIZONTAL_SCROLL_BARS (f
))
3893 || (!NILP (arg
) && !FRAME_HAS_HORIZONTAL_SCROLL_BARS (f
)))
3895 f
->horizontal_scroll_bars
= NILP (arg
) ? false : true;
3897 /* We set this parameter before creating the X window for the
3898 frame, so we can get the geometry right from the start.
3899 However, if the window hasn't been created yet, we shouldn't
3900 call x_set_window_size. */
3901 if (FRAME_X_WINDOW (f
))
3902 adjust_frame_size (f
, -1, -1, 3, 0, Qhorizontal_scroll_bars
);
3904 SET_FRAME_GARBAGED (f
);
3910 x_set_scroll_bar_width (struct frame
*f
, Lisp_Object arg
, Lisp_Object oldval
)
3912 int unit
= FRAME_COLUMN_WIDTH (f
);
3916 x_set_scroll_bar_default_width (f
);
3918 if (FRAME_X_WINDOW (f
))
3919 adjust_frame_size (f
, -1, -1, 3, 0, Qscroll_bar_width
);
3921 SET_FRAME_GARBAGED (f
);
3923 else if (RANGED_INTEGERP (1, arg
, INT_MAX
)
3924 && XFASTINT (arg
) != FRAME_CONFIG_SCROLL_BAR_WIDTH (f
))
3926 FRAME_CONFIG_SCROLL_BAR_WIDTH (f
) = XFASTINT (arg
);
3927 FRAME_CONFIG_SCROLL_BAR_COLS (f
) = (XFASTINT (arg
) + unit
- 1) / unit
;
3928 if (FRAME_X_WINDOW (f
))
3929 adjust_frame_size (f
, -1, -1, 3, 0, Qscroll_bar_width
);
3931 SET_FRAME_GARBAGED (f
);
3934 XWINDOW (FRAME_SELECTED_WINDOW (f
))->cursor
.hpos
= 0;
3935 XWINDOW (FRAME_SELECTED_WINDOW (f
))->cursor
.x
= 0;
3939 x_set_scroll_bar_height (struct frame
*f
, Lisp_Object arg
, Lisp_Object oldval
)
3941 #if USE_HORIZONTAL_SCROLL_BARS
3942 int unit
= FRAME_LINE_HEIGHT (f
);
3946 x_set_scroll_bar_default_height (f
);
3948 if (FRAME_X_WINDOW (f
))
3949 adjust_frame_size (f
, -1, -1, 3, 0, Qscroll_bar_height
);
3951 SET_FRAME_GARBAGED (f
);
3953 else if (RANGED_INTEGERP (1, arg
, INT_MAX
)
3954 && XFASTINT (arg
) != FRAME_CONFIG_SCROLL_BAR_HEIGHT (f
))
3956 FRAME_CONFIG_SCROLL_BAR_HEIGHT (f
) = XFASTINT (arg
);
3957 FRAME_CONFIG_SCROLL_BAR_LINES (f
) = (XFASTINT (arg
) + unit
- 1) / unit
;
3958 if (FRAME_X_WINDOW (f
))
3959 adjust_frame_size (f
, -1, -1, 3, 0, Qscroll_bar_height
);
3961 SET_FRAME_GARBAGED (f
);
3964 XWINDOW (FRAME_SELECTED_WINDOW (f
))->cursor
.vpos
= 0;
3965 XWINDOW (FRAME_SELECTED_WINDOW (f
))->cursor
.y
= 0;
3970 x_set_alpha (struct frame
*f
, Lisp_Object arg
, Lisp_Object oldval
)
3977 for (i
= 0; i
< 2; i
++)
3990 else if (FLOATP (item
))
3992 alpha
= XFLOAT_DATA (item
);
3993 if (! (0 <= alpha
&& alpha
<= 1.0))
3994 args_out_of_range (make_float (0.0), make_float (1.0));
3996 else if (INTEGERP (item
))
3998 EMACS_INT ialpha
= XINT (item
);
3999 if (! (0 <= ialpha
&& alpha
<= 100))
4000 args_out_of_range (make_number (0), make_number (100));
4001 alpha
= ialpha
/ 100.0;
4004 wrong_type_argument (Qnumberp
, item
);
4008 for (i
= 0; i
< 2; i
++)
4009 f
->alpha
[i
] = newval
[i
];
4011 #if defined (HAVE_X_WINDOWS) || defined (HAVE_NTGUI) || defined (NS_IMPL_COCOA)
4013 x_set_frame_alpha (f
);
4022 /* Non-zero if mouse is grabbed on DPYINFO
4023 and we know the frame where it is. */
4025 bool x_mouse_grabbed (Display_Info
*dpyinfo
)
4027 return (dpyinfo
->grabbed
4028 && dpyinfo
->last_mouse_frame
4029 && FRAME_LIVE_P (dpyinfo
->last_mouse_frame
));
4032 /* Re-highlight something with mouse-face properties
4033 on DPYINFO using saved frame and mouse position. */
4036 x_redo_mouse_highlight (Display_Info
*dpyinfo
)
4038 if (dpyinfo
->last_mouse_motion_frame
4039 && FRAME_LIVE_P (dpyinfo
->last_mouse_motion_frame
))
4040 note_mouse_highlight (dpyinfo
->last_mouse_motion_frame
,
4041 dpyinfo
->last_mouse_motion_x
,
4042 dpyinfo
->last_mouse_motion_y
);
4045 #endif /* HAVE_NS */
4047 /* Subroutines of creating an X frame. */
4049 /* Make sure that Vx_resource_name is set to a reasonable value.
4050 Fix it up, or set it to `emacs' if it is too hopeless. */
4053 validate_x_resource_name (void)
4056 /* Number of valid characters in the resource name. */
4057 ptrdiff_t good_count
= 0;
4058 /* Number of invalid characters in the resource name. */
4059 ptrdiff_t bad_count
= 0;
4063 if (!STRINGP (Vx_resource_class
))
4064 Vx_resource_class
= build_string (EMACS_CLASS
);
4066 if (STRINGP (Vx_resource_name
))
4068 unsigned char *p
= SDATA (Vx_resource_name
);
4070 len
= SBYTES (Vx_resource_name
);
4072 /* Only letters, digits, - and _ are valid in resource names.
4073 Count the valid characters and count the invalid ones. */
4074 for (i
= 0; i
< len
; i
++)
4077 if (! ((c
>= 'a' && c
<= 'z')
4078 || (c
>= 'A' && c
<= 'Z')
4079 || (c
>= '0' && c
<= '9')
4080 || c
== '-' || c
== '_'))
4087 /* Not a string => completely invalid. */
4088 bad_count
= 5, good_count
= 0;
4090 /* If name is valid already, return. */
4094 /* If name is entirely invalid, or nearly so, or is so implausibly
4095 large that alloca might not work, use `emacs'. */
4096 if (good_count
< 2 || MAX_ALLOCA
- sizeof ".customization" < len
)
4098 Vx_resource_name
= build_string ("emacs");
4102 /* Name is partly valid. Copy it and replace the invalid characters
4103 with underscores. */
4105 Vx_resource_name
= new = Fcopy_sequence (Vx_resource_name
);
4107 for (i
= 0; i
< len
; i
++)
4109 int c
= SREF (new, i
);
4110 if (! ((c
>= 'a' && c
<= 'z')
4111 || (c
>= 'A' && c
<= 'Z')
4112 || (c
>= '0' && c
<= '9')
4113 || c
== '-' || c
== '_'))
4118 /* Get specified attribute from resource database RDB.
4119 See Fx_get_resource below for other parameters. */
4122 xrdb_get_resource (XrmDatabase rdb
, Lisp_Object attribute
, Lisp_Object
class, Lisp_Object component
, Lisp_Object subclass
)
4124 CHECK_STRING (attribute
);
4125 CHECK_STRING (class);
4127 if (!NILP (component
))
4128 CHECK_STRING (component
);
4129 if (!NILP (subclass
))
4130 CHECK_STRING (subclass
);
4131 if (NILP (component
) != NILP (subclass
))
4132 error ("x-get-resource: must specify both COMPONENT and SUBCLASS or neither");
4134 validate_x_resource_name ();
4136 /* Allocate space for the components, the dots which separate them,
4137 and the final '\0'. Make them big enough for the worst case. */
4138 ptrdiff_t name_keysize
= (SBYTES (Vx_resource_name
)
4139 + (STRINGP (component
)
4140 ? SBYTES (component
) : 0)
4141 + SBYTES (attribute
)
4144 ptrdiff_t class_keysize
= (SBYTES (Vx_resource_class
)
4146 + (STRINGP (subclass
)
4147 ? SBYTES (subclass
) : 0)
4150 char *name_key
= SAFE_ALLOCA (name_keysize
+ class_keysize
);
4151 char *class_key
= name_key
+ name_keysize
;
4153 /* Start with emacs.FRAMENAME for the name (the specific one)
4154 and with `Emacs' for the class key (the general one). */
4155 char *nz
= lispstpcpy (name_key
, Vx_resource_name
);
4156 char *cz
= lispstpcpy (class_key
, Vx_resource_class
);
4159 cz
= lispstpcpy (cz
, class);
4161 if (!NILP (component
))
4164 lispstpcpy (cz
, subclass
);
4167 nz
= lispstpcpy (nz
, component
);
4171 lispstpcpy (nz
, attribute
);
4173 char *value
= x_get_string_resource (rdb
, name_key
, class_key
);
4176 if (value
&& *value
)
4177 return build_string (value
);
4183 DEFUN ("x-get-resource", Fx_get_resource
, Sx_get_resource
, 2, 4, 0,
4184 doc
: /* Return the value of ATTRIBUTE, of class CLASS, from the X defaults database.
4185 This uses `INSTANCE.ATTRIBUTE' as the key and `Emacs.CLASS' as the
4186 class, where INSTANCE is the name under which Emacs was invoked, or
4187 the name specified by the `-name' or `-rn' command-line arguments.
4189 The optional arguments COMPONENT and SUBCLASS add to the key and the
4190 class, respectively. You must specify both of them or neither.
4191 If you specify them, the key is `INSTANCE.COMPONENT.ATTRIBUTE'
4192 and the class is `Emacs.CLASS.SUBCLASS'. */)
4193 (Lisp_Object attribute
, Lisp_Object
class, Lisp_Object component
,
4194 Lisp_Object subclass
)
4196 check_window_system (NULL
);
4198 return xrdb_get_resource (check_x_display_info (Qnil
)->xrdb
,
4199 attribute
, class, component
, subclass
);
4202 /* Get an X resource, like Fx_get_resource, but for display DPYINFO. */
4205 display_x_get_resource (Display_Info
*dpyinfo
, Lisp_Object attribute
,
4206 Lisp_Object
class, Lisp_Object component
,
4207 Lisp_Object subclass
)
4209 return xrdb_get_resource (dpyinfo
->xrdb
,
4210 attribute
, class, component
, subclass
);
4213 #if defined HAVE_X_WINDOWS && !defined USE_X_TOOLKIT && !defined USE_GTK
4214 /* Used when C code wants a resource value. */
4215 /* Called from oldXMenu/Create.c. */
4217 x_get_resource_string (const char *attribute
, const char *class)
4220 struct frame
*sf
= SELECTED_FRAME ();
4221 ptrdiff_t invocation_namelen
= SBYTES (Vinvocation_name
);
4224 /* Allocate space for the components, the dots which separate them,
4225 and the final '\0'. */
4226 ptrdiff_t name_keysize
= invocation_namelen
+ strlen (attribute
) + 2;
4227 ptrdiff_t class_keysize
= sizeof (EMACS_CLASS
) - 1 + strlen (class) + 2;
4228 char *name_key
= SAFE_ALLOCA (name_keysize
+ class_keysize
);
4229 char *class_key
= name_key
+ name_keysize
;
4231 esprintf (name_key
, "%s.%s", SSDATA (Vinvocation_name
), attribute
);
4232 sprintf (class_key
, "%s.%s", EMACS_CLASS
, class);
4234 result
= x_get_string_resource (FRAME_DISPLAY_INFO (sf
)->xrdb
,
4235 name_key
, class_key
);
4241 /* Return the value of parameter PARAM.
4243 First search ALIST, then Vdefault_frame_alist, then the X defaults
4244 database, using ATTRIBUTE as the attribute name and CLASS as its class.
4246 Convert the resource to the type specified by desired_type.
4248 If no default is specified, return Qunbound. If you call
4249 x_get_arg, make sure you deal with Qunbound in a reasonable way,
4250 and don't let it get stored in any Lisp-visible variables! */
4253 x_get_arg (Display_Info
*dpyinfo
, Lisp_Object alist
, Lisp_Object param
,
4254 const char *attribute
, const char *class, enum resource_types type
)
4258 tem
= Fassq (param
, alist
);
4262 /* If we find this parm in ALIST, clear it out
4263 so that it won't be "left over" at the end. */
4265 XSETCAR (tem
, Qnil
);
4266 /* In case the parameter appears more than once in the alist,
4268 for (tail
= alist
; CONSP (tail
); tail
= XCDR (tail
))
4269 if (CONSP (XCAR (tail
))
4270 && EQ (XCAR (XCAR (tail
)), param
))
4271 XSETCAR (XCAR (tail
), Qnil
);
4274 tem
= Fassq (param
, Vdefault_frame_alist
);
4276 /* If it wasn't specified in ALIST or the Lisp-level defaults,
4277 look in the X resources. */
4280 if (attribute
&& dpyinfo
)
4282 AUTO_STRING (at
, attribute
);
4283 AUTO_STRING (cl
, class);
4284 tem
= display_x_get_resource (dpyinfo
, at
, cl
, Qnil
, Qnil
);
4291 case RES_TYPE_NUMBER
:
4292 return make_number (atoi (SSDATA (tem
)));
4294 case RES_TYPE_BOOLEAN_NUMBER
:
4295 if (!strcmp (SSDATA (tem
), "on")
4296 || !strcmp (SSDATA (tem
), "true"))
4297 return make_number (1);
4298 return make_number (atoi (SSDATA (tem
)));
4301 case RES_TYPE_FLOAT
:
4302 return make_float (atof (SSDATA (tem
)));
4304 case RES_TYPE_BOOLEAN
:
4305 tem
= Fdowncase (tem
);
4306 if (!strcmp (SSDATA (tem
), "on")
4308 || !strcmp (SSDATA (tem
), "yes")
4310 || !strcmp (SSDATA (tem
), "true"))
4315 case RES_TYPE_STRING
:
4318 case RES_TYPE_SYMBOL
:
4319 /* As a special case, we map the values `true' and `on'
4320 to Qt, and `false' and `off' to Qnil. */
4323 lower
= Fdowncase (tem
);
4324 if (!strcmp (SSDATA (lower
), "on")
4326 || !strcmp (SSDATA (lower
), "yes")
4328 || !strcmp (SSDATA (lower
), "true"))
4330 else if (!strcmp (SSDATA (lower
), "off")
4332 || !strcmp (SSDATA (lower
), "no")
4334 || !strcmp (SSDATA (lower
), "false"))
4337 return Fintern (tem
, Qnil
);
4351 x_frame_get_arg (struct frame
*f
, Lisp_Object alist
, Lisp_Object param
,
4352 const char *attribute
, const char *class,
4353 enum resource_types type
)
4355 return x_get_arg (FRAME_DISPLAY_INFO (f
),
4356 alist
, param
, attribute
, class, type
);
4359 /* Like x_frame_get_arg, but also record the value in f->param_alist. */
4362 x_frame_get_and_record_arg (struct frame
*f
, Lisp_Object alist
,
4364 const char *attribute
, const char *class,
4365 enum resource_types type
)
4369 value
= x_get_arg (FRAME_DISPLAY_INFO (f
), alist
, param
,
4370 attribute
, class, type
);
4371 if (! NILP (value
) && ! EQ (value
, Qunbound
))
4372 store_frame_param (f
, param
, value
);
4378 /* Record in frame F the specified or default value according to ALIST
4379 of the parameter named PROP (a Lisp symbol).
4380 If no value is specified for PROP, look for an X default for XPROP
4381 on the frame named NAME.
4382 If that is not found either, use the value DEFLT. */
4385 x_default_parameter (struct frame
*f
, Lisp_Object alist
, Lisp_Object prop
,
4386 Lisp_Object deflt
, const char *xprop
, const char *xclass
,
4387 enum resource_types type
)
4391 tem
= x_frame_get_arg (f
, alist
, prop
, xprop
, xclass
, type
);
4392 if (EQ (tem
, Qunbound
))
4394 AUTO_FRAME_ARG (arg
, prop
, tem
);
4395 x_set_frame_parameters (f
, arg
);
4400 #if !defined (HAVE_X_WINDOWS) && defined (NoValue)
4403 * XParseGeometry parses strings of the form
4404 * "=<width>x<height>{+-}<xoffset>{+-}<yoffset>", where
4405 * width, height, xoffset, and yoffset are unsigned integers.
4406 * Example: "=80x24+300-49"
4407 * The equal sign is optional.
4408 * It returns a bitmask that indicates which of the four values
4409 * were actually found in the string. For each value found,
4410 * the corresponding argument is updated; for each value
4411 * not found, the corresponding argument is left unchanged.
4415 XParseGeometry (char *string
,
4417 unsigned int *width
, unsigned int *height
)
4421 unsigned long tempWidth
, tempHeight
;
4422 long int tempX
, tempY
;
4423 char *nextCharacter
;
4425 if (string
== NULL
|| *string
== '\0')
4428 string
++; /* ignore possible '=' at beg of geometry spec */
4431 if (*strind
!= '+' && *strind
!= '-' && *strind
!= 'x')
4433 tempWidth
= strtoul (strind
, &nextCharacter
, 10);
4434 if (strind
== nextCharacter
)
4436 strind
= nextCharacter
;
4440 if (*strind
== 'x' || *strind
== 'X')
4443 tempHeight
= strtoul (strind
, &nextCharacter
, 10);
4444 if (strind
== nextCharacter
)
4446 strind
= nextCharacter
;
4447 mask
|= HeightValue
;
4450 if (*strind
== '+' || *strind
== '-')
4454 tempX
= strtol (strind
, &nextCharacter
, 10);
4455 if (strind
== nextCharacter
)
4457 strind
= nextCharacter
;
4459 if (*strind
== '+' || *strind
== '-')
4463 tempY
= strtol (strind
, &nextCharacter
, 10);
4464 if (strind
== nextCharacter
)
4466 strind
= nextCharacter
;
4471 /* If strind isn't at the end of the string then it's an invalid
4472 geometry specification. */
4474 if (*strind
!= '\0')
4478 *x
= clip_to_bounds (INT_MIN
, tempX
, INT_MAX
);
4480 *y
= clip_to_bounds (INT_MIN
, tempY
, INT_MAX
);
4481 if (mask
& WidthValue
)
4482 *width
= min (tempWidth
, UINT_MAX
);
4483 if (mask
& HeightValue
)
4484 *height
= min (tempHeight
, UINT_MAX
);
4488 #endif /* !defined (HAVE_X_WINDOWS) && defined (NoValue) */
4491 /* NS used to define x-parse-geometry in ns-win.el, but that confused
4492 make-docfile: the documentation string in ns-win.el was used for
4493 x-parse-geometry even in non-NS builds.
4495 With two definitions of x-parse-geometry in this file, various
4496 things still get confused (eg M-x apropos documentation), so that
4497 it is best if the two definitions just share the same doc-string.
4499 DEFUN ("x-parse-geometry", Fx_parse_geometry
, Sx_parse_geometry
, 1, 1, 0,
4500 doc
: /* Parse a display geometry string STRING.
4501 Returns an alist of the form ((top . TOP), (left . LEFT) ... ).
4502 The properties returned may include `top', `left', `height', and `width'.
4503 For X, the value of `left' or `top' may be an integer,
4504 or a list (+ N) meaning N pixels relative to top/left corner,
4505 or a list (- N) meaning -N pixels relative to bottom/right corner.
4506 On Nextstep, this just calls `ns-parse-geometry'. */)
4507 (Lisp_Object string
)
4510 unsigned int width
, height
;
4513 CHECK_STRING (string
);
4516 if (strchr (SSDATA (string
), ' ') != NULL
)
4517 return call1 (Qns_parse_geometry
, string
);
4519 geometry
= XParseGeometry (SSDATA (string
),
4520 &x
, &y
, &width
, &height
);
4522 if (geometry
& XValue
)
4524 Lisp_Object element
;
4526 if (x
>= 0 && (geometry
& XNegative
))
4527 element
= list3 (Qleft
, Qminus
, make_number (-x
));
4528 else if (x
< 0 && ! (geometry
& XNegative
))
4529 element
= list3 (Qleft
, Qplus
, make_number (x
));
4531 element
= Fcons (Qleft
, make_number (x
));
4532 result
= Fcons (element
, result
);
4535 if (geometry
& YValue
)
4537 Lisp_Object element
;
4539 if (y
>= 0 && (geometry
& YNegative
))
4540 element
= list3 (Qtop
, Qminus
, make_number (-y
));
4541 else if (y
< 0 && ! (geometry
& YNegative
))
4542 element
= list3 (Qtop
, Qplus
, make_number (y
));
4544 element
= Fcons (Qtop
, make_number (y
));
4545 result
= Fcons (element
, result
);
4548 if (geometry
& WidthValue
)
4549 result
= Fcons (Fcons (Qwidth
, make_number (width
)), result
);
4550 if (geometry
& HeightValue
)
4551 result
= Fcons (Fcons (Qheight
, make_number (height
)), result
);
4557 /* Calculate the desired size and position of frame F.
4558 Return the flags saying which aspects were specified.
4560 Also set the win_gravity and size_hint_flags of F.
4562 Adjust height for toolbar if TOOLBAR_P is 1.
4564 This function does not make the coordinates positive. */
4566 #define DEFAULT_ROWS 35
4567 #define DEFAULT_COLS 80
4570 x_figure_window_size (struct frame
*f
, Lisp_Object parms
, bool toolbar_p
, int *x_width
, int *x_height
)
4572 Lisp_Object height
, width
, user_size
, top
, left
, user_position
;
4573 long window_prompting
= 0;
4574 Display_Info
*dpyinfo
= FRAME_DISPLAY_INFO (f
);
4576 /* Default values if we fall through.
4577 Actually, if that happens we should get
4578 window manager prompting. */
4579 SET_FRAME_WIDTH (f
, DEFAULT_COLS
* FRAME_COLUMN_WIDTH (f
));
4580 SET_FRAME_COLS (f
, DEFAULT_COLS
);
4581 SET_FRAME_HEIGHT (f
, DEFAULT_ROWS
* FRAME_LINE_HEIGHT (f
));
4582 SET_FRAME_LINES (f
, DEFAULT_ROWS
);
4584 /* Window managers expect that if program-specified
4585 positions are not (0,0), they're intentional, not defaults. */
4589 /* Calculate a tool bar height so that the user gets a text display
4590 area of the size he specified with -g or via .Xdefaults. Later
4591 changes of the tool bar height don't change the frame size. This
4592 is done so that users can create tall Emacs frames without having
4593 to guess how tall the tool bar will get. */
4594 if (toolbar_p
&& FRAME_TOOL_BAR_LINES (f
))
4596 if (frame_default_tool_bar_height
)
4597 FRAME_TOOL_BAR_HEIGHT (f
) = frame_default_tool_bar_height
;
4602 relief
= (tool_bar_button_relief
>= 0
4603 ? tool_bar_button_relief
4604 : DEFAULT_TOOL_BAR_BUTTON_RELIEF
);
4606 if (RANGED_INTEGERP (1, Vtool_bar_button_margin
, INT_MAX
))
4607 margin
= XFASTINT (Vtool_bar_button_margin
);
4608 else if (CONSP (Vtool_bar_button_margin
)
4609 && RANGED_INTEGERP (1, XCDR (Vtool_bar_button_margin
), INT_MAX
))
4610 margin
= XFASTINT (XCDR (Vtool_bar_button_margin
));
4614 FRAME_TOOL_BAR_HEIGHT (f
)
4615 = DEFAULT_TOOL_BAR_IMAGE_HEIGHT
+ 2 * margin
+ 2 * relief
;
4619 /* Ensure that earlier new_width and new_height settings won't
4620 override what we specify below. */
4621 f
->new_width
= f
->new_height
= 0;
4623 height
= x_get_arg (dpyinfo
, parms
, Qheight
, 0, 0, RES_TYPE_NUMBER
);
4624 width
= x_get_arg (dpyinfo
, parms
, Qwidth
, 0, 0, RES_TYPE_NUMBER
);
4625 if (!EQ (width
, Qunbound
) || !EQ (height
, Qunbound
))
4627 if (!EQ (width
, Qunbound
))
4629 if (CONSP (width
) && EQ (XCAR (width
), Qtext_pixels
))
4631 CHECK_NUMBER (XCDR (width
));
4632 if ((XINT (XCDR (width
)) < 0 || XINT (XCDR (width
)) > INT_MAX
))
4633 xsignal1 (Qargs_out_of_range
, XCDR (width
));
4635 SET_FRAME_WIDTH (f
, XINT (XCDR (width
)));
4636 f
->inhibit_horizontal_resize
= true;
4637 *x_width
= XINT (XCDR (width
));
4641 CHECK_NUMBER (width
);
4642 if ((XINT (width
) < 0 || XINT (width
) > INT_MAX
))
4643 xsignal1 (Qargs_out_of_range
, width
);
4645 SET_FRAME_WIDTH (f
, XINT (width
) * FRAME_COLUMN_WIDTH (f
));
4649 if (!EQ (height
, Qunbound
))
4651 if (CONSP (height
) && EQ (XCAR (height
), Qtext_pixels
))
4653 CHECK_NUMBER (XCDR (height
));
4654 if ((XINT (XCDR (height
)) < 0 || XINT (XCDR (height
)) > INT_MAX
))
4655 xsignal1 (Qargs_out_of_range
, XCDR (height
));
4657 SET_FRAME_HEIGHT (f
, XINT (XCDR (height
)));
4658 f
->inhibit_vertical_resize
= true;
4659 *x_height
= XINT (XCDR (height
));
4663 CHECK_NUMBER (height
);
4664 if ((XINT (height
) < 0) || (XINT (height
) > INT_MAX
))
4665 xsignal1 (Qargs_out_of_range
, height
);
4667 SET_FRAME_HEIGHT (f
, XINT (height
) * FRAME_LINE_HEIGHT (f
));
4671 user_size
= x_get_arg (dpyinfo
, parms
, Quser_size
, 0, 0, RES_TYPE_NUMBER
);
4672 if (!NILP (user_size
) && !EQ (user_size
, Qunbound
))
4673 window_prompting
|= USSize
;
4675 window_prompting
|= PSize
;
4678 top
= x_get_arg (dpyinfo
, parms
, Qtop
, 0, 0, RES_TYPE_NUMBER
);
4679 left
= x_get_arg (dpyinfo
, parms
, Qleft
, 0, 0, RES_TYPE_NUMBER
);
4680 user_position
= x_get_arg (dpyinfo
, parms
, Quser_position
, 0, 0, RES_TYPE_NUMBER
);
4681 if (! EQ (top
, Qunbound
) || ! EQ (left
, Qunbound
))
4683 if (EQ (top
, Qminus
))
4686 window_prompting
|= YNegative
;
4688 else if (CONSP (top
) && EQ (XCAR (top
), Qminus
)
4689 && CONSP (XCDR (top
))
4690 && RANGED_INTEGERP (-INT_MAX
, XCAR (XCDR (top
)), INT_MAX
))
4692 f
->top_pos
= - XINT (XCAR (XCDR (top
)));
4693 window_prompting
|= YNegative
;
4695 else if (CONSP (top
) && EQ (XCAR (top
), Qplus
)
4696 && CONSP (XCDR (top
))
4697 && TYPE_RANGED_INTEGERP (int, XCAR (XCDR (top
))))
4699 f
->top_pos
= XINT (XCAR (XCDR (top
)));
4701 else if (EQ (top
, Qunbound
))
4705 CHECK_TYPE_RANGED_INTEGER (int, top
);
4706 f
->top_pos
= XINT (top
);
4708 window_prompting
|= YNegative
;
4711 if (EQ (left
, Qminus
))
4714 window_prompting
|= XNegative
;
4716 else if (CONSP (left
) && EQ (XCAR (left
), Qminus
)
4717 && CONSP (XCDR (left
))
4718 && RANGED_INTEGERP (-INT_MAX
, XCAR (XCDR (left
)), INT_MAX
))
4720 f
->left_pos
= - XINT (XCAR (XCDR (left
)));
4721 window_prompting
|= XNegative
;
4723 else if (CONSP (left
) && EQ (XCAR (left
), Qplus
)
4724 && CONSP (XCDR (left
))
4725 && TYPE_RANGED_INTEGERP (int, XCAR (XCDR (left
))))
4727 f
->left_pos
= XINT (XCAR (XCDR (left
)));
4729 else if (EQ (left
, Qunbound
))
4733 CHECK_TYPE_RANGED_INTEGER (int, left
);
4734 f
->left_pos
= XINT (left
);
4735 if (f
->left_pos
< 0)
4736 window_prompting
|= XNegative
;
4739 if (!NILP (user_position
) && ! EQ (user_position
, Qunbound
))
4740 window_prompting
|= USPosition
;
4742 window_prompting
|= PPosition
;
4745 if (window_prompting
& XNegative
)
4747 if (window_prompting
& YNegative
)
4748 f
->win_gravity
= SouthEastGravity
;
4750 f
->win_gravity
= NorthEastGravity
;
4754 if (window_prompting
& YNegative
)
4755 f
->win_gravity
= SouthWestGravity
;
4757 f
->win_gravity
= NorthWestGravity
;
4760 f
->size_hint_flags
= window_prompting
;
4762 return window_prompting
;
4767 #endif /* HAVE_WINDOW_SYSTEM */
4770 frame_make_pointer_invisible (struct frame
*f
)
4772 if (! NILP (Vmake_pointer_invisible
))
4774 if (f
&& FRAME_LIVE_P (f
) && !f
->pointer_invisible
4775 && FRAME_TERMINAL (f
)->toggle_invisible_pointer_hook
)
4778 FRAME_TERMINAL (f
)->toggle_invisible_pointer_hook (f
, 1);
4779 f
->pointer_invisible
= 1;
4785 frame_make_pointer_visible (struct frame
*f
)
4787 /* We don't check Vmake_pointer_invisible here in case the
4788 pointer was invisible when Vmake_pointer_invisible was set to nil. */
4789 if (f
&& FRAME_LIVE_P (f
) && f
->pointer_invisible
&& f
->mouse_moved
4790 && FRAME_TERMINAL (f
)->toggle_invisible_pointer_hook
)
4792 FRAME_TERMINAL (f
)->toggle_invisible_pointer_hook (f
, 0);
4793 f
->pointer_invisible
= 0;
4797 DEFUN ("frame-pointer-visible-p", Fframe_pointer_visible_p
,
4798 Sframe_pointer_visible_p
, 0, 1, 0,
4799 doc
: /* Return t if the mouse pointer displayed on FRAME is visible.
4800 Otherwise it returns nil. FRAME omitted or nil means the
4801 selected frame. This is useful when `make-pointer-invisible' is set. */)
4804 return decode_any_frame (frame
)->pointer_invisible
? Qnil
: Qt
;
4809 /***********************************************************************
4811 ***********************************************************************/
4813 #ifdef HAVE_WINDOW_SYSTEM
4815 # if (defined HAVE_NS \
4816 || (!defined USE_GTK && (defined HAVE_XINERAMA || defined HAVE_XRANDR)))
4818 free_monitors (struct MonitorInfo
*monitors
, int n_monitors
)
4821 for (i
= 0; i
< n_monitors
; ++i
)
4822 xfree (monitors
[i
].name
);
4828 make_monitor_attribute_list (struct MonitorInfo
*monitors
,
4830 int primary_monitor
,
4831 Lisp_Object monitor_frames
,
4834 Lisp_Object attributes_list
= Qnil
;
4835 Lisp_Object primary_monitor_attributes
= Qnil
;
4838 for (i
= 0; i
< n_monitors
; ++i
)
4840 Lisp_Object geometry
, workarea
, attributes
= Qnil
;
4841 struct MonitorInfo
*mi
= &monitors
[i
];
4843 if (mi
->geom
.width
== 0) continue;
4845 workarea
= list4i (mi
->work
.x
, mi
->work
.y
,
4846 mi
->work
.width
, mi
->work
.height
);
4847 geometry
= list4i (mi
->geom
.x
, mi
->geom
.y
,
4848 mi
->geom
.width
, mi
->geom
.height
);
4849 attributes
= Fcons (Fcons (Qsource
, build_string (source
)),
4851 attributes
= Fcons (Fcons (Qframes
, AREF (monitor_frames
, i
)),
4853 attributes
= Fcons (Fcons (Qmm_size
,
4854 list2i (mi
->mm_width
, mi
->mm_height
)),
4856 attributes
= Fcons (Fcons (Qworkarea
, workarea
), attributes
);
4857 attributes
= Fcons (Fcons (Qgeometry
, geometry
), attributes
);
4859 attributes
= Fcons (Fcons (Qname
, make_string (mi
->name
,
4860 strlen (mi
->name
))),
4863 if (i
== primary_monitor
)
4864 primary_monitor_attributes
= attributes
;
4866 attributes_list
= Fcons (attributes
, attributes_list
);
4869 if (!NILP (primary_monitor_attributes
))
4870 attributes_list
= Fcons (primary_monitor_attributes
, attributes_list
);
4871 return attributes_list
;
4874 #endif /* HAVE_WINDOW_SYSTEM */
4877 /***********************************************************************
4879 ***********************************************************************/
4882 syms_of_frame (void)
4884 DEFSYM (Qframep
, "framep");
4885 DEFSYM (Qframe_live_p
, "frame-live-p");
4886 DEFSYM (Qframe_windows_min_size
, "frame-windows-min-size");
4887 DEFSYM (Qwindow_pixel_to_total
, "window--pixel-to-total");
4888 DEFSYM (Qexplicit_name
, "explicit-name");
4889 DEFSYM (Qheight
, "height");
4890 DEFSYM (Qicon
, "icon");
4891 DEFSYM (Qminibuffer
, "minibuffer");
4892 DEFSYM (Qmodeline
, "modeline");
4893 DEFSYM (Qonly
, "only");
4894 DEFSYM (Qnone
, "none");
4895 DEFSYM (Qwidth
, "width");
4896 DEFSYM (Qtext_pixels
, "text-pixels");
4897 DEFSYM (Qgeometry
, "geometry");
4898 DEFSYM (Qicon_left
, "icon-left");
4899 DEFSYM (Qicon_top
, "icon-top");
4900 DEFSYM (Qtooltip
, "tooltip");
4901 DEFSYM (Quser_position
, "user-position");
4902 DEFSYM (Quser_size
, "user-size");
4903 DEFSYM (Qwindow_id
, "window-id");
4904 #ifdef HAVE_X_WINDOWS
4905 DEFSYM (Qouter_window_id
, "outer-window-id");
4907 DEFSYM (Qparent_id
, "parent-id");
4909 DEFSYM (Qw32
, "w32");
4912 DEFSYM (Qvisible
, "visible");
4913 DEFSYM (Qbuffer_predicate
, "buffer-predicate");
4914 DEFSYM (Qbuffer_list
, "buffer-list");
4915 DEFSYM (Qburied_buffer_list
, "buried-buffer-list");
4916 DEFSYM (Qdisplay_type
, "display-type");
4917 DEFSYM (Qbackground_mode
, "background-mode");
4918 DEFSYM (Qnoelisp
, "noelisp");
4919 DEFSYM (Qtty_color_mode
, "tty-color-mode");
4920 DEFSYM (Qtty
, "tty");
4921 DEFSYM (Qtty_type
, "tty-type");
4923 DEFSYM (Qface_set_after_frame_default
, "face-set-after-frame-default");
4925 DEFSYM (Qfullwidth
, "fullwidth");
4926 DEFSYM (Qfullheight
, "fullheight");
4927 DEFSYM (Qfullboth
, "fullboth");
4928 DEFSYM (Qmaximized
, "maximized");
4929 DEFSYM (Qx_resource_name
, "x-resource-name");
4930 DEFSYM (Qx_frame_parameter
, "x-frame-parameter");
4932 DEFSYM (Qterminal
, "terminal");
4934 DEFSYM (Qworkarea
, "workarea");
4935 DEFSYM (Qmm_size
, "mm-size");
4936 DEFSYM (Qframes
, "frames");
4937 DEFSYM (Qsource
, "source");
4939 DEFSYM (Qouter_edges
, "outer-edges");
4940 DEFSYM (Qouter_position
, "outer-position");
4941 DEFSYM (Qouter_size
, "outer-size");
4942 DEFSYM (Qnative_edges
, "native-edges");
4943 DEFSYM (Qinner_edges
, "inner-edges");
4944 DEFSYM (Qexternal_border_size
, "external-border-size");
4945 DEFSYM (Qtitle_bar_size
, "title-bar-size");
4946 DEFSYM (Qmenu_bar_external
, "menu-bar-external");
4947 DEFSYM (Qmenu_bar_size
, "menu-bar-size");
4948 DEFSYM (Qtool_bar_external
, "tool-bar-external");
4949 DEFSYM (Qtool_bar_size
, "tool-bar-size");
4950 /* The following are used for frame_size_history. */
4951 DEFSYM (Qadjust_frame_size_1
, "adjust-frame-size-1");
4952 DEFSYM (Qadjust_frame_size_2
, "adjust-frame-size-2");
4953 DEFSYM (Qadjust_frame_size_3
, "adjust-frame-size-3");
4954 DEFSYM (Qx_set_frame_parameters
, "x-set-frame-parameters");
4955 DEFSYM (QEmacsFrameResize
, "EmacsFrameResize");
4956 DEFSYM (Qset_frame_size
, "set-frame-size");
4957 DEFSYM (Qframe_inhibit_resize
, "frame-inhibit-resize");
4958 DEFSYM (Qx_set_fullscreen
, "x-set-fullscreen");
4959 DEFSYM (Qx_check_fullscreen
, "x-check-fullscreen");
4960 DEFSYM (Qxg_frame_resized
, "xg-frame-resized");
4961 DEFSYM (Qxg_frame_set_char_size_1
, "xg-frame-set-char-size-1");
4962 DEFSYM (Qxg_frame_set_char_size_2
, "xg-frame-set-char-size-2");
4963 DEFSYM (Qxg_frame_set_char_size_3
, "xg-frame-set-char-size-3");
4964 DEFSYM (Qx_set_window_size_1
, "x-set-window-size-1");
4965 DEFSYM (Qx_set_window_size_2
, "x-set-window-size-2");
4966 DEFSYM (Qx_set_window_size_3
, "x-set-window-size-3");
4967 DEFSYM (Qxg_change_toolbar_position
, "xg-change-toolbar-position");
4968 DEFSYM (Qx_net_wm_state
, "x-net-wm-state");
4969 DEFSYM (Qx_handle_net_wm_state
, "x-handle-net-wm-state");
4970 DEFSYM (Qtb_size_cb
, "tb-size-cb");
4971 DEFSYM (Qupdate_frame_tool_bar
, "update-frame-tool-bar");
4972 DEFSYM (Qfree_frame_tool_bar
, "free-frame-tool-bar");
4973 DEFSYM (Qx_set_menu_bar_lines
, "x-set-menu-bar-lines");
4974 DEFSYM (Qchange_frame_size
, "change-frame-size");
4975 DEFSYM (Qxg_frame_set_char_size
, "xg-frame-set-char-size");
4976 DEFSYM (Qset_window_configuration
, "set-window-configuration");
4977 DEFSYM (Qx_create_frame_1
, "x-create-frame-1");
4978 DEFSYM (Qx_create_frame_2
, "x-create-frame-2");
4979 DEFSYM (Qterminal_frame
, "terminal-frame");
4982 DEFSYM (Qns_parse_geometry
, "ns-parse-geometry");
4985 DEFSYM (Qalpha
, "alpha");
4986 DEFSYM (Qauto_lower
, "auto-lower");
4987 DEFSYM (Qauto_raise
, "auto-raise");
4988 DEFSYM (Qborder_color
, "border-color");
4989 DEFSYM (Qborder_width
, "border-width");
4990 DEFSYM (Qbottom_divider_width
, "bottom-divider-width");
4991 DEFSYM (Qcursor_color
, "cursor-color");
4992 DEFSYM (Qcursor_type
, "cursor-type");
4993 DEFSYM (Qfont_backend
, "font-backend");
4994 DEFSYM (Qfullscreen
, "fullscreen");
4995 DEFSYM (Qhorizontal_scroll_bars
, "horizontal-scroll-bars");
4996 DEFSYM (Qicon_name
, "icon-name");
4997 DEFSYM (Qicon_type
, "icon-type");
4998 DEFSYM (Qinternal_border_width
, "internal-border-width");
4999 DEFSYM (Qleft_fringe
, "left-fringe");
5000 DEFSYM (Qline_spacing
, "line-spacing");
5001 DEFSYM (Qmenu_bar_lines
, "menu-bar-lines");
5002 DEFSYM (Qupdate_frame_menubar
, "update-frame-menubar");
5003 DEFSYM (Qfree_frame_menubar_1
, "free-frame-menubar-1");
5004 DEFSYM (Qfree_frame_menubar_2
, "free-frame-menubar-2");
5005 DEFSYM (Qmouse_color
, "mouse-color");
5006 DEFSYM (Qname
, "name");
5007 DEFSYM (Qright_divider_width
, "right-divider-width");
5008 DEFSYM (Qright_fringe
, "right-fringe");
5009 DEFSYM (Qscreen_gamma
, "screen-gamma");
5010 DEFSYM (Qscroll_bar_background
, "scroll-bar-background");
5011 DEFSYM (Qscroll_bar_foreground
, "scroll-bar-foreground");
5012 DEFSYM (Qscroll_bar_height
, "scroll-bar-height");
5013 DEFSYM (Qscroll_bar_width
, "scroll-bar-width");
5014 DEFSYM (Qsticky
, "sticky");
5015 DEFSYM (Qtitle
, "title");
5016 DEFSYM (Qtool_bar_lines
, "tool-bar-lines");
5017 DEFSYM (Qtool_bar_position
, "tool-bar-position");
5018 DEFSYM (Qunsplittable
, "unsplittable");
5019 DEFSYM (Qvertical_scroll_bars
, "vertical-scroll-bars");
5020 DEFSYM (Qvisibility
, "visibility");
5021 DEFSYM (Qwait_for_wm
, "wait-for-wm");
5026 for (i
= 0; i
< ARRAYELTS (frame_parms
); i
++)
5028 Lisp_Object v
= (frame_parms
[i
].sym
< 0
5029 ? intern_c_string (frame_parms
[i
].name
)
5030 : builtin_lisp_symbol (frame_parms
[i
].sym
));
5031 Fput (v
, Qx_frame_parameter
, make_number (i
));
5035 #ifdef HAVE_WINDOW_SYSTEM
5036 DEFVAR_LISP ("x-resource-name", Vx_resource_name
,
5037 doc
: /* The name Emacs uses to look up X resources.
5038 `x-get-resource' uses this as the first component of the instance name
5039 when requesting resource values.
5040 Emacs initially sets `x-resource-name' to the name under which Emacs
5041 was invoked, or to the value specified with the `-name' or `-rn'
5042 switches, if present.
5044 It may be useful to bind this variable locally around a call
5045 to `x-get-resource'. See also the variable `x-resource-class'. */);
5046 Vx_resource_name
= Qnil
;
5048 DEFVAR_LISP ("x-resource-class", Vx_resource_class
,
5049 doc
: /* The class Emacs uses to look up X resources.
5050 `x-get-resource' uses this as the first component of the instance class
5051 when requesting resource values.
5053 Emacs initially sets `x-resource-class' to "Emacs".
5055 Setting this variable permanently is not a reasonable thing to do,
5056 but binding this variable locally around a call to `x-get-resource'
5057 is a reasonable practice. See also the variable `x-resource-name'. */);
5058 Vx_resource_class
= build_string (EMACS_CLASS
);
5060 DEFVAR_LISP ("frame-alpha-lower-limit", Vframe_alpha_lower_limit
,
5061 doc
: /* The lower limit of the frame opacity (alpha transparency).
5062 The value should range from 0 (invisible) to 100 (completely opaque).
5063 You can also use a floating number between 0.0 and 1.0. */);
5064 Vframe_alpha_lower_limit
= make_number (20);
5067 DEFVAR_LISP ("default-frame-alist", Vdefault_frame_alist
,
5068 doc
: /* Alist of default values for frame creation.
5069 These may be set in your init file, like this:
5070 (setq default-frame-alist \\='((width . 80) (height . 55) (menu-bar-lines . 1)))
5071 These override values given in window system configuration data,
5072 including X Windows' defaults database.
5073 For values specific to the first Emacs frame, see `initial-frame-alist'.
5074 For window-system specific values, see `window-system-default-frame-alist'.
5075 For values specific to the separate minibuffer frame, see
5076 `minibuffer-frame-alist'.
5077 The `menu-bar-lines' element of the list controls whether new frames
5078 have menu bars; `menu-bar-mode' works by altering this element.
5079 Setting this variable does not affect existing frames, only new ones. */);
5080 Vdefault_frame_alist
= Qnil
;
5082 DEFVAR_LISP ("default-frame-scroll-bars", Vdefault_frame_scroll_bars
,
5083 doc
: /* Default position of vertical scroll bars on this window-system. */);
5084 #ifdef HAVE_WINDOW_SYSTEM
5085 #if defined (HAVE_NTGUI) || defined (NS_IMPL_COCOA) || (defined (USE_GTK) && defined (USE_TOOLKIT_SCROLL_BARS))
5086 /* MS-Windows, Mac OS X, and GTK have scroll bars on the right by
5088 Vdefault_frame_scroll_bars
= Qright
;
5090 Vdefault_frame_scroll_bars
= Qleft
;
5093 Vdefault_frame_scroll_bars
= Qnil
;
5096 DEFVAR_BOOL ("scroll-bar-adjust-thumb-portion",
5097 scroll_bar_adjust_thumb_portion_p
,
5098 doc
: /* Adjust thumb for overscrolling for Gtk+ and MOTIF.
5099 Non-nil means adjust the thumb in the scroll bar so it can be dragged downwards
5100 even if the end of the buffer is shown (i.e. overscrolling).
5101 Set to nil if you want the thumb to be at the bottom when the end of the buffer
5102 is shown. Also, the thumb fills the whole scroll bar when the entire buffer
5103 is visible. In this case you can not overscroll. */);
5104 scroll_bar_adjust_thumb_portion_p
= 1;
5106 DEFVAR_LISP ("terminal-frame", Vterminal_frame
,
5107 doc
: /* The initial frame-object, which represents Emacs's stdout. */);
5109 DEFVAR_LISP ("mouse-position-function", Vmouse_position_function
,
5110 doc
: /* If non-nil, function to transform normal value of `mouse-position'.
5111 `mouse-position' and `mouse-pixel-position' call this function, passing their
5112 usual return value as argument, and return whatever this function returns.
5113 This abnormal hook exists for the benefit of packages like `xt-mouse.el'
5114 which need to do mouse handling at the Lisp level. */);
5115 Vmouse_position_function
= Qnil
;
5117 DEFVAR_LISP ("mouse-highlight", Vmouse_highlight
,
5118 doc
: /* If non-nil, clickable text is highlighted when mouse is over it.
5119 If the value is an integer, highlighting is only shown after moving the
5120 mouse, while keyboard input turns off the highlight even when the mouse
5121 is over the clickable text. However, the mouse shape still indicates
5122 when the mouse is over clickable text. */);
5123 Vmouse_highlight
= Qt
;
5125 DEFVAR_LISP ("make-pointer-invisible", Vmake_pointer_invisible
,
5126 doc
: /* If non-nil, make pointer invisible while typing.
5127 The pointer becomes visible again when the mouse is moved. */);
5128 Vmake_pointer_invisible
= Qt
;
5130 DEFVAR_LISP ("focus-in-hook", Vfocus_in_hook
,
5131 doc
: /* Normal hook run when a frame gains input focus. */);
5132 Vfocus_in_hook
= Qnil
;
5134 DEFVAR_LISP ("focus-out-hook", Vfocus_out_hook
,
5135 doc
: /* Normal hook run when a frame loses input focus. */);
5136 Vfocus_out_hook
= Qnil
;
5138 DEFVAR_LISP ("delete-frame-functions", Vdelete_frame_functions
,
5139 doc
: /* Functions run before deleting a frame.
5140 The functions are run with one arg, the frame to be deleted.
5143 Note that functions in this list may be called just before the frame is
5144 actually deleted, or some time later (or even both when an earlier function
5145 in `delete-frame-functions' (indirectly) calls `delete-frame'
5147 Vdelete_frame_functions
= Qnil
;
5148 DEFSYM (Qdelete_frame_functions
, "delete-frame-functions");
5150 DEFVAR_LISP ("menu-bar-mode", Vmenu_bar_mode
,
5151 doc
: /* Non-nil if Menu-Bar mode is enabled.
5152 See the command `menu-bar-mode' for a description of this minor mode.
5153 Setting this variable directly does not take effect;
5154 either customize it (see the info node `Easy Customization')
5155 or call the function `menu-bar-mode'. */);
5156 Vmenu_bar_mode
= Qt
;
5158 DEFVAR_LISP ("tool-bar-mode", Vtool_bar_mode
,
5159 doc
: /* Non-nil if Tool-Bar mode is enabled.
5160 See the command `tool-bar-mode' for a description of this minor mode.
5161 Setting this variable directly does not take effect;
5162 either customize it (see the info node `Easy Customization')
5163 or call the function `tool-bar-mode'. */);
5164 #ifdef HAVE_WINDOW_SYSTEM
5165 Vtool_bar_mode
= Qt
;
5167 Vtool_bar_mode
= Qnil
;
5170 DEFVAR_KBOARD ("default-minibuffer-frame", Vdefault_minibuffer_frame
,
5171 doc
: /* Minibufferless frames use this frame's minibuffer.
5172 Emacs cannot create minibufferless frames unless this is set to an
5173 appropriate surrogate.
5175 Emacs consults this variable only when creating minibufferless
5176 frames; once the frame is created, it sticks with its assigned
5177 minibuffer, no matter what this variable is set to. This means that
5178 this variable doesn't necessarily say anything meaningful about the
5179 current set of frames, or where the minibuffer is currently being
5182 This variable is local to the current terminal and cannot be buffer-local. */);
5184 DEFVAR_BOOL ("focus-follows-mouse", focus_follows_mouse
,
5185 doc
: /* Non-nil if window system changes focus when you move the mouse.
5186 You should set this variable to tell Emacs how your window manager
5187 handles focus, since there is no way in general for Emacs to find out
5188 automatically. See also `mouse-autoselect-window'. */);
5189 focus_follows_mouse
= 0;
5191 DEFVAR_BOOL ("frame-resize-pixelwise", frame_resize_pixelwise
,
5192 doc
: /* Non-nil means resize frames pixelwise.
5193 If this option is nil, resizing a frame rounds its sizes to the frame's
5194 current values of `frame-char-height' and `frame-char-width'. If this
5195 is non-nil, no rounding occurs, hence frame sizes can increase/decrease
5198 With some window managers you may have to set this to non-nil in order
5199 to set the size of a frame in pixels, to maximize frames or to make them
5200 fullscreen. To resize your initial frame pixelwise, set this option to
5201 a non-nil value in your init file. */);
5202 frame_resize_pixelwise
= 0;
5204 DEFVAR_LISP ("frame-inhibit-implied-resize", frame_inhibit_implied_resize
,
5205 doc
: /* Whether frames should be resized implicitly.
5206 If this option is nil, setting font, menu bar, tool bar, internal
5207 borders, fringes or scroll bars of a specific frame may resize the frame
5208 in order to preserve the number of columns or lines it displays. If
5209 this option is t, no such resizing is done. Note that the size of
5210 fullscreen and maximized frames, the height of fullheight frames and the
5211 width of fullwidth frames never change implicitly.
5213 The value of this option can be also be a list of frame parameters. In
5214 this case, resizing is inhibited when changing a parameter that appears
5215 in that list. The parameters currently handled by this option include
5216 `font', `font-backend', `internal-border-width', `menu-bar-lines' and
5219 Changing any of the parameters `scroll-bar-width', `scroll-bar-height',
5220 `vertical-scroll-bars', `horizontal-scroll-bars', `left-fringe' and
5221 `right-fringe' is handled as if the frame contained just one live
5222 window. This means, for example, that removing vertical scroll bars on
5223 a frame containing several side by side windows will shrink the frame
5224 width by the width of one scroll bar provided this option is nil and
5225 keep it unchanged if this option is either t or a list containing
5226 `vertical-scroll-bars'.
5228 The default value is \\='(tool-bar-lines) on Lucid, Motif and Windows
5229 \(which means that adding/removing a tool bar does not change the frame
5230 height), nil on all other window systems including GTK+ (which means
5231 that changing any of the parameters listed above may change the size of
5232 the frame), and t otherwise (which means the frame size never changes
5233 implicitly when there's no window system support).
5235 Note that when a frame is not large enough to accommodate a change of
5236 any of the parameters listed above, Emacs may try to enlarge the frame
5237 even if this option is non-nil. */);
5238 #if defined (HAVE_WINDOW_SYSTEM)
5239 #if defined (USE_LUCID) || defined (USE_MOTIF) || defined (HAVE_NTGUI)
5240 frame_inhibit_implied_resize
= list1 (Qtool_bar_lines
);
5242 frame_inhibit_implied_resize
= Qnil
;
5245 frame_inhibit_implied_resize
= Qt
;
5248 DEFVAR_LISP ("frame-size-history", frame_size_history
,
5249 doc
: /* History of frame size adjustments.
5250 If non-nil, list recording frame size adjustment. Adjustments are
5251 recorded only if the first element of this list is a positive number.
5252 Adding an adjustment decrements that number by one.
5254 The remaining elements are the adjustments. Each adjustment is a list
5255 of four elements `frame', `function', `sizes' and `more'. `frame' is
5256 the affected frame and `function' the invoking function. `sizes' is
5257 usually a list of four elements `old-width', `old-height', `new-width'
5258 and `new-height' representing the old and new sizes recorded/requested
5259 by `function'. `more' is a list with additional information.
5261 The function `frame--size-history' displays the value of this variable
5262 in a more readable form. */);
5263 frame_size_history
= Qnil
;
5265 DEFVAR_BOOL ("tooltip-reuse-hidden-frame", tooltip_reuse_hidden_frame
,
5266 doc
: /* Non-nil means reuse hidden tooltip frames.
5267 When this is nil, delete a tooltip frame when hiding the associated
5268 tooltip. When this is non-nil, make the tooltip frame invisible only,
5269 so it can be reused when the next tooltip is shown.
5271 Setting this to non-nil may drastically reduce the consing overhead
5272 incurred by creating new tooltip frames. However, a value of non-nil
5273 means also that intermittent changes of faces or `default-frame-alist'
5274 are not applied when showing a tooltip in a reused frame.
5276 This variable is effective only with the X toolkit (and there only when
5277 Gtk+ tooltips are not used) and on Windows. */);
5278 tooltip_reuse_hidden_frame
= false;
5280 staticpro (&Vframe_list
);
5283 defsubr (&Sframe_live_p
);
5284 defsubr (&Swindow_system
);
5285 defsubr (&Sframe_windows_min_size
);
5286 defsubr (&Smake_terminal_frame
);
5287 defsubr (&Shandle_switch_frame
);
5288 defsubr (&Sselect_frame
);
5289 defsubr (&Sselected_frame
);
5290 defsubr (&Sframe_list
);
5291 defsubr (&Snext_frame
);
5292 defsubr (&Sprevious_frame
);
5293 defsubr (&Slast_nonminibuf_frame
);
5294 defsubr (&Sdelete_frame
);
5295 defsubr (&Smouse_position
);
5296 defsubr (&Smouse_pixel_position
);
5297 defsubr (&Sset_mouse_position
);
5298 defsubr (&Sset_mouse_pixel_position
);
5300 defsubr (&Sframe_configuration
);
5301 defsubr (&Srestore_frame_configuration
);
5303 defsubr (&Smake_frame_visible
);
5304 defsubr (&Smake_frame_invisible
);
5305 defsubr (&Siconify_frame
);
5306 defsubr (&Sframe_visible_p
);
5307 defsubr (&Svisible_frame_list
);
5308 defsubr (&Sraise_frame
);
5309 defsubr (&Slower_frame
);
5310 defsubr (&Sx_focus_frame
);
5311 defsubr (&Sframe_after_make_frame
);
5312 defsubr (&Sredirect_frame_focus
);
5313 defsubr (&Sframe_focus
);
5314 defsubr (&Sframe_parameters
);
5315 defsubr (&Sframe_parameter
);
5316 defsubr (&Smodify_frame_parameters
);
5317 defsubr (&Sframe_char_height
);
5318 defsubr (&Sframe_char_width
);
5319 defsubr (&Sframe_pixel_height
);
5320 defsubr (&Sframe_pixel_width
);
5321 defsubr (&Sframe_text_cols
);
5322 defsubr (&Sframe_text_lines
);
5323 defsubr (&Sframe_total_cols
);
5324 defsubr (&Sframe_total_lines
);
5325 defsubr (&Sframe_text_width
);
5326 defsubr (&Sframe_text_height
);
5327 defsubr (&Sscroll_bar_width
);
5328 defsubr (&Sscroll_bar_height
);
5329 defsubr (&Sfringe_width
);
5330 defsubr (&Sborder_width
);
5331 defsubr (&Sright_divider_width
);
5332 defsubr (&Sbottom_divider_width
);
5333 defsubr (&Stool_bar_pixel_width
);
5334 defsubr (&Sset_frame_height
);
5335 defsubr (&Sset_frame_width
);
5336 defsubr (&Sset_frame_size
);
5337 defsubr (&Sframe_position
);
5338 defsubr (&Sset_frame_position
);
5339 defsubr (&Sframe_pointer_visible_p
);
5341 #ifdef HAVE_WINDOW_SYSTEM
5342 defsubr (&Sx_get_resource
);
5343 defsubr (&Sx_parse_geometry
);