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 by
513 our video hardware. Try to find the smallest size greater or
514 equal to the requested dimensions, while accounting for the fact
515 that the menu-bar lines are not counted in the frame height. */
516 int dos_new_lines
= new_lines
+ FRAME_TOP_MARGIN (f
);
517 dos_set_window_size (&dos_new_lines
, &new_cols
);
518 new_lines
= dos_new_lines
- FRAME_TOP_MARGIN (f
);
521 if (new_windows_width
!= old_windows_width
)
523 resize_frame_windows (f
, new_windows_width
, 1, 1);
525 /* MSDOS frames cannot PRETEND, as they change frame size by
526 manipulating video hardware. */
527 if ((FRAME_TERMCAP_P (f
) && !pretend
) || FRAME_MSDOS_P (f
))
528 FrameCols (FRAME_TTY (f
)) = new_cols
;
530 #if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
531 if (WINDOWP (f
->tool_bar_window
))
533 XWINDOW (f
->tool_bar_window
)->pixel_width
= new_windows_width
;
534 XWINDOW (f
->tool_bar_window
)->total_cols
535 = new_windows_width
/ unit_width
;
539 else if (new_cols
!= old_cols
)
540 call2 (Qwindow__pixel_to_total
, frame
, Qt
);
542 if (new_windows_height
!= old_windows_height
543 /* When the top margin has changed we have to recalculate the top
544 edges of all windows. No such calculation is necessary for the
546 || WINDOW_TOP_PIXEL_EDGE (r
) != FRAME_TOP_MARGIN_HEIGHT (f
))
548 resize_frame_windows (f
, new_windows_height
, 0, 1);
550 /* MSDOS frames cannot PRETEND, as they change frame size by
551 manipulating video hardware. */
552 if ((FRAME_TERMCAP_P (f
) && !pretend
) || FRAME_MSDOS_P (f
))
553 FrameRows (FRAME_TTY (f
)) = new_lines
+ FRAME_TOP_MARGIN (f
);
555 else if (new_lines
!= old_lines
)
556 call2 (Qwindow__pixel_to_total
, frame
, Qnil
);
558 frame_size_history_add
559 (f
, Qadjust_frame_size_3
, new_text_width
, new_text_height
,
560 list4 (make_number (old_pixel_width
), make_number (old_pixel_height
),
561 make_number (new_pixel_width
), make_number (new_pixel_height
)));
563 /* Assign new sizes. */
564 FRAME_TEXT_WIDTH (f
) = new_text_width
;
565 FRAME_TEXT_HEIGHT (f
) = new_text_height
;
566 FRAME_PIXEL_WIDTH (f
) = new_pixel_width
;
567 FRAME_PIXEL_HEIGHT (f
) = new_pixel_height
;
568 SET_FRAME_COLS (f
, new_cols
);
569 SET_FRAME_LINES (f
, new_lines
);
572 struct window
*w
= XWINDOW (FRAME_SELECTED_WINDOW (f
));
573 int text_area_x
, text_area_y
, text_area_width
, text_area_height
;
575 window_box (w
, TEXT_AREA
, &text_area_x
, &text_area_y
, &text_area_width
,
577 if (w
->cursor
.x
>= text_area_x
+ text_area_width
)
578 w
->cursor
.hpos
= w
->cursor
.x
= 0;
579 if (w
->cursor
.y
>= text_area_y
+ text_area_height
)
580 w
->cursor
.vpos
= w
->cursor
.y
= 0;
583 /* Sanitize window sizes. */
584 sanitize_window_sizes (frame
, Qt
);
585 sanitize_window_sizes (frame
, Qnil
);
587 adjust_frame_glyphs (f
);
589 SET_FRAME_GARBAGED (f
);
591 /* A frame was "resized" if one of its pixelsizes changed, even if its
592 X window wasn't resized at all. */
593 f
->resized_p
= (new_pixel_width
!= old_pixel_width
594 || new_pixel_height
!= old_pixel_height
);
599 /* Allocate basically initialized frame. */
601 static struct frame
*
602 allocate_frame (void)
604 return ALLOCATE_ZEROED_PSEUDOVECTOR (struct frame
, face_cache
, PVEC_FRAME
);
608 make_frame (bool mini_p
)
612 struct window
*rw
, *mw
;
613 Lisp_Object root_window
;
614 Lisp_Object mini_window
;
616 f
= allocate_frame ();
617 XSETFRAME (frame
, f
);
620 /* Initialize Lisp data. Note that allocate_frame initializes all
621 Lisp data to nil, so do it only for slots which should not be nil. */
622 fset_tool_bar_position (f
, Qtop
);
625 /* Initialize non-Lisp data. Note that allocate_frame zeroes out all
626 non-Lisp data, so do it only for slots which should not be zero.
627 To avoid subtle bugs and for the sake of readability, it's better to
628 initialize enum members explicitly even if their values are zero. */
629 f
->wants_modeline
= true;
632 f
->can_x_set_window_size
= false;
633 f
->after_make_frame
= false;
634 f
->inhibit_horizontal_resize
= false;
635 f
->inhibit_vertical_resize
= false;
636 f
->tool_bar_redisplayed
= false;
637 f
->tool_bar_resized
= false;
638 f
->column_width
= 1; /* !FRAME_WINDOW_P value. */
639 f
->line_height
= 1; /* !FRAME_WINDOW_P value. */
640 #ifdef HAVE_WINDOW_SYSTEM
641 f
->vertical_scroll_bar_type
= vertical_scroll_bar_none
;
642 f
->horizontal_scroll_bars
= false;
643 f
->want_fullscreen
= FULLSCREEN_NONE
;
644 #if ! defined (USE_GTK) && ! defined (HAVE_NS)
645 f
->last_tool_bar_item
= -1;
649 root_window
= make_window ();
650 rw
= XWINDOW (root_window
);
653 mini_window
= make_window ();
654 mw
= XWINDOW (mini_window
);
655 wset_next (rw
, mini_window
);
656 wset_prev (mw
, root_window
);
658 wset_frame (mw
, frame
);
659 fset_minibuffer_window (f
, mini_window
);
664 wset_next (rw
, Qnil
);
665 fset_minibuffer_window (f
, Qnil
);
668 wset_frame (rw
, frame
);
671 just so that there is "something there."
672 Correct size will be set up later with adjust_frame_size. */
674 SET_FRAME_COLS (f
, 10);
675 SET_FRAME_LINES (f
, 10);
676 SET_FRAME_WIDTH (f
, FRAME_COLS (f
) * FRAME_COLUMN_WIDTH (f
));
677 SET_FRAME_HEIGHT (f
, FRAME_LINES (f
) * FRAME_LINE_HEIGHT (f
));
680 rw
->pixel_width
= rw
->total_cols
* FRAME_COLUMN_WIDTH (f
);
681 rw
->total_lines
= mini_p
? 9 : 10;
682 rw
->pixel_height
= rw
->total_lines
* FRAME_LINE_HEIGHT (f
);
686 mw
->top_line
= rw
->total_lines
;
687 mw
->pixel_top
= rw
->pixel_height
;
688 mw
->total_cols
= rw
->total_cols
;
689 mw
->pixel_width
= rw
->pixel_width
;
691 mw
->pixel_height
= FRAME_LINE_HEIGHT (f
);
694 /* Choose a buffer for the frame's root window. */
696 Lisp_Object buf
= Fcurrent_buffer ();
698 /* If current buffer is hidden, try to find another one. */
699 if (BUFFER_HIDDEN_P (XBUFFER (buf
)))
700 buf
= other_buffer_safely (buf
);
702 /* Use set_window_buffer, not Fset_window_buffer, and don't let
703 hooks be run by it. The reason is that the whole frame/window
704 arrangement is not yet fully initialized at this point. Windows
705 don't have the right size, glyph matrices aren't initialized
706 etc. Running Lisp functions at this point surely ends in a
708 set_window_buffer (root_window
, buf
, 0, 0);
709 fset_buffer_list (f
, list1 (buf
));
714 set_window_buffer (mini_window
,
715 (NILP (Vminibuffer_list
)
717 : Fcar (Vminibuffer_list
)),
719 /* No horizontal scroll bars in minibuffers. */
720 wset_horizontal_scroll_bar (mw
, Qnil
);
723 fset_root_window (f
, root_window
);
724 fset_selected_window (f
, root_window
);
725 /* Make sure this window seems more recently used than
726 a newly-created, never-selected window. */
727 XWINDOW (f
->selected_window
)->use_time
= ++window_select_count
;
732 #ifdef HAVE_WINDOW_SYSTEM
733 /* Make a frame using a separate minibuffer window on another frame.
734 MINI_WINDOW is the minibuffer window to use. nil means use the
735 default (the global minibuffer). */
738 make_frame_without_minibuffer (Lisp_Object mini_window
, KBOARD
*kb
,
743 if (!NILP (mini_window
))
744 CHECK_LIVE_WINDOW (mini_window
);
746 if (!NILP (mini_window
)
747 && FRAME_KBOARD (XFRAME (XWINDOW (mini_window
)->frame
)) != kb
)
748 error ("Frame and minibuffer must be on the same terminal");
750 /* Make a frame containing just a root window. */
753 if (NILP (mini_window
))
755 /* Use default-minibuffer-frame if possible. */
756 if (!FRAMEP (KVAR (kb
, Vdefault_minibuffer_frame
))
757 || ! FRAME_LIVE_P (XFRAME (KVAR (kb
, Vdefault_minibuffer_frame
))))
759 Lisp_Object frame_dummy
;
761 XSETFRAME (frame_dummy
, f
);
762 /* If there's no minibuffer frame to use, create one. */
763 kset_default_minibuffer_frame
764 (kb
, call1 (intern ("make-initial-minibuffer-frame"), display
));
768 = XFRAME (KVAR (kb
, Vdefault_minibuffer_frame
))->minibuffer_window
;
771 fset_minibuffer_window (f
, mini_window
);
773 /* Make the chosen minibuffer window display the proper minibuffer,
774 unless it is already showing a minibuffer. */
775 if (NILP (Fmemq (XWINDOW (mini_window
)->contents
, Vminibuffer_list
)))
776 /* Use set_window_buffer instead of Fset_window_buffer (see
777 discussion of bug#11984, bug#12025, bug#12026). */
778 set_window_buffer (mini_window
,
779 (NILP (Vminibuffer_list
)
781 : Fcar (Vminibuffer_list
)), 0, 0);
785 /* Make a frame containing only a minibuffer window. */
788 make_minibuffer_frame (void)
790 /* First make a frame containing just a root window, no minibuffer. */
792 register struct frame
*f
= make_frame (0);
793 register Lisp_Object mini_window
;
794 register Lisp_Object frame
;
796 XSETFRAME (frame
, f
);
801 f
->wants_modeline
= 0;
803 /* Now label the root window as also being the minibuffer.
804 Avoid infinite looping on the window chain by marking next pointer
807 mini_window
= f
->root_window
;
808 fset_minibuffer_window (f
, mini_window
);
809 XWINDOW (mini_window
)->mini
= 1;
810 wset_next (XWINDOW (mini_window
), Qnil
);
811 wset_prev (XWINDOW (mini_window
), Qnil
);
812 wset_frame (XWINDOW (mini_window
), frame
);
814 /* Put the proper buffer in that window. */
816 /* Use set_window_buffer instead of Fset_window_buffer (see
817 discussion of bug#11984, bug#12025, bug#12026). */
818 set_window_buffer (mini_window
,
819 (NILP (Vminibuffer_list
)
821 : Fcar (Vminibuffer_list
)), 0, 0);
824 #endif /* HAVE_WINDOW_SYSTEM */
826 /* Construct a frame that refers to a terminal. */
828 static printmax_t tty_frame_count
;
831 make_initial_frame (void)
834 struct terminal
*terminal
;
837 eassert (initial_kboard
);
839 /* The first call must initialize Vframe_list. */
840 if (! (NILP (Vframe_list
) || CONSP (Vframe_list
)))
843 terminal
= init_initial_terminal ();
846 XSETFRAME (frame
, f
);
848 Vframe_list
= Fcons (frame
, Vframe_list
);
851 fset_name (f
, build_pure_c_string ("F1"));
853 SET_FRAME_VISIBLE (f
, 1);
855 f
->output_method
= terminal
->type
;
856 f
->terminal
= terminal
;
857 f
->terminal
->reference_count
++;
858 f
->output_data
.nothing
= 0;
860 FRAME_FOREGROUND_PIXEL (f
) = FACE_TTY_DEFAULT_FG_COLOR
;
861 FRAME_BACKGROUND_PIXEL (f
) = FACE_TTY_DEFAULT_BG_COLOR
;
863 #ifdef HAVE_WINDOW_SYSTEM
864 f
->vertical_scroll_bar_type
= vertical_scroll_bar_none
;
865 f
->horizontal_scroll_bars
= false;
868 /* The default value of menu-bar-mode is t. */
869 set_menu_bar_lines (f
, make_number (1), Qnil
);
871 /* Allocate glyph matrices. */
872 adjust_frame_glyphs (f
);
875 init_frame_faces (f
);
877 last_nonminibuf_frame
= f
;
879 f
->can_x_set_window_size
= true;
880 f
->after_make_frame
= true;
886 static struct frame
*
887 make_terminal_frame (struct terminal
*terminal
)
889 register struct frame
*f
;
891 char name
[sizeof "F" + INT_STRLEN_BOUND (printmax_t
)];
894 error ("Terminal is not live, can't create new frames on it");
898 XSETFRAME (frame
, f
);
899 Vframe_list
= Fcons (frame
, Vframe_list
);
901 fset_name (f
, make_formatted_string (name
, "F%"pMd
, ++tty_frame_count
));
903 SET_FRAME_VISIBLE (f
, 1);
905 f
->terminal
= terminal
;
906 f
->terminal
->reference_count
++;
908 f
->output_data
.tty
->display_info
= &the_only_display_info
;
909 if (!inhibit_window_system
910 && (!FRAMEP (selected_frame
) || !FRAME_LIVE_P (XFRAME (selected_frame
))
911 || XFRAME (selected_frame
)->output_method
== output_msdos_raw
))
912 f
->output_method
= output_msdos_raw
;
914 f
->output_method
= output_termcap
;
915 #else /* not MSDOS */
916 f
->output_method
= output_termcap
;
917 create_tty_output (f
);
918 FRAME_FOREGROUND_PIXEL (f
) = FACE_TTY_DEFAULT_FG_COLOR
;
919 FRAME_BACKGROUND_PIXEL (f
) = FACE_TTY_DEFAULT_BG_COLOR
;
920 #endif /* not MSDOS */
922 #ifdef HAVE_WINDOW_SYSTEM
923 f
->vertical_scroll_bar_type
= vertical_scroll_bar_none
;
924 f
->horizontal_scroll_bars
= false;
927 FRAME_MENU_BAR_LINES (f
) = NILP (Vmenu_bar_mode
) ? 0 : 1;
928 FRAME_LINES (f
) = FRAME_LINES (f
) - FRAME_MENU_BAR_LINES (f
);
929 FRAME_MENU_BAR_HEIGHT (f
) = FRAME_MENU_BAR_LINES (f
) * FRAME_LINE_HEIGHT (f
);
930 FRAME_TEXT_HEIGHT (f
) = FRAME_TEXT_HEIGHT (f
) - FRAME_MENU_BAR_HEIGHT (f
);
932 /* Set the top frame to the newly created frame. */
933 if (FRAMEP (FRAME_TTY (f
)->top_frame
)
934 && FRAME_LIVE_P (XFRAME (FRAME_TTY (f
)->top_frame
)))
935 SET_FRAME_VISIBLE (XFRAME (FRAME_TTY (f
)->top_frame
), 2); /* obscured */
937 FRAME_TTY (f
)->top_frame
= frame
;
940 init_frame_faces (f
);
945 /* Get a suitable value for frame parameter PARAMETER for a newly
946 created frame, based on (1) the user-supplied frame parameter
947 alist SUPPLIED_PARMS, and (2) CURRENT_VALUE. */
950 get_future_frame_param (Lisp_Object parameter
,
951 Lisp_Object supplied_parms
,
956 result
= Fassq (parameter
, supplied_parms
);
958 result
= Fassq (parameter
, XFRAME (selected_frame
)->param_alist
);
959 if (NILP (result
) && current_value
!= NULL
)
960 result
= build_string (current_value
);
961 if (!NILP (result
) && !STRINGP (result
))
962 result
= XCDR (result
);
963 if (NILP (result
) || !STRINGP (result
))
969 DEFUN ("make-terminal-frame", Fmake_terminal_frame
, Smake_terminal_frame
,
971 doc
: /* Create an additional terminal frame, possibly on another terminal.
972 This function takes one argument, an alist specifying frame parameters.
974 You can create multiple frames on a single text terminal, but only one
975 of them (the selected terminal frame) is actually displayed.
977 In practice, generally you don't need to specify any parameters,
978 except when you want to create a new frame on another terminal.
979 In that case, the `tty' parameter specifies the device file to open,
980 and the `tty-type' parameter specifies the terminal type. Example:
982 (make-terminal-frame \\='((tty . "/dev/pts/5") (tty-type . "xterm")))
984 Note that changing the size of one terminal frame automatically
985 affects all frames on the same terminal device. */)
989 struct terminal
*t
= NULL
;
990 Lisp_Object frame
, tem
;
991 struct frame
*sf
= SELECTED_FRAME ();
994 if (sf
->output_method
!= output_msdos_raw
995 && sf
->output_method
!= output_termcap
)
997 #else /* not MSDOS */
999 #ifdef WINDOWSNT /* This should work now! */
1000 if (sf
->output_method
!= output_termcap
)
1001 error ("Not using an ASCII terminal now; cannot make a new ASCII frame");
1003 #endif /* not MSDOS */
1006 Lisp_Object terminal
;
1008 terminal
= Fassq (Qterminal
, parms
);
1009 if (CONSP (terminal
))
1011 terminal
= XCDR (terminal
);
1012 t
= decode_live_terminal (terminal
);
1015 if (t
&& t
!= the_only_display_info
.terminal
)
1016 /* msdos.c assumes a single tty_display_info object. */
1017 error ("Multiple terminals are not supported on this platform");
1019 t
= the_only_display_info
.terminal
;
1025 char *name
= 0, *type
= 0;
1026 Lisp_Object tty
, tty_type
;
1029 tty
= get_future_frame_param
1030 (Qtty
, parms
, (FRAME_TERMCAP_P (XFRAME (selected_frame
))
1031 ? FRAME_TTY (XFRAME (selected_frame
))->name
1034 SAFE_ALLOCA_STRING (name
, tty
);
1036 tty_type
= get_future_frame_param
1037 (Qtty_type
, parms
, (FRAME_TERMCAP_P (XFRAME (selected_frame
))
1038 ? FRAME_TTY (XFRAME (selected_frame
))->type
1040 if (!NILP (tty_type
))
1041 SAFE_ALLOCA_STRING (type
, tty_type
);
1043 t
= init_tty (name
, type
, 0); /* Errors are not fatal. */
1047 f
= make_terminal_frame (t
);
1051 get_tty_size (fileno (FRAME_TTY (f
)->input
), &width
, &height
);
1052 adjust_frame_size (f
, width
, height
- FRAME_MENU_BAR_LINES (f
),
1053 5, 0, Qterminal_frame
);
1056 adjust_frame_glyphs (f
);
1057 calculate_costs (f
);
1058 XSETFRAME (frame
, f
);
1060 store_in_alist (&parms
, Qtty_type
, build_string (t
->display_info
.tty
->type
));
1061 store_in_alist (&parms
, Qtty
,
1062 (t
->display_info
.tty
->name
1063 ? build_string (t
->display_info
.tty
->name
)
1065 Fmodify_frame_parameters (frame
, parms
);
1067 /* Make the frame face alist be frame-specific, so that each
1068 frame could change its face definitions independently. */
1069 fset_face_alist (f
, Fcopy_alist (sf
->face_alist
));
1070 /* Simple Fcopy_alist isn't enough, because we need the contents of
1071 the vectors which are the CDRs of associations in face_alist to
1072 be copied as well. */
1073 for (tem
= f
->face_alist
; CONSP (tem
); tem
= XCDR (tem
))
1074 XSETCDR (XCAR (tem
), Fcopy_sequence (XCDR (XCAR (tem
))));
1076 f
->can_x_set_window_size
= true;
1077 f
->after_make_frame
= true;
1083 /* Perform the switch to frame FRAME.
1085 If FRAME is a switch-frame event `(switch-frame FRAME1)', use
1088 If TRACK is non-zero and the frame that currently has the focus
1089 redirects its focus to the selected frame, redirect that focused
1090 frame's focus to FRAME instead.
1092 FOR_DELETION non-zero means that the selected frame is being
1093 deleted, which includes the possibility that the frame's terminal
1096 The value of NORECORD is passed as argument to Fselect_window. */
1099 do_switch_frame (Lisp_Object frame
, int track
, int for_deletion
, Lisp_Object norecord
)
1101 struct frame
*sf
= SELECTED_FRAME ();
1103 /* If FRAME is a switch-frame event, extract the frame we should
1106 && EQ (XCAR (frame
), Qswitch_frame
)
1107 && CONSP (XCDR (frame
)))
1108 frame
= XCAR (XCDR (frame
));
1110 /* This used to say CHECK_LIVE_FRAME, but apparently it's possible for
1111 a switch-frame event to arrive after a frame is no longer live,
1112 especially when deleting the initial frame during startup. */
1113 CHECK_FRAME (frame
);
1114 if (! FRAME_LIVE_P (XFRAME (frame
)))
1117 if (sf
== XFRAME (frame
))
1120 /* If a frame's focus has been redirected toward the currently
1121 selected frame, we should change the redirection to point to the
1122 newly selected frame. This means that if the focus is redirected
1123 from a minibufferless frame to a surrogate minibuffer frame, we
1124 can use `other-window' to switch between all the frames using
1125 that minibuffer frame, and the focus redirection will follow us
1128 /* This is too greedy; it causes inappropriate focus redirection
1129 that's hard to get rid of. */
1134 for (tail
= Vframe_list
; CONSP (tail
); tail
= XCDR (tail
))
1138 if (!FRAMEP (XCAR (tail
)))
1141 focus
= FRAME_FOCUS_FRAME (XFRAME (XCAR (tail
)));
1143 if (FRAMEP (focus
) && XFRAME (focus
) == SELECTED_FRAME ())
1144 Fredirect_frame_focus (XCAR (tail
), frame
);
1148 /* Instead, apply it only to the frame we're pointing to. */
1149 #ifdef HAVE_WINDOW_SYSTEM
1150 if (track
&& FRAME_WINDOW_P (XFRAME (frame
)))
1152 Lisp_Object focus
, xfocus
;
1154 xfocus
= x_get_focus_frame (XFRAME (frame
));
1155 if (FRAMEP (xfocus
))
1157 focus
= FRAME_FOCUS_FRAME (XFRAME (xfocus
));
1158 if (FRAMEP (focus
) && XFRAME (focus
) == SELECTED_FRAME ())
1159 Fredirect_frame_focus (xfocus
, frame
);
1162 #endif /* HAVE_X_WINDOWS */
1165 if (!for_deletion
&& FRAME_HAS_MINIBUF_P (sf
))
1166 resize_mini_window (XWINDOW (FRAME_MINIBUF_WINDOW (sf
)), 1);
1168 if (FRAME_TERMCAP_P (XFRAME (frame
)) || FRAME_MSDOS_P (XFRAME (frame
)))
1170 struct frame
*f
= XFRAME (frame
);
1171 struct tty_display_info
*tty
= FRAME_TTY (f
);
1172 Lisp_Object top_frame
= tty
->top_frame
;
1174 /* Don't mark the frame garbaged and/or obscured if we are
1175 switching to the frame that is already the top frame of that
1177 if (!EQ (frame
, top_frame
))
1179 if (FRAMEP (top_frame
))
1180 /* Mark previously displayed frame as now obscured. */
1181 SET_FRAME_VISIBLE (XFRAME (top_frame
), 2);
1182 SET_FRAME_VISIBLE (f
, 1);
1183 /* If the new TTY frame changed dimensions, we need to
1184 resync term.c's idea of the frame size with the new
1186 if (FRAME_COLS (f
) != FrameCols (tty
))
1187 FrameCols (tty
) = FRAME_COLS (f
);
1188 if (FRAME_TOTAL_LINES (f
) != FrameRows (tty
))
1189 FrameRows (tty
) = FRAME_TOTAL_LINES (f
);
1191 tty
->top_frame
= frame
;
1194 selected_frame
= frame
;
1195 if (! FRAME_MINIBUF_ONLY_P (XFRAME (selected_frame
)))
1196 last_nonminibuf_frame
= XFRAME (selected_frame
);
1198 Fselect_window (XFRAME (frame
)->selected_window
, norecord
);
1200 /* We want to make sure that the next event generates a frame-switch
1201 event to the appropriate frame. This seems kludgy to me, but
1202 before you take it out, make sure that evaluating something like
1203 (select-window (frame-root-window (new-frame))) doesn't end up
1204 with your typing being interpreted in the new frame instead of
1205 the one you're actually typing in. */
1206 internal_last_event_frame
= Qnil
;
1211 DEFUN ("select-frame", Fselect_frame
, Sselect_frame
, 1, 2, "e",
1212 doc
: /* Select FRAME.
1213 Subsequent editing commands apply to its selected window.
1214 Optional argument NORECORD means to neither change the order of
1215 recently selected windows nor the buffer list.
1217 The selection of FRAME lasts until the next time the user does
1218 something to select a different frame, or until the next time
1219 this function is called. If you are using a window system, the
1220 previously selected frame may be restored as the selected frame
1221 when returning to the command loop, because it still may have
1222 the window system's input focus. On a text terminal, the next
1223 redisplay will display FRAME.
1225 This function returns FRAME, or nil if FRAME has been deleted. */)
1226 (Lisp_Object frame
, Lisp_Object norecord
)
1228 return do_switch_frame (frame
, 1, 0, norecord
);
1231 DEFUN ("handle-switch-frame", Fhandle_switch_frame
, Shandle_switch_frame
, 1, 1, "^e",
1232 doc
: /* Handle a switch-frame event EVENT.
1233 Switch-frame events are usually bound to this function.
1234 A switch-frame event tells Emacs that the window manager has requested
1235 that the user's events be directed to the frame mentioned in the event.
1236 This function selects the selected window of the frame of EVENT.
1238 If EVENT is frame object, handle it as if it were a switch-frame event
1242 /* Preserve prefix arg that the command loop just cleared. */
1243 kset_prefix_arg (current_kboard
, Vcurrent_prefix_arg
);
1244 run_hook (Qmouse_leave_buffer_hook
);
1245 /* `switch-frame' implies a focus in. */
1246 call1 (intern ("handle-focus-in"), event
);
1247 return do_switch_frame (event
, 0, 0, Qnil
);
1250 DEFUN ("selected-frame", Fselected_frame
, Sselected_frame
, 0, 0, 0,
1251 doc
: /* Return the frame that is now selected. */)
1254 return selected_frame
;
1257 DEFUN ("frame-list", Fframe_list
, Sframe_list
,
1259 doc
: /* Return a list of all live frames. */)
1263 frames
= Fcopy_sequence (Vframe_list
);
1264 #ifdef HAVE_WINDOW_SYSTEM
1265 if (FRAMEP (tip_frame
))
1266 frames
= Fdelq (tip_frame
, frames
);
1271 /* Return CANDIDATE if it can be used as 'other-than-FRAME' frame on the
1272 same tty (for tty frames) or among frames which uses FRAME's keyboard.
1273 If MINIBUF is nil, do not consider minibuffer-only candidate.
1274 If MINIBUF is `visible', do not consider an invisible candidate.
1275 If MINIBUF is a window, consider only its own frame and candidate now
1276 using that window as the minibuffer.
1277 If MINIBUF is 0, consider candidate if it is visible or iconified.
1278 Otherwise consider any candidate and return nil if CANDIDATE is not
1282 candidate_frame (Lisp_Object candidate
, Lisp_Object frame
, Lisp_Object minibuf
)
1284 struct frame
*c
= XFRAME (candidate
), *f
= XFRAME (frame
);
1286 if ((!FRAME_TERMCAP_P (c
) && !FRAME_TERMCAP_P (f
)
1287 && FRAME_KBOARD (c
) == FRAME_KBOARD (f
))
1288 || (FRAME_TERMCAP_P (c
) && FRAME_TERMCAP_P (f
)
1289 && FRAME_TTY (c
) == FRAME_TTY (f
)))
1293 if (!FRAME_MINIBUF_ONLY_P (c
))
1296 else if (EQ (minibuf
, Qvisible
))
1298 if (FRAME_VISIBLE_P (c
))
1301 else if (WINDOWP (minibuf
))
1303 if (EQ (FRAME_MINIBUF_WINDOW (c
), minibuf
)
1304 || EQ (WINDOW_FRAME (XWINDOW (minibuf
)), candidate
)
1305 || EQ (WINDOW_FRAME (XWINDOW (minibuf
)),
1306 FRAME_FOCUS_FRAME (c
)))
1309 else if (XFASTINT (minibuf
) == 0)
1311 if (FRAME_VISIBLE_P (c
) || FRAME_ICONIFIED_P (c
))
1320 /* Return the next frame in the frame list after FRAME. */
1323 next_frame (Lisp_Object frame
, Lisp_Object minibuf
)
1325 Lisp_Object f
, tail
;
1328 /* There must always be at least one frame in Vframe_list. */
1329 eassert (CONSP (Vframe_list
));
1332 FOR_EACH_FRAME (tail
, f
)
1336 f
= candidate_frame (f
, frame
, minibuf
);
1346 /* Return the previous frame in the frame list before FRAME. */
1349 prev_frame (Lisp_Object frame
, Lisp_Object minibuf
)
1351 Lisp_Object f
, tail
, prev
= Qnil
;
1353 /* There must always be at least one frame in Vframe_list. */
1354 eassert (CONSP (Vframe_list
));
1356 FOR_EACH_FRAME (tail
, f
)
1358 if (EQ (frame
, f
) && !NILP (prev
))
1360 f
= candidate_frame (f
, frame
, minibuf
);
1365 /* We've scanned the entire list. */
1367 /* We went through the whole frame list without finding a single
1368 acceptable frame. Return the original frame. */
1371 /* There were no acceptable frames in the list before FRAME; otherwise,
1372 we would have returned directly from the loop. Since PREV is the last
1373 acceptable frame in the list, return it. */
1378 DEFUN ("next-frame", Fnext_frame
, Snext_frame
, 0, 2, 0,
1379 doc
: /* Return the next frame in the frame list after FRAME.
1380 It considers only frames on the same terminal as FRAME.
1381 By default, skip minibuffer-only frames.
1382 If omitted, FRAME defaults to the selected frame.
1383 If optional argument MINIFRAME is nil, exclude minibuffer-only frames.
1384 If MINIFRAME is a window, include only its own frame
1385 and any frame now using that window as the minibuffer.
1386 If MINIFRAME is `visible', include all visible frames.
1387 If MINIFRAME is 0, include all visible and iconified frames.
1388 Otherwise, include all frames. */)
1389 (Lisp_Object frame
, Lisp_Object miniframe
)
1392 frame
= selected_frame
;
1393 CHECK_LIVE_FRAME (frame
);
1394 return next_frame (frame
, miniframe
);
1397 DEFUN ("previous-frame", Fprevious_frame
, Sprevious_frame
, 0, 2, 0,
1398 doc
: /* Return the previous frame in the frame list before FRAME.
1399 It considers only frames on the same terminal as FRAME.
1400 By default, skip minibuffer-only frames.
1401 If omitted, FRAME defaults to the selected frame.
1402 If optional argument MINIFRAME is nil, exclude minibuffer-only frames.
1403 If MINIFRAME is a window, include only its own frame
1404 and any frame now using that window as the minibuffer.
1405 If MINIFRAME is `visible', include all visible frames.
1406 If MINIFRAME is 0, include all visible and iconified frames.
1407 Otherwise, include all frames. */)
1408 (Lisp_Object frame
, Lisp_Object miniframe
)
1411 frame
= selected_frame
;
1412 CHECK_LIVE_FRAME (frame
);
1413 return prev_frame (frame
, miniframe
);
1416 DEFUN ("last-nonminibuffer-frame", Flast_nonminibuf_frame
,
1417 Slast_nonminibuf_frame
, 0, 0, 0,
1418 doc
: /* Return last non-minibuffer frame selected. */)
1421 Lisp_Object frame
= Qnil
;
1423 if (last_nonminibuf_frame
)
1424 XSETFRAME (frame
, last_nonminibuf_frame
);
1429 /* Return 1 if it is ok to delete frame F;
1430 0 if all frames aside from F are invisible.
1431 (Exception: if F is the terminal frame, and we are using X, return 1.) */
1434 other_visible_frames (struct frame
*f
)
1436 Lisp_Object frames
, this;
1438 FOR_EACH_FRAME (frames
, this)
1440 if (f
== XFRAME (this))
1443 /* Verify that we can still talk to the frame's X window,
1444 and note any recent change in visibility. */
1445 #ifdef HAVE_X_WINDOWS
1446 if (FRAME_WINDOW_P (XFRAME (this)))
1447 x_sync (XFRAME (this));
1450 if (FRAME_VISIBLE_P (XFRAME (this))
1451 || FRAME_ICONIFIED_P (XFRAME (this))
1452 /* Allow deleting the terminal frame when at least one X
1454 || (FRAME_WINDOW_P (XFRAME (this)) && !FRAME_WINDOW_P (f
)))
1460 /* Make sure that minibuf_window doesn't refer to FRAME's minibuffer
1461 window. Preferably use the selected frame's minibuffer window
1462 instead. If the selected frame doesn't have one, get some other
1463 frame's minibuffer window. SELECT non-zero means select the new
1464 minibuffer window. */
1466 check_minibuf_window (Lisp_Object frame
, int select
)
1468 struct frame
*f
= decode_live_frame (frame
);
1470 XSETFRAME (frame
, f
);
1472 if (WINDOWP (minibuf_window
) && EQ (f
->minibuffer_window
, minibuf_window
))
1474 Lisp_Object frames
, this, window
= make_number (0);
1476 if (!EQ (frame
, selected_frame
)
1477 && FRAME_HAS_MINIBUF_P (XFRAME (selected_frame
)))
1478 window
= FRAME_MINIBUF_WINDOW (XFRAME (selected_frame
));
1480 FOR_EACH_FRAME (frames
, this)
1482 if (!EQ (this, frame
) && FRAME_HAS_MINIBUF_P (XFRAME (this)))
1484 window
= FRAME_MINIBUF_WINDOW (XFRAME (this));
1489 /* Don't abort if no window was found (Bug#15247). */
1490 if (WINDOWP (window
))
1492 /* Use set_window_buffer instead of Fset_window_buffer (see
1493 discussion of bug#11984, bug#12025, bug#12026). */
1494 set_window_buffer (window
, XWINDOW (minibuf_window
)->contents
, 0, 0);
1495 minibuf_window
= window
;
1497 /* SELECT non-zero usually means that FRAME's minibuffer
1498 window was selected; select the new one. */
1500 Fselect_window (minibuf_window
, Qnil
);
1506 /* Delete FRAME. When FORCE equals Qnoelisp, delete FRAME
1507 unconditionally. x_connection_closed and delete_terminal use
1508 this. Any other value of FORCE implements the semantics
1509 described for Fdelete_frame. */
1511 delete_frame (Lisp_Object frame
, Lisp_Object force
)
1513 struct frame
*f
= decode_any_frame (frame
);
1517 int minibuffer_selected
, is_tooltip_frame
;
1519 if (! FRAME_LIVE_P (f
))
1522 if (NILP (force
) && !other_visible_frames (f
))
1523 error ("Attempt to delete the sole visible or iconified frame");
1525 /* x_connection_closed must have set FORCE to `noelisp' in order
1526 to delete the last frame, if it is gone. */
1527 if (NILP (XCDR (Vframe_list
)) && !EQ (force
, Qnoelisp
))
1528 error ("Attempt to delete the only frame");
1530 XSETFRAME (frame
, f
);
1532 /* Does this frame have a minibuffer, and is it the surrogate
1533 minibuffer for any other frame? */
1534 if (FRAME_HAS_MINIBUF_P (f
))
1536 Lisp_Object frames
, this;
1538 FOR_EACH_FRAME (frames
, this)
1542 if (EQ (this, frame
))
1545 fminiw
= FRAME_MINIBUF_WINDOW (XFRAME (this));
1547 if (WINDOWP (fminiw
) && EQ (frame
, WINDOW_FRAME (XWINDOW (fminiw
))))
1549 /* If we MUST delete this frame, delete the other first.
1550 But do this only if FORCE equals `noelisp'. */
1551 if (EQ (force
, Qnoelisp
))
1552 delete_frame (this, Qnoelisp
);
1554 error ("Attempt to delete a surrogate minibuffer frame");
1559 is_tooltip_frame
= !NILP (Fframe_parameter (frame
, Qtooltip
));
1561 /* Run `delete-frame-functions' unless FORCE is `noelisp' or
1562 frame is a tooltip. FORCE is set to `noelisp' when handling
1563 a disconnect from the terminal, so we don't dare call Lisp
1565 if (NILP (Vrun_hooks
) || is_tooltip_frame
)
1567 else if (EQ (force
, Qnoelisp
))
1569 = Fcons (list3 (Qrun_hook_with_args
, Qdelete_frame_functions
, frame
),
1573 #ifdef HAVE_X_WINDOWS
1574 /* Also, save clipboard to the clipboard manager. */
1575 x_clipboard_manager_save_frame (frame
);
1578 safe_call2 (Qrun_hook_with_args
, Qdelete_frame_functions
, frame
);
1581 /* The hook may sometimes (indirectly) cause the frame to be deleted. */
1582 if (! FRAME_LIVE_P (f
))
1585 /* At this point, we are committed to deleting the frame.
1586 There is no more chance for errors to prevent it. */
1588 minibuffer_selected
= EQ (minibuf_window
, selected_window
);
1589 sf
= SELECTED_FRAME ();
1590 /* Don't let the frame remain selected. */
1594 Lisp_Object frame1
= Qnil
;
1596 /* Look for another visible frame on the same terminal.
1597 Do not call next_frame here because it may loop forever.
1598 See http://debbugs.gnu.org/cgi/bugreport.cgi?bug=15025. */
1599 FOR_EACH_FRAME (tail
, frame1
)
1600 if (!EQ (frame
, frame1
)
1601 && (FRAME_TERMINAL (XFRAME (frame
))
1602 == FRAME_TERMINAL (XFRAME (frame1
)))
1603 && FRAME_VISIBLE_P (XFRAME (frame1
)))
1606 /* If there is none, find *some* other frame. */
1607 if (NILP (frame1
) || EQ (frame1
, frame
))
1609 FOR_EACH_FRAME (tail
, frame1
)
1611 if (! EQ (frame
, frame1
) && FRAME_LIVE_P (XFRAME (frame1
)))
1613 /* Do not change a text terminal's top-frame. */
1614 struct frame
*f1
= XFRAME (frame1
);
1615 if (FRAME_TERMCAP_P (f1
) || FRAME_MSDOS_P (f1
))
1617 Lisp_Object top_frame
= FRAME_TTY (f1
)->top_frame
;
1618 if (!EQ (top_frame
, frame
))
1625 #ifdef NS_IMPL_COCOA
1627 /* Under NS, there is no system mechanism for choosing a new
1628 window to get focus -- it is left to application code.
1629 So the portion of THIS application interfacing with NS
1630 needs to know about it. We call Fraise_frame, but the
1631 purpose is really to transfer focus. */
1632 Fraise_frame (frame1
);
1635 do_switch_frame (frame1
, 0, 1, Qnil
);
1636 sf
= SELECTED_FRAME ();
1639 /* Don't allow minibuf_window to remain on a deleted frame. */
1640 check_minibuf_window (frame
, minibuffer_selected
);
1642 /* Don't let echo_area_window to remain on a deleted frame. */
1643 if (EQ (f
->minibuffer_window
, echo_area_window
))
1644 echo_area_window
= sf
->minibuffer_window
;
1646 /* Clear any X selections for this frame. */
1647 #ifdef HAVE_X_WINDOWS
1649 x_clear_frame_selections (f
);
1653 This function must be called before the window tree of the
1654 frame is deleted because windows contain dynamically allocated
1658 #ifdef HAVE_WINDOW_SYSTEM
1659 /* Give chance to each font driver to free a frame specific data. */
1660 font_update_drivers (f
, Qnil
);
1663 /* Mark all the windows that used to be on FRAME as deleted, and then
1664 remove the reference to them. */
1665 delete_all_child_windows (f
->root_window
);
1666 fset_root_window (f
, Qnil
);
1668 Vframe_list
= Fdelq (frame
, Vframe_list
);
1669 SET_FRAME_VISIBLE (f
, 0);
1671 /* Allow the vector of menu bar contents to be freed in the next
1672 garbage collection. The frame object itself may not be garbage
1673 collected until much later, because recent_keys and other data
1674 structures can still refer to it. */
1675 fset_menu_bar_vector (f
, Qnil
);
1677 /* If FRAME's buffer lists contains killed
1678 buffers, this helps GC to reclaim them. */
1679 fset_buffer_list (f
, Qnil
);
1680 fset_buried_buffer_list (f
, Qnil
);
1682 free_font_driver_list (f
);
1683 #if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI)
1686 xfree (f
->decode_mode_spec_buffer
);
1687 xfree (FRAME_INSERT_COST (f
));
1688 xfree (FRAME_DELETEN_COST (f
));
1689 xfree (FRAME_INSERTN_COST (f
));
1690 xfree (FRAME_DELETE_COST (f
));
1692 /* Since some events are handled at the interrupt level, we may get
1693 an event for f at any time; if we zero out the frame's terminal
1694 now, then we may trip up the event-handling code. Instead, we'll
1695 promise that the terminal of the frame must be valid until we
1696 have called the window-system-dependent frame destruction
1701 struct terminal
*terminal
;
1703 if (FRAME_TERMINAL (f
)->delete_frame_hook
)
1704 (*FRAME_TERMINAL (f
)->delete_frame_hook
) (f
);
1705 terminal
= FRAME_TERMINAL (f
);
1706 f
->output_data
.nothing
= 0;
1707 f
->terminal
= 0; /* Now the frame is dead. */
1710 /* If needed, delete the terminal that this frame was on.
1711 (This must be done after the frame is killed.) */
1712 terminal
->reference_count
--;
1714 /* FIXME: Deleting the terminal crashes emacs because of a GTK
1716 http://lists.gnu.org/archive/html/emacs-devel/2011-10/msg00363.html */
1717 if (terminal
->reference_count
== 0 && terminal
->type
== output_x_window
)
1718 terminal
->reference_count
= 1;
1719 #endif /* USE_GTK */
1720 if (terminal
->reference_count
== 0)
1723 XSETTERMINAL (tmp
, terminal
);
1726 Fdelete_terminal (tmp
, NILP (force
) ? Qt
: force
);
1729 kb
= terminal
->kboard
;
1732 /* If we've deleted the last_nonminibuf_frame, then try to find
1734 if (f
== last_nonminibuf_frame
)
1736 Lisp_Object frames
, this;
1738 last_nonminibuf_frame
= 0;
1740 FOR_EACH_FRAME (frames
, this)
1743 if (!FRAME_MINIBUF_ONLY_P (f
))
1745 last_nonminibuf_frame
= f
;
1751 /* If there's no other frame on the same kboard, get out of
1752 single-kboard state if we're in it for this kboard. */
1755 Lisp_Object frames
, this;
1756 /* Some frame we found on the same kboard, or nil if there are none. */
1757 Lisp_Object frame_on_same_kboard
= Qnil
;
1759 FOR_EACH_FRAME (frames
, this)
1760 if (kb
== FRAME_KBOARD (XFRAME (this)))
1761 frame_on_same_kboard
= this;
1763 if (NILP (frame_on_same_kboard
))
1764 not_single_kboard_state (kb
);
1768 /* If we've deleted this keyboard's default_minibuffer_frame, try to
1769 find another one. Prefer minibuffer-only frames, but also notice
1770 frames with other windows. */
1771 if (kb
!= NULL
&& EQ (frame
, KVAR (kb
, Vdefault_minibuffer_frame
)))
1773 Lisp_Object frames
, this;
1775 /* The last frame we saw with a minibuffer, minibuffer-only or not. */
1776 Lisp_Object frame_with_minibuf
= Qnil
;
1777 /* Some frame we found on the same kboard, or nil if there are none. */
1778 Lisp_Object frame_on_same_kboard
= Qnil
;
1780 FOR_EACH_FRAME (frames
, this)
1782 struct frame
*f1
= XFRAME (this);
1784 /* Consider only frames on the same kboard
1785 and only those with minibuffers. */
1786 if (kb
== FRAME_KBOARD (f1
)
1787 && FRAME_HAS_MINIBUF_P (f1
))
1789 frame_with_minibuf
= this;
1790 if (FRAME_MINIBUF_ONLY_P (f1
))
1794 if (kb
== FRAME_KBOARD (f1
))
1795 frame_on_same_kboard
= this;
1798 if (!NILP (frame_on_same_kboard
))
1800 /* We know that there must be some frame with a minibuffer out
1801 there. If this were not true, all of the frames present
1802 would have to be minibufferless, which implies that at some
1803 point their minibuffer frames must have been deleted, but
1804 that is prohibited at the top; you can't delete surrogate
1805 minibuffer frames. */
1806 if (NILP (frame_with_minibuf
))
1809 kset_default_minibuffer_frame (kb
, frame_with_minibuf
);
1812 /* No frames left on this kboard--say no minibuffer either. */
1813 kset_default_minibuffer_frame (kb
, Qnil
);
1816 /* Cause frame titles to update--necessary if we now have just one frame. */
1817 if (!is_tooltip_frame
)
1818 update_mode_lines
= 15;
1823 DEFUN ("delete-frame", Fdelete_frame
, Sdelete_frame
, 0, 2, "",
1824 doc
: /* Delete FRAME, permanently eliminating it from use.
1825 FRAME defaults to the selected frame.
1827 A frame may not be deleted if its minibuffer serves as surrogate
1828 minibuffer for another frame. Normally, you may not delete a frame if
1829 all other frames are invisible, but if the second optional argument
1830 FORCE is non-nil, you may do so.
1832 This function runs `delete-frame-functions' before actually
1833 deleting the frame, unless the frame is a tooltip.
1834 The functions are run with one argument, the frame to be deleted. */)
1835 (Lisp_Object frame
, Lisp_Object force
)
1837 return delete_frame (frame
, !NILP (force
) ? Qt
: Qnil
);
1841 /* Return mouse position in character cell units. */
1843 DEFUN ("mouse-position", Fmouse_position
, Smouse_position
, 0, 0, 0,
1844 doc
: /* Return a list (FRAME X . Y) giving the current mouse frame and position.
1845 The position is given in canonical character cells, where (0, 0) is the
1846 upper-left corner of the frame, X is the horizontal offset, and Y is the
1847 vertical offset, measured in units of the frame's default character size.
1848 If Emacs is running on a mouseless terminal or hasn't been programmed
1849 to read the mouse position, it returns the selected frame for FRAME
1850 and nil for X and Y.
1851 If `mouse-position-function' is non-nil, `mouse-position' calls it,
1852 passing the normal return value to that function as an argument,
1853 and returns whatever that function returns. */)
1857 Lisp_Object lispy_dummy
;
1858 Lisp_Object x
, y
, retval
;
1860 f
= SELECTED_FRAME ();
1863 /* It's okay for the hook to refrain from storing anything. */
1864 if (FRAME_TERMINAL (f
)->mouse_position_hook
)
1866 enum scroll_bar_part party_dummy
;
1868 (*FRAME_TERMINAL (f
)->mouse_position_hook
) (&f
, -1,
1869 &lispy_dummy
, &party_dummy
,
1878 pixel_to_glyph_coords (f
, col
, row
, &col
, &row
, NULL
, 1);
1882 XSETFRAME (lispy_dummy
, f
);
1883 retval
= Fcons (lispy_dummy
, Fcons (x
, y
));
1884 if (!NILP (Vmouse_position_function
))
1885 retval
= call1 (Vmouse_position_function
, retval
);
1889 DEFUN ("mouse-pixel-position", Fmouse_pixel_position
,
1890 Smouse_pixel_position
, 0, 0, 0,
1891 doc
: /* Return a list (FRAME X . Y) giving the current mouse frame and position.
1892 The position is given in pixel units, where (0, 0) is the
1893 upper-left corner of the frame, X is the horizontal offset, and Y is
1894 the vertical offset.
1895 If Emacs is running on a mouseless terminal or hasn't been programmed
1896 to read the mouse position, it returns the selected frame for FRAME
1897 and nil for X and Y. */)
1901 Lisp_Object lispy_dummy
;
1902 Lisp_Object x
, y
, retval
;
1904 f
= SELECTED_FRAME ();
1907 /* It's okay for the hook to refrain from storing anything. */
1908 if (FRAME_TERMINAL (f
)->mouse_position_hook
)
1910 enum scroll_bar_part party_dummy
;
1912 (*FRAME_TERMINAL (f
)->mouse_position_hook
) (&f
, -1,
1913 &lispy_dummy
, &party_dummy
,
1918 XSETFRAME (lispy_dummy
, f
);
1919 retval
= Fcons (lispy_dummy
, Fcons (x
, y
));
1920 if (!NILP (Vmouse_position_function
))
1921 retval
= call1 (Vmouse_position_function
, retval
);
1925 #ifdef HAVE_WINDOW_SYSTEM
1927 /* On frame F, convert character coordinates X and Y to pixel
1928 coordinates *PIX_X and *PIX_Y. */
1931 frame_char_to_pixel_position (struct frame
*f
, int x
, int y
,
1932 int *pix_x
, int *pix_y
)
1934 *pix_x
= FRAME_COL_TO_PIXEL_X (f
, x
) + FRAME_COLUMN_WIDTH (f
) / 2;
1935 *pix_y
= FRAME_LINE_TO_PIXEL_Y (f
, y
) + FRAME_LINE_HEIGHT (f
) / 2;
1939 if (*pix_x
> FRAME_PIXEL_WIDTH (f
))
1940 *pix_x
= FRAME_PIXEL_WIDTH (f
);
1944 if (*pix_y
> FRAME_PIXEL_HEIGHT (f
))
1945 *pix_y
= FRAME_PIXEL_HEIGHT (f
);
1948 /* On frame F, reposition mouse pointer to character coordinates X and Y. */
1951 frame_set_mouse_position (struct frame
*f
, int x
, int y
)
1955 frame_char_to_pixel_position (f
, x
, y
, &pix_x
, &pix_y
);
1956 frame_set_mouse_pixel_position (f
, pix_x
, pix_y
);
1959 #endif /* HAVE_WINDOW_SYSTEM */
1961 DEFUN ("set-mouse-position", Fset_mouse_position
, Sset_mouse_position
, 3, 3, 0,
1962 doc
: /* Move the mouse pointer to the center of character cell (X,Y) in FRAME.
1963 Coordinates are relative to the frame, not a window,
1964 so the coordinates of the top left character in the frame
1965 may be nonzero due to left-hand scroll bars or the menu bar.
1967 The position is given in canonical character cells, where (0, 0) is
1968 the upper-left corner of the frame, X is the horizontal offset, and
1969 Y is the vertical offset, measured in units of the frame's default
1972 This function is a no-op for an X frame that is not visible.
1973 If you have just created a frame, you must wait for it to become visible
1974 before calling this function on it, like this.
1975 (while (not (frame-visible-p frame)) (sleep-for .5)) */)
1976 (Lisp_Object frame
, Lisp_Object x
, Lisp_Object y
)
1978 CHECK_LIVE_FRAME (frame
);
1979 CHECK_TYPE_RANGED_INTEGER (int, x
);
1980 CHECK_TYPE_RANGED_INTEGER (int, y
);
1982 /* I think this should be done with a hook. */
1983 #ifdef HAVE_WINDOW_SYSTEM
1984 if (FRAME_WINDOW_P (XFRAME (frame
)))
1985 /* Warping the mouse will cause enternotify and focus events. */
1986 frame_set_mouse_position (XFRAME (frame
), XINT (x
), XINT (y
));
1989 if (FRAME_MSDOS_P (XFRAME (frame
)))
1991 Fselect_frame (frame
, Qnil
);
1992 mouse_moveto (XINT (x
), XINT (y
));
1997 Fselect_frame (frame
, Qnil
);
1998 term_mouse_moveto (XINT (x
), XINT (y
));
2007 DEFUN ("set-mouse-pixel-position", Fset_mouse_pixel_position
,
2008 Sset_mouse_pixel_position
, 3, 3, 0,
2009 doc
: /* Move the mouse pointer to pixel position (X,Y) in FRAME.
2010 The position is given in pixels, where (0, 0) is the upper-left corner
2011 of the frame, X is the horizontal offset, and Y is the vertical offset.
2013 Note, this is a no-op for an X frame that is not visible.
2014 If you have just created a frame, you must wait for it to become visible
2015 before calling this function on it, like this.
2016 (while (not (frame-visible-p frame)) (sleep-for .5)) */)
2017 (Lisp_Object frame
, Lisp_Object x
, Lisp_Object y
)
2019 CHECK_LIVE_FRAME (frame
);
2020 CHECK_TYPE_RANGED_INTEGER (int, x
);
2021 CHECK_TYPE_RANGED_INTEGER (int, y
);
2023 /* I think this should be done with a hook. */
2024 #ifdef HAVE_WINDOW_SYSTEM
2025 if (FRAME_WINDOW_P (XFRAME (frame
)))
2026 /* Warping the mouse will cause enternotify and focus events. */
2027 frame_set_mouse_pixel_position (XFRAME (frame
), XINT (x
), XINT (y
));
2030 if (FRAME_MSDOS_P (XFRAME (frame
)))
2032 Fselect_frame (frame
, Qnil
);
2033 mouse_moveto (XINT (x
), XINT (y
));
2038 Fselect_frame (frame
, Qnil
);
2039 term_mouse_moveto (XINT (x
), XINT (y
));
2048 static void make_frame_visible_1 (Lisp_Object
);
2050 DEFUN ("make-frame-visible", Fmake_frame_visible
, Smake_frame_visible
,
2052 doc
: /* Make the frame FRAME visible (assuming it is an X window).
2053 If omitted, FRAME defaults to the currently selected frame. */)
2056 struct frame
*f
= decode_live_frame (frame
);
2058 /* I think this should be done with a hook. */
2059 #ifdef HAVE_WINDOW_SYSTEM
2060 if (FRAME_WINDOW_P (f
))
2061 x_make_frame_visible (f
);
2064 make_frame_visible_1 (f
->root_window
);
2066 /* Make menu bar update for the Buffers and Frames menus. */
2067 /* windows_or_buffers_changed = 15; FIXME: Why? */
2069 XSETFRAME (frame
, f
);
2073 /* Update the display_time slot of the buffers shown in WINDOW
2074 and all its descendants. */
2077 make_frame_visible_1 (Lisp_Object window
)
2081 for (; !NILP (window
); window
= w
->next
)
2083 w
= XWINDOW (window
);
2084 if (WINDOWP (w
->contents
))
2085 make_frame_visible_1 (w
->contents
);
2087 bset_display_time (XBUFFER (w
->contents
), Fcurrent_time ());
2091 DEFUN ("make-frame-invisible", Fmake_frame_invisible
, Smake_frame_invisible
,
2093 doc
: /* Make the frame FRAME invisible.
2094 If omitted, FRAME defaults to the currently selected frame.
2095 On graphical displays, invisible frames are not updated and are
2096 usually not displayed at all, even in a window system's \"taskbar\".
2098 Normally you may not make FRAME invisible if all other frames are invisible,
2099 but if the second optional argument FORCE is non-nil, you may do so.
2101 This function has no effect on text terminal frames. Such frames are
2102 always considered visible, whether or not they are currently being
2103 displayed in the terminal. */)
2104 (Lisp_Object frame
, Lisp_Object force
)
2106 struct frame
*f
= decode_live_frame (frame
);
2108 if (NILP (force
) && !other_visible_frames (f
))
2109 error ("Attempt to make invisible the sole visible or iconified frame");
2111 /* Don't allow minibuf_window to remain on an invisible frame. */
2112 check_minibuf_window (frame
, EQ (minibuf_window
, selected_window
));
2114 /* I think this should be done with a hook. */
2115 #ifdef HAVE_WINDOW_SYSTEM
2116 if (FRAME_WINDOW_P (f
))
2117 x_make_frame_invisible (f
);
2120 /* Make menu bar update for the Buffers and Frames menus. */
2121 windows_or_buffers_changed
= 16;
2126 DEFUN ("iconify-frame", Ficonify_frame
, Siconify_frame
,
2128 doc
: /* Make the frame FRAME into an icon.
2129 If omitted, FRAME defaults to the currently selected frame. */)
2132 struct frame
*f
= decode_live_frame (frame
);
2134 /* Don't allow minibuf_window to remain on an iconified frame. */
2135 check_minibuf_window (frame
, EQ (minibuf_window
, selected_window
));
2137 /* I think this should be done with a hook. */
2138 #ifdef HAVE_WINDOW_SYSTEM
2139 if (FRAME_WINDOW_P (f
))
2140 x_iconify_frame (f
);
2143 /* Make menu bar update for the Buffers and Frames menus. */
2144 windows_or_buffers_changed
= 17;
2149 DEFUN ("frame-visible-p", Fframe_visible_p
, Sframe_visible_p
,
2151 doc
: /* Return t if FRAME is \"visible\" (actually in use for display).
2152 Return the symbol `icon' if FRAME is iconified or \"minimized\".
2153 Return nil if FRAME was made invisible, via `make-frame-invisible'.
2154 On graphical displays, invisible frames are not updated and are
2155 usually not displayed at all, even in a window system's \"taskbar\".
2157 If FRAME is a text terminal frame, this always returns t.
2158 Such frames are always considered visible, whether or not they are
2159 currently being displayed on the terminal. */)
2162 CHECK_LIVE_FRAME (frame
);
2164 if (FRAME_VISIBLE_P (XFRAME (frame
)))
2166 if (FRAME_ICONIFIED_P (XFRAME (frame
)))
2171 DEFUN ("visible-frame-list", Fvisible_frame_list
, Svisible_frame_list
,
2173 doc
: /* Return a list of all frames now \"visible\" (being updated). */)
2176 Lisp_Object tail
, frame
, value
= Qnil
;
2178 FOR_EACH_FRAME (tail
, frame
)
2179 if (FRAME_VISIBLE_P (XFRAME (frame
)))
2180 value
= Fcons (frame
, value
);
2186 DEFUN ("raise-frame", Fraise_frame
, Sraise_frame
, 0, 1, "",
2187 doc
: /* Bring FRAME to the front, so it occludes any frames it overlaps.
2188 If FRAME is invisible or iconified, make it visible.
2189 If you don't specify a frame, the selected frame is used.
2190 If Emacs is displaying on an ordinary terminal or some other device which
2191 doesn't support multiple overlapping frames, this function selects FRAME. */)
2194 struct frame
*f
= decode_live_frame (frame
);
2196 XSETFRAME (frame
, f
);
2198 if (FRAME_TERMCAP_P (f
))
2199 /* On a text terminal select FRAME. */
2200 Fselect_frame (frame
, Qnil
);
2202 /* Do like the documentation says. */
2203 Fmake_frame_visible (frame
);
2205 if (FRAME_TERMINAL (f
)->frame_raise_lower_hook
)
2206 (*FRAME_TERMINAL (f
)->frame_raise_lower_hook
) (f
, 1);
2211 /* Should we have a corresponding function called Flower_Power? */
2212 DEFUN ("lower-frame", Flower_frame
, Slower_frame
, 0, 1, "",
2213 doc
: /* Send FRAME to the back, so it is occluded by any frames that overlap it.
2214 If you don't specify a frame, the selected frame is used.
2215 If Emacs is displaying on an ordinary terminal or some other device which
2216 doesn't support multiple overlapping frames, this function does nothing. */)
2219 struct frame
*f
= decode_live_frame (frame
);
2221 if (FRAME_TERMINAL (f
)->frame_raise_lower_hook
)
2222 (*FRAME_TERMINAL (f
)->frame_raise_lower_hook
) (f
, 0);
2228 DEFUN ("redirect-frame-focus", Fredirect_frame_focus
, Sredirect_frame_focus
,
2230 doc
: /* Arrange for keystrokes typed at FRAME to be sent to FOCUS-FRAME.
2231 In other words, switch-frame events caused by events in FRAME will
2232 request a switch to FOCUS-FRAME, and `last-event-frame' will be
2233 FOCUS-FRAME after reading an event typed at FRAME.
2235 If FOCUS-FRAME is nil, any existing redirection is canceled, and the
2236 frame again receives its own keystrokes.
2238 Focus redirection is useful for temporarily redirecting keystrokes to
2239 a surrogate minibuffer frame when a frame doesn't have its own
2242 A frame's focus redirection can be changed by `select-frame'. If frame
2243 FOO is selected, and then a different frame BAR is selected, any
2244 frames redirecting their focus to FOO are shifted to redirect their
2245 focus to BAR. This allows focus redirection to work properly when the
2246 user switches from one frame to another using `select-window'.
2248 This means that a frame whose focus is redirected to itself is treated
2249 differently from a frame whose focus is redirected to nil; the former
2250 is affected by `select-frame', while the latter is not.
2252 The redirection lasts until `redirect-frame-focus' is called to change it. */)
2253 (Lisp_Object frame
, Lisp_Object focus_frame
)
2255 /* Note that we don't check for a live frame here. It's reasonable
2256 to redirect the focus of a frame you're about to delete, if you
2257 know what other frame should receive those keystrokes. */
2258 struct frame
*f
= decode_any_frame (frame
);
2260 if (! NILP (focus_frame
))
2261 CHECK_LIVE_FRAME (focus_frame
);
2263 fset_focus_frame (f
, focus_frame
);
2265 if (FRAME_TERMINAL (f
)->frame_rehighlight_hook
)
2266 (*FRAME_TERMINAL (f
)->frame_rehighlight_hook
) (f
);
2272 DEFUN ("frame-focus", Fframe_focus
, Sframe_focus
, 0, 1, 0,
2273 doc
: /* Return the frame to which FRAME's keystrokes are currently being sent.
2274 If FRAME is omitted or nil, the selected frame is used.
2275 Return nil if FRAME's focus is not redirected.
2276 See `redirect-frame-focus'. */)
2279 return FRAME_FOCUS_FRAME (decode_live_frame (frame
));
2282 DEFUN ("x-focus-frame", Fx_focus_frame
, Sx_focus_frame
, 1, 1, 0,
2283 doc
: /* Set the input focus to FRAME.
2284 FRAME nil means use the selected frame.
2285 If there is no window system support, this function does nothing. */)
2288 #ifdef HAVE_WINDOW_SYSTEM
2289 x_focus_frame (decode_window_system_frame (frame
));
2294 DEFUN ("frame-after-make-frame",
2295 Fframe_after_make_frame
,
2296 Sframe_after_make_frame
, 2, 2, 0,
2297 doc
: /* Mark FRAME as made.
2298 FRAME nil means use the selected frame. Second argument MADE non-nil
2299 means functions on `window-configuration-change-hook' are called
2300 whenever the window configuration of FRAME changes. MADE nil means
2301 these functions are not called.
2303 This function is currently called by `make-frame' only and should be
2304 otherwise used with utter care to avoid that running functions on
2305 `window-configuration-change-hook' is impeded forever. */)
2306 (Lisp_Object frame
, Lisp_Object made
)
2308 struct frame
*f
= decode_live_frame (frame
);
2309 f
->after_make_frame
= !NILP (made
);
2310 f
->inhibit_horizontal_resize
= false;
2311 f
->inhibit_vertical_resize
= false;
2316 /* Discard BUFFER from the buffer-list and buried-buffer-list of each frame. */
2319 frames_discard_buffer (Lisp_Object buffer
)
2321 Lisp_Object frame
, tail
;
2323 FOR_EACH_FRAME (tail
, frame
)
2326 (XFRAME (frame
), Fdelq (buffer
, XFRAME (frame
)->buffer_list
));
2327 fset_buried_buffer_list
2328 (XFRAME (frame
), Fdelq (buffer
, XFRAME (frame
)->buried_buffer_list
));
2332 /* Modify the alist in *ALISTPTR to associate PROP with VAL.
2333 If the alist already has an element for PROP, we change it. */
2336 store_in_alist (Lisp_Object
*alistptr
, Lisp_Object prop
, Lisp_Object val
)
2338 register Lisp_Object tem
;
2340 tem
= Fassq (prop
, *alistptr
);
2342 *alistptr
= Fcons (Fcons (prop
, val
), *alistptr
);
2348 frame_name_fnn_p (char *str
, ptrdiff_t len
)
2350 if (len
> 1 && str
[0] == 'F' && '0' <= str
[1] && str
[1] <= '9')
2353 while ('0' <= *p
&& *p
<= '9')
2361 /* Set the name of the terminal frame. Also used by MSDOS frames.
2362 Modeled after x_set_name which is used for WINDOW frames. */
2365 set_term_frame_name (struct frame
*f
, Lisp_Object name
)
2367 f
->explicit_name
= ! NILP (name
);
2369 /* If NAME is nil, set the name to F<num>. */
2372 char namebuf
[sizeof "F" + INT_STRLEN_BOUND (printmax_t
)];
2374 /* Check for no change needed in this very common case
2375 before we do any consing. */
2376 if (frame_name_fnn_p (SSDATA (f
->name
), SBYTES (f
->name
)))
2379 name
= make_formatted_string (namebuf
, "F%"pMd
, ++tty_frame_count
);
2383 CHECK_STRING (name
);
2385 /* Don't change the name if it's already NAME. */
2386 if (! NILP (Fstring_equal (name
, f
->name
)))
2389 /* Don't allow the user to set the frame name to F<num>, so it
2390 doesn't clash with the names we generate for terminal frames. */
2391 if (frame_name_fnn_p (SSDATA (name
), SBYTES (name
)))
2392 error ("Frame names of the form F<num> are usurped by Emacs");
2395 fset_name (f
, name
);
2396 update_mode_lines
= 16;
2400 store_frame_param (struct frame
*f
, Lisp_Object prop
, Lisp_Object val
)
2402 register Lisp_Object old_alist_elt
;
2404 /* The buffer-list parameters are stored in a special place and not
2405 in the alist. All buffers must be live. */
2406 if (EQ (prop
, Qbuffer_list
))
2408 Lisp_Object list
= Qnil
;
2409 for (; CONSP (val
); val
= XCDR (val
))
2410 if (!NILP (Fbuffer_live_p (XCAR (val
))))
2411 list
= Fcons (XCAR (val
), list
);
2412 fset_buffer_list (f
, Fnreverse (list
));
2415 if (EQ (prop
, Qburied_buffer_list
))
2417 Lisp_Object list
= Qnil
;
2418 for (; CONSP (val
); val
= XCDR (val
))
2419 if (!NILP (Fbuffer_live_p (XCAR (val
))))
2420 list
= Fcons (XCAR (val
), list
);
2421 fset_buried_buffer_list (f
, Fnreverse (list
));
2425 /* If PROP is a symbol which is supposed to have frame-local values,
2426 and it is set up based on this frame, switch to the global
2427 binding. That way, we can create or alter the frame-local binding
2428 without messing up the symbol's status. */
2431 struct Lisp_Symbol
*sym
= XSYMBOL (prop
);
2433 switch (sym
->redirect
)
2435 case SYMBOL_VARALIAS
: sym
= indirect_variable (sym
); goto start
;
2436 case SYMBOL_PLAINVAL
: case SYMBOL_FORWARDED
: break;
2437 case SYMBOL_LOCALIZED
:
2438 { struct Lisp_Buffer_Local_Value
*blv
= sym
->val
.blv
;
2439 if (blv
->frame_local
&& blv_found (blv
) && XFRAME (blv
->where
) == f
)
2440 swap_in_global_binding (sym
);
2443 default: emacs_abort ();
2447 /* The tty color needed to be set before the frame's parameter
2448 alist was updated with the new value. This is not true any more,
2449 but we still do this test early on. */
2450 if (FRAME_TERMCAP_P (f
) && EQ (prop
, Qtty_color_mode
)
2451 && f
== FRAME_TTY (f
)->previous_frame
)
2452 /* Force redisplay of this tty. */
2453 FRAME_TTY (f
)->previous_frame
= NULL
;
2455 /* Update the frame parameter alist. */
2456 old_alist_elt
= Fassq (prop
, f
->param_alist
);
2457 if (EQ (old_alist_elt
, Qnil
))
2458 fset_param_alist (f
, Fcons (Fcons (prop
, val
), f
->param_alist
));
2460 Fsetcdr (old_alist_elt
, val
);
2462 /* Update some other special parameters in their special places
2463 in addition to the alist. */
2465 if (EQ (prop
, Qbuffer_predicate
))
2466 fset_buffer_predicate (f
, val
);
2468 if (! FRAME_WINDOW_P (f
))
2470 if (EQ (prop
, Qmenu_bar_lines
))
2471 set_menu_bar_lines (f
, val
, make_number (FRAME_MENU_BAR_LINES (f
)));
2472 else if (EQ (prop
, Qname
))
2473 set_term_frame_name (f
, val
);
2476 if (EQ (prop
, Qminibuffer
) && WINDOWP (val
))
2478 if (! MINI_WINDOW_P (XWINDOW (val
)))
2479 error ("Surrogate minibuffer windows must be minibuffer windows");
2481 if ((FRAME_HAS_MINIBUF_P (f
) || FRAME_MINIBUF_ONLY_P (f
))
2482 && !EQ (val
, f
->minibuffer_window
))
2483 error ("Can't change the surrogate minibuffer of a frame with its own minibuffer");
2485 /* Install the chosen minibuffer window, with proper buffer. */
2486 fset_minibuffer_window (f
, val
);
2490 /* Return color matches UNSPEC on frame F or nil if UNSPEC
2491 is not an unspecified foreground or background color. */
2494 frame_unspecified_color (struct frame
*f
, Lisp_Object unspec
)
2496 return (!strncmp (SSDATA (unspec
), unspecified_bg
, SBYTES (unspec
))
2497 ? tty_color_name (f
, FRAME_BACKGROUND_PIXEL (f
))
2498 : (!strncmp (SSDATA (unspec
), unspecified_fg
, SBYTES (unspec
))
2499 ? tty_color_name (f
, FRAME_FOREGROUND_PIXEL (f
)) : Qnil
));
2502 DEFUN ("frame-parameters", Fframe_parameters
, Sframe_parameters
, 0, 1, 0,
2503 doc
: /* Return the parameters-alist of frame FRAME.
2504 It is a list of elements of the form (PARM . VALUE), where PARM is a symbol.
2505 The meaningful PARMs depend on the kind of frame.
2506 If FRAME is omitted or nil, return information on the currently selected frame. */)
2510 struct frame
*f
= decode_any_frame (frame
);
2513 if (!FRAME_LIVE_P (f
))
2516 alist
= Fcopy_alist (f
->param_alist
);
2518 if (!FRAME_WINDOW_P (f
))
2522 /* If the frame's parameter alist says the colors are
2523 unspecified and reversed, take the frame's background pixel
2524 for foreground and vice versa. */
2525 elt
= Fassq (Qforeground_color
, alist
);
2526 if (CONSP (elt
) && STRINGP (XCDR (elt
)))
2528 elt
= frame_unspecified_color (f
, XCDR (elt
));
2530 store_in_alist (&alist
, Qforeground_color
, elt
);
2533 store_in_alist (&alist
, Qforeground_color
,
2534 tty_color_name (f
, FRAME_FOREGROUND_PIXEL (f
)));
2535 elt
= Fassq (Qbackground_color
, alist
);
2536 if (CONSP (elt
) && STRINGP (XCDR (elt
)))
2538 elt
= frame_unspecified_color (f
, XCDR (elt
));
2540 store_in_alist (&alist
, Qbackground_color
, elt
);
2543 store_in_alist (&alist
, Qbackground_color
,
2544 tty_color_name (f
, FRAME_BACKGROUND_PIXEL (f
)));
2545 store_in_alist (&alist
, Qfont
,
2546 build_string (FRAME_MSDOS_P (f
)
2548 : FRAME_W32_P (f
) ? "w32term"
2551 store_in_alist (&alist
, Qname
, f
->name
);
2552 height
= (f
->new_height
2554 ? (f
->new_height
/ FRAME_LINE_HEIGHT (f
))
2557 store_in_alist (&alist
, Qheight
, make_number (height
));
2558 width
= (f
->new_width
2560 ? (f
->new_width
/ FRAME_COLUMN_WIDTH (f
))
2563 store_in_alist (&alist
, Qwidth
, make_number (width
));
2564 store_in_alist (&alist
, Qmodeline
, (FRAME_WANTS_MODELINE_P (f
) ? Qt
: Qnil
));
2565 store_in_alist (&alist
, Qminibuffer
,
2566 (! FRAME_HAS_MINIBUF_P (f
) ? Qnil
2567 : FRAME_MINIBUF_ONLY_P (f
) ? Qonly
2568 : FRAME_MINIBUF_WINDOW (f
)));
2569 store_in_alist (&alist
, Qunsplittable
, (FRAME_NO_SPLIT_P (f
) ? Qt
: Qnil
));
2570 store_in_alist (&alist
, Qbuffer_list
, f
->buffer_list
);
2571 store_in_alist (&alist
, Qburied_buffer_list
, f
->buried_buffer_list
);
2573 /* I think this should be done with a hook. */
2574 #ifdef HAVE_WINDOW_SYSTEM
2575 if (FRAME_WINDOW_P (f
))
2576 x_report_frame_params (f
, &alist
);
2580 /* This ought to be correct in f->param_alist for an X frame. */
2582 XSETFASTINT (lines
, FRAME_MENU_BAR_LINES (f
));
2583 store_in_alist (&alist
, Qmenu_bar_lines
, lines
);
2590 DEFUN ("frame-parameter", Fframe_parameter
, Sframe_parameter
, 2, 2, 0,
2591 doc
: /* Return FRAME's value for parameter PARAMETER.
2592 If FRAME is nil, describe the currently selected frame. */)
2593 (Lisp_Object frame
, Lisp_Object parameter
)
2595 struct frame
*f
= decode_any_frame (frame
);
2596 Lisp_Object value
= Qnil
;
2598 CHECK_SYMBOL (parameter
);
2600 XSETFRAME (frame
, f
);
2602 if (FRAME_LIVE_P (f
))
2604 /* Avoid consing in frequent cases. */
2605 if (EQ (parameter
, Qname
))
2607 #ifdef HAVE_X_WINDOWS
2608 else if (EQ (parameter
, Qdisplay
) && FRAME_X_P (f
))
2609 value
= XCAR (FRAME_DISPLAY_INFO (f
)->name_list_element
);
2610 #endif /* HAVE_X_WINDOWS */
2611 else if (EQ (parameter
, Qbackground_color
)
2612 || EQ (parameter
, Qforeground_color
))
2614 value
= Fassq (parameter
, f
->param_alist
);
2617 value
= XCDR (value
);
2618 /* Fframe_parameters puts the actual fg/bg color names,
2619 even if f->param_alist says otherwise. This is
2620 important when param_alist's notion of colors is
2621 "unspecified". We need to do the same here. */
2622 if (STRINGP (value
) && !FRAME_WINDOW_P (f
))
2624 Lisp_Object tem
= frame_unspecified_color (f
, value
);
2631 value
= Fcdr (Fassq (parameter
, Fframe_parameters (frame
)));
2633 else if (EQ (parameter
, Qdisplay_type
)
2634 || EQ (parameter
, Qbackground_mode
))
2635 value
= Fcdr (Fassq (parameter
, f
->param_alist
));
2637 /* FIXME: Avoid this code path at all (as well as code duplication)
2638 by sharing more code with Fframe_parameters. */
2639 value
= Fcdr (Fassq (parameter
, Fframe_parameters (frame
)));
2646 DEFUN ("modify-frame-parameters", Fmodify_frame_parameters
,
2647 Smodify_frame_parameters
, 2, 2, 0,
2648 doc
: /* Modify FRAME according to new values of its parameters in ALIST.
2649 If FRAME is nil, it defaults to the selected frame.
2650 ALIST is an alist of parameters to change and their new values.
2651 Each element of ALIST has the form (PARM . VALUE), where PARM is a symbol.
2652 Which PARMs are meaningful depends on the kind of frame.
2653 The meaningful parameters are acted upon, i.e. the frame is changed
2654 according to their new values, and are also stored in the frame's
2655 parameter list so that `frame-parameters' will return them.
2656 PARMs that are not meaningful are still stored in the frame's parameter
2657 list, but are otherwise ignored.
2659 The value of frame parameter FOO can also be accessed
2660 as a frame-local binding for the variable FOO, if you have
2661 enabled such bindings for that variable with `make-variable-frame-local'.
2662 Note that this functionality is obsolete as of Emacs 22.2, and its
2663 use is not recommended. Explicitly check for a frame-parameter instead. */)
2664 (Lisp_Object frame
, Lisp_Object alist
)
2666 struct frame
*f
= decode_live_frame (frame
);
2667 register Lisp_Object prop
, val
;
2671 /* I think this should be done with a hook. */
2672 #ifdef HAVE_WINDOW_SYSTEM
2673 if (FRAME_WINDOW_P (f
))
2674 x_set_frame_parameters (f
, alist
);
2678 if (FRAME_MSDOS_P (f
))
2679 IT_set_frame_parameters (f
, alist
);
2684 EMACS_INT length
= XFASTINT (Flength (alist
));
2687 Lisp_Object
*values
;
2689 SAFE_ALLOCA_LISP (parms
, 2 * length
);
2690 values
= parms
+ length
;
2692 /* Extract parm names and values into those vectors. */
2694 for (i
= 0; CONSP (alist
); alist
= XCDR (alist
))
2699 parms
[i
] = Fcar (elt
);
2700 values
[i
] = Fcdr (elt
);
2704 /* Now process them in reverse of specified order. */
2709 store_frame_param (f
, prop
, val
);
2711 if (EQ (prop
, Qforeground_color
)
2712 || EQ (prop
, Qbackground_color
))
2713 update_face_from_frame_parameter (f
, prop
, val
);
2721 DEFUN ("frame-char-height", Fframe_char_height
, Sframe_char_height
,
2723 doc
: /* Height in pixels of a line in the font in frame FRAME.
2724 If FRAME is omitted or nil, the selected frame is used.
2725 For a terminal frame, the value is always 1. */)
2728 #ifdef HAVE_WINDOW_SYSTEM
2729 struct frame
*f
= decode_any_frame (frame
);
2731 if (FRAME_WINDOW_P (f
))
2732 return make_number (FRAME_LINE_HEIGHT (f
));
2735 return make_number (1);
2739 DEFUN ("frame-char-width", Fframe_char_width
, Sframe_char_width
,
2741 doc
: /* Width in pixels of characters in the font in frame FRAME.
2742 If FRAME is omitted or nil, the selected frame is used.
2743 On a graphical screen, the width is the standard width of the default font.
2744 For a terminal screen, the value is always 1. */)
2747 #ifdef HAVE_WINDOW_SYSTEM
2748 struct frame
*f
= decode_any_frame (frame
);
2750 if (FRAME_WINDOW_P (f
))
2751 return make_number (FRAME_COLUMN_WIDTH (f
));
2754 return make_number (1);
2757 DEFUN ("frame-pixel-height", Fframe_pixel_height
,
2758 Sframe_pixel_height
, 0, 1, 0,
2759 doc
: /* Return a FRAME's height in pixels.
2760 If FRAME is omitted or nil, the selected frame is used. The exact value
2761 of the result depends on the window-system and toolkit in use:
2763 In the Gtk+ version of Emacs, it includes only any window (including
2764 the minibuffer or echo area), mode line, and header line. It does not
2765 include the tool bar or menu bar.
2767 With other graphical versions, it also includes the tool bar and the
2770 For a text terminal, it includes the menu bar. In this case, the
2771 result is really in characters rather than pixels (i.e., is identical
2772 to `frame-height'). */)
2775 struct frame
*f
= decode_any_frame (frame
);
2777 #ifdef HAVE_WINDOW_SYSTEM
2778 if (FRAME_WINDOW_P (f
))
2779 return make_number (FRAME_PIXEL_HEIGHT (f
));
2782 return make_number (FRAME_TOTAL_LINES (f
));
2785 DEFUN ("frame-pixel-width", Fframe_pixel_width
,
2786 Sframe_pixel_width
, 0, 1, 0,
2787 doc
: /* Return FRAME's width in pixels.
2788 For a terminal frame, the result really gives the width in characters.
2789 If FRAME is omitted or nil, the selected frame is used. */)
2792 struct frame
*f
= decode_any_frame (frame
);
2794 #ifdef HAVE_WINDOW_SYSTEM
2795 if (FRAME_WINDOW_P (f
))
2796 return make_number (FRAME_PIXEL_WIDTH (f
));
2799 return make_number (FRAME_TOTAL_COLS (f
));
2802 DEFUN ("tool-bar-pixel-width", Ftool_bar_pixel_width
,
2803 Stool_bar_pixel_width
, 0, 1, 0,
2804 doc
: /* Return width in pixels of FRAME's tool bar.
2805 The result is greater than zero only when the tool bar is on the left
2806 or right side of FRAME. If FRAME is omitted or nil, the selected frame
2810 #ifdef FRAME_TOOLBAR_WIDTH
2811 struct frame
*f
= decode_any_frame (frame
);
2813 if (FRAME_WINDOW_P (f
))
2814 return make_number (FRAME_TOOLBAR_WIDTH (f
));
2816 return make_number (0);
2819 DEFUN ("frame-text-cols", Fframe_text_cols
, Sframe_text_cols
, 0, 1, 0,
2820 doc
: /* Return width in columns of FRAME's text area. */)
2823 return make_number (FRAME_COLS (decode_any_frame (frame
)));
2826 DEFUN ("frame-text-lines", Fframe_text_lines
, Sframe_text_lines
, 0, 1, 0,
2827 doc
: /* Return height in lines of FRAME's text area. */)
2830 return make_number (FRAME_LINES (decode_any_frame (frame
)));
2833 DEFUN ("frame-total-cols", Fframe_total_cols
, Sframe_total_cols
, 0, 1, 0,
2834 doc
: /* Return number of total columns of FRAME. */)
2837 return make_number (FRAME_TOTAL_COLS (decode_any_frame (frame
)));
2840 DEFUN ("frame-total-lines", Fframe_total_lines
, Sframe_total_lines
, 0, 1, 0,
2841 doc
: /* Return number of total lines of FRAME. */)
2844 return make_number (FRAME_TOTAL_LINES (decode_any_frame (frame
)));
2847 DEFUN ("frame-text-width", Fframe_text_width
, Sframe_text_width
, 0, 1, 0,
2848 doc
: /* Return text area width of FRAME in pixels. */)
2851 return make_number (FRAME_TEXT_WIDTH (decode_any_frame (frame
)));
2854 DEFUN ("frame-text-height", Fframe_text_height
, Sframe_text_height
, 0, 1, 0,
2855 doc
: /* Return text area height of FRAME in pixels. */)
2858 return make_number (FRAME_TEXT_HEIGHT (decode_any_frame (frame
)));
2861 DEFUN ("frame-scroll-bar-width", Fscroll_bar_width
, Sscroll_bar_width
, 0, 1, 0,
2862 doc
: /* Return scroll bar width of FRAME in pixels. */)
2865 return make_number (FRAME_SCROLL_BAR_AREA_WIDTH (decode_any_frame (frame
)));
2868 DEFUN ("frame-scroll-bar-height", Fscroll_bar_height
, Sscroll_bar_height
, 0, 1, 0,
2869 doc
: /* Return scroll bar height of FRAME in pixels. */)
2872 return make_number (FRAME_SCROLL_BAR_AREA_HEIGHT (decode_any_frame (frame
)));
2875 DEFUN ("frame-fringe-width", Ffringe_width
, Sfringe_width
, 0, 1, 0,
2876 doc
: /* Return fringe width of FRAME in pixels. */)
2879 return make_number (FRAME_TOTAL_FRINGE_WIDTH (decode_any_frame (frame
)));
2882 DEFUN ("frame-border-width", Fborder_width
, Sborder_width
, 0, 1, 0,
2883 doc
: /* Return border width of FRAME in pixels. */)
2886 return make_number (FRAME_INTERNAL_BORDER_WIDTH (decode_any_frame (frame
)));
2889 DEFUN ("frame-right-divider-width", Fright_divider_width
, Sright_divider_width
, 0, 1, 0,
2890 doc
: /* Return width (in pixels) of vertical window dividers on FRAME. */)
2893 return make_number (FRAME_RIGHT_DIVIDER_WIDTH (decode_any_frame (frame
)));
2896 DEFUN ("frame-bottom-divider-width", Fbottom_divider_width
, Sbottom_divider_width
, 0, 1, 0,
2897 doc
: /* Return width (in pixels) of horizontal window dividers on FRAME. */)
2900 return make_number (FRAME_BOTTOM_DIVIDER_WIDTH (decode_any_frame (frame
)));
2903 DEFUN ("set-frame-height", Fset_frame_height
, Sset_frame_height
, 2, 4, 0,
2904 doc
: /* Set text height of frame FRAME to HEIGHT lines.
2905 Optional third arg PRETEND non-nil means that redisplay should use
2906 HEIGHT lines but that the idea of the actual height of the frame should
2909 Optional fourth argument PIXELWISE non-nil means that FRAME should be
2910 HEIGHT pixels high. Note: When `frame-resize-pixelwise' is nil, some
2911 window managers may refuse to honor a HEIGHT that is not an integer
2912 multiple of the default frame font height. */)
2913 (Lisp_Object frame
, Lisp_Object height
, Lisp_Object pretend
, Lisp_Object pixelwise
)
2915 struct frame
*f
= decode_live_frame (frame
);
2918 CHECK_TYPE_RANGED_INTEGER (int, height
);
2920 pixel_height
= (!NILP (pixelwise
)
2922 : XINT (height
) * FRAME_LINE_HEIGHT (f
));
2923 adjust_frame_size (f
, -1, pixel_height
, 1, !NILP (pretend
), Qheight
);
2928 DEFUN ("set-frame-width", Fset_frame_width
, Sset_frame_width
, 2, 4, 0,
2929 doc
: /* Set text width of frame FRAME to WIDTH columns.
2930 Optional third arg PRETEND non-nil means that redisplay should use WIDTH
2931 columns but that the idea of the actual width of the frame should not
2934 Optional fourth argument PIXELWISE non-nil means that FRAME should be
2935 WIDTH pixels wide. Note: When `frame-resize-pixelwise' is nil, some
2936 window managers may refuse to honor a WIDTH that is not an integer
2937 multiple of the default frame font width. */)
2938 (Lisp_Object frame
, Lisp_Object width
, Lisp_Object pretend
, Lisp_Object pixelwise
)
2940 struct frame
*f
= decode_live_frame (frame
);
2943 CHECK_TYPE_RANGED_INTEGER (int, width
);
2945 pixel_width
= (!NILP (pixelwise
)
2947 : XINT (width
) * FRAME_COLUMN_WIDTH (f
));
2948 adjust_frame_size (f
, pixel_width
, -1, 1, !NILP (pretend
), Qwidth
);
2953 DEFUN ("set-frame-size", Fset_frame_size
, Sset_frame_size
, 3, 4, 0,
2954 doc
: /* Set text size of FRAME to WIDTH by HEIGHT, measured in characters.
2955 Optional argument PIXELWISE non-nil means to measure in pixels. Note:
2956 When `frame-resize-pixelwise' is nil, some window managers may refuse to
2957 honor a WIDTH that is not an integer multiple of the default frame font
2958 width or a HEIGHT that is not an integer multiple of the default frame
2960 (Lisp_Object frame
, Lisp_Object width
, Lisp_Object height
, Lisp_Object pixelwise
)
2962 struct frame
*f
= decode_live_frame (frame
);
2963 int pixel_width
, pixel_height
;
2965 CHECK_TYPE_RANGED_INTEGER (int, width
);
2966 CHECK_TYPE_RANGED_INTEGER (int, height
);
2968 pixel_width
= (!NILP (pixelwise
)
2970 : XINT (width
) * FRAME_COLUMN_WIDTH (f
));
2971 pixel_height
= (!NILP (pixelwise
)
2973 : XINT (height
) * FRAME_LINE_HEIGHT (f
));
2974 adjust_frame_size (f
, pixel_width
, pixel_height
, 1, 0, Qsize
);
2979 DEFUN ("frame-position", Fframe_position
,
2980 Sframe_position
, 0, 1, 0,
2981 doc
: /* Return top left corner of FRAME in pixels.
2982 FRAME must be a live frame and defaults to the selected one. The return
2983 value is a cons (x, y) of the coordinates of the top left corner of
2984 FRAME's outer frame, in pixels relative to an origin (0, 0) of FRAME's
2988 register struct frame
*f
= decode_live_frame (frame
);
2990 return Fcons (make_number (f
->left_pos
), make_number (f
->top_pos
));
2993 DEFUN ("set-frame-position", Fset_frame_position
,
2994 Sset_frame_position
, 3, 3, 0,
2995 doc
: /* Set position of FRAME to (X, Y).
2996 FRAME must be a live frame and defaults to the selected one. X and Y,
2997 if positive, specify the coordinate of the left and top edge of FRAME's
2998 outer frame in pixels relative to an origin (0, 0) of FRAME's display.
2999 If any of X or Y is negative, it specifies the coordinates of the right
3000 or bottom edge of the outer frame of FRAME relative to the right or
3001 bottom edge of FRAME's display. */)
3002 (Lisp_Object frame
, Lisp_Object x
, Lisp_Object y
)
3004 register struct frame
*f
= decode_live_frame (frame
);
3006 CHECK_TYPE_RANGED_INTEGER (int, x
);
3007 CHECK_TYPE_RANGED_INTEGER (int, y
);
3009 /* I think this should be done with a hook. */
3010 #ifdef HAVE_WINDOW_SYSTEM
3011 if (FRAME_WINDOW_P (f
))
3012 x_set_offset (f
, XINT (x
), XINT (y
), 1);
3019 /***********************************************************************
3021 ***********************************************************************/
3023 /* Connect the frame-parameter names for X frames
3024 to the ways of passing the parameter values to the window system.
3026 The name of a parameter, as a Lisp symbol,
3027 has an `x-frame-parameter' property which is an integer in Lisp
3028 that is an index in this table. */
3030 struct frame_parm_table
{
3035 static const struct frame_parm_table frame_parms
[] =
3037 {"auto-raise", SYMBOL_INDEX (Qauto_raise
)},
3038 {"auto-lower", SYMBOL_INDEX (Qauto_lower
)},
3039 {"background-color", -1},
3040 {"border-color", SYMBOL_INDEX (Qborder_color
)},
3041 {"border-width", SYMBOL_INDEX (Qborder_width
)},
3042 {"cursor-color", SYMBOL_INDEX (Qcursor_color
)},
3043 {"cursor-type", SYMBOL_INDEX (Qcursor_type
)},
3045 {"foreground-color", -1},
3046 {"icon-name", SYMBOL_INDEX (Qicon_name
)},
3047 {"icon-type", SYMBOL_INDEX (Qicon_type
)},
3048 {"internal-border-width", SYMBOL_INDEX (Qinternal_border_width
)},
3049 {"right-divider-width", SYMBOL_INDEX (Qright_divider_width
)},
3050 {"bottom-divider-width", SYMBOL_INDEX (Qbottom_divider_width
)},
3051 {"menu-bar-lines", SYMBOL_INDEX (Qmenu_bar_lines
)},
3052 {"mouse-color", SYMBOL_INDEX (Qmouse_color
)},
3053 {"name", SYMBOL_INDEX (Qname
)},
3054 {"scroll-bar-width", SYMBOL_INDEX (Qscroll_bar_width
)},
3055 {"scroll-bar-height", SYMBOL_INDEX (Qscroll_bar_height
)},
3056 {"title", SYMBOL_INDEX (Qtitle
)},
3057 {"unsplittable", SYMBOL_INDEX (Qunsplittable
)},
3058 {"vertical-scroll-bars", SYMBOL_INDEX (Qvertical_scroll_bars
)},
3059 {"horizontal-scroll-bars", SYMBOL_INDEX (Qhorizontal_scroll_bars
)},
3060 {"visibility", SYMBOL_INDEX (Qvisibility
)},
3061 {"tool-bar-lines", SYMBOL_INDEX (Qtool_bar_lines
)},
3062 {"scroll-bar-foreground", SYMBOL_INDEX (Qscroll_bar_foreground
)},
3063 {"scroll-bar-background", SYMBOL_INDEX (Qscroll_bar_background
)},
3064 {"screen-gamma", SYMBOL_INDEX (Qscreen_gamma
)},
3065 {"line-spacing", SYMBOL_INDEX (Qline_spacing
)},
3066 {"left-fringe", SYMBOL_INDEX (Qleft_fringe
)},
3067 {"right-fringe", SYMBOL_INDEX (Qright_fringe
)},
3068 {"wait-for-wm", SYMBOL_INDEX (Qwait_for_wm
)},
3069 {"fullscreen", SYMBOL_INDEX (Qfullscreen
)},
3070 {"font-backend", SYMBOL_INDEX (Qfont_backend
)},
3071 {"alpha", SYMBOL_INDEX (Qalpha
)},
3072 {"sticky", SYMBOL_INDEX (Qsticky
)},
3073 {"tool-bar-position", SYMBOL_INDEX (Qtool_bar_position
)},
3076 #ifdef HAVE_WINDOW_SYSTEM
3078 /* Change the parameters of frame F as specified by ALIST.
3079 If a parameter is not specially recognized, do nothing special;
3080 otherwise call the `x_set_...' function for that parameter.
3081 Except for certain geometry properties, always call store_frame_param
3082 to store the new value in the parameter alist. */
3085 x_set_frame_parameters (struct frame
*f
, Lisp_Object alist
)
3089 /* If both of these parameters are present, it's more efficient to
3090 set them both at once. So we wait until we've looked at the
3091 entire list before we set them. */
3093 bool width_change
= false, height_change
= false;
3096 Lisp_Object left
, top
;
3098 /* Same with these. */
3099 Lisp_Object icon_left
, icon_top
;
3101 /* And with this. */
3102 Lisp_Object fullscreen
;
3103 bool fullscreen_change
= false;
3105 /* Record in these vectors all the parms specified. */
3107 Lisp_Object
*values
;
3109 bool left_no_change
= 0, top_no_change
= 0;
3110 #ifdef HAVE_X_WINDOWS
3111 bool icon_left_no_change
= 0, icon_top_no_change
= 0;
3115 for (tail
= alist
; CONSP (tail
); tail
= XCDR (tail
))
3119 SAFE_ALLOCA_LISP (parms
, 2 * i
);
3122 /* Extract parm names and values into those vectors. */
3125 for (tail
= alist
; CONSP (tail
); tail
= XCDR (tail
))
3130 parms
[i
] = Fcar (elt
);
3131 values
[i
] = Fcdr (elt
);
3134 /* TAIL and ALIST are not used again below here. */
3135 alist
= tail
= Qnil
;
3137 top
= left
= Qunbound
;
3138 icon_left
= icon_top
= Qunbound
;
3140 /* Process foreground_color and background_color before anything else.
3141 They are independent of other properties, but other properties (e.g.,
3142 cursor_color) are dependent upon them. */
3143 /* Process default font as well, since fringe widths depends on it. */
3144 for (p
= 0; p
< i
; p
++)
3146 Lisp_Object prop
, val
;
3150 if (EQ (prop
, Qforeground_color
)
3151 || EQ (prop
, Qbackground_color
)
3152 || EQ (prop
, Qfont
))
3154 register Lisp_Object param_index
, old_value
;
3156 old_value
= get_frame_param (f
, prop
);
3157 if (NILP (Fequal (val
, old_value
)))
3159 store_frame_param (f
, prop
, val
);
3161 param_index
= Fget (prop
, Qx_frame_parameter
);
3162 if (NATNUMP (param_index
)
3163 && XFASTINT (param_index
) < ARRAYELTS (frame_parms
)
3164 && FRAME_RIF (f
)->frame_parm_handlers
[XINT (param_index
)])
3165 (*(FRAME_RIF (f
)->frame_parm_handlers
[XINT (param_index
)])) (f
, val
, old_value
);
3170 /* Now process them in reverse of specified order. */
3173 Lisp_Object prop
, val
;
3178 if (EQ (prop
, Qwidth
))
3180 if (RANGED_INTEGERP (0, val
, INT_MAX
))
3182 width
= XFASTINT (val
) * FRAME_COLUMN_WIDTH (f
) ;
3183 width_change
= true;
3185 else if (CONSP (val
) && EQ (XCAR (val
), Qtext_pixels
)
3186 && RANGED_INTEGERP (0, XCDR (val
), INT_MAX
))
3188 width
= XFASTINT (XCDR (val
));
3189 width_change
= true;
3192 else if (EQ (prop
, Qheight
))
3194 if (RANGED_INTEGERP (0, val
, INT_MAX
))
3196 height
= XFASTINT (val
) * FRAME_LINE_HEIGHT (f
);
3197 height_change
= true;
3199 else if (CONSP (val
) && EQ (XCAR (val
), Qtext_pixels
)
3200 && RANGED_INTEGERP (0, XCDR (val
), INT_MAX
))
3202 height
= XFASTINT (XCDR (val
));
3203 height_change
= true;
3206 else if (EQ (prop
, Qtop
))
3208 else if (EQ (prop
, Qleft
))
3210 else if (EQ (prop
, Qicon_top
))
3212 else if (EQ (prop
, Qicon_left
))
3214 else if (EQ (prop
, Qfullscreen
))
3217 fullscreen_change
= true;
3219 else if (EQ (prop
, Qforeground_color
)
3220 || EQ (prop
, Qbackground_color
)
3221 || EQ (prop
, Qfont
))
3222 /* Processed above. */
3226 register Lisp_Object param_index
, old_value
;
3228 old_value
= get_frame_param (f
, prop
);
3230 store_frame_param (f
, prop
, val
);
3232 param_index
= Fget (prop
, Qx_frame_parameter
);
3233 if (NATNUMP (param_index
)
3234 && XFASTINT (param_index
) < ARRAYELTS (frame_parms
)
3235 && FRAME_RIF (f
)->frame_parm_handlers
[XINT (param_index
)])
3236 (*(FRAME_RIF (f
)->frame_parm_handlers
[XINT (param_index
)])) (f
, val
, old_value
);
3240 /* Don't die if just one of these was set. */
3241 if (EQ (left
, Qunbound
))
3244 if (f
->left_pos
< 0)
3245 left
= list2 (Qplus
, make_number (f
->left_pos
));
3247 XSETINT (left
, f
->left_pos
);
3249 if (EQ (top
, Qunbound
))
3253 top
= list2 (Qplus
, make_number (f
->top_pos
));
3255 XSETINT (top
, f
->top_pos
);
3258 /* If one of the icon positions was not set, preserve or default it. */
3259 if (! TYPE_RANGED_INTEGERP (int, icon_left
))
3261 #ifdef HAVE_X_WINDOWS
3262 icon_left_no_change
= 1;
3264 icon_left
= Fcdr (Fassq (Qicon_left
, f
->param_alist
));
3265 if (NILP (icon_left
))
3266 XSETINT (icon_left
, 0);
3268 if (! TYPE_RANGED_INTEGERP (int, icon_top
))
3270 #ifdef HAVE_X_WINDOWS
3271 icon_top_no_change
= 1;
3273 icon_top
= Fcdr (Fassq (Qicon_top
, f
->param_alist
));
3274 if (NILP (icon_top
))
3275 XSETINT (icon_top
, 0);
3278 /* Don't set these parameters unless they've been explicitly
3279 specified. The window might be mapped or resized while we're in
3280 this function, and we don't want to override that unless the lisp
3281 code has asked for it.
3283 Don't set these parameters unless they actually differ from the
3284 window's current parameters; the window may not actually exist
3289 XSETFRAME (frame
, f
);
3291 if ((width_change
&& width
!= FRAME_TEXT_WIDTH (f
))
3292 || (height_change
&& height
!= FRAME_TEXT_HEIGHT (f
)))
3293 /* We could consider checking f->after_make_frame here, but I
3294 don't have the faintest idea why the following is needed at
3295 all. With the old setting it can get a Heisenbug when
3296 EmacsFrameResize intermittently provokes a delayed
3297 change_frame_size in the middle of adjust_frame_size. */
3298 /** || (f->can_x_set_window_size && (f->new_height || f->new_width))) **/
3299 adjust_frame_size (f
, width_change
? width
: -1,
3300 height_change
? height
: -1, 1, 0, Qx_set_frame_parameters
);
3302 if ((!NILP (left
) || !NILP (top
))
3303 && ! (left_no_change
&& top_no_change
)
3304 && ! (NUMBERP (left
) && XINT (left
) == f
->left_pos
3305 && NUMBERP (top
) && XINT (top
) == f
->top_pos
))
3310 /* Record the signs. */
3311 f
->size_hint_flags
&= ~ (XNegative
| YNegative
);
3312 if (EQ (left
, Qminus
))
3313 f
->size_hint_flags
|= XNegative
;
3314 else if (TYPE_RANGED_INTEGERP (int, left
))
3316 leftpos
= XINT (left
);
3318 f
->size_hint_flags
|= XNegative
;
3320 else if (CONSP (left
) && EQ (XCAR (left
), Qminus
)
3321 && CONSP (XCDR (left
))
3322 && RANGED_INTEGERP (-INT_MAX
, XCAR (XCDR (left
)), INT_MAX
))
3324 leftpos
= - XINT (XCAR (XCDR (left
)));
3325 f
->size_hint_flags
|= XNegative
;
3327 else if (CONSP (left
) && EQ (XCAR (left
), Qplus
)
3328 && CONSP (XCDR (left
))
3329 && TYPE_RANGED_INTEGERP (int, XCAR (XCDR (left
))))
3331 leftpos
= XINT (XCAR (XCDR (left
)));
3334 if (EQ (top
, Qminus
))
3335 f
->size_hint_flags
|= YNegative
;
3336 else if (TYPE_RANGED_INTEGERP (int, top
))
3338 toppos
= XINT (top
);
3340 f
->size_hint_flags
|= YNegative
;
3342 else if (CONSP (top
) && EQ (XCAR (top
), Qminus
)
3343 && CONSP (XCDR (top
))
3344 && RANGED_INTEGERP (-INT_MAX
, XCAR (XCDR (top
)), INT_MAX
))
3346 toppos
= - XINT (XCAR (XCDR (top
)));
3347 f
->size_hint_flags
|= YNegative
;
3349 else if (CONSP (top
) && EQ (XCAR (top
), Qplus
)
3350 && CONSP (XCDR (top
))
3351 && TYPE_RANGED_INTEGERP (int, XCAR (XCDR (top
))))
3353 toppos
= XINT (XCAR (XCDR (top
)));
3357 /* Store the numeric value of the position. */
3358 f
->top_pos
= toppos
;
3359 f
->left_pos
= leftpos
;
3361 f
->win_gravity
= NorthWestGravity
;
3363 /* Actually set that position, and convert to absolute. */
3364 x_set_offset (f
, leftpos
, toppos
, -1);
3367 if (fullscreen_change
)
3369 Lisp_Object old_value
= get_frame_param (f
, Qfullscreen
);
3371 frame_size_history_add
3372 (f
, Qx_set_fullscreen
, 0, 0, list2 (old_value
, fullscreen
));
3374 store_frame_param (f
, Qfullscreen
, fullscreen
);
3375 if (!EQ (fullscreen
, old_value
))
3376 x_set_fullscreen (f
, fullscreen
, old_value
);
3380 #ifdef HAVE_X_WINDOWS
3381 if ((!NILP (icon_left
) || !NILP (icon_top
))
3382 && ! (icon_left_no_change
&& icon_top_no_change
))
3383 x_wm_set_icon_position (f
, XINT (icon_left
), XINT (icon_top
));
3384 #endif /* HAVE_X_WINDOWS */
3391 /* Insert a description of internally-recorded parameters of frame X
3392 into the parameter alist *ALISTPTR that is to be given to the user.
3393 Only parameters that are specific to the X window system
3394 and whose values are not correctly recorded in the frame's
3395 param_alist need to be considered here. */
3398 x_report_frame_params (struct frame
*f
, Lisp_Object
*alistptr
)
3402 char buf
[INT_BUFSIZE_BOUND (w
)];
3404 /* Represent negative positions (off the top or left screen edge)
3405 in a way that Fmodify_frame_parameters will understand correctly. */
3406 XSETINT (tem
, f
->left_pos
);
3407 if (f
->left_pos
>= 0)
3408 store_in_alist (alistptr
, Qleft
, tem
);
3410 store_in_alist (alistptr
, Qleft
, list2 (Qplus
, tem
));
3412 XSETINT (tem
, f
->top_pos
);
3413 if (f
->top_pos
>= 0)
3414 store_in_alist (alistptr
, Qtop
, tem
);
3416 store_in_alist (alistptr
, Qtop
, list2 (Qplus
, tem
));
3418 store_in_alist (alistptr
, Qborder_width
,
3419 make_number (f
->border_width
));
3420 store_in_alist (alistptr
, Qinternal_border_width
,
3421 make_number (FRAME_INTERNAL_BORDER_WIDTH (f
)));
3422 store_in_alist (alistptr
, Qright_divider_width
,
3423 make_number (FRAME_RIGHT_DIVIDER_WIDTH (f
)));
3424 store_in_alist (alistptr
, Qbottom_divider_width
,
3425 make_number (FRAME_BOTTOM_DIVIDER_WIDTH (f
)));
3426 store_in_alist (alistptr
, Qleft_fringe
,
3427 make_number (FRAME_LEFT_FRINGE_WIDTH (f
)));
3428 store_in_alist (alistptr
, Qright_fringe
,
3429 make_number (FRAME_RIGHT_FRINGE_WIDTH (f
)));
3430 store_in_alist (alistptr
, Qscroll_bar_width
,
3431 (! FRAME_HAS_VERTICAL_SCROLL_BARS (f
)
3433 : FRAME_CONFIG_SCROLL_BAR_WIDTH (f
) > 0
3434 ? make_number (FRAME_CONFIG_SCROLL_BAR_WIDTH (f
))
3435 /* nil means "use default width"
3436 for non-toolkit scroll bar.
3437 ruler-mode.el depends on this. */
3439 store_in_alist (alistptr
, Qscroll_bar_height
,
3440 (! FRAME_HAS_HORIZONTAL_SCROLL_BARS (f
)
3442 : FRAME_CONFIG_SCROLL_BAR_HEIGHT (f
) > 0
3443 ? make_number (FRAME_CONFIG_SCROLL_BAR_HEIGHT (f
))
3444 /* nil means "use default height"
3445 for non-toolkit scroll bar. */
3447 /* FRAME_X_WINDOW is not guaranteed to return an integer. E.g., on
3448 MS-Windows it returns a value whose type is HANDLE, which is
3449 actually a pointer. Explicit casting avoids compiler
3451 w
= (uintptr_t) FRAME_X_WINDOW (f
);
3452 store_in_alist (alistptr
, Qwindow_id
,
3453 make_formatted_string (buf
, "%"pMu
, w
));
3454 #ifdef HAVE_X_WINDOWS
3455 #ifdef USE_X_TOOLKIT
3456 /* Tooltip frame may not have this widget. */
3457 if (FRAME_X_OUTPUT (f
)->widget
)
3459 w
= (uintptr_t) FRAME_OUTER_WINDOW (f
);
3460 store_in_alist (alistptr
, Qouter_window_id
,
3461 make_formatted_string (buf
, "%"pMu
, w
));
3463 store_in_alist (alistptr
, Qicon_name
, f
->icon_name
);
3464 store_in_alist (alistptr
, Qvisibility
,
3465 (FRAME_VISIBLE_P (f
) ? Qt
3466 : FRAME_ICONIFIED_P (f
) ? Qicon
: Qnil
));
3467 store_in_alist (alistptr
, Qdisplay
,
3468 XCAR (FRAME_DISPLAY_INFO (f
)->name_list_element
));
3470 if (FRAME_X_OUTPUT (f
)->parent_desc
== FRAME_DISPLAY_INFO (f
)->root_window
)
3473 tem
= make_natnum ((uintptr_t) FRAME_X_OUTPUT (f
)->parent_desc
);
3474 store_in_alist (alistptr
, Qexplicit_name
, (f
->explicit_name
? Qt
: Qnil
));
3475 store_in_alist (alistptr
, Qparent_id
, tem
);
3476 store_in_alist (alistptr
, Qtool_bar_position
, FRAME_TOOL_BAR_POSITION (f
));
3480 /* Change the `fullscreen' frame parameter of frame F. OLD_VALUE is
3481 the previous value of that parameter, NEW_VALUE is the new value. */
3484 x_set_fullscreen (struct frame
*f
, Lisp_Object new_value
, Lisp_Object old_value
)
3486 if (NILP (new_value
))
3487 f
->want_fullscreen
= FULLSCREEN_NONE
;
3488 else if (EQ (new_value
, Qfullboth
) || EQ (new_value
, Qfullscreen
))
3489 f
->want_fullscreen
= FULLSCREEN_BOTH
;
3490 else if (EQ (new_value
, Qfullwidth
))
3491 f
->want_fullscreen
= FULLSCREEN_WIDTH
;
3492 else if (EQ (new_value
, Qfullheight
))
3493 f
->want_fullscreen
= FULLSCREEN_HEIGHT
;
3494 else if (EQ (new_value
, Qmaximized
))
3495 f
->want_fullscreen
= FULLSCREEN_MAXIMIZED
;
3497 if (FRAME_TERMINAL (f
)->fullscreen_hook
!= NULL
)
3498 FRAME_TERMINAL (f
)->fullscreen_hook (f
);
3502 /* Change the `line-spacing' frame parameter of frame F. OLD_VALUE is
3503 the previous value of that parameter, NEW_VALUE is the new value. */
3506 x_set_line_spacing (struct frame
*f
, Lisp_Object new_value
, Lisp_Object old_value
)
3508 if (NILP (new_value
))
3509 f
->extra_line_spacing
= 0;
3510 else if (RANGED_INTEGERP (0, new_value
, INT_MAX
))
3511 f
->extra_line_spacing
= XFASTINT (new_value
);
3512 else if (FLOATP (new_value
))
3514 int new_spacing
= XFLOAT_DATA (new_value
) * FRAME_LINE_HEIGHT (f
) + 0.5;
3516 if (new_spacing
>= 0)
3517 f
->extra_line_spacing
= new_spacing
;
3519 signal_error ("Invalid line-spacing", new_value
);
3522 signal_error ("Invalid line-spacing", new_value
);
3523 if (FRAME_VISIBLE_P (f
))
3528 /* Change the `screen-gamma' frame parameter of frame F. OLD_VALUE is
3529 the previous value of that parameter, NEW_VALUE is the new value. */
3532 x_set_screen_gamma (struct frame
*f
, Lisp_Object new_value
, Lisp_Object old_value
)
3534 Lisp_Object bgcolor
;
3536 if (NILP (new_value
))
3538 else if (NUMBERP (new_value
) && XFLOATINT (new_value
) > 0)
3539 /* The value 0.4545 is the normal viewing gamma. */
3540 f
->gamma
= 1.0 / (0.4545 * XFLOATINT (new_value
));
3542 signal_error ("Invalid screen-gamma", new_value
);
3544 /* Apply the new gamma value to the frame background. */
3545 bgcolor
= Fassq (Qbackground_color
, f
->param_alist
);
3546 if (CONSP (bgcolor
) && (bgcolor
= XCDR (bgcolor
), STRINGP (bgcolor
)))
3548 Lisp_Object parm_index
= Fget (Qbackground_color
, Qx_frame_parameter
);
3549 if (NATNUMP (parm_index
)
3550 && XFASTINT (parm_index
) < ARRAYELTS (frame_parms
)
3551 && FRAME_RIF (f
)->frame_parm_handlers
[XFASTINT (parm_index
)])
3552 (*FRAME_RIF (f
)->frame_parm_handlers
[XFASTINT (parm_index
)])
3556 clear_face_cache (true); /* FIXME: Why of all frames? */
3562 x_set_font (struct frame
*f
, Lisp_Object arg
, Lisp_Object oldval
)
3564 Lisp_Object font_object
;
3566 #ifdef HAVE_X_WINDOWS
3567 Lisp_Object font_param
= arg
;
3570 /* Set the frame parameter back to the old value because we may
3571 fail to use ARG as the new parameter value. */
3572 store_frame_param (f
, Qfont
, oldval
);
3574 /* ARG is a fontset name, a font name, a cons of fontset name and a
3575 font object, or a font object. In the last case, this function
3579 fontset
= fs_query_fontset (arg
, 0);
3582 font_object
= font_open_by_name (f
, arg
);
3583 if (NILP (font_object
))
3584 error ("Font `%s' is not defined", SSDATA (arg
));
3585 arg
= AREF (font_object
, FONT_NAME_INDEX
);
3587 else if (fontset
> 0)
3589 font_object
= font_open_by_name (f
, fontset_ascii (fontset
));
3590 if (NILP (font_object
))
3591 error ("Font `%s' is not defined", SDATA (arg
));
3592 arg
= AREF (font_object
, FONT_NAME_INDEX
);
3595 error ("The default fontset can't be used for a frame font");
3597 else if (CONSP (arg
) && STRINGP (XCAR (arg
)) && FONT_OBJECT_P (XCDR (arg
)))
3599 /* This is the case that the ASCII font of F's fontset XCAR
3600 (arg) is changed to the font XCDR (arg) by
3601 `set-fontset-font'. */
3602 fontset
= fs_query_fontset (XCAR (arg
), 0);
3604 error ("Unknown fontset: %s", SDATA (XCAR (arg
)));
3605 font_object
= XCDR (arg
);
3606 arg
= AREF (font_object
, FONT_NAME_INDEX
);
3607 #ifdef HAVE_X_WINDOWS
3608 font_param
= Ffont_get (font_object
, QCname
);
3611 else if (FONT_OBJECT_P (arg
))
3614 #ifdef HAVE_X_WINDOWS
3615 font_param
= Ffont_get (font_object
, QCname
);
3617 /* This is to store the XLFD font name in the frame parameter for
3618 backward compatibility. We should store the font-object
3619 itself in the future. */
3620 arg
= AREF (font_object
, FONT_NAME_INDEX
);
3621 fontset
= FRAME_FONTSET (f
);
3622 /* Check if we can use the current fontset. If not, set FONTSET
3623 to -1 to generate a new fontset from FONT-OBJECT. */
3626 Lisp_Object ascii_font
= fontset_ascii (fontset
);
3627 Lisp_Object spec
= font_spec_from_name (ascii_font
);
3629 /* SPEC might be nil because ASCII_FONT's name doesn't parse
3630 according to stupid XLFD rules, which, for example,
3631 disallow font names that include a dash followed by a
3632 number. So in those cases we simply request x_new_font
3633 below to generate a new fontset. */
3634 if (NILP (spec
) || ! font_match_p (spec
, font_object
))
3639 signal_error ("Invalid font", arg
);
3641 if (! NILP (Fequal (font_object
, oldval
)))
3644 x_new_font (f
, font_object
, fontset
);
3645 store_frame_param (f
, Qfont
, arg
);
3646 #ifdef HAVE_X_WINDOWS
3647 store_frame_param (f
, Qfont_parameter
, font_param
);
3649 /* Recalculate toolbar height. */
3650 f
->n_tool_bar_rows
= 0;
3652 /* Ensure we redraw it. */
3653 clear_current_matrices (f
);
3655 /* Attempt to hunt down bug#16028. */
3656 SET_FRAME_GARBAGED (f
);
3658 /* This is important if we are called by some Lisp as part of
3659 redisplaying the frame, see redisplay_internal. */
3660 f
->fonts_changed
= true;
3662 recompute_basic_faces (f
);
3664 do_pending_window_change (0);
3666 /* We used to call face-set-after-frame-default here, but it leads to
3667 recursive calls (since that function can set the `default' face's
3668 font which in turns changes the frame's `font' parameter).
3669 Also I don't know what this call is meant to do, but it seems the
3670 wrong way to do it anyway (it does a lot more work than what seems
3671 reasonable in response to a change to `font'). */
3676 x_set_font_backend (struct frame
*f
, Lisp_Object new_value
, Lisp_Object old_value
)
3678 if (! NILP (new_value
)
3679 && !CONSP (new_value
))
3683 CHECK_STRING (new_value
);
3684 p0
= p1
= SSDATA (new_value
);
3688 while (*p1
&& ! c_isspace (*p1
) && *p1
!= ',') p1
++;
3690 new_value
= Fcons (Fintern (make_string (p0
, p1
- p0
), Qnil
),
3696 while ((c
= *++p1
) && c_isspace (c
));
3700 new_value
= Fnreverse (new_value
);
3703 if (! NILP (old_value
) && ! NILP (Fequal (old_value
, new_value
)))
3707 free_all_realized_faces (Qnil
);
3709 new_value
= font_update_drivers (f
, NILP (new_value
) ? Qt
: new_value
);
3710 if (NILP (new_value
))
3712 if (NILP (old_value
))
3713 error ("No font backend available");
3714 font_update_drivers (f
, old_value
);
3715 error ("None of specified font backends are available");
3717 store_frame_param (f
, Qfont_backend
, new_value
);
3723 XSETFRAME (frame
, f
);
3724 x_set_font (f
, Fframe_parameter (frame
, Qfont
), Qnil
);
3726 windows_or_buffers_changed
= 18;
3731 x_set_left_fringe (struct frame
*f
, Lisp_Object new_value
, Lisp_Object old_value
)
3733 int unit
= FRAME_COLUMN_WIDTH (f
);
3734 int old_width
= FRAME_LEFT_FRINGE_WIDTH (f
);
3737 new_width
= (RANGED_INTEGERP (-INT_MAX
, new_value
, INT_MAX
)
3738 ? eabs (XINT (new_value
)) : 8);
3740 if (new_width
!= old_width
)
3742 FRAME_LEFT_FRINGE_WIDTH (f
) = new_width
;
3743 FRAME_FRINGE_COLS (f
) /* Round up. */
3744 = (new_width
+ FRAME_RIGHT_FRINGE_WIDTH (f
) + unit
- 1) / unit
;
3746 if (FRAME_X_WINDOW (f
) != 0)
3747 adjust_frame_size (f
, -1, -1, 3, 0, Qleft_fringe
);
3749 SET_FRAME_GARBAGED (f
);
3755 x_set_right_fringe (struct frame
*f
, Lisp_Object new_value
, Lisp_Object old_value
)
3757 int unit
= FRAME_COLUMN_WIDTH (f
);
3758 int old_width
= FRAME_RIGHT_FRINGE_WIDTH (f
);
3761 new_width
= (RANGED_INTEGERP (-INT_MAX
, new_value
, INT_MAX
)
3762 ? eabs (XINT (new_value
)) : 8);
3764 if (new_width
!= old_width
)
3766 FRAME_RIGHT_FRINGE_WIDTH (f
) = new_width
;
3767 FRAME_FRINGE_COLS (f
) /* Round up. */
3768 = (new_width
+ FRAME_LEFT_FRINGE_WIDTH (f
) + unit
- 1) / unit
;
3770 if (FRAME_X_WINDOW (f
) != 0)
3771 adjust_frame_size (f
, -1, -1, 3, 0, Qright_fringe
);
3773 SET_FRAME_GARBAGED (f
);
3779 x_set_border_width (struct frame
*f
, Lisp_Object arg
, Lisp_Object oldval
)
3781 CHECK_TYPE_RANGED_INTEGER (int, arg
);
3783 if (XINT (arg
) == f
->border_width
)
3786 if (FRAME_X_WINDOW (f
) != 0)
3787 error ("Cannot change the border width of a frame");
3789 f
->border_width
= XINT (arg
);
3793 x_set_right_divider_width (struct frame
*f
, Lisp_Object arg
, Lisp_Object oldval
)
3795 int old
= FRAME_RIGHT_DIVIDER_WIDTH (f
);
3797 CHECK_TYPE_RANGED_INTEGER (int, arg
);
3798 FRAME_RIGHT_DIVIDER_WIDTH (f
) = XINT (arg
);
3799 if (FRAME_RIGHT_DIVIDER_WIDTH (f
) < 0)
3800 FRAME_RIGHT_DIVIDER_WIDTH (f
) = 0;
3801 if (FRAME_RIGHT_DIVIDER_WIDTH (f
) != old
)
3803 adjust_frame_size (f
, -1, -1, 4, 0, Qright_divider_width
);
3804 adjust_frame_glyphs (f
);
3805 SET_FRAME_GARBAGED (f
);
3811 x_set_bottom_divider_width (struct frame
*f
, Lisp_Object arg
, Lisp_Object oldval
)
3813 int old
= FRAME_BOTTOM_DIVIDER_WIDTH (f
);
3815 CHECK_TYPE_RANGED_INTEGER (int, arg
);
3816 FRAME_BOTTOM_DIVIDER_WIDTH (f
) = XINT (arg
);
3817 if (FRAME_BOTTOM_DIVIDER_WIDTH (f
) < 0)
3818 FRAME_BOTTOM_DIVIDER_WIDTH (f
) = 0;
3819 if (FRAME_BOTTOM_DIVIDER_WIDTH (f
) != old
)
3821 adjust_frame_size (f
, -1, -1, 4, 0, Qbottom_divider_width
);
3822 adjust_frame_glyphs (f
);
3823 SET_FRAME_GARBAGED (f
);
3828 x_set_visibility (struct frame
*f
, Lisp_Object value
, Lisp_Object oldval
)
3831 XSETFRAME (frame
, f
);
3834 Fmake_frame_invisible (frame
, Qt
);
3835 else if (EQ (value
, Qicon
))
3836 Ficonify_frame (frame
);
3838 Fmake_frame_visible (frame
);
3842 x_set_autoraise (struct frame
*f
, Lisp_Object arg
, Lisp_Object oldval
)
3844 f
->auto_raise
= !EQ (Qnil
, arg
);
3848 x_set_autolower (struct frame
*f
, Lisp_Object arg
, Lisp_Object oldval
)
3850 f
->auto_lower
= !EQ (Qnil
, arg
);
3854 x_set_unsplittable (struct frame
*f
, Lisp_Object arg
, Lisp_Object oldval
)
3856 f
->no_split
= !NILP (arg
);
3860 x_set_vertical_scroll_bars (struct frame
*f
, Lisp_Object arg
, Lisp_Object oldval
)
3862 if ((EQ (arg
, Qleft
) && FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f
))
3863 || (EQ (arg
, Qright
) && FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f
))
3864 || (NILP (arg
) && FRAME_HAS_VERTICAL_SCROLL_BARS (f
))
3865 || (!NILP (arg
) && !FRAME_HAS_VERTICAL_SCROLL_BARS (f
)))
3867 FRAME_VERTICAL_SCROLL_BAR_TYPE (f
)
3869 ? vertical_scroll_bar_none
3871 ? vertical_scroll_bar_left
3873 ? vertical_scroll_bar_right
3874 : EQ (Qleft
, Vdefault_frame_scroll_bars
)
3875 ? vertical_scroll_bar_left
3876 : EQ (Qright
, Vdefault_frame_scroll_bars
)
3877 ? vertical_scroll_bar_right
3878 : vertical_scroll_bar_none
);
3880 /* We set this parameter before creating the X window for the
3881 frame, so we can get the geometry right from the start.
3882 However, if the window hasn't been created yet, we shouldn't
3883 call x_set_window_size. */
3884 if (FRAME_X_WINDOW (f
))
3885 adjust_frame_size (f
, -1, -1, 3, 0, Qvertical_scroll_bars
);
3887 SET_FRAME_GARBAGED (f
);
3892 x_set_horizontal_scroll_bars (struct frame
*f
, Lisp_Object arg
, Lisp_Object oldval
)
3894 #if USE_HORIZONTAL_SCROLL_BARS
3895 if ((NILP (arg
) && FRAME_HAS_HORIZONTAL_SCROLL_BARS (f
))
3896 || (!NILP (arg
) && !FRAME_HAS_HORIZONTAL_SCROLL_BARS (f
)))
3898 f
->horizontal_scroll_bars
= NILP (arg
) ? false : true;
3900 /* We set this parameter before creating the X window for the
3901 frame, so we can get the geometry right from the start.
3902 However, if the window hasn't been created yet, we shouldn't
3903 call x_set_window_size. */
3904 if (FRAME_X_WINDOW (f
))
3905 adjust_frame_size (f
, -1, -1, 3, 0, Qhorizontal_scroll_bars
);
3907 SET_FRAME_GARBAGED (f
);
3913 x_set_scroll_bar_width (struct frame
*f
, Lisp_Object arg
, Lisp_Object oldval
)
3915 int unit
= FRAME_COLUMN_WIDTH (f
);
3919 x_set_scroll_bar_default_width (f
);
3921 if (FRAME_X_WINDOW (f
))
3922 adjust_frame_size (f
, -1, -1, 3, 0, Qscroll_bar_width
);
3924 SET_FRAME_GARBAGED (f
);
3926 else if (RANGED_INTEGERP (1, arg
, INT_MAX
)
3927 && XFASTINT (arg
) != FRAME_CONFIG_SCROLL_BAR_WIDTH (f
))
3929 FRAME_CONFIG_SCROLL_BAR_WIDTH (f
) = XFASTINT (arg
);
3930 FRAME_CONFIG_SCROLL_BAR_COLS (f
) = (XFASTINT (arg
) + unit
- 1) / unit
;
3931 if (FRAME_X_WINDOW (f
))
3932 adjust_frame_size (f
, -1, -1, 3, 0, Qscroll_bar_width
);
3934 SET_FRAME_GARBAGED (f
);
3937 XWINDOW (FRAME_SELECTED_WINDOW (f
))->cursor
.hpos
= 0;
3938 XWINDOW (FRAME_SELECTED_WINDOW (f
))->cursor
.x
= 0;
3942 x_set_scroll_bar_height (struct frame
*f
, Lisp_Object arg
, Lisp_Object oldval
)
3944 #if USE_HORIZONTAL_SCROLL_BARS
3945 int unit
= FRAME_LINE_HEIGHT (f
);
3949 x_set_scroll_bar_default_height (f
);
3951 if (FRAME_X_WINDOW (f
))
3952 adjust_frame_size (f
, -1, -1, 3, 0, Qscroll_bar_height
);
3954 SET_FRAME_GARBAGED (f
);
3956 else if (RANGED_INTEGERP (1, arg
, INT_MAX
)
3957 && XFASTINT (arg
) != FRAME_CONFIG_SCROLL_BAR_HEIGHT (f
))
3959 FRAME_CONFIG_SCROLL_BAR_HEIGHT (f
) = XFASTINT (arg
);
3960 FRAME_CONFIG_SCROLL_BAR_LINES (f
) = (XFASTINT (arg
) + unit
- 1) / unit
;
3961 if (FRAME_X_WINDOW (f
))
3962 adjust_frame_size (f
, -1, -1, 3, 0, Qscroll_bar_height
);
3964 SET_FRAME_GARBAGED (f
);
3967 XWINDOW (FRAME_SELECTED_WINDOW (f
))->cursor
.vpos
= 0;
3968 XWINDOW (FRAME_SELECTED_WINDOW (f
))->cursor
.y
= 0;
3973 x_set_alpha (struct frame
*f
, Lisp_Object arg
, Lisp_Object oldval
)
3980 for (i
= 0; i
< 2; i
++)
3993 else if (FLOATP (item
))
3995 alpha
= XFLOAT_DATA (item
);
3996 if (! (0 <= alpha
&& alpha
<= 1.0))
3997 args_out_of_range (make_float (0.0), make_float (1.0));
3999 else if (INTEGERP (item
))
4001 EMACS_INT ialpha
= XINT (item
);
4002 if (! (0 <= ialpha
&& alpha
<= 100))
4003 args_out_of_range (make_number (0), make_number (100));
4004 alpha
= ialpha
/ 100.0;
4007 wrong_type_argument (Qnumberp
, item
);
4011 for (i
= 0; i
< 2; i
++)
4012 f
->alpha
[i
] = newval
[i
];
4014 #if defined (HAVE_X_WINDOWS) || defined (HAVE_NTGUI) || defined (NS_IMPL_COCOA)
4016 x_set_frame_alpha (f
);
4025 /* Non-zero if mouse is grabbed on DPYINFO
4026 and we know the frame where it is. */
4028 bool x_mouse_grabbed (Display_Info
*dpyinfo
)
4030 return (dpyinfo
->grabbed
4031 && dpyinfo
->last_mouse_frame
4032 && FRAME_LIVE_P (dpyinfo
->last_mouse_frame
));
4035 /* Re-highlight something with mouse-face properties
4036 on DPYINFO using saved frame and mouse position. */
4039 x_redo_mouse_highlight (Display_Info
*dpyinfo
)
4041 if (dpyinfo
->last_mouse_motion_frame
4042 && FRAME_LIVE_P (dpyinfo
->last_mouse_motion_frame
))
4043 note_mouse_highlight (dpyinfo
->last_mouse_motion_frame
,
4044 dpyinfo
->last_mouse_motion_x
,
4045 dpyinfo
->last_mouse_motion_y
);
4048 #endif /* HAVE_NS */
4050 /* Subroutines of creating an X frame. */
4052 /* Make sure that Vx_resource_name is set to a reasonable value.
4053 Fix it up, or set it to `emacs' if it is too hopeless. */
4056 validate_x_resource_name (void)
4059 /* Number of valid characters in the resource name. */
4060 ptrdiff_t good_count
= 0;
4061 /* Number of invalid characters in the resource name. */
4062 ptrdiff_t bad_count
= 0;
4066 if (!STRINGP (Vx_resource_class
))
4067 Vx_resource_class
= build_string (EMACS_CLASS
);
4069 if (STRINGP (Vx_resource_name
))
4071 unsigned char *p
= SDATA (Vx_resource_name
);
4073 len
= SBYTES (Vx_resource_name
);
4075 /* Only letters, digits, - and _ are valid in resource names.
4076 Count the valid characters and count the invalid ones. */
4077 for (i
= 0; i
< len
; i
++)
4080 if (! ((c
>= 'a' && c
<= 'z')
4081 || (c
>= 'A' && c
<= 'Z')
4082 || (c
>= '0' && c
<= '9')
4083 || c
== '-' || c
== '_'))
4090 /* Not a string => completely invalid. */
4091 bad_count
= 5, good_count
= 0;
4093 /* If name is valid already, return. */
4097 /* If name is entirely invalid, or nearly so, or is so implausibly
4098 large that alloca might not work, use `emacs'. */
4099 if (good_count
< 2 || MAX_ALLOCA
- sizeof ".customization" < len
)
4101 Vx_resource_name
= build_string ("emacs");
4105 /* Name is partly valid. Copy it and replace the invalid characters
4106 with underscores. */
4108 Vx_resource_name
= new = Fcopy_sequence (Vx_resource_name
);
4110 for (i
= 0; i
< len
; i
++)
4112 int c
= SREF (new, i
);
4113 if (! ((c
>= 'a' && c
<= 'z')
4114 || (c
>= 'A' && c
<= 'Z')
4115 || (c
>= '0' && c
<= '9')
4116 || c
== '-' || c
== '_'))
4121 /* Get specified attribute from resource database RDB.
4122 See Fx_get_resource below for other parameters. */
4125 xrdb_get_resource (XrmDatabase rdb
, Lisp_Object attribute
, Lisp_Object
class, Lisp_Object component
, Lisp_Object subclass
)
4127 CHECK_STRING (attribute
);
4128 CHECK_STRING (class);
4130 if (!NILP (component
))
4131 CHECK_STRING (component
);
4132 if (!NILP (subclass
))
4133 CHECK_STRING (subclass
);
4134 if (NILP (component
) != NILP (subclass
))
4135 error ("x-get-resource: must specify both COMPONENT and SUBCLASS or neither");
4137 validate_x_resource_name ();
4139 /* Allocate space for the components, the dots which separate them,
4140 and the final '\0'. Make them big enough for the worst case. */
4141 ptrdiff_t name_keysize
= (SBYTES (Vx_resource_name
)
4142 + (STRINGP (component
)
4143 ? SBYTES (component
) : 0)
4144 + SBYTES (attribute
)
4147 ptrdiff_t class_keysize
= (SBYTES (Vx_resource_class
)
4149 + (STRINGP (subclass
)
4150 ? SBYTES (subclass
) : 0)
4153 char *name_key
= SAFE_ALLOCA (name_keysize
+ class_keysize
);
4154 char *class_key
= name_key
+ name_keysize
;
4156 /* Start with emacs.FRAMENAME for the name (the specific one)
4157 and with `Emacs' for the class key (the general one). */
4158 char *nz
= lispstpcpy (name_key
, Vx_resource_name
);
4159 char *cz
= lispstpcpy (class_key
, Vx_resource_class
);
4162 cz
= lispstpcpy (cz
, class);
4164 if (!NILP (component
))
4167 lispstpcpy (cz
, subclass
);
4170 nz
= lispstpcpy (nz
, component
);
4174 lispstpcpy (nz
, attribute
);
4176 char *value
= x_get_string_resource (rdb
, name_key
, class_key
);
4179 if (value
&& *value
)
4180 return build_string (value
);
4186 DEFUN ("x-get-resource", Fx_get_resource
, Sx_get_resource
, 2, 4, 0,
4187 doc
: /* Return the value of ATTRIBUTE, of class CLASS, from the X defaults database.
4188 This uses `INSTANCE.ATTRIBUTE' as the key and `Emacs.CLASS' as the
4189 class, where INSTANCE is the name under which Emacs was invoked, or
4190 the name specified by the `-name' or `-rn' command-line arguments.
4192 The optional arguments COMPONENT and SUBCLASS add to the key and the
4193 class, respectively. You must specify both of them or neither.
4194 If you specify them, the key is `INSTANCE.COMPONENT.ATTRIBUTE'
4195 and the class is `Emacs.CLASS.SUBCLASS'. */)
4196 (Lisp_Object attribute
, Lisp_Object
class, Lisp_Object component
,
4197 Lisp_Object subclass
)
4199 check_window_system (NULL
);
4201 return xrdb_get_resource (check_x_display_info (Qnil
)->xrdb
,
4202 attribute
, class, component
, subclass
);
4205 /* Get an X resource, like Fx_get_resource, but for display DPYINFO. */
4208 display_x_get_resource (Display_Info
*dpyinfo
, Lisp_Object attribute
,
4209 Lisp_Object
class, Lisp_Object component
,
4210 Lisp_Object subclass
)
4212 return xrdb_get_resource (dpyinfo
->xrdb
,
4213 attribute
, class, component
, subclass
);
4216 #if defined HAVE_X_WINDOWS && !defined USE_X_TOOLKIT && !defined USE_GTK
4217 /* Used when C code wants a resource value. */
4218 /* Called from oldXMenu/Create.c. */
4220 x_get_resource_string (const char *attribute
, const char *class)
4223 struct frame
*sf
= SELECTED_FRAME ();
4224 ptrdiff_t invocation_namelen
= SBYTES (Vinvocation_name
);
4227 /* Allocate space for the components, the dots which separate them,
4228 and the final '\0'. */
4229 ptrdiff_t name_keysize
= invocation_namelen
+ strlen (attribute
) + 2;
4230 ptrdiff_t class_keysize
= sizeof (EMACS_CLASS
) - 1 + strlen (class) + 2;
4231 char *name_key
= SAFE_ALLOCA (name_keysize
+ class_keysize
);
4232 char *class_key
= name_key
+ name_keysize
;
4234 esprintf (name_key
, "%s.%s", SSDATA (Vinvocation_name
), attribute
);
4235 sprintf (class_key
, "%s.%s", EMACS_CLASS
, class);
4237 result
= x_get_string_resource (FRAME_DISPLAY_INFO (sf
)->xrdb
,
4238 name_key
, class_key
);
4244 /* Return the value of parameter PARAM.
4246 First search ALIST, then Vdefault_frame_alist, then the X defaults
4247 database, using ATTRIBUTE as the attribute name and CLASS as its class.
4249 Convert the resource to the type specified by desired_type.
4251 If no default is specified, return Qunbound. If you call
4252 x_get_arg, make sure you deal with Qunbound in a reasonable way,
4253 and don't let it get stored in any Lisp-visible variables! */
4256 x_get_arg (Display_Info
*dpyinfo
, Lisp_Object alist
, Lisp_Object param
,
4257 const char *attribute
, const char *class, enum resource_types type
)
4261 tem
= Fassq (param
, alist
);
4265 /* If we find this parm in ALIST, clear it out
4266 so that it won't be "left over" at the end. */
4268 XSETCAR (tem
, Qnil
);
4269 /* In case the parameter appears more than once in the alist,
4271 for (tail
= alist
; CONSP (tail
); tail
= XCDR (tail
))
4272 if (CONSP (XCAR (tail
))
4273 && EQ (XCAR (XCAR (tail
)), param
))
4274 XSETCAR (XCAR (tail
), Qnil
);
4277 tem
= Fassq (param
, Vdefault_frame_alist
);
4279 /* If it wasn't specified in ALIST or the Lisp-level defaults,
4280 look in the X resources. */
4283 if (attribute
&& dpyinfo
)
4285 AUTO_STRING (at
, attribute
);
4286 AUTO_STRING (cl
, class);
4287 tem
= display_x_get_resource (dpyinfo
, at
, cl
, Qnil
, Qnil
);
4294 case RES_TYPE_NUMBER
:
4295 return make_number (atoi (SSDATA (tem
)));
4297 case RES_TYPE_BOOLEAN_NUMBER
:
4298 if (!strcmp (SSDATA (tem
), "on")
4299 || !strcmp (SSDATA (tem
), "true"))
4300 return make_number (1);
4301 return make_number (atoi (SSDATA (tem
)));
4304 case RES_TYPE_FLOAT
:
4305 return make_float (atof (SSDATA (tem
)));
4307 case RES_TYPE_BOOLEAN
:
4308 tem
= Fdowncase (tem
);
4309 if (!strcmp (SSDATA (tem
), "on")
4311 || !strcmp (SSDATA (tem
), "yes")
4313 || !strcmp (SSDATA (tem
), "true"))
4318 case RES_TYPE_STRING
:
4321 case RES_TYPE_SYMBOL
:
4322 /* As a special case, we map the values `true' and `on'
4323 to Qt, and `false' and `off' to Qnil. */
4326 lower
= Fdowncase (tem
);
4327 if (!strcmp (SSDATA (lower
), "on")
4329 || !strcmp (SSDATA (lower
), "yes")
4331 || !strcmp (SSDATA (lower
), "true"))
4333 else if (!strcmp (SSDATA (lower
), "off")
4335 || !strcmp (SSDATA (lower
), "no")
4337 || !strcmp (SSDATA (lower
), "false"))
4340 return Fintern (tem
, Qnil
);
4354 x_frame_get_arg (struct frame
*f
, Lisp_Object alist
, Lisp_Object param
,
4355 const char *attribute
, const char *class,
4356 enum resource_types type
)
4358 return x_get_arg (FRAME_DISPLAY_INFO (f
),
4359 alist
, param
, attribute
, class, type
);
4362 /* Like x_frame_get_arg, but also record the value in f->param_alist. */
4365 x_frame_get_and_record_arg (struct frame
*f
, Lisp_Object alist
,
4367 const char *attribute
, const char *class,
4368 enum resource_types type
)
4372 value
= x_get_arg (FRAME_DISPLAY_INFO (f
), alist
, param
,
4373 attribute
, class, type
);
4374 if (! NILP (value
) && ! EQ (value
, Qunbound
))
4375 store_frame_param (f
, param
, value
);
4381 /* Record in frame F the specified or default value according to ALIST
4382 of the parameter named PROP (a Lisp symbol).
4383 If no value is specified for PROP, look for an X default for XPROP
4384 on the frame named NAME.
4385 If that is not found either, use the value DEFLT. */
4388 x_default_parameter (struct frame
*f
, Lisp_Object alist
, Lisp_Object prop
,
4389 Lisp_Object deflt
, const char *xprop
, const char *xclass
,
4390 enum resource_types type
)
4394 tem
= x_frame_get_arg (f
, alist
, prop
, xprop
, xclass
, type
);
4395 if (EQ (tem
, Qunbound
))
4397 AUTO_FRAME_ARG (arg
, prop
, tem
);
4398 x_set_frame_parameters (f
, arg
);
4403 #if !defined (HAVE_X_WINDOWS) && defined (NoValue)
4406 * XParseGeometry parses strings of the form
4407 * "=<width>x<height>{+-}<xoffset>{+-}<yoffset>", where
4408 * width, height, xoffset, and yoffset are unsigned integers.
4409 * Example: "=80x24+300-49"
4410 * The equal sign is optional.
4411 * It returns a bitmask that indicates which of the four values
4412 * were actually found in the string. For each value found,
4413 * the corresponding argument is updated; for each value
4414 * not found, the corresponding argument is left unchanged.
4418 XParseGeometry (char *string
,
4420 unsigned int *width
, unsigned int *height
)
4424 unsigned long tempWidth
, tempHeight
;
4425 long int tempX
, tempY
;
4426 char *nextCharacter
;
4428 if (string
== NULL
|| *string
== '\0')
4431 string
++; /* ignore possible '=' at beg of geometry spec */
4434 if (*strind
!= '+' && *strind
!= '-' && *strind
!= 'x')
4436 tempWidth
= strtoul (strind
, &nextCharacter
, 10);
4437 if (strind
== nextCharacter
)
4439 strind
= nextCharacter
;
4443 if (*strind
== 'x' || *strind
== 'X')
4446 tempHeight
= strtoul (strind
, &nextCharacter
, 10);
4447 if (strind
== nextCharacter
)
4449 strind
= nextCharacter
;
4450 mask
|= HeightValue
;
4453 if (*strind
== '+' || *strind
== '-')
4457 tempX
= strtol (strind
, &nextCharacter
, 10);
4458 if (strind
== nextCharacter
)
4460 strind
= nextCharacter
;
4462 if (*strind
== '+' || *strind
== '-')
4466 tempY
= strtol (strind
, &nextCharacter
, 10);
4467 if (strind
== nextCharacter
)
4469 strind
= nextCharacter
;
4474 /* If strind isn't at the end of the string then it's an invalid
4475 geometry specification. */
4477 if (*strind
!= '\0')
4481 *x
= clip_to_bounds (INT_MIN
, tempX
, INT_MAX
);
4483 *y
= clip_to_bounds (INT_MIN
, tempY
, INT_MAX
);
4484 if (mask
& WidthValue
)
4485 *width
= min (tempWidth
, UINT_MAX
);
4486 if (mask
& HeightValue
)
4487 *height
= min (tempHeight
, UINT_MAX
);
4491 #endif /* !defined (HAVE_X_WINDOWS) && defined (NoValue) */
4494 /* NS used to define x-parse-geometry in ns-win.el, but that confused
4495 make-docfile: the documentation string in ns-win.el was used for
4496 x-parse-geometry even in non-NS builds.
4498 With two definitions of x-parse-geometry in this file, various
4499 things still get confused (eg M-x apropos documentation), so that
4500 it is best if the two definitions just share the same doc-string.
4502 DEFUN ("x-parse-geometry", Fx_parse_geometry
, Sx_parse_geometry
, 1, 1, 0,
4503 doc
: /* Parse a display geometry string STRING.
4504 Returns an alist of the form ((top . TOP), (left . LEFT) ... ).
4505 The properties returned may include `top', `left', `height', and `width'.
4506 For X, the value of `left' or `top' may be an integer,
4507 or a list (+ N) meaning N pixels relative to top/left corner,
4508 or a list (- N) meaning -N pixels relative to bottom/right corner.
4509 On Nextstep, this just calls `ns-parse-geometry'. */)
4510 (Lisp_Object string
)
4513 unsigned int width
, height
;
4516 CHECK_STRING (string
);
4519 if (strchr (SSDATA (string
), ' ') != NULL
)
4520 return call1 (Qns_parse_geometry
, string
);
4522 geometry
= XParseGeometry (SSDATA (string
),
4523 &x
, &y
, &width
, &height
);
4525 if (geometry
& XValue
)
4527 Lisp_Object element
;
4529 if (x
>= 0 && (geometry
& XNegative
))
4530 element
= list3 (Qleft
, Qminus
, make_number (-x
));
4531 else if (x
< 0 && ! (geometry
& XNegative
))
4532 element
= list3 (Qleft
, Qplus
, make_number (x
));
4534 element
= Fcons (Qleft
, make_number (x
));
4535 result
= Fcons (element
, result
);
4538 if (geometry
& YValue
)
4540 Lisp_Object element
;
4542 if (y
>= 0 && (geometry
& YNegative
))
4543 element
= list3 (Qtop
, Qminus
, make_number (-y
));
4544 else if (y
< 0 && ! (geometry
& YNegative
))
4545 element
= list3 (Qtop
, Qplus
, make_number (y
));
4547 element
= Fcons (Qtop
, make_number (y
));
4548 result
= Fcons (element
, result
);
4551 if (geometry
& WidthValue
)
4552 result
= Fcons (Fcons (Qwidth
, make_number (width
)), result
);
4553 if (geometry
& HeightValue
)
4554 result
= Fcons (Fcons (Qheight
, make_number (height
)), result
);
4560 /* Calculate the desired size and position of frame F.
4561 Return the flags saying which aspects were specified.
4563 Also set the win_gravity and size_hint_flags of F.
4565 Adjust height for toolbar if TOOLBAR_P is 1.
4567 This function does not make the coordinates positive. */
4569 #define DEFAULT_ROWS 36
4570 #define DEFAULT_COLS 80
4573 x_figure_window_size (struct frame
*f
, Lisp_Object parms
, bool toolbar_p
, int *x_width
, int *x_height
)
4575 Lisp_Object height
, width
, user_size
, top
, left
, user_position
;
4576 long window_prompting
= 0;
4577 Display_Info
*dpyinfo
= FRAME_DISPLAY_INFO (f
);
4579 /* Default values if we fall through.
4580 Actually, if that happens we should get
4581 window manager prompting. */
4582 SET_FRAME_WIDTH (f
, DEFAULT_COLS
* FRAME_COLUMN_WIDTH (f
));
4583 SET_FRAME_COLS (f
, DEFAULT_COLS
);
4584 SET_FRAME_HEIGHT (f
, DEFAULT_ROWS
* FRAME_LINE_HEIGHT (f
));
4585 SET_FRAME_LINES (f
, DEFAULT_ROWS
);
4587 /* Window managers expect that if program-specified
4588 positions are not (0,0), they're intentional, not defaults. */
4592 /* Calculate a tool bar height so that the user gets a text display
4593 area of the size he specified with -g or via .Xdefaults. Later
4594 changes of the tool bar height don't change the frame size. This
4595 is done so that users can create tall Emacs frames without having
4596 to guess how tall the tool bar will get. */
4597 if (toolbar_p
&& FRAME_TOOL_BAR_LINES (f
))
4599 if (frame_default_tool_bar_height
)
4600 FRAME_TOOL_BAR_HEIGHT (f
) = frame_default_tool_bar_height
;
4605 relief
= (tool_bar_button_relief
>= 0
4606 ? tool_bar_button_relief
4607 : DEFAULT_TOOL_BAR_BUTTON_RELIEF
);
4609 if (RANGED_INTEGERP (1, Vtool_bar_button_margin
, INT_MAX
))
4610 margin
= XFASTINT (Vtool_bar_button_margin
);
4611 else if (CONSP (Vtool_bar_button_margin
)
4612 && RANGED_INTEGERP (1, XCDR (Vtool_bar_button_margin
), INT_MAX
))
4613 margin
= XFASTINT (XCDR (Vtool_bar_button_margin
));
4617 FRAME_TOOL_BAR_HEIGHT (f
)
4618 = DEFAULT_TOOL_BAR_IMAGE_HEIGHT
+ 2 * margin
+ 2 * relief
;
4622 /* Ensure that earlier new_width and new_height settings won't
4623 override what we specify below. */
4624 f
->new_width
= f
->new_height
= 0;
4626 height
= x_get_arg (dpyinfo
, parms
, Qheight
, 0, 0, RES_TYPE_NUMBER
);
4627 width
= x_get_arg (dpyinfo
, parms
, Qwidth
, 0, 0, RES_TYPE_NUMBER
);
4628 if (!EQ (width
, Qunbound
) || !EQ (height
, Qunbound
))
4630 if (!EQ (width
, Qunbound
))
4632 if (CONSP (width
) && EQ (XCAR (width
), Qtext_pixels
))
4634 CHECK_NUMBER (XCDR (width
));
4635 if ((XINT (XCDR (width
)) < 0 || XINT (XCDR (width
)) > INT_MAX
))
4636 xsignal1 (Qargs_out_of_range
, XCDR (width
));
4638 SET_FRAME_WIDTH (f
, XINT (XCDR (width
)));
4639 f
->inhibit_horizontal_resize
= true;
4640 *x_width
= XINT (XCDR (width
));
4644 CHECK_NUMBER (width
);
4645 if ((XINT (width
) < 0 || XINT (width
) > INT_MAX
))
4646 xsignal1 (Qargs_out_of_range
, width
);
4648 SET_FRAME_WIDTH (f
, XINT (width
) * FRAME_COLUMN_WIDTH (f
));
4652 if (!EQ (height
, Qunbound
))
4654 if (CONSP (height
) && EQ (XCAR (height
), Qtext_pixels
))
4656 CHECK_NUMBER (XCDR (height
));
4657 if ((XINT (XCDR (height
)) < 0 || XINT (XCDR (height
)) > INT_MAX
))
4658 xsignal1 (Qargs_out_of_range
, XCDR (height
));
4660 SET_FRAME_HEIGHT (f
, XINT (XCDR (height
)));
4661 f
->inhibit_vertical_resize
= true;
4662 *x_height
= XINT (XCDR (height
));
4666 CHECK_NUMBER (height
);
4667 if ((XINT (height
) < 0) || (XINT (height
) > INT_MAX
))
4668 xsignal1 (Qargs_out_of_range
, height
);
4670 SET_FRAME_HEIGHT (f
, XINT (height
) * FRAME_LINE_HEIGHT (f
));
4674 user_size
= x_get_arg (dpyinfo
, parms
, Quser_size
, 0, 0, RES_TYPE_NUMBER
);
4675 if (!NILP (user_size
) && !EQ (user_size
, Qunbound
))
4676 window_prompting
|= USSize
;
4678 window_prompting
|= PSize
;
4681 top
= x_get_arg (dpyinfo
, parms
, Qtop
, 0, 0, RES_TYPE_NUMBER
);
4682 left
= x_get_arg (dpyinfo
, parms
, Qleft
, 0, 0, RES_TYPE_NUMBER
);
4683 user_position
= x_get_arg (dpyinfo
, parms
, Quser_position
, 0, 0, RES_TYPE_NUMBER
);
4684 if (! EQ (top
, Qunbound
) || ! EQ (left
, Qunbound
))
4686 if (EQ (top
, Qminus
))
4689 window_prompting
|= YNegative
;
4691 else if (CONSP (top
) && EQ (XCAR (top
), Qminus
)
4692 && CONSP (XCDR (top
))
4693 && RANGED_INTEGERP (-INT_MAX
, XCAR (XCDR (top
)), INT_MAX
))
4695 f
->top_pos
= - XINT (XCAR (XCDR (top
)));
4696 window_prompting
|= YNegative
;
4698 else if (CONSP (top
) && EQ (XCAR (top
), Qplus
)
4699 && CONSP (XCDR (top
))
4700 && TYPE_RANGED_INTEGERP (int, XCAR (XCDR (top
))))
4702 f
->top_pos
= XINT (XCAR (XCDR (top
)));
4704 else if (EQ (top
, Qunbound
))
4708 CHECK_TYPE_RANGED_INTEGER (int, top
);
4709 f
->top_pos
= XINT (top
);
4711 window_prompting
|= YNegative
;
4714 if (EQ (left
, Qminus
))
4717 window_prompting
|= XNegative
;
4719 else if (CONSP (left
) && EQ (XCAR (left
), Qminus
)
4720 && CONSP (XCDR (left
))
4721 && RANGED_INTEGERP (-INT_MAX
, XCAR (XCDR (left
)), INT_MAX
))
4723 f
->left_pos
= - XINT (XCAR (XCDR (left
)));
4724 window_prompting
|= XNegative
;
4726 else if (CONSP (left
) && EQ (XCAR (left
), Qplus
)
4727 && CONSP (XCDR (left
))
4728 && TYPE_RANGED_INTEGERP (int, XCAR (XCDR (left
))))
4730 f
->left_pos
= XINT (XCAR (XCDR (left
)));
4732 else if (EQ (left
, Qunbound
))
4736 CHECK_TYPE_RANGED_INTEGER (int, left
);
4737 f
->left_pos
= XINT (left
);
4738 if (f
->left_pos
< 0)
4739 window_prompting
|= XNegative
;
4742 if (!NILP (user_position
) && ! EQ (user_position
, Qunbound
))
4743 window_prompting
|= USPosition
;
4745 window_prompting
|= PPosition
;
4748 if (window_prompting
& XNegative
)
4750 if (window_prompting
& YNegative
)
4751 f
->win_gravity
= SouthEastGravity
;
4753 f
->win_gravity
= NorthEastGravity
;
4757 if (window_prompting
& YNegative
)
4758 f
->win_gravity
= SouthWestGravity
;
4760 f
->win_gravity
= NorthWestGravity
;
4763 f
->size_hint_flags
= window_prompting
;
4765 return window_prompting
;
4770 #endif /* HAVE_WINDOW_SYSTEM */
4773 frame_make_pointer_invisible (struct frame
*f
)
4775 if (! NILP (Vmake_pointer_invisible
))
4777 if (f
&& FRAME_LIVE_P (f
) && !f
->pointer_invisible
4778 && FRAME_TERMINAL (f
)->toggle_invisible_pointer_hook
)
4781 FRAME_TERMINAL (f
)->toggle_invisible_pointer_hook (f
, 1);
4782 f
->pointer_invisible
= 1;
4788 frame_make_pointer_visible (struct frame
*f
)
4790 /* We don't check Vmake_pointer_invisible here in case the
4791 pointer was invisible when Vmake_pointer_invisible was set to nil. */
4792 if (f
&& FRAME_LIVE_P (f
) && f
->pointer_invisible
&& f
->mouse_moved
4793 && FRAME_TERMINAL (f
)->toggle_invisible_pointer_hook
)
4795 FRAME_TERMINAL (f
)->toggle_invisible_pointer_hook (f
, 0);
4796 f
->pointer_invisible
= 0;
4800 DEFUN ("frame-pointer-visible-p", Fframe_pointer_visible_p
,
4801 Sframe_pointer_visible_p
, 0, 1, 0,
4802 doc
: /* Return t if the mouse pointer displayed on FRAME is visible.
4803 Otherwise it returns nil. FRAME omitted or nil means the
4804 selected frame. This is useful when `make-pointer-invisible' is set. */)
4807 return decode_any_frame (frame
)->pointer_invisible
? Qnil
: Qt
;
4812 /***********************************************************************
4814 ***********************************************************************/
4816 #ifdef HAVE_WINDOW_SYSTEM
4818 # if (defined HAVE_NS \
4819 || (!defined USE_GTK && (defined HAVE_XINERAMA || defined HAVE_XRANDR)))
4821 free_monitors (struct MonitorInfo
*monitors
, int n_monitors
)
4824 for (i
= 0; i
< n_monitors
; ++i
)
4825 xfree (monitors
[i
].name
);
4831 make_monitor_attribute_list (struct MonitorInfo
*monitors
,
4833 int primary_monitor
,
4834 Lisp_Object monitor_frames
,
4837 Lisp_Object attributes_list
= Qnil
;
4838 Lisp_Object primary_monitor_attributes
= Qnil
;
4841 for (i
= 0; i
< n_monitors
; ++i
)
4843 Lisp_Object geometry
, workarea
, attributes
= Qnil
;
4844 struct MonitorInfo
*mi
= &monitors
[i
];
4846 if (mi
->geom
.width
== 0) continue;
4848 workarea
= list4i (mi
->work
.x
, mi
->work
.y
,
4849 mi
->work
.width
, mi
->work
.height
);
4850 geometry
= list4i (mi
->geom
.x
, mi
->geom
.y
,
4851 mi
->geom
.width
, mi
->geom
.height
);
4852 attributes
= Fcons (Fcons (Qsource
, build_string (source
)),
4854 attributes
= Fcons (Fcons (Qframes
, AREF (monitor_frames
, i
)),
4856 attributes
= Fcons (Fcons (Qmm_size
,
4857 list2i (mi
->mm_width
, mi
->mm_height
)),
4859 attributes
= Fcons (Fcons (Qworkarea
, workarea
), attributes
);
4860 attributes
= Fcons (Fcons (Qgeometry
, geometry
), attributes
);
4862 attributes
= Fcons (Fcons (Qname
, make_string (mi
->name
,
4863 strlen (mi
->name
))),
4866 if (i
== primary_monitor
)
4867 primary_monitor_attributes
= attributes
;
4869 attributes_list
= Fcons (attributes
, attributes_list
);
4872 if (!NILP (primary_monitor_attributes
))
4873 attributes_list
= Fcons (primary_monitor_attributes
, attributes_list
);
4874 return attributes_list
;
4877 #endif /* HAVE_WINDOW_SYSTEM */
4880 /***********************************************************************
4882 ***********************************************************************/
4885 syms_of_frame (void)
4887 DEFSYM (Qframep
, "framep");
4888 DEFSYM (Qframe_live_p
, "frame-live-p");
4889 DEFSYM (Qframe_windows_min_size
, "frame-windows-min-size");
4890 DEFSYM (Qwindow__pixel_to_total
, "window--pixel-to-total");
4891 DEFSYM (Qexplicit_name
, "explicit-name");
4892 DEFSYM (Qheight
, "height");
4893 DEFSYM (Qicon
, "icon");
4894 DEFSYM (Qminibuffer
, "minibuffer");
4895 DEFSYM (Qmodeline
, "modeline");
4896 DEFSYM (Qonly
, "only");
4897 DEFSYM (Qnone
, "none");
4898 DEFSYM (Qwidth
, "width");
4899 DEFSYM (Qtext_pixels
, "text-pixels");
4900 DEFSYM (Qgeometry
, "geometry");
4901 DEFSYM (Qicon_left
, "icon-left");
4902 DEFSYM (Qicon_top
, "icon-top");
4903 DEFSYM (Qtooltip
, "tooltip");
4904 DEFSYM (Quser_position
, "user-position");
4905 DEFSYM (Quser_size
, "user-size");
4906 DEFSYM (Qwindow_id
, "window-id");
4907 #ifdef HAVE_X_WINDOWS
4908 DEFSYM (Qouter_window_id
, "outer-window-id");
4910 DEFSYM (Qparent_id
, "parent-id");
4912 DEFSYM (Qw32
, "w32");
4915 DEFSYM (Qvisible
, "visible");
4916 DEFSYM (Qbuffer_predicate
, "buffer-predicate");
4917 DEFSYM (Qbuffer_list
, "buffer-list");
4918 DEFSYM (Qburied_buffer_list
, "buried-buffer-list");
4919 DEFSYM (Qdisplay_type
, "display-type");
4920 DEFSYM (Qbackground_mode
, "background-mode");
4921 DEFSYM (Qnoelisp
, "noelisp");
4922 DEFSYM (Qtty_color_mode
, "tty-color-mode");
4923 DEFSYM (Qtty
, "tty");
4924 DEFSYM (Qtty_type
, "tty-type");
4926 DEFSYM (Qface_set_after_frame_default
, "face-set-after-frame-default");
4928 DEFSYM (Qfullwidth
, "fullwidth");
4929 DEFSYM (Qfullheight
, "fullheight");
4930 DEFSYM (Qfullboth
, "fullboth");
4931 DEFSYM (Qmaximized
, "maximized");
4932 DEFSYM (Qx_resource_name
, "x-resource-name");
4933 DEFSYM (Qx_frame_parameter
, "x-frame-parameter");
4935 DEFSYM (Qterminal
, "terminal");
4937 DEFSYM (Qworkarea
, "workarea");
4938 DEFSYM (Qmm_size
, "mm-size");
4939 DEFSYM (Qframes
, "frames");
4940 DEFSYM (Qsource
, "source");
4942 DEFSYM (Qouter_edges
, "outer-edges");
4943 DEFSYM (Qouter_position
, "outer-position");
4944 DEFSYM (Qouter_size
, "outer-size");
4945 DEFSYM (Qnative_edges
, "native-edges");
4946 DEFSYM (Qinner_edges
, "inner-edges");
4947 DEFSYM (Qexternal_border_size
, "external-border-size");
4948 DEFSYM (Qtitle_bar_size
, "title-bar-size");
4949 DEFSYM (Qmenu_bar_external
, "menu-bar-external");
4950 DEFSYM (Qmenu_bar_size
, "menu-bar-size");
4951 DEFSYM (Qtool_bar_external
, "tool-bar-external");
4952 DEFSYM (Qtool_bar_size
, "tool-bar-size");
4953 /* The following are used for frame_size_history. */
4954 DEFSYM (Qadjust_frame_size_1
, "adjust-frame-size-1");
4955 DEFSYM (Qadjust_frame_size_2
, "adjust-frame-size-2");
4956 DEFSYM (Qadjust_frame_size_3
, "adjust-frame-size-3");
4957 DEFSYM (Qx_set_frame_parameters
, "x-set-frame-parameters");
4958 DEFSYM (QEmacsFrameResize
, "EmacsFrameResize");
4959 DEFSYM (Qset_frame_size
, "set-frame-size");
4960 DEFSYM (Qframe_inhibit_resize
, "frame-inhibit-resize");
4961 DEFSYM (Qx_set_fullscreen
, "x-set-fullscreen");
4962 DEFSYM (Qx_check_fullscreen
, "x-check-fullscreen");
4963 DEFSYM (Qxg_frame_resized
, "xg-frame-resized");
4964 DEFSYM (Qxg_frame_set_char_size_1
, "xg-frame-set-char-size-1");
4965 DEFSYM (Qxg_frame_set_char_size_2
, "xg-frame-set-char-size-2");
4966 DEFSYM (Qxg_frame_set_char_size_3
, "xg-frame-set-char-size-3");
4967 DEFSYM (Qx_set_window_size_1
, "x-set-window-size-1");
4968 DEFSYM (Qx_set_window_size_2
, "x-set-window-size-2");
4969 DEFSYM (Qx_set_window_size_3
, "x-set-window-size-3");
4970 DEFSYM (Qxg_change_toolbar_position
, "xg-change-toolbar-position");
4971 DEFSYM (Qx_net_wm_state
, "x-net-wm-state");
4972 DEFSYM (Qx_handle_net_wm_state
, "x-handle-net-wm-state");
4973 DEFSYM (Qtb_size_cb
, "tb-size-cb");
4974 DEFSYM (Qupdate_frame_tool_bar
, "update-frame-tool-bar");
4975 DEFSYM (Qfree_frame_tool_bar
, "free-frame-tool-bar");
4976 DEFSYM (Qx_set_menu_bar_lines
, "x-set-menu-bar-lines");
4977 DEFSYM (Qchange_frame_size
, "change-frame-size");
4978 DEFSYM (Qxg_frame_set_char_size
, "xg-frame-set-char-size");
4979 DEFSYM (Qset_window_configuration
, "set-window-configuration");
4980 DEFSYM (Qx_create_frame_1
, "x-create-frame-1");
4981 DEFSYM (Qx_create_frame_2
, "x-create-frame-2");
4982 DEFSYM (Qterminal_frame
, "terminal-frame");
4985 DEFSYM (Qns_parse_geometry
, "ns-parse-geometry");
4988 DEFSYM (Qalpha
, "alpha");
4989 DEFSYM (Qauto_lower
, "auto-lower");
4990 DEFSYM (Qauto_raise
, "auto-raise");
4991 DEFSYM (Qborder_color
, "border-color");
4992 DEFSYM (Qborder_width
, "border-width");
4993 DEFSYM (Qbottom_divider_width
, "bottom-divider-width");
4994 DEFSYM (Qcursor_color
, "cursor-color");
4995 DEFSYM (Qcursor_type
, "cursor-type");
4996 DEFSYM (Qfont_backend
, "font-backend");
4997 DEFSYM (Qfullscreen
, "fullscreen");
4998 DEFSYM (Qhorizontal_scroll_bars
, "horizontal-scroll-bars");
4999 DEFSYM (Qicon_name
, "icon-name");
5000 DEFSYM (Qicon_type
, "icon-type");
5001 DEFSYM (Qinternal_border_width
, "internal-border-width");
5002 DEFSYM (Qleft_fringe
, "left-fringe");
5003 DEFSYM (Qline_spacing
, "line-spacing");
5004 DEFSYM (Qmenu_bar_lines
, "menu-bar-lines");
5005 DEFSYM (Qupdate_frame_menubar
, "update-frame-menubar");
5006 DEFSYM (Qfree_frame_menubar_1
, "free-frame-menubar-1");
5007 DEFSYM (Qfree_frame_menubar_2
, "free-frame-menubar-2");
5008 DEFSYM (Qmouse_color
, "mouse-color");
5009 DEFSYM (Qname
, "name");
5010 DEFSYM (Qright_divider_width
, "right-divider-width");
5011 DEFSYM (Qright_fringe
, "right-fringe");
5012 DEFSYM (Qscreen_gamma
, "screen-gamma");
5013 DEFSYM (Qscroll_bar_background
, "scroll-bar-background");
5014 DEFSYM (Qscroll_bar_foreground
, "scroll-bar-foreground");
5015 DEFSYM (Qscroll_bar_height
, "scroll-bar-height");
5016 DEFSYM (Qscroll_bar_width
, "scroll-bar-width");
5017 DEFSYM (Qsticky
, "sticky");
5018 DEFSYM (Qtitle
, "title");
5019 DEFSYM (Qtool_bar_lines
, "tool-bar-lines");
5020 DEFSYM (Qtool_bar_position
, "tool-bar-position");
5021 DEFSYM (Qunsplittable
, "unsplittable");
5022 DEFSYM (Qvertical_scroll_bars
, "vertical-scroll-bars");
5023 DEFSYM (Qvisibility
, "visibility");
5024 DEFSYM (Qwait_for_wm
, "wait-for-wm");
5029 for (i
= 0; i
< ARRAYELTS (frame_parms
); i
++)
5031 Lisp_Object v
= (frame_parms
[i
].sym
< 0
5032 ? intern_c_string (frame_parms
[i
].name
)
5033 : builtin_lisp_symbol (frame_parms
[i
].sym
));
5034 Fput (v
, Qx_frame_parameter
, make_number (i
));
5038 #ifdef HAVE_WINDOW_SYSTEM
5039 DEFVAR_LISP ("x-resource-name", Vx_resource_name
,
5040 doc
: /* The name Emacs uses to look up X resources.
5041 `x-get-resource' uses this as the first component of the instance name
5042 when requesting resource values.
5043 Emacs initially sets `x-resource-name' to the name under which Emacs
5044 was invoked, or to the value specified with the `-name' or `-rn'
5045 switches, if present.
5047 It may be useful to bind this variable locally around a call
5048 to `x-get-resource'. See also the variable `x-resource-class'. */);
5049 Vx_resource_name
= Qnil
;
5051 DEFVAR_LISP ("x-resource-class", Vx_resource_class
,
5052 doc
: /* The class Emacs uses to look up X resources.
5053 `x-get-resource' uses this as the first component of the instance class
5054 when requesting resource values.
5056 Emacs initially sets `x-resource-class' to "Emacs".
5058 Setting this variable permanently is not a reasonable thing to do,
5059 but binding this variable locally around a call to `x-get-resource'
5060 is a reasonable practice. See also the variable `x-resource-name'. */);
5061 Vx_resource_class
= build_string (EMACS_CLASS
);
5063 DEFVAR_LISP ("frame-alpha-lower-limit", Vframe_alpha_lower_limit
,
5064 doc
: /* The lower limit of the frame opacity (alpha transparency).
5065 The value should range from 0 (invisible) to 100 (completely opaque).
5066 You can also use a floating number between 0.0 and 1.0. */);
5067 Vframe_alpha_lower_limit
= make_number (20);
5070 DEFVAR_LISP ("default-frame-alist", Vdefault_frame_alist
,
5071 doc
: /* Alist of default values for frame creation.
5072 These may be set in your init file, like this:
5073 (setq default-frame-alist \\='((width . 80) (height . 55) (menu-bar-lines . 1)))
5074 These override values given in window system configuration data,
5075 including X Windows' defaults database.
5076 For values specific to the first Emacs frame, see `initial-frame-alist'.
5077 For window-system specific values, see `window-system-default-frame-alist'.
5078 For values specific to the separate minibuffer frame, see
5079 `minibuffer-frame-alist'.
5080 The `menu-bar-lines' element of the list controls whether new frames
5081 have menu bars; `menu-bar-mode' works by altering this element.
5082 Setting this variable does not affect existing frames, only new ones. */);
5083 Vdefault_frame_alist
= Qnil
;
5085 DEFVAR_LISP ("default-frame-scroll-bars", Vdefault_frame_scroll_bars
,
5086 doc
: /* Default position of vertical scroll bars on this window-system. */);
5087 #ifdef HAVE_WINDOW_SYSTEM
5088 #if defined (HAVE_NTGUI) || defined (NS_IMPL_COCOA) || (defined (USE_GTK) && defined (USE_TOOLKIT_SCROLL_BARS))
5089 /* MS-Windows, Mac OS X, and GTK have scroll bars on the right by
5091 Vdefault_frame_scroll_bars
= Qright
;
5093 Vdefault_frame_scroll_bars
= Qleft
;
5096 Vdefault_frame_scroll_bars
= Qnil
;
5099 DEFVAR_BOOL ("scroll-bar-adjust-thumb-portion",
5100 scroll_bar_adjust_thumb_portion_p
,
5101 doc
: /* Adjust thumb for overscrolling for Gtk+ and MOTIF.
5102 Non-nil means adjust the thumb in the scroll bar so it can be dragged downwards
5103 even if the end of the buffer is shown (i.e. overscrolling).
5104 Set to nil if you want the thumb to be at the bottom when the end of the buffer
5105 is shown. Also, the thumb fills the whole scroll bar when the entire buffer
5106 is visible. In this case you can not overscroll. */);
5107 scroll_bar_adjust_thumb_portion_p
= 1;
5109 DEFVAR_LISP ("terminal-frame", Vterminal_frame
,
5110 doc
: /* The initial frame-object, which represents Emacs's stdout. */);
5112 DEFVAR_LISP ("mouse-position-function", Vmouse_position_function
,
5113 doc
: /* If non-nil, function to transform normal value of `mouse-position'.
5114 `mouse-position' and `mouse-pixel-position' call this function, passing their
5115 usual return value as argument, and return whatever this function returns.
5116 This abnormal hook exists for the benefit of packages like `xt-mouse.el'
5117 which need to do mouse handling at the Lisp level. */);
5118 Vmouse_position_function
= Qnil
;
5120 DEFVAR_LISP ("mouse-highlight", Vmouse_highlight
,
5121 doc
: /* If non-nil, clickable text is highlighted when mouse is over it.
5122 If the value is an integer, highlighting is only shown after moving the
5123 mouse, while keyboard input turns off the highlight even when the mouse
5124 is over the clickable text. However, the mouse shape still indicates
5125 when the mouse is over clickable text. */);
5126 Vmouse_highlight
= Qt
;
5128 DEFVAR_LISP ("make-pointer-invisible", Vmake_pointer_invisible
,
5129 doc
: /* If non-nil, make pointer invisible while typing.
5130 The pointer becomes visible again when the mouse is moved. */);
5131 Vmake_pointer_invisible
= Qt
;
5133 DEFVAR_LISP ("focus-in-hook", Vfocus_in_hook
,
5134 doc
: /* Normal hook run when a frame gains input focus. */);
5135 Vfocus_in_hook
= Qnil
;
5137 DEFVAR_LISP ("focus-out-hook", Vfocus_out_hook
,
5138 doc
: /* Normal hook run when a frame loses input focus. */);
5139 Vfocus_out_hook
= Qnil
;
5141 DEFVAR_LISP ("delete-frame-functions", Vdelete_frame_functions
,
5142 doc
: /* Functions run before deleting a frame.
5143 The functions are run with one arg, the frame to be deleted.
5146 Note that functions in this list may be called just before the frame is
5147 actually deleted, or some time later (or even both when an earlier function
5148 in `delete-frame-functions' (indirectly) calls `delete-frame'
5150 Vdelete_frame_functions
= Qnil
;
5151 DEFSYM (Qdelete_frame_functions
, "delete-frame-functions");
5153 DEFVAR_LISP ("menu-bar-mode", Vmenu_bar_mode
,
5154 doc
: /* Non-nil if Menu-Bar mode is enabled.
5155 See the command `menu-bar-mode' for a description of this minor mode.
5156 Setting this variable directly does not take effect;
5157 either customize it (see the info node `Easy Customization')
5158 or call the function `menu-bar-mode'. */);
5159 Vmenu_bar_mode
= Qt
;
5161 DEFVAR_LISP ("tool-bar-mode", Vtool_bar_mode
,
5162 doc
: /* Non-nil if Tool-Bar mode is enabled.
5163 See the command `tool-bar-mode' for a description of this minor mode.
5164 Setting this variable directly does not take effect;
5165 either customize it (see the info node `Easy Customization')
5166 or call the function `tool-bar-mode'. */);
5167 #ifdef HAVE_WINDOW_SYSTEM
5168 Vtool_bar_mode
= Qt
;
5170 Vtool_bar_mode
= Qnil
;
5173 DEFVAR_KBOARD ("default-minibuffer-frame", Vdefault_minibuffer_frame
,
5174 doc
: /* Minibufferless frames use this frame's minibuffer.
5175 Emacs cannot create minibufferless frames unless this is set to an
5176 appropriate surrogate.
5178 Emacs consults this variable only when creating minibufferless
5179 frames; once the frame is created, it sticks with its assigned
5180 minibuffer, no matter what this variable is set to. This means that
5181 this variable doesn't necessarily say anything meaningful about the
5182 current set of frames, or where the minibuffer is currently being
5185 This variable is local to the current terminal and cannot be buffer-local. */);
5187 DEFVAR_BOOL ("focus-follows-mouse", focus_follows_mouse
,
5188 doc
: /* Non-nil if window system changes focus when you move the mouse.
5189 You should set this variable to tell Emacs how your window manager
5190 handles focus, since there is no way in general for Emacs to find out
5191 automatically. See also `mouse-autoselect-window'. */);
5192 focus_follows_mouse
= 0;
5194 DEFVAR_BOOL ("frame-resize-pixelwise", frame_resize_pixelwise
,
5195 doc
: /* Non-nil means resize frames pixelwise.
5196 If this option is nil, resizing a frame rounds its sizes to the frame's
5197 current values of `frame-char-height' and `frame-char-width'. If this
5198 is non-nil, no rounding occurs, hence frame sizes can increase/decrease
5201 With some window managers you may have to set this to non-nil in order
5202 to set the size of a frame in pixels, to maximize frames or to make them
5203 fullscreen. To resize your initial frame pixelwise, set this option to
5204 a non-nil value in your init file. */);
5205 frame_resize_pixelwise
= 0;
5207 DEFVAR_LISP ("frame-inhibit-implied-resize", frame_inhibit_implied_resize
,
5208 doc
: /* Whether frames should be resized implicitly.
5209 If this option is nil, setting font, menu bar, tool bar, internal
5210 borders, fringes or scroll bars of a specific frame may resize the frame
5211 in order to preserve the number of columns or lines it displays. If
5212 this option is t, no such resizing is done. Note that the size of
5213 fullscreen and maximized frames, the height of fullheight frames and the
5214 width of fullwidth frames never change implicitly.
5216 The value of this option can be also be a list of frame parameters. In
5217 this case, resizing is inhibited when changing a parameter that appears
5218 in that list. The parameters currently handled by this option include
5219 `font', `font-backend', `internal-border-width', `menu-bar-lines' and
5222 Changing any of the parameters `scroll-bar-width', `scroll-bar-height',
5223 `vertical-scroll-bars', `horizontal-scroll-bars', `left-fringe' and
5224 `right-fringe' is handled as if the frame contained just one live
5225 window. This means, for example, that removing vertical scroll bars on
5226 a frame containing several side by side windows will shrink the frame
5227 width by the width of one scroll bar provided this option is nil and
5228 keep it unchanged if this option is either t or a list containing
5229 `vertical-scroll-bars'.
5231 The default value is \\='(tool-bar-lines) on Lucid, Motif and Windows
5232 \(which means that adding/removing a tool bar does not change the frame
5233 height), nil on all other window systems including GTK+ (which means
5234 that changing any of the parameters listed above may change the size of
5235 the frame), and t otherwise (which means the frame size never changes
5236 implicitly when there's no window system support).
5238 Note that when a frame is not large enough to accommodate a change of
5239 any of the parameters listed above, Emacs may try to enlarge the frame
5240 even if this option is non-nil. */);
5241 #if defined (HAVE_WINDOW_SYSTEM)
5242 #if defined (USE_LUCID) || defined (USE_MOTIF) || defined (HAVE_NTGUI)
5243 frame_inhibit_implied_resize
= list1 (Qtool_bar_lines
);
5245 frame_inhibit_implied_resize
= Qnil
;
5248 frame_inhibit_implied_resize
= Qt
;
5251 DEFVAR_LISP ("frame-size-history", frame_size_history
,
5252 doc
: /* History of frame size adjustments.
5253 If non-nil, list recording frame size adjustment. Adjustments are
5254 recorded only if the first element of this list is a positive number.
5255 Adding an adjustment decrements that number by one.
5257 The remaining elements are the adjustments. Each adjustment is a list
5258 of four elements `frame', `function', `sizes' and `more'. `frame' is
5259 the affected frame and `function' the invoking function. `sizes' is
5260 usually a list of four elements `old-width', `old-height', `new-width'
5261 and `new-height' representing the old and new sizes recorded/requested
5262 by `function'. `more' is a list with additional information.
5264 The function `frame--size-history' displays the value of this variable
5265 in a more readable form. */);
5266 frame_size_history
= Qnil
;
5268 DEFVAR_BOOL ("tooltip-reuse-hidden-frame", tooltip_reuse_hidden_frame
,
5269 doc
: /* Non-nil means reuse hidden tooltip frames.
5270 When this is nil, delete a tooltip frame when hiding the associated
5271 tooltip. When this is non-nil, make the tooltip frame invisible only,
5272 so it can be reused when the next tooltip is shown.
5274 Setting this to non-nil may drastically reduce the consing overhead
5275 incurred by creating new tooltip frames. However, a value of non-nil
5276 means also that intermittent changes of faces or `default-frame-alist'
5277 are not applied when showing a tooltip in a reused frame.
5279 This variable is effective only with the X toolkit (and there only when
5280 Gtk+ tooltips are not used) and on Windows. */);
5281 tooltip_reuse_hidden_frame
= false;
5283 staticpro (&Vframe_list
);
5286 defsubr (&Sframe_live_p
);
5287 defsubr (&Swindow_system
);
5288 defsubr (&Sframe_windows_min_size
);
5289 defsubr (&Smake_terminal_frame
);
5290 defsubr (&Shandle_switch_frame
);
5291 defsubr (&Sselect_frame
);
5292 defsubr (&Sselected_frame
);
5293 defsubr (&Sframe_list
);
5294 defsubr (&Snext_frame
);
5295 defsubr (&Sprevious_frame
);
5296 defsubr (&Slast_nonminibuf_frame
);
5297 defsubr (&Sdelete_frame
);
5298 defsubr (&Smouse_position
);
5299 defsubr (&Smouse_pixel_position
);
5300 defsubr (&Sset_mouse_position
);
5301 defsubr (&Sset_mouse_pixel_position
);
5303 defsubr (&Sframe_configuration
);
5304 defsubr (&Srestore_frame_configuration
);
5306 defsubr (&Smake_frame_visible
);
5307 defsubr (&Smake_frame_invisible
);
5308 defsubr (&Siconify_frame
);
5309 defsubr (&Sframe_visible_p
);
5310 defsubr (&Svisible_frame_list
);
5311 defsubr (&Sraise_frame
);
5312 defsubr (&Slower_frame
);
5313 defsubr (&Sx_focus_frame
);
5314 defsubr (&Sframe_after_make_frame
);
5315 defsubr (&Sredirect_frame_focus
);
5316 defsubr (&Sframe_focus
);
5317 defsubr (&Sframe_parameters
);
5318 defsubr (&Sframe_parameter
);
5319 defsubr (&Smodify_frame_parameters
);
5320 defsubr (&Sframe_char_height
);
5321 defsubr (&Sframe_char_width
);
5322 defsubr (&Sframe_pixel_height
);
5323 defsubr (&Sframe_pixel_width
);
5324 defsubr (&Sframe_text_cols
);
5325 defsubr (&Sframe_text_lines
);
5326 defsubr (&Sframe_total_cols
);
5327 defsubr (&Sframe_total_lines
);
5328 defsubr (&Sframe_text_width
);
5329 defsubr (&Sframe_text_height
);
5330 defsubr (&Sscroll_bar_width
);
5331 defsubr (&Sscroll_bar_height
);
5332 defsubr (&Sfringe_width
);
5333 defsubr (&Sborder_width
);
5334 defsubr (&Sright_divider_width
);
5335 defsubr (&Sbottom_divider_width
);
5336 defsubr (&Stool_bar_pixel_width
);
5337 defsubr (&Sset_frame_height
);
5338 defsubr (&Sset_frame_width
);
5339 defsubr (&Sset_frame_size
);
5340 defsubr (&Sframe_position
);
5341 defsubr (&Sset_frame_position
);
5342 defsubr (&Sframe_pointer_visible_p
);
5344 #ifdef HAVE_WINDOW_SYSTEM
5345 defsubr (&Sx_get_resource
);
5346 defsubr (&Sx_parse_geometry
);