Fix recently-introduced copy-directory bug
[emacs.git] / doc / lispref / frames.texi
blob6431bbdedb979a360329cec6dd6fec6147ad8058
1 @c -*-texinfo-*-
2 @c This is part of the GNU Emacs Lisp Reference Manual.
3 @c Copyright (C) 1990-1995, 1998-1999, 2001-2017 Free Software
4 @c Foundation, Inc.
5 @c See the file elisp.texi for copying conditions.
6 @node Frames
7 @chapter Frames
8 @cindex frame
10   A @dfn{frame} is a screen object that contains one or more Emacs
11 windows (@pxref{Windows}).  It is the kind of object called a
12 ``window'' in the terminology of graphical environments; but we can't
13 call it a ``window'' here, because Emacs uses that word in a different
14 way.  In Emacs Lisp, a @dfn{frame object} is a Lisp object that
15 represents a frame on the screen.  @xref{Frame Type}.
17   A frame initially contains a single main window and/or a minibuffer
18 window; you can subdivide the main window vertically or horizontally
19 into smaller windows.  @xref{Splitting Windows}.
21 @cindex terminal
22   A @dfn{terminal} is a display device capable of displaying one or
23 more Emacs frames.  In Emacs Lisp, a @dfn{terminal object} is a Lisp
24 object that represents a terminal.  @xref{Terminal Type}.
26 @cindex text terminal
27 @cindex graphical terminal
28 @cindex graphical display
29   There are two classes of terminals: @dfn{text terminals} and
30 @dfn{graphical terminals}.  Text terminals are non-graphics-capable
31 displays, including @command{xterm} and other terminal emulators.  On
32 a text terminal, each Emacs frame occupies the terminal's entire
33 screen; although you can create additional frames and switch between
34 them, the terminal only shows one frame at a time.  Graphical
35 terminals, on the other hand, are managed by graphical display systems
36 such as the X Window System, which allow Emacs to show multiple frames
37 simultaneously on the same display.
39   On GNU and Unix systems, you can create additional frames on any
40 available terminal, within a single Emacs session, regardless of
41 whether Emacs was started on a text or graphical terminal.  Emacs can
42 display on both graphical and text terminals simultaneously.  This
43 comes in handy, for instance, when you connect to the same session
44 from several remote locations.  @xref{Multiple Terminals}.
46 @defun framep object
47 This predicate returns a non-@code{nil} value if @var{object} is a
48 frame, and @code{nil} otherwise.  For a frame, the value indicates which
49 kind of display the frame uses:
51 @table @code
52 @item t
53 The frame is displayed on a text terminal.
54 @item x
55 The frame is displayed on an X graphical terminal.
56 @item w32
57 The frame is displayed on a MS-Windows graphical terminal.
58 @item ns
59 The frame is displayed on a GNUstep or Macintosh Cocoa graphical
60 terminal.
61 @item pc
62 The frame is displayed on an MS-DOS terminal.
63 @end table
64 @end defun
66 @defun frame-terminal &optional frame
67 This function returns the terminal object that displays @var{frame}.
68 If @var{frame} is @code{nil} or unspecified, it defaults to the
69 selected frame.
70 @end defun
72 @defun terminal-live-p object
73 This predicate returns a non-@code{nil} value if @var{object} is a
74 terminal that is live (i.e., not deleted), and @code{nil} otherwise.
75 For live terminals, the return value indicates what kind of frames are
76 displayed on that terminal; the list of possible values is the same as
77 for @code{framep} above.
78 @end defun
80 @cindex top-level frame
81 On a graphical terminal we distinguish two types of frames: A normal
82 @dfn{top-level frame} is a frame whose window-system window is a child
83 of the window-system's root window for that terminal.  A child frame is
84 a frame whose window-system window is the child of the window-system
85 window of another Emacs frame.  @xref{Child Frames}.
87 @menu
88 * Creating Frames::             Creating additional frames.
89 * Multiple Terminals::          Displaying on several different devices.
90 * Frame Geometry::              Geometric properties of frames.
91 * Frame Parameters::            Controlling frame size, position, font, etc.
92 * Terminal Parameters::         Parameters common for all frames on terminal.
93 * Frame Titles::                Automatic updating of frame titles.
94 * Deleting Frames::             Frames last until explicitly deleted.
95 * Finding All Frames::          How to examine all existing frames.
96 * Minibuffers and Frames::      How a frame finds the minibuffer to use.
97 * Input Focus::                 Specifying the selected frame.
98 * Visibility of Frames::        Frames may be visible or invisible, or icons.
99 * Raising and Lowering::        Raising, Lowering and Restacking Frames.
100 * Frame Configurations::        Saving the state of all frames.
101 * Child Frames::                Making a frame the child of another.
102 * Mouse Tracking::              Getting events that say when the mouse moves.
103 * Mouse Position::              Asking where the mouse is, or moving it.
104 * Pop-Up Menus::                Displaying a menu for the user to select from.
105 * Dialog Boxes::                Displaying a box to ask yes or no.
106 * Pointer Shape::               Specifying the shape of the mouse pointer.
107 * Window System Selections::    Transferring text to and from other X clients.
108 * Drag and Drop::               Internals of Drag-and-Drop implementation.
109 * Color Names::                 Getting the definitions of color names.
110 * Text Terminal Colors::        Defining colors for text terminals.
111 * Resources::                   Getting resource values from the server.
112 * Display Feature Testing::     Determining the features of a terminal.
113 @end menu
115 @node Creating Frames
116 @section Creating Frames
117 @cindex frame creation
119 To create a new frame, call the function @code{make-frame}.
121 @deffn Command make-frame &optional alist
122 This function creates and returns a new frame, displaying the current
123 buffer.
125 The @var{alist} argument is an alist that specifies frame parameters
126 for the new frame.  @xref{Frame Parameters}.  If you specify the
127 @code{terminal} parameter in @var{alist}, the new frame is created on
128 that terminal.  Otherwise, if you specify the @code{window-system}
129 frame parameter in @var{alist}, that determines whether the frame
130 should be displayed on a text terminal or a graphical terminal.
131 @xref{Window Systems}.  If neither is specified, the new frame is
132 created in the same terminal as the selected frame.
134 Any parameters not mentioned in @var{alist} default to the values in
135 the alist @code{default-frame-alist} (@pxref{Initial Parameters});
136 parameters not specified there default from the X resources or its
137 equivalent on your operating system (@pxref{X Resources,, X Resources,
138 emacs, The GNU Emacs Manual}).  After the frame is created, Emacs
139 applies any parameters listed in @code{frame-inherited-parameters}
140 (see below) and not present in the argument, taking the values from
141 the frame that was selected when @code{make-frame} was called.
143 Note that on multi-monitor displays (@pxref{Multiple Terminals}), the
144 window manager might position the frame differently than specified by
145 the positional parameters in @var{alist} (@pxref{Position
146 Parameters}).  For example, some window managers have a policy of
147 displaying the frame on the monitor that contains the largest part of
148 the window (a.k.a.@: the @dfn{dominating} monitor).
150 This function itself does not make the new frame the selected frame.
151 @xref{Input Focus}.  The previously selected frame remains selected.
152 On graphical terminals, however, the windowing system may select the
153 new frame for its own reasons.
154 @end deffn
156 @defvar before-make-frame-hook
157 A normal hook run by @code{make-frame} before it creates the frame.
158 @end defvar
160 @defvar after-make-frame-functions
161 An abnormal hook run by @code{make-frame} after it creates the frame.
162 Each function in @code{after-make-frame-functions} receives one argument, the
163 frame just created.
164 @end defvar
166 @defvar frame-inherited-parameters
167 This variable specifies the list of frame parameters that a newly
168 created frame inherits from the currently selected frame.  For each
169 parameter (a symbol) that is an element in the list and is not present
170 in the argument to @code{make-frame}, the function sets the value of
171 that parameter in the created frame to its value in the selected
172 frame.
173 @end defvar
175 @node Multiple Terminals
176 @section Multiple Terminals
177 @cindex multiple terminals
178 @cindex multi-tty
179 @cindex multiple X displays
180 @cindex displays, multiple
182   Emacs represents each terminal as a @dfn{terminal object} data type
183 (@pxref{Terminal Type}).  On GNU and Unix systems, Emacs can use
184 multiple terminals simultaneously in each session.  On other systems,
185 it can only use a single terminal.  Each terminal object has the
186 following attributes:
188 @itemize @bullet
189 @item
190 The name of the device used by the terminal (e.g., @samp{:0.0} or
191 @file{/dev/tty}).
193 @item
194 The terminal and keyboard coding systems used on the terminal.
195 @xref{Terminal I/O Encoding}.
197 @item
198 The kind of display associated with the terminal.  This is the symbol
199 returned by the function @code{terminal-live-p} (i.e., @code{x},
200 @code{t}, @code{w32}, @code{ns}, or @code{pc}).  @xref{Frames}.
202 @item
203 A list of terminal parameters.  @xref{Terminal Parameters}.
204 @end itemize
206   There is no primitive for creating terminal objects.  Emacs creates
207 them as needed, such as when you call @code{make-frame-on-display}
208 (described below).
210 @defun terminal-name &optional terminal
211 This function returns the file name of the device used by
212 @var{terminal}.  If @var{terminal} is omitted or @code{nil}, it
213 defaults to the selected frame's terminal.  @var{terminal} can also be
214 a frame, meaning that frame's terminal.
215 @end defun
217 @defun terminal-list
218 This function returns a list of all live terminal objects.
219 @end defun
221 @defun get-device-terminal device
222 This function returns a terminal whose device name is given by
223 @var{device}.  If @var{device} is a string, it can be either the file
224 name of a terminal device, or the name of an X display of the form
225 @samp{@var{host}:@var{server}.@var{screen}}.  If @var{device} is a
226 frame, this function returns that frame's terminal; @code{nil} means
227 the selected frame.  Finally, if @var{device} is a terminal object
228 that represents a live terminal, that terminal is returned.  The
229 function signals an error if its argument is none of the above.
230 @end defun
232 @defun delete-terminal &optional terminal force
233 This function deletes all frames on @var{terminal} and frees the
234 resources used by it.  It runs the abnormal hook
235 @code{delete-terminal-functions}, passing @var{terminal} as the
236 argument to each function.
238 If @var{terminal} is omitted or @code{nil}, it defaults to the
239 selected frame's terminal.  @var{terminal} can also be a frame,
240 meaning that frame's terminal.
242 Normally, this function signals an error if you attempt to delete the
243 sole active terminal, but if @var{force} is non-@code{nil}, you are
244 allowed to do so.  Emacs automatically calls this function when the
245 last frame on a terminal is deleted (@pxref{Deleting Frames}).
246 @end defun
248 @defvar delete-terminal-functions
249 An abnormal hook run by @code{delete-terminal}.  Each function
250 receives one argument, the @var{terminal} argument passed to
251 @code{delete-terminal}.  Due to technical details, the functions may
252 be called either just before the terminal is deleted, or just
253 afterwards.
254 @end defvar
256 @cindex terminal-local variables
257   A few Lisp variables are @dfn{terminal-local}; that is, they have a
258 separate binding for each terminal.  The binding in effect at any time
259 is the one for the terminal that the currently selected frame belongs
260 to.  These variables include @code{default-minibuffer-frame},
261 @code{defining-kbd-macro}, @code{last-kbd-macro}, and
262 @code{system-key-alist}.  They are always terminal-local, and can
263 never be buffer-local (@pxref{Buffer-Local Variables}).
265   On GNU and Unix systems, each X display is a separate graphical
266 terminal.  When Emacs is started from within the X window system, it
267 uses the X display specified by the @env{DISPLAY} environment
268 variable, or by the @samp{--display} option (@pxref{Initial Options,,,
269 emacs, The GNU Emacs Manual}).  Emacs can connect to other X displays
270 via the command @code{make-frame-on-display}.  Each X display has its
271 own selected frame and its own minibuffer windows; however, only one
272 of those frames is @emph{the} selected frame at any given moment
273 (@pxref{Input Focus}).  Emacs can even connect to other text
274 terminals, by interacting with the @command{emacsclient} program.
275 @xref{Emacs Server,,, emacs, The GNU Emacs Manual}.
277 @cindex X display names
278 @cindex display name on X
279   A single X server can handle more than one display.  Each X display
280 has a three-part name,
281 @samp{@var{hostname}:@var{displaynumber}.@var{screennumber}}.  The
282 first part, @var{hostname}, specifies the name of the machine to which
283 the display is physically connected.  The second part,
284 @var{displaynumber}, is a zero-based number that identifies one or
285 more monitors connected to that machine that share a common keyboard
286 and pointing device (mouse, tablet, etc.).  The third part,
287 @var{screennumber}, identifies a zero-based screen number (a separate
288 monitor) that is part of a single monitor collection on that X server.
289 When you use two or more screens belonging to one server, Emacs knows
290 by the similarity in their names that they share a single keyboard.
292   Systems that don't use the X window system, such as MS-Windows,
293 don't support the notion of X displays, and have only one display on
294 each host.  The display name on these systems doesn't follow the above
295 3-part format; for example, the display name on MS-Windows systems is
296 a constant string @samp{w32}, and exists for compatibility, so that
297 you could pass it to functions that expect a display name.
299 @deffn Command make-frame-on-display display &optional parameters
300 This function creates and returns a new frame on @var{display}, taking
301 the other frame parameters from the alist @var{parameters}.
302 @var{display} should be the name of an X display (a string).
304 Before creating the frame, this function ensures that Emacs is set
305 up to display graphics.  For instance, if Emacs has not processed X
306 resources (e.g., if it was started on a text terminal), it does so at
307 this time.  In all other respects, this function behaves like
308 @code{make-frame} (@pxref{Creating Frames}).
309 @end deffn
311 @defun x-display-list
312 This function returns a list that indicates which X displays Emacs has
313 a connection to.  The elements of the list are strings, and each one
314 is a display name.
315 @end defun
317 @defun x-open-connection display &optional xrm-string must-succeed
318 This function opens a connection to the X display @var{display},
319 without creating a frame on that display.  Normally, Emacs Lisp
320 programs need not call this function, as @code{make-frame-on-display}
321 calls it automatically.  The only reason for calling it is to check
322 whether communication can be established with a given X display.
324 The optional argument @var{xrm-string}, if not @code{nil}, is a string
325 of resource names and values, in the same format used in the
326 @file{.Xresources} file.  @xref{X Resources,, X Resources, emacs, The
327 GNU Emacs Manual}.  These values apply to all Emacs frames created on
328 this display, overriding the resource values recorded in the X server.
329 Here's an example of what this string might look like:
331 @example
332 "*BorderWidth: 3\n*InternalBorder: 2\n"
333 @end example
335 If @var{must-succeed} is non-@code{nil}, failure to open the connection
336 terminates Emacs.  Otherwise, it is an ordinary Lisp error.
337 @end defun
339 @defun x-close-connection display
340 This function closes the connection to display @var{display}.  Before
341 you can do this, you must first delete all the frames that were open
342 on that display (@pxref{Deleting Frames}).
343 @end defun
345 @cindex multi-monitor
346   On some multi-monitor setups, a single X display outputs to more
347 than one physical monitor.  You can use the functions
348 @code{display-monitor-attributes-list} and @code{frame-monitor-attributes}
349 to obtain information about such setups.
351 @defun display-monitor-attributes-list &optional display
352 This function returns a list of physical monitor attributes on
353 @var{display}, which can be a display name (a string), a terminal, or
354 a frame; if omitted or @code{nil}, it defaults to the selected frame's
355 display.  Each element of the list is an association list,
356 representing the attributes of a physical monitor.  The first element
357 corresponds to the primary monitor.  The attribute keys and values
358 are:
360 @table @samp
361 @item geometry
362 Position of the top-left corner of the monitor's screen and its size,
363 in pixels, as @samp{(@var{x} @var{y} @var{width} @var{height})}.  Note
364 that, if the monitor is not the primary monitor, some of the
365 coordinates might be negative.
367 @item workarea
368 Position of the top-left corner and size of the work area (usable
369 space) in pixels as @samp{(@var{x} @var{y} @var{width} @var{height})}.
370 This may be different from @samp{geometry} in that space occupied by
371 various window manager features (docks, taskbars, etc.)@: may be
372 excluded from the work area.  Whether or not such features actually
373 subtract from the work area depends on the platform and environment.
374 Again, if the monitor is not the primary monitor, some of the
375 coordinates might be negative.
377 @item mm-size
378 Width and height in millimeters as @samp{(@var{width} @var{height})}
380 @item frames
381 List of frames that this physical monitor dominates (see below).
383 @item name
384 Name of the physical monitor as @var{string}.
386 @item source
387 Source of the multi-monitor information as @var{string};
388 e.g., @samp{XRandr} or @samp{Xinerama}.
389 @end table
391 @var{x}, @var{y}, @var{width}, and @var{height} are integers.
392 @samp{name} and @samp{source} may be absent.
394 A frame is @dfn{dominated} by a physical monitor when either the
395 largest area of the frame resides in that monitor, or (if the frame
396 does not intersect any physical monitors) that monitor is the closest
397 to the frame.  Every (non-tooltip) frame (whether visible or not) in a
398 graphical display is dominated by exactly one physical monitor at a
399 time, though the frame can span multiple (or no) physical monitors.
401 Here's an example of the data produced by this function on a 2-monitor
402 display:
404 @lisp
405   (display-monitor-attributes-list)
406   @result{}
407   (((geometry 0 0 1920 1080) ;; @r{Left-hand, primary monitor}
408     (workarea 0 0 1920 1050) ;; @r{A taskbar occupies some of the height}
409     (mm-size 677 381)
410     (name . "DISPLAY1")
411     (frames #<frame emacs@@host *Messages* 0x11578c0>
412             #<frame emacs@@host *scratch* 0x114b838>))
413    ((geometry 1920 0 1680 1050) ;; @r{Right-hand monitor}
414     (workarea 1920 0 1680 1050) ;; @r{Whole screen can be used}
415     (mm-size 593 370)
416     (name . "DISPLAY2")
417     (frames)))
418 @end lisp
420 @end defun
422 @defun frame-monitor-attributes &optional frame
423 This function returns the attributes of the physical monitor
424 dominating (see above) @var{frame}, which defaults to the selected frame.
425 @end defun
428 @node Frame Geometry
429 @section Frame Geometry
430 @cindex frame geometry
431 @cindex frame position
432 @cindex position of frame
433 @cindex frame size
434 @cindex size of frame
436 The geometry of a frame depends on the toolkit that was used to build
437 this instance of Emacs and the terminal that displays the frame.  This
438 chapter describes these dependencies and some of the functions to deal
439 with them.  Note that the @var{frame} argument of all of these functions
440 has to specify a live frame (@pxref{Deleting Frames}).  If omitted or
441 @code{nil}, it specifies the selected frame (@pxref{Input Focus}).
443 @menu
444 * Frame Layout::            Basic layout of frames.
445 * Frame Font::              The default font of a frame and how to set it.
446 * Frame Position::          The position of a frame on its display.
447 * Frame Size::              Specifying and retrieving a frame's size.
448 * Implied Frame Resizing::  Implied resizing of frames and how to prevent it.
449 @end menu
452 @node Frame Layout
453 @subsection Frame Layout
454 @cindex frame layout
455 @cindex layout of frame
457 A visible frame occupies a rectangular area on its terminal's display.
458 This area may contain a number of nested rectangles, each serving a
459 different purpose.  The drawing below sketches the layout of a frame on
460 a graphical terminal:
461 @smallexample
462 @group
464         <------------ Outer Frame Width ----------->
465         ____________________________________________
466      ^(0)  ________ External/Outer Border _______   |
467      | |  |_____________ Title Bar ______________|  |
468      | | (1)_____________ Menu Bar ______________|  | ^
469      | | (2)_____________ Tool Bar ______________|  | ^
470      | | (3) _________ Internal Border ________  |  | ^
471      | |  | |   ^                              | |  | |
472      | |  | |   |                              | |  | |
473 Outer  |  | | Inner                            | |  | Native
474 Frame  |  | | Frame                            | |  | Frame
475 Height |  | | Height                           | |  | Height
476      | |  | |   |                              | |  | |
477      | |  | |<--+--- Inner Frame Width ------->| |  | |
478      | |  | |   |                              | |  | |
479      | |  | |___v______________________________| |  | |
480      | |  |___________ Internal Border __________|  | v
481      v |___________ External/Outer Border __________|
482            <-------- Native Frame Width -------->
484 @end group
485 @end smallexample
487 In practice not all of the areas shown in the drawing will or may be
488 present.  The meaning of these areas is described below.
490 @table @samp
491 @item Outer Frame
492 @cindex outer frame
493 @cindex outer edges
494 @cindex outer width
495 @cindex outer height
496 @cindex outer size
497 The @dfn{outer frame} is a rectangle comprising all areas shown in the
498 drawing.  The edges of that rectangle are called the @dfn{outer edges}
499 of the frame.  Together, the @dfn{outer width} and @dfn{outer height} of
500 the frame specify the @dfn{outer size} of that rectangle.
502 Knowing the outer size of a frame is useful for fitting a frame into the
503 working area of its display (@pxref{Multiple Terminals}) or for placing
504 two frames adjacent to each other on the screen.  Usually, the outer
505 size of a frame is available only after the frame has been mapped (made
506 visible, @pxref{Visibility of Frames}) at least once.  For the initial
507 frame or a frame that has not been created yet, the outer size can be
508 only estimated or must be calculated from the window-system's or window
509 manager's defaults.  One workaround is to obtain the differences of the
510 outer and native (see below) sizes of a mapped frame and use them for
511 calculating the outer size of the new frame.
513 @cindex outer position
514 The position of the upper left corner of the outer frame (indicated by
515 @samp{(0)} in the drawing above) is the @dfn{outer position} of the
516 frame.  The outer position of a graphical frame is also referred to as
517 ``the position'' of the frame because it usually remains unchanged on
518 its display whenever the frame is resized or its layout is changed.
520 The outer position is specified by and can be set via the @code{left}
521 and @code{top} frame parameters (@pxref{Position Parameters}).  For a
522 normal, top-level frame these parameters usually represent its absolute
523 position (see below) with respect to its display's origin.  For a child
524 frame (@pxref{Child Frames}) these parameters represent its position
525 relative to the native position (see below) of its parent frame.  For
526 frames on text terminals the values of these parameters are meaningless
527 and always zero.
529 @item External Border
530 @cindex external border
531 The @dfn{external border} is part of the decorations supplied by the
532 window manager.  It is typically used for resizing the frame with the
533 mouse and is therefore not shown on ``fullboth'' and maximized frames
534 (@pxref{Size Parameters}).  Its width is determined by the window
535 manager and cannot be changed by Emacs' functions.
537 External borders don't exist on text terminal frames.  For graphical
538 frames, their display can be suppressed by setting the
539 @code{override-redirect} or @code{undecorated} frame parameter
540 (@pxref{Management Parameters}).
542 @item Outer Border
543 @cindex outer border
544 The @dfn{outer border} is a separate border whose width can be specified
545 with the @code{border-width} frame parameter (@pxref{Layout
546 Parameters}).  In practice, either the external or the outer border of a
547 frame are displayed but never both at the same time.  Usually, the outer
548 border is shown only for special frames that are not (fully) controlled
549 by the window manager like tooltip frames (@pxref{Tooltips}), child
550 frames (@pxref{Child Frames}) and @code{undecorated} or
551 @code{override-redirect} frames (@pxref{Management Parameters}).
553 Outer borders are never shown on text terminal frames and on frames
554 generated by GTK+ routines.  On MS-Windows, the outer border is emulated
555 with the help of a one pixel wide external border.  Non-toolkit builds
556 on X allow to change the color of the outer border by setting the
557 @code{border-color} frame parameter (@pxref{Layout Parameters}).
559 @item Title Bar
560 @cindex title bar
561 @cindex caption bar
562 The @dfn{title bar}, a.k.a.@ @dfn{caption bar}, is also part of the
563 window manager's decorations and typically displays the title of the
564 frame (@pxref{Frame Titles}) as well as buttons for minimizing,
565 maximizing and deleting the frame.  It can be also used for dragging
566 the frame with the mouse.  The title bar is usually not displayed for
567 fullboth (@pxref{Size Parameters}), tooltip (@pxref{Tooltips}) and
568 child frames (@pxref{Child Frames}) and doesn't exist for terminal
569 frames.  Display of the title bar can be suppressed by setting the
570 @code{override-redirect} or the @code{undecorated} frame parameters
571 (@pxref{Management Parameters}).
573 @item Menu Bar
574 @cindex internal menu bar
575 @cindex external menu bar
576 The menu bar (@pxref{Menu Bar}) can be either internal (drawn by Emacs
577 itself) or external (drawn by the toolkit).  Most builds (GTK+, Lucid,
578 Motif and MS-Windows) rely on an external menu bar.  NS also uses an
579 external menu bar which, however, is not part of the outer frame.
580 Non-toolkit builds can provide an internal menu bar.  On text terminal
581 frames, the menu bar is part of the frame's root window (@pxref{Windows
582 and Frames}).  As a rule, menu bars are never shown on child frames
583 (@pxref{Child Frames}).  Display of the menu bar can be suppressed by
584 setting the @code{menu-bar-lines} parameter (@pxref{Layout Parameters})
585 to zero.
587 Whether the menu bar is wrapped or truncated whenever its width
588 becomes too large to fit on its frame depends on the toolkit .
589 Usually, only Motif and MS-Windows builds can wrap the menu bar.  When
590 they (un-)wrap the menu bar, they try to keep the outer height of the
591 frame unchanged, so the native height of the frame (see below) will
592 change instead.
594 @item Tool Bar
595 @cindex internal tool bar
596 @cindex external tool bar
597 Like the menu bar, the tool bar (@pxref{Tool Bar}) can be either
598 internal (drawn by Emacs itself) or external (drawn by a toolkit).  The
599 GTK+ and NS builds have the tool bar drawn by the toolkit.  The
600 remaining builds use internal tool bars.  With GTK+ the tool bar can be
601 located on either side of the frame, immediately outside the internal
602 border, see below.  Tool bars are usually not shown for child frames
603 (@pxref{Child Frames}).  Display of the tool bar can be suppressed by
604 setting the @code{tool-bar-lines} parameter (@pxref{Layout
605 Parameters}) to zero.
607 If the variable @code{auto-resize-tool-bars} is non-@code{nil}, Emacs
608 wraps the internal tool bar when its width becomes too large for its
609 frame.  If and when Emacs (un-)wraps the internal tool bar, it by
610 default keeps the outer height of the frame unchanged, so the native
611 height of the frame (see below) will change instead.  Emacs built with
612 GTK+, on the other hand, never wraps the tool bar but may
613 automatically increase the outer width of a frame in order to
614 accommodate an overlong tool bar.
616 @item Native Frame
617 @cindex native frame
618 @cindex native edges
619 @cindex native width
620 @cindex native height
621 @cindex native size
622 The @dfn{native frame} is a rectangle located entirely within the outer
623 frame.  It excludes the areas occupied by an external or outer border,
624 the title bar and any external menu or tool bar.  The edges of the
625 native frame are called the @dfn{native edges} of the frame.  Together,
626 the @dfn{native width} and @dfn{native height} of a frame specify the
627 @dfn{native size} of the frame.
629 The native size of a frame is the size Emacs passes to the window-system
630 or window manager when creating or resizing the frame from within Emacs.
631 It is also the size Emacs receives from the window-system or window
632 manager whenever these resize the frame's window-system window, for
633 example, after maximizing the frame by clicking on the corresponding
634 button in the title bar or when dragging its external border with the
635 mouse.
637 @cindex native position
638 The position of the top left corner of the native frame specifies the
639 @dfn{native position} of the frame.  (1)--(3) in the drawing above
640 indicate that position for the various builds:
642 @itemize @w{}
643 @item (1) non-toolkit and terminal frames
645 @item (2) Lucid, Motif and MS-Windows frames
647 @item (3) GTK+ and NS frames
648 @end itemize
650 Accordingly, the native height of a frame may include the height of the
651 tool bar but not that of the menu bar (Lucid, Motif, MS-Windows) or
652 those of the menu bar and the tool bar (non-toolkit and text terminal
653 frames).
655 The native position of a frame is the reference position for functions
656 that set or return the current position of the mouse (@pxref{Mouse
657 Position}) and for functions dealing with the position of windows like
658 @code{window-edges}, @code{window-at} or @code{coordinates-in-window-p}
659 (@pxref{Coordinates and Windows}).  It also specifies the (0, 0) origin
660 for locating and positioning child frames within this frame
661 (@pxref{Child Frames}).
663 Note also that the native position of a frame usually remains unaltered
664 on its display when removing or adding the window manager decorations by
665 changing the frame's @code{override-redirect} or @code{undecorated}
666 parameter (@pxref{Management Parameters}).
668 @item Internal Border
669 The internal border is a border drawn by Emacs around the inner frame
670 (see below).  Its width is specified by the @code{internal-border-width}
671 frame parameter (@pxref{Layout Parameters}).  Its color is specified by
672 the background of the @code{internal-border} face.
674 @item Inner Frame
675 @cindex inner frame
676 @cindex inner edges
677 @cindex inner width
678 @cindex inner height
679 @cindex inner size
680 @cindex display area
681 The @dfn{inner frame} is the rectangle reserved for the frame's windows.
682 It's enclosed by the internal border which, however, is not part of the
683 inner frame.  Its edges are called the @dfn{inner edges} of the frame.
684 The @dfn{inner width} and @dfn{inner height} specify the @dfn{inner
685 size} of the rectangle.  The inner frame is sometimes also referred to
686 as the @dfn{display area} of the frame.
688 @cindex minibuffer-less frame
689 @cindex minibuffer-only frame
690 As a rule, the inner frame is subdivided into the frame's root window
691 (@pxref{Windows and Frames}) and the frame's minibuffer window
692 (@pxref{Minibuffer Windows}).  There are two notable exceptions to this
693 rule: A @dfn{minibuffer-less frame} contains a root window only and does
694 not contain a minibuffer window.  A @dfn{minibuffer-only frame} contains
695 only a minibuffer window which also serves as that frame's root window.
696 See @ref{Initial Parameters} for how to create such frame
697 configurations.
699 @item Text Area
700 @cindex text area
701 The @dfn{text area} of a frame is a somewhat fictitious area that can be
702 embedded in the native frame.  Its position is unspecified.  Its width
703 can be obtained by removing from that of the native width the widths of
704 the internal border, one vertical scroll bar, and one left and one right
705 fringe if they are specified for this frame, see @ref{Layout
706 Parameters}.  Its height can be obtained by removing from that of the
707 native height the widths of the internal border and the heights of the
708 frame's internal menu and tool bars and one horizontal scroll bar if
709 specified for this frame.
710 @end table
712 @cindex absolute position
713 @cindex absolute frame position
714 @cindex absolute edges
715 @cindex absolute frame edges
716 @cindex display origin
717 @cindex origin of display
718 The @dfn{absolute position} of a frame is given as a pair (X, Y) of
719 horizontal and vertical pixel offsets relative to an origin (0, 0) of
720 the frame's display.  Correspondingly, the @dfn{absolute edges} of a
721 frame are given as pixel offsets from that origin.
723   Note that with multiple monitors, the origin of the display does not
724 necessarily coincide with the top-left corner of the entire usable
725 display area of the terminal.  Hence the absolute position of a frame
726 can be negative in such an environment even when that frame is
727 completely visible.
729   By convention, vertical offsets increase ``downwards''.  This means
730 that the height of a frame is obtained by subtracting the offset of its
731 top edge from that of its bottom edge.  Horizontal offsets increase
732 ``rightwards'', as expected, so a frame's width is calculated by
733 subtracting the offset of its left edge from that of its right edge.
735   For a frame on a graphical terminal the following function returns the
736 sizes of the areas described above:
738 @defun frame-geometry &optional frame
739 This function returns geometric attributes of @var{frame}.  The return
740 value is an association list of the attributes listed below.  All
741 coordinate, height and width values are integers counting pixels.  Note
742 that if @var{frame} has not been mapped yet, (@pxref{Visibility of
743 Frames}) some of the return values may only represent approximations of
744 the actual values---those that can be seen after the frame has been
745 mapped.
747 @table @code
748 @item outer-position
749 A cons representing the absolute position of the outer @var{frame},
750 relative to the origin at position (0, 0) of @var{frame}'s display.
752 @item outer-size
753 A cons of the outer width and height of @var{frame}.
755 @item external-border-size
756 A cons of the horizontal and vertical width of @var{frame}'s external
757 borders as supplied by the window manager.  If the window manager
758 doesn't supply these values, Emacs will try to guess them from the
759 coordinates of the outer and inner frame.
761 @item outer-border-width
762 The width of the outer border of @var{frame}.  The value is meaningful
763 for non-GTK+ X builds only.
765 @item title-bar-size
766 A cons of the width and height of the title bar of @var{frame} as
767 supplied by the window manager or operating system.  If both of them are
768 zero, the frame has no title bar.  If only the width is zero, Emacs was
769 not able to retrieve the width information.
771 @item menu-bar-external
772 If non-@code{nil}, this means the menu bar is external (not part of the
773 native frame of @var{frame}).
775 @item menu-bar-size
776 A cons of the width and height of the menu bar of @var{frame}.
778 @item tool-bar-external
779 If non-@code{nil}, this means the tool bar is external (not part of the
780 native frame of @var{frame}).
782 @item tool-bar-position
783 This tells on which side the tool bar on @var{frame} is and can be one
784 of @code{left}, @code{top}, @code{right} or @code{bottom}.  The only
785 toolkit that currently supports a value other than @code{top} is GTK+.
787 @item tool-bar-size
788 A cons of the width and height of the tool bar of @var{frame}.
790 @item internal-border-width
791 The width of the internal border of @var{frame}.
792 @end table
793 @end defun
795 The following function can be used to retrieve the edges of the outer,
796 native and inner frame.
798 @defun frame-edges &optional frame type
799 This function returns the absolute edges of the outer, native or inner
800 frame of @var{frame}.  @var{frame} must be a live frame and defaults to
801 the selected one.  The returned list has the form @w{@code{(@var{left}
802 @var{top} @var{right} @var{bottom})}} where all values are in pixels
803 relative to the origin of @var{frame}'s display.  For terminal frames
804 the values returned for @var{left} and @var{top} are always zero.
806 Optional argument @var{type} specifies the type of the edges to return:
807 @code{outer-edges} means to return the outer edges of @var{frame},
808 @code{native-edges} (or @code{nil}) means to return its native edges and
809 @code{inner-edges} means to return its inner edges.
811 By convention, the pixels of the display at the values returned for
812 @var{left} and @var{top} are considered to be inside (part of)
813 @var{frame}.  Hence, if @var{left} and @var{top} are both zero, the
814 pixel at the display's origin is part of @var{frame}.  The pixels at
815 @var{bottom} and @var{right}, on the other hand, are considered to lie
816 immediately outside @var{frame}.  This means that if you have, for
817 example, two side-by-side frames positioned such that the right outer
818 edge of the frame on the left equals the left outer edge of the frame on
819 the right, the pixels at that edge show a part of the frame on the
820 right.
821 @end defun
824 @node Frame Font
825 @subsection Frame Font
826 @cindex default font
827 @cindex default character size
828 @cindex default character width
829 @cindex default width of character
830 @cindex default character height
831 @cindex default height of character
832 Each frame has a @dfn{default font} which specifies the default
833 character size for that frame.  This size is meant when retrieving or
834 changing the size of a frame in terms of columns or lines
835 (@pxref{Size Parameters}).  It is also used when resizing (@pxref{Window
836 Sizes}) or splitting (@pxref{Splitting Windows}) windows.
838 @cindex line height
839 @cindex column width
840 @cindex canonical character height
841 @cindex canonical character width
842 The terms @dfn{line height} and @dfn{canonical character height} are
843 sometimes used instead of ``default character height''.  Similarly, the
844 terms @dfn{column width} and @dfn{canonical character width} are used
845 instead of ``default character width''.
847 @defun frame-char-height &optional frame
848 @defunx frame-char-width &optional frame
849 These functions return the default height and width of a character in
850 @var{frame}, measured in pixels.  Together, these values establish the
851 size of the default font on @var{frame}.  The values depend on the
852 choice of font for @var{frame}, see @ref{Font and Color Parameters}.
853 @end defun
855 The default font can be also set directly with the following function:
857 @deffn Command set-frame-font font &optional keep-size frames
858 This sets the default font to @var{font}.  When called interactively, it
859 prompts for the name of a font, and uses that font on the selected
860 frame.  When called from Lisp, @var{font} should be a font name (a
861 string), a font object, font entity, or a font spec.
863 If the optional argument @var{keep-size} is @code{nil}, this keeps the
864 number of frame lines and columns fixed.  (If non-@code{nil}, the option
865 @code{frame-inhibit-implied-resize} described in the next section will
866 override this.)  If @var{keep-size} is non-@code{nil} (or with a prefix
867 argument), it tries to keep the size of the display area of the current
868 frame fixed by adjusting the number of lines and columns.
870 If the optional argument @var{frames} is @code{nil}, this applies the
871 font to the selected frame only.  If @var{frames} is non-@code{nil}, it
872 should be a list of frames to act upon, or @code{t} meaning all existing
873 and all future graphical frames.
874 @end deffn
877 @node Frame Position
878 @subsection Frame Position
879 @cindex frame position
880 @cindex position of frame
882 On graphical systems, the position of a normal top-level frame is
883 specified as the absolute position of its outer frame (@pxref{Frame
884 Geometry}).  The position of a child frame (@pxref{Child Frames}) is
885 specified via pixel offsets of its outer edges relative to the native
886 position of its parent frame.
888   You can access or change the position of a frame using the frame
889 parameters @code{left} and @code{top} (@pxref{Position Parameters}).
890 Here are two additional functions for working with the positions of an
891 existing, visible frame.  For both functions, the argument @var{frame}
892 must denote a live frame and defaults to the selected frame.
894 @defun frame-position &optional frame
895 For a normal, non-child frame this function returns a cons of the pixel
896 coordinates of its outer position (@pxref{Frame Layout}) with respect to
897 the origin @code{(0, 0)} of its display.  For a child frame
898 (@pxref{Child Frames}) this function returns the pixel coordinates of
899 its outer position with respect to an origin @code{(0, 0)} at the native
900 position of @var{frame}'s parent.
902 Negative values never indicate an offset from the right or bottom
903 edge of @var{frame}'s display or parent frame.  Rather, they mean that
904 @var{frame}'s outer position is on the left and/or above the origin of
905 its display or the native position of its parent frame.  This usually
906 means that @var{frame} is only partially visible (or completely
907 invisible).  However, on systems where the display's origin does not
908 coincide with its top-left corner, the frame may be visible on a
909 secondary monitor.
911 On a text terminal frame both values are zero.
912 @end defun
914 @defun set-frame-position frame x y
915 This function sets the outer frame position of @var{frame} to (@var{x},
916 @var{y}).  The latter arguments specify pixels and normally count from
917 the origin at the position (0, 0) of @var{frame}'s display.  For child
918 frames, they count from the native position of @var{frame}'s parent
919 frame.
921 Negative parameter values position the right edge of the outer frame by
922 @var{-x} pixels left from the right edge of the screen (or the parent
923 frame's native rectangle) and the bottom edge by @var{-y} pixels up from
924 the bottom edge of the screen (or the parent frame's native rectangle).
926 Note that negative values do not permit to align the right or bottom
927 edge of @var{frame} exactly at the right or bottom edge of its display
928 or parent frame.  Neither do they allow to specify a position that does
929 not lie within the edges of the display or parent frame.  The frame
930 parameters @code{left} and @code{top} (@pxref{Position Parameters})
931 allow to do that, but may still fail to provide good results for the
932 initial or a new frame.
934 This function has no effect on text terminal frames.
935 @end defun
937 @defvar move-frame-functions
938 @cindex frame position changes, a hook
939 This hook specifies the functions that are run when an Emacs frame is moved
940 (assigned a new position) by the window-system or window manager.  The
941 functions are run with one argument, the frame that moved.  For a child
942 frame (@pxref{Child Frames}), the functions are run only when the
943 position of the frame changes in relation to that of its parent frame.
944 @end defvar
947 @node Frame Size
948 @subsection Frame Size
949 @cindex frame size
950 @cindex text width of a frame
951 @cindex text height of a frame
952 @cindex text size of a frame
953 The canonical way to specify the @dfn{size of a frame} from within Emacs
954 is by specifying its @dfn{text size}---a tuple of the width and height
955 of the frame's text area (@pxref{Frame Layout}).  It can be measured
956 either in pixels or in terms of the frame's canonical character size
957 (@pxref{Frame Font}).
959   For frames with an internal menu or tool bar, the frame's native
960 height cannot be told exactly before the frame has been actually drawn.
961 This means that in general you cannot use the native size to specify the
962 initial size of a frame.  As soon as you know the native size of a
963 visible frame, you can calculate its outer size (@pxref{Frame Layout})
964 by adding in the remaining components from the return value of
965 @code{frame-geometry}.  For invisible frames or for frames that have
966 yet to be created, however, the outer size can only be estimated.  This
967 also means that calculating an exact initial position of a frame
968 specified via offsets from the right or bottom edge of the screen
969 (@pxref{Frame Position}) is impossible.
971   The text size of any frame can be set and retrieved with the help of
972 the @code{height} and @code{width} frame parameters (@pxref{Size
973 Parameters}).  The text size of the initial frame can be also set with
974 the help of an X-style geometry specification.  @xref{Emacs Invocation,,
975 Command Line Arguments for Emacs Invocation, emacs, The GNU Emacs
976 Manual}.  Below we list some functions to access and set the size of an
977 existing, visible frame, by default the selected one.
979 @defun frame-height &optional frame
980 @defunx frame-width &optional frame
981 These functions return the height and width of the text area of
982 @var{frame}, measured in units of the default font height and width of
983 @var{frame} (@pxref{Frame Font}).  These functions are plain shorthands
984 for writing @code{(frame-parameter frame 'height)} and
985 @code{(frame-parameter frame 'width)}.
987 If the text area of @var{frame} measured in pixels is not a multiple of
988 its default font size, the values returned by these functions are
989 rounded down to the number of characters of the default font that fully
990 fit into the text area.
991 @end defun
993 The functions following next return the pixel widths and heights of the
994 native, outer and inner frame and the text area (@pxref{Frame Layout})
995 of a given frame.  For a text terminal, the results are in characters
996 rather than pixels.
998 @defun frame-outer-width &optional frame
999 @defunx frame-outer-height &optional frame
1000 These functions return the outer width and height of @var{frame} in
1001 pixels.
1002 @end defun
1004 @defun frame-native-height &optional frame
1005 @defunx frame-native-width &optional frame
1006 These functions return the native width and height of @var{frame} in
1007 pixels.
1008 @end defun
1010 @defun frame-inner-width &optional frame
1011 @defunx frame-inner-height &optional frame
1012 These functions return the inner width and height of @var{frame} in
1013 pixels.
1014 @end defun
1016 @defun frame-text-width &optional frame
1017 @defunx frame-text-height &optional frame
1018 These functions return the width and height of the text area of
1019 @var{frame} in pixels.
1020 @end defun
1022 On window systems that support it, Emacs tries by default to make the
1023 text size of a frame measured in pixels a multiple of the frame's
1024 character size.  This, however, usually means that a frame can be
1025 resized only in character size increments when dragging its external
1026 borders.  It also may break attempts to truly maximize the frame or
1027 making it ``fullheight'' or ``fullwidth'' (@pxref{Size Parameters})
1028 leaving some empty space below and/or on the right of the frame.  The
1029 following option may help in that case.
1031 @defopt frame-resize-pixelwise
1032 If this option is @code{nil} (the default), a frame's text pixel size is
1033 usually rounded to a multiple of the current values of that frame's
1034 @code{frame-char-height} and @code{frame-char-width} whenever the frame
1035 is resized.  If this is non-@code{nil}, no rounding occurs, hence frame
1036 sizes can increase/decrease by one pixel.
1038 Setting this variable usually causes the next resize operation to pass
1039 the corresponding size hints to the window manager.  This means that
1040 this variable should be set only in a user's initial file; applications
1041 should never bind it temporarily.
1043 The precise meaning of a value of @code{nil} for this option depends on
1044 the toolkit used.  Dragging the external border with the mouse is done
1045 character-wise provided the window manager is willing to process the
1046 corresponding size hints.  Calling @code{set-frame-size} (see below)
1047 with arguments that do not specify the frame size as an integer multiple
1048 of its character size, however, may: be ignored, cause a rounding
1049 (GTK+), or be accepted (Lucid, Motif, MS-Windows).
1051 With some window managers you may have to set this to non-@code{nil} in
1052 order to make a frame appear truly maximized or full-screen.
1053 @end defopt
1055 @defun set-frame-size frame width height &optional pixelwise
1056 This function sets the size of the text area of @var{frame}, measured in
1057 terms of the canonical height and width of a character on @var{frame}
1058 (@pxref{Frame Font}).
1060 The optional argument @var{pixelwise} non-@code{nil} means to measure
1061 the new width and height in units of pixels instead.  Note that if
1062 @code{frame-resize-pixelwise} is @code{nil}, some toolkits may refuse to
1063 truly honor the request if it does not increase/decrease the frame size
1064 to a multiple of its character size.
1065 @end defun
1067 @defun set-frame-height frame height &optional pretend pixelwise
1068 This function resizes the text area of @var{frame} to a height of
1069 @var{height} lines.  The sizes of existing windows in @var{frame} are
1070 altered proportionally to fit.
1072 If @var{pretend} is non-@code{nil}, then Emacs displays @var{height}
1073 lines of output in @var{frame}, but does not change its value for the
1074 actual height of the frame.  This is only useful on text terminals.
1075 Using a smaller height than the terminal actually implements may be
1076 useful to reproduce behavior observed on a smaller screen, or if the
1077 terminal malfunctions when using its whole screen.  Setting the frame
1078 height directly does not always work, because knowing the correct
1079 actual size may be necessary for correct cursor positioning on
1080 text terminals.
1082 The optional fourth argument @var{pixelwise} non-@code{nil} means that
1083 @var{frame} should be @var{height} pixels high.  Note that if
1084 @code{frame-resize-pixelwise} is @code{nil}, some window managers may
1085 refuse to truly honor the request if it does not increase/decrease the
1086 frame height to a multiple of its character height.
1087 @end defun
1089 @defun set-frame-width frame width &optional pretend pixelwise
1090 This function sets the width of the text area of @var{frame}, measured
1091 in characters.  The argument @var{pretend} has the same meaning as in
1092 @code{set-frame-height}.
1094 The optional fourth argument @var{pixelwise} non-@code{nil} means that
1095 @var{frame} should be @var{width} pixels wide.  Note that if
1096 @code{frame-resize-pixelwise} is @code{nil}, some window managers may
1097 refuse to fully honor the request if it does not increase/decrease the
1098 frame width to a multiple of its character width.
1099 @end defun
1101 None of these three functions will make a frame smaller than needed to
1102 display all of its windows together with their scroll bars, fringes,
1103 margins, dividers, mode and header lines.  This contrasts with requests
1104 by the window manager triggered, for example, by dragging the external
1105 border of a frame with the mouse.  Such requests are always honored by
1106 clipping, if necessary, portions that cannot be displayed at the right,
1107 bottom corner of the frame.  The parameters @code{min-width} and
1108 @code{min-height} (@pxref{Size Parameters}) can be used to obtain a
1109 similar behavior when changing the frame size from within Emacs.
1111 @cindex tracking frame size changes
1112   The abnormal hook @code{window-size-change-functions} (@pxref{Window
1113 Hooks}) tracks all changes of the inner size of a frame including those
1114 induced by request of the window-system or window manager.  To rule out
1115 false positives that might occur when changing only the sizes of a
1116 frame's windows without actually changing the size of the inner frame,
1117 use the following function.
1119 @defun frame-size-changed-p &optional frame
1120 This function returns non-@code{nil} when the inner width or height of
1121 @var{frame} has changed since @code{window-size-change-functions} was
1122 run the last time for @var{frame}.  It always returns @code{nil}
1123 immediately after running @code{window-size-change-functions} for
1124 @var{frame}.
1125 @end defun
1128 @node Implied Frame Resizing
1129 @subsection Implied Frame Resizing
1130 @cindex implied frame resizing
1131 @cindex implied resizing of frame
1133 By default, Emacs tries to keep the number of lines and columns of a
1134 frame's text area unaltered when, for example, adding or removing the
1135 menu bar, changing the default font or setting the width of the frame's
1136 scroll bars.  This means, however, that in such case Emacs must ask the
1137 window manager to resize the outer frame in order to accommodate the
1138 size change.  Note that wrapping a menu or tool bar usually does not
1139 resize the frame's outer size, hence this will alter the number of
1140 displayed lines.
1142   Occasionally, such @dfn{implied frame resizing} may be unwanted, for
1143 example, when the frame is maximized or made full-screen (where it's
1144 turned off by default).  In other cases you can disable implied resizing
1145 with the following option:
1147 @defopt frame-inhibit-implied-resize
1148 If this option is @code{nil}, changing font, menu bar, tool bar,
1149 internal borders, fringes or scroll bars of a specific frame may
1150 implicitly resize the frame's display area in order to preserve the
1151 number of columns or lines the frame displays.  If this option is
1152 non-@code{nil}, no implied resizing is done.
1154 The value of this option can be also a list of frame parameters.  In
1155 that case, implied resizing is inhibited when changing a parameter that
1156 appears in this list.  The frame parameters currently handled by this
1157 option are: @code{font}, @code{font-backend},
1158 @code{internal-border-width}, @code{menu-bar-lines} and
1159 @code{tool-bar-lines}.
1161 Changing any of the @code{scroll-bar-width}, @code{scroll-bar-height},
1162 @code{vertical-scroll-bars}, @code{horizontal-scroll-bars},
1163 @code{left-fringe} and @code{right-fringe} frame parameters is handled
1164 as if the frame contained just one live window.  This means, for
1165 example, that removing vertical scroll bars on a frame containing
1166 several side by side windows will shrink the outer frame width by the
1167 width of one scroll bar provided this option is @code{nil} and keep it
1168 unchanged if this option is either @code{t} or a list containing
1169 @code{vertical-scroll-bars}.
1171 The default value is @code{'(tool-bar-lines)} for Lucid, Motif and
1172 MS-Windows (which means that adding/removing a tool bar there does not
1173 change the outer frame height), @code{nil} on all other window systems
1174 including GTK+ (which means that changing any of the parameters listed
1175 above may change the size of the outer frame), and @code{t} otherwise
1176 (which means the outer frame size never changes implicitly when there's
1177 no window system support).
1179 Note that when a frame is not large enough to accommodate a change of
1180 any of the parameters listed above, Emacs may try to enlarge the frame
1181 even if this option is non-@code{nil}.
1182 @end defopt
1185 @node Frame Parameters
1186 @section Frame Parameters
1187 @cindex frame parameters
1189   A frame has many parameters that control its appearance and behavior.
1190 Just what parameters a frame has depends on what display mechanism it
1191 uses.
1193   Frame parameters exist mostly for the sake of graphical displays.
1194 Most frame parameters have no effect when applied to a frame on a text
1195 terminal; only the @code{height}, @code{width}, @code{name},
1196 @code{title}, @code{menu-bar-lines}, @code{buffer-list} and
1197 @code{buffer-predicate} parameters do something special.  If the
1198 terminal supports colors, the parameters @code{foreground-color},
1199 @code{background-color}, @code{background-mode} and
1200 @code{display-type} are also meaningful.  If the terminal supports
1201 frame transparency, the parameter @code{alpha} is also meaningful.
1203 @menu
1204 * Parameter Access::       How to change a frame's parameters.
1205 * Initial Parameters::     Specifying frame parameters when you make a frame.
1206 * Window Frame Parameters:: List of frame parameters for window systems.
1207 * Geometry::               Parsing geometry specifications.
1208 @end menu
1210 @node Parameter Access
1211 @subsection Access to Frame Parameters
1213 These functions let you read and change the parameter values of a
1214 frame.
1216 @defun frame-parameter frame parameter
1217 This function returns the value of the parameter @var{parameter} (a
1218 symbol) of @var{frame}.  If @var{frame} is @code{nil}, it returns the
1219 selected frame's parameter.  If @var{frame} has no setting for
1220 @var{parameter}, this function returns @code{nil}.
1221 @end defun
1223 @defun frame-parameters &optional frame
1224 The function @code{frame-parameters} returns an alist listing all the
1225 parameters of @var{frame} and their values.  If @var{frame} is
1226 @code{nil} or omitted, this returns the selected frame's parameters
1227 @end defun
1229 @defun modify-frame-parameters frame alist
1230 This function alters the frame @var{frame} based on the elements of
1231 @var{alist}.  Each element of @var{alist} has the form
1232 @code{(@var{parm} . @var{value})}, where @var{parm} is a symbol naming
1233 a parameter.  If you don't mention a parameter in @var{alist}, its
1234 value doesn't change.  If @var{frame} is @code{nil}, it defaults to
1235 the selected frame.
1237 Some parameters are only meaningful for frames on certain kinds of
1238 display (@pxref{Frames}).  If @var{alist} includes parameters that are
1239 not meaningful for the @var{frame}'s display, this function will
1240 change its value in the frame's parameter list, but will otherwise
1241 ignore it.
1243 When @var{alist} specifies more than one parameter whose value can
1244 affect the new size of @var{frame}, the final size of the frame may
1245 differ according to the toolkit used.  For example, specifying that a
1246 frame should from now on have a menu and/or tool bar instead of none and
1247 simultaneously specifying the new height of the frame will inevitably
1248 lead to a recalculation of the frame's height.  Conceptually, in such
1249 case, this function will try to have the explicit height specification
1250 prevail.  It cannot be excluded, however, that the addition (or removal)
1251 of the menu or tool bar, when eventually performed by the toolkit, will
1252 defeat this intention.
1254 Sometimes, binding @code{frame-inhibit-implied-resize} (@pxref{Implied
1255 Frame Resizing}) to a non-@code{nil} value around calls to this function
1256 may fix the problem sketched here.  Sometimes, however, exactly such
1257 binding may be hit by the problem.
1258 @end defun
1260 @defun set-frame-parameter frame parm value
1261 This function sets the frame parameter @var{parm} to the specified
1262 @var{value}.  If @var{frame} is @code{nil}, it defaults to the selected
1263 frame.
1264 @end defun
1266 @defun modify-all-frames-parameters alist
1267 This function alters the frame parameters of all existing frames
1268 according to @var{alist}, then modifies @code{default-frame-alist}
1269 (and, if necessary, @code{initial-frame-alist}) to apply the same
1270 parameter values to frames that will be created henceforth.
1271 @end defun
1273 @node Initial Parameters
1274 @subsection Initial Frame Parameters
1275 @cindex parameters of initial frame
1277 You can specify the parameters for the initial startup frame by
1278 setting @code{initial-frame-alist} in your init file (@pxref{Init
1279 File}).
1281 @defopt initial-frame-alist
1282 This variable's value is an alist of parameter values used when
1283 creating the initial frame.  You can set this variable to specify the
1284 appearance of the initial frame without altering subsequent frames.
1285 Each element has the form:
1287 @example
1288 (@var{parameter} . @var{value})
1289 @end example
1291 Emacs creates the initial frame before it reads your init
1292 file.  After reading that file, Emacs checks @code{initial-frame-alist},
1293 and applies the parameter settings in the altered value to the already
1294 created initial frame.
1296 If these settings affect the frame geometry and appearance, you'll see
1297 the frame appear with the wrong ones and then change to the specified
1298 ones.  If that bothers you, you can specify the same geometry and
1299 appearance with X resources; those do take effect before the frame is
1300 created.  @xref{X Resources,, X Resources, emacs, The GNU Emacs Manual}.
1302 X resource settings typically apply to all frames.  If you want to
1303 specify some X resources solely for the sake of the initial frame, and
1304 you don't want them to apply to subsequent frames, here's how to achieve
1305 this.  Specify parameters in @code{default-frame-alist} to override the
1306 X resources for subsequent frames; then, to prevent these from affecting
1307 the initial frame, specify the same parameters in
1308 @code{initial-frame-alist} with values that match the X resources.
1309 @end defopt
1311 @cindex minibuffer-only frame
1312 If these parameters include @code{(minibuffer . nil)}, that indicates
1313 that the initial frame should have no minibuffer.  In this case, Emacs
1314 creates a separate @dfn{minibuffer-only frame} as well.
1316 @defopt minibuffer-frame-alist
1317 This variable's value is an alist of parameter values used when
1318 creating an initial minibuffer-only frame (i.e., the minibuffer-only
1319 frame that Emacs creates if @code{initial-frame-alist} specifies a
1320 frame with no minibuffer).
1321 @end defopt
1323 @defopt default-frame-alist
1324 This is an alist specifying default values of frame parameters for all
1325 Emacs frames---the first frame, and subsequent frames.  When using the X
1326 Window System, you can get the same results by means of X resources
1327 in many cases.
1329 Setting this variable does not affect existing frames.  Furthermore,
1330 functions that display a buffer in a separate frame may override the
1331 default parameters by supplying their own parameters.
1332 @end defopt
1334 If you invoke Emacs with command-line options that specify frame
1335 appearance, those options take effect by adding elements to either
1336 @code{initial-frame-alist} or @code{default-frame-alist}.  Options
1337 which affect just the initial frame, such as @samp{--geometry} and
1338 @samp{--maximized}, add to @code{initial-frame-alist}; the others add
1339 to @code{default-frame-alist}.  @pxref{Emacs Invocation,, Command Line
1340 Arguments for Emacs Invocation, emacs, The GNU Emacs Manual}.
1342 @node Window Frame Parameters
1343 @subsection Window Frame Parameters
1344 @cindex frame parameters for windowed displays
1346   Just what parameters a frame has depends on what display mechanism
1347 it uses.  This section describes the parameters that have special
1348 meanings on some or all kinds of terminals.  Of these, @code{name},
1349 @code{title}, @code{height}, @code{width}, @code{buffer-list} and
1350 @code{buffer-predicate} provide meaningful information in terminal
1351 frames, and @code{tty-color-mode} is meaningful only for frames on
1352 text terminals.
1354 @menu
1355 * Basic Parameters::            Parameters that are fundamental.
1356 * Position Parameters::         The position of the frame on the screen.
1357 * Size Parameters::             Frame's size.
1358 * Layout Parameters::           Size of parts of the frame, and
1359                                   enabling or disabling some parts.
1360 * Buffer Parameters::           Which buffers have been or should be shown.
1361 * Frame Interaction Parameters::  Parameters for interacting with other
1362                                   frames.
1363 * Mouse Dragging Parameters::   Parameters for resizing and moving
1364                                   frames with the mouse.
1365 * Management Parameters::       Communicating with the window manager.
1366 * Cursor Parameters::           Controlling the cursor appearance.
1367 * Font and Color Parameters::   Fonts and colors for the frame text.
1368 @end menu
1370 @node Basic Parameters
1371 @subsubsection Basic Parameters
1373   These frame parameters give the most basic information about the
1374 frame.  @code{title} and @code{name} are meaningful on all terminals.
1376 @table @code
1377 @vindex display, a frame parameter
1378 @item display
1379 The display on which to open this frame.  It should be a string of the
1380 form @samp{@var{host}:@var{dpy}.@var{screen}}, just like the
1381 @env{DISPLAY} environment variable.  @xref{Multiple Terminals}, for
1382 more details about display names.
1384 @vindex display-type, a frame parameter
1385 @item display-type
1386 This parameter describes the range of possible colors that can be used
1387 in this frame.  Its value is @code{color}, @code{grayscale} or
1388 @code{mono}.
1390 @vindex title, a frame parameter
1391 @item title
1392 If a frame has a non-@code{nil} title, it appears in the window
1393 system's title bar at the top of the frame, and also in the mode line
1394 of windows in that frame if @code{mode-line-frame-identification} uses
1395 @samp{%F} (@pxref{%-Constructs}).  This is normally the case when
1396 Emacs is not using a window system, and can only display one frame at
1397 a time.  @xref{Frame Titles}.
1399 @vindex name, a frame parameter
1400 @item name
1401 The name of the frame.  The frame name serves as a default for the frame
1402 title, if the @code{title} parameter is unspecified or @code{nil}.  If
1403 you don't specify a name, Emacs sets the frame name automatically
1404 (@pxref{Frame Titles}).
1406 If you specify the frame name explicitly when you create the frame, the
1407 name is also used (instead of the name of the Emacs executable) when
1408 looking up X resources for the frame.
1410 @vindex explicit-name, a frame parameter
1411 @item explicit-name
1412 If the frame name was specified explicitly when the frame was created,
1413 this parameter will be that name.  If the frame wasn't explicitly
1414 named, this parameter will be @code{nil}.
1415 @end table
1418 @node Position Parameters
1419 @subsubsection Position Parameters
1420 @cindex window position on display
1421 @cindex frame position
1423 Parameters describing the X- and Y-offsets of a frame are always
1424 measured in pixels.  For a normal, non-child frame they specify the
1425 frame's outer position (@pxref{Frame Geometry}) relative to its
1426 display's origin.  For a child frame (@pxref{Child Frames}) they specify
1427 the frame's outer position relative to the native position of the
1428 frame's parent frame.  (Note that none of these parameters is meaningful
1429 on TTY frames.)
1431 @table @code
1432 @vindex left, a frame parameter
1433 @item left
1434 The position, in pixels, of the left outer edge of the frame with
1435 respect to the left edge of the frame's display or parent frame.  It can
1436 be specified in one of the following ways.
1438 @table @asis
1439 @item an integer
1440 A positive integer always relates the left edge of the frame to the left
1441 edge of its display or parent frame.  A negative integer relates the
1442 right frame edge to the right edge of the display or parent frame.
1444 @item @code{(+ @var{pos})}
1445 This specifies the position of the left frame edge relative to the left
1446 edge of its display or parent frame.  The integer @var{pos} may be
1447 positive or negative; a negative value specifies a position outside the
1448 screen or parent frame or on a monitor other than the primary one (for
1449 multi-monitor displays).
1451 @item @code{(- @var{pos})}
1452 This specifies the position of the right frame edge relative to the
1453 right edge of the display or parent frame.  The integer @var{pos} may be
1454 positive or negative; a negative value specifies a position outside the
1455 screen or parent frame or on a monitor other than the primary one (for
1456 multi-monitor displays).
1458 @cindex left position ratio
1459 @cindex top position ratio
1460 @item a floating-point value
1461 A floating-point value in the range 0.0 to 1.0 specifies the left edge's
1462 offset via the @dfn{left position ratio} of the frame---the ratio of the
1463 left edge of its outer frame to the width of the frame's workarea
1464 (@pxref{Multiple Terminals}) or its parent's native frame (@pxref{Child
1465 Frames}) minus the width of the outer frame.  Thus, a left position
1466 ratio of 0.0 flushes a frame to the left, a ratio of 0.5 centers it and
1467 a ratio of 1.0 flushes it to the right of its display or parent frame.
1468 Similarly, the @dfn{top position ratio} of a frame is the ratio of the
1469 frame's top position to the height of its workarea or parent frame minus
1470 the height of the frame.
1472 Emacs will try to keep the position ratios of a child frame unaltered if
1473 that frame has a non-@code{nil} @code{keep-ratio} parameter
1474 (@pxref{Frame Interaction Parameters}) and its parent frame is resized.
1476 Since the outer size of a frame (@pxref{Frame Geometry}) is usually
1477 unavailable before a frame has been made visible, it is generally not
1478 advisable to use floating-point values when creating decorated frames.
1479 Floating-point values are more suited for ensuring that an (undecorated)
1480 child frame is positioned nicely within the area of its parent frame.
1481 @end table
1483 Some window managers ignore program-specified positions.  If you want to
1484 be sure the position you specify is not ignored, specify a
1485 non-@code{nil} value for the @code{user-position} parameter as in the
1486 following example:
1488 @example
1489 (modify-frame-parameters
1490   nil '((user-position . t) (left . (+ -4))))
1491 @end example
1493 In general, it is not a good idea to position a frame relative to the
1494 right or bottom edge of its display.  Positioning the initial or a new
1495 frame is either not accurate (because the size of the outer frame is not
1496 yet fully known before the frame has been made visible) or will cause
1497 additional flicker (if the frame has to be repositioned after becoming
1498 visible).
1500   Note also, that positions specified relative to the right/bottom edge
1501 of a display, workarea or parent frame as well as floating-point offsets
1502 are stored internally as integer offsets relative to the left/top edge
1503 of the display, workarea or parent frame edge.  They are also returned
1504 as such by functions like @code{frame-parameters} and restored as such
1505 by the desktop saving routines.
1507 @vindex top, a frame parameter
1508 @item top
1509 The screen position of the top (or bottom) edge, in pixels, with respect
1510 to the top (or bottom) edge of the display or parent frame.  It works
1511 just like @code{left}, except vertically instead of horizontally.
1513 @vindex icon-left, a frame parameter
1514 @item icon-left
1515 The screen position of the left edge of the frame's icon, in pixels,
1516 counting from the left edge of the screen.  This takes effect when the
1517 frame is iconified, if the window manager supports this feature.  If
1518 you specify a value for this parameter, then you must also specify a
1519 value for @code{icon-top} and vice versa.
1521 @vindex icon-top, a frame parameter
1522 @item icon-top
1523 The screen position of the top edge of the frame's icon, in pixels,
1524 counting from the top edge of the screen.  This takes effect when the
1525 frame is iconified, if the window manager supports this feature.
1527 @vindex user-position, a frame parameter
1528 @item user-position
1529 When you create a frame and specify its screen position with the
1530 @code{left} and @code{top} parameters, use this parameter to say whether
1531 the specified position was user-specified (explicitly requested in some
1532 way by a human user) or merely program-specified (chosen by a program).
1533 A non-@code{nil} value says the position was user-specified.
1535 @cindex window positions and window managers
1536 Window managers generally heed user-specified positions, and some heed
1537 program-specified positions too.  But many ignore program-specified
1538 positions, placing the window in a default fashion or letting the user
1539 place it with the mouse.  Some window managers, including @code{twm},
1540 let the user specify whether to obey program-specified positions or
1541 ignore them.
1543 When you call @code{make-frame}, you should specify a non-@code{nil}
1544 value for this parameter if the values of the @code{left} and @code{top}
1545 parameters represent the user's stated preference; otherwise, use
1546 @code{nil}.
1548 @vindex z-group, a frame parameter
1549 @item z-group
1550 This parameter specifies a relative position of the frame's
1551 window-system window in the stacking (Z-) order of the frame's display.
1553 If this is @code{above}, the frame's window-system window is displayed
1554 above all other window-system windows that do not have the @code{above}
1555 property set.  If this is nil, the frame's window is displayed below all
1556 windows that have the @code{above} property set and above all windows
1557 that have the @code{below} property set.  If this is @code{below}, the
1558 frame's window is displayed below all windows that do not have the
1559 @code{below} property set.
1561 To position the frame above or below a specific other frame use the
1562 function @code{frame-restack} (@pxref{Raising and Lowering}).
1563 @end table
1566 @node Size Parameters
1567 @subsubsection Size Parameters
1568 @cindex window size on display
1570 Frame parameters usually specify frame sizes in character units.  On
1571 graphical displays, the @code{default} face determines the actual pixel
1572 sizes of these character units (@pxref{Face Attributes}).
1574 @table @code
1575 @vindex width, a frame parameter
1576 @item width
1577 This parameter specifies the width of the frame.  It can be specified as
1578 in the following ways:
1580 @table @asis
1581 @item an integer
1582 A positive integer specifies the width of the frame's text area
1583 (@pxref{Frame Geometry}) in characters.
1585 @item a cons cell
1586 If this is a cons cell with the symbol @code{text-pixels} in its
1587 @sc{car}, the @sc{cdr} of that cell specifies the width of the frame's
1588 text area in pixels.
1590 @cindex frame width ratio
1591 @cindex frame height ratio
1592 @item a floating-point value
1593 A floating-point number between 0.0 and 1.0 can be used to specify the
1594 width of a frame via its @dfn{width ratio}---the ratio of its outer
1595 width (@pxref{Frame Geometry}) to the width of the frame's workarea
1596 (@pxref{Multiple Terminals}) or its parent frame's (@pxref{Child
1597 Frames}) native frame.  Thus, a value of 0.5 makes the frame occupy half
1598 of the width of its workarea or parent frame, a value of 1.0 the full
1599 width.  Similarly, the @dfn{height ratio} of a frame is the ratio of its
1600 outer height to the height of its workarea or its parent's native frame.
1602 Emacs will try to keep the width and height ratio of a child frame
1603 unaltered if that frame has a non-@code{nil} @code{keep-ratio} parameter
1604 (@pxref{Frame Interaction Parameters}) and its parent frame is resized.
1606 Since the outer size of a frame is usually unavailable before a frame
1607 has been made visible, it is generally not advisable to use
1608 floating-point values when creating decorated frames.  Floating-point
1609 values are more suited to ensure that a child frame always fits within
1610 the area of its parent frame as, for example, when customizing
1611 @code{display-buffer-alist} (@pxref{Choosing Window}) via
1612 @code{display-buffer-in-child-frame}.
1613 @end table
1615 Regardless of how this parameter was specified, functions reporting the
1616 value of this parameter like @code{frame-parameters} always report the
1617 width of the frame's text area in characters as an integer rounded, if
1618 necessary, to a multiple of the frame's default character width.  That
1619 value is also used by the desktop saving routines.
1621 @vindex height, a frame parameter
1622 @item height
1623 This parameter specifies the height of the frame.  It works just like
1624 @code{width}, except vertically instead of horizontally.
1626 @vindex user-size, a frame parameter
1627 @item user-size
1628 This does for the size parameters @code{height} and @code{width} what
1629 the @code{user-position} parameter (@pxref{Position Parameters,
1630 user-position}) does for the position parameters @code{top} and
1631 @code{left}.
1633 @vindex min-width, a frame parameter
1634 @item min-width
1635 This parameter specifies the minimum native width (@pxref{Frame
1636 Geometry}) of the frame, in characters.  Normally, the functions that
1637 establish a frame's initial width or resize a frame horizontally make
1638 sure that all the frame's windows, vertical scroll bars, fringes,
1639 margins and vertical dividers can be displayed.  This parameter, if
1640 non-@code{nil} allows to make a frame narrower than that with the
1641 consequence that any components that do not fit will be clipped by the
1642 window manager.
1644 @vindex min-height, a frame parameter
1645 @item min-height
1646 This parameter specifies the minimum native height (@pxref{Frame
1647 Geometry}) of the frame, in characters.  Normally, the functions that
1648 establish a frame's initial size or resize a frame make sure that all
1649 the frame's windows, horizontal scroll bars and dividers, mode and
1650 header lines, the echo area and the internal menu and tool bar can be
1651 displayed.  This parameter, if non-@code{nil} allows to make a frame
1652 smaller than that with the consequence that any components that do not
1653 fit will be clipped by the window manager.
1655 @cindex fullboth frames
1656 @cindex fullheight frames
1657 @cindex fullwidth frames
1658 @cindex maximized frames
1659 @vindex fullscreen, a frame parameter
1660 @item fullscreen
1661 This parameter specifies whether to maximize the frame's width, height
1662 or both.  Its value can be @code{fullwidth}, @code{fullheight},
1663 @code{fullboth}, or @code{maximized}.  A @dfn{fullwidth} frame is as
1664 wide as possible, a @dfn{fullheight} frame is as tall as possible, and
1665 a @dfn{fullboth} frame is both as wide and as tall as possible.  A
1666 @dfn{maximized} frame is like a ``fullboth'' frame, except that it usually
1667 keeps its title bar and the buttons for resizing
1668 and closing the frame.  Also, maximized frames typically avoid hiding
1669 any task bar or panels displayed on the desktop.  A ``fullboth'' frame,
1670 on the other hand, usually omits the title bar and occupies the entire
1671 available screen space.
1673 Full-height and full-width frames are more similar to maximized
1674 frames in this regard.  However, these typically display an external
1675 border which might be absent with maximized frames.  Hence the heights
1676 of maximized and full-height frames and the widths of maximized and
1677 full-width frames often differ by a few pixels.
1679 With some window managers you may have to customize the variable
1680 @code{frame-resize-pixelwise} (@pxref{Frame Size}) in order to make a
1681 frame truly appear maximized or full-screen.  Moreover, some window
1682 managers might not support smooth transition between the various
1683 full-screen or maximization states.  Customizing the variable
1684 @code{x-frame-normalize-before-maximize} can help to overcome that.
1686 Full-screen on macOS hides both the tool-bar and the menu-bar, however
1687 both will be displayed if the mouse pointer is moved to the top of the
1688 screen.
1690 @vindex fullscreen-restore, a frame parameter
1691 @item fullscreen-restore
1692 This parameter specifies the desired fullscreen state of the frame
1693 after invoking the @code{toggle-frame-fullscreen} command (@pxref{Frame
1694 Commands,,, emacs, The GNU Emacs Manual}) in the ``fullboth'' state.
1695 Normally this parameter is installed automatically by that command when
1696 toggling the state to fullboth.  If, however, you start Emacs in the
1697 ``fullboth'' state, you have to specify the desired behavior in your initial
1698 file as, for example
1700 @example
1701 (setq default-frame-alist
1702     '((fullscreen . fullboth) (fullscreen-restore . fullheight)))
1703 @end example
1705 This will give a new frame full height after typing in it @key{F11} for
1706 the first time.
1708 @vindex fit-frame-to-buffer-margins, a frame parameter
1709 @item fit-frame-to-buffer-margins
1710 This parameter allows to override the value of the option
1711 @code{fit-frame-to-buffer-margins} when fitting this frame to the buffer
1712 of its root window with @code{fit-frame-to-buffer} (@pxref{Resizing
1713 Windows}).
1715 @vindex fit-frame-to-buffer-sizes, a frame parameter
1716 @item fit-frame-to-buffer-sizes
1717 This parameter allows to override the value of the option
1718 @code{fit-frame-to-buffer-sizes} when fitting this frame to the buffer
1719 of its root window with @code{fit-frame-to-buffer} (@pxref{Resizing
1720 Windows}).
1721 @end table
1724 @node Layout Parameters
1725 @subsubsection Layout Parameters
1726 @cindex layout parameters of frames
1727 @cindex frame layout parameters
1729   These frame parameters enable or disable various parts of the
1730 frame, or control their sizes.
1732 @table @code
1733 @vindex border-width, a frame parameter
1734 @item border-width
1735 The width in pixels of the frame's outer border (@pxref{Frame Geometry}).
1737 @vindex internal-border-width, a frame parameter
1738 @item internal-border-width
1739 The width in pixels of the frame's internal border (@pxref{Frame
1740 Geometry}).
1742 @vindex vertical-scroll-bars, a frame parameter
1743 @item vertical-scroll-bars
1744 Whether the frame has scroll bars (@pxref{Scroll Bars}) for vertical
1745 scrolling, and which side of the frame they should be on.  The possible
1746 values are @code{left}, @code{right}, and @code{nil} for no scroll bars.
1748 @vindex horizontal-scroll-bars, a frame parameter
1749 @item horizontal-scroll-bars
1750 Whether the frame has scroll bars for horizontal scrolling (@code{t} and
1751 @code{bottom} mean yes, @code{nil} means no).
1753 @vindex scroll-bar-width, a frame parameter
1754 @item scroll-bar-width
1755 The width of vertical scroll bars, in pixels, or @code{nil} meaning to
1756 use the default width.
1758 @vindex scroll-bar-height, a frame parameter
1759 @item scroll-bar-height
1760 The height of horizontal scroll bars, in pixels, or @code{nil} meaning
1761 to use the default height.
1763 @vindex left-fringe, a frame parameter
1764 @vindex right-fringe, a frame parameter
1765 @item left-fringe
1766 @itemx right-fringe
1767 The default width of the left and right fringes of windows in this
1768 frame (@pxref{Fringes}).  If either of these is zero, that effectively
1769 removes the corresponding fringe.
1771 When you use @code{frame-parameter} to query the value of either of
1772 these two frame parameters, the return value is always an integer.
1773 When using @code{set-frame-parameter}, passing a @code{nil} value
1774 imposes an actual default value of 8 pixels.
1776 @vindex right-divider-width, a frame parameter
1777 @item right-divider-width
1778 The width (thickness) reserved for the right divider (@pxref{Window
1779 Dividers}) of any window on the frame, in pixels.  A value of zero means
1780 to not draw right dividers.
1782 @vindex bottom-divider-width, a frame parameter
1783 @item bottom-divider-width
1784 The width (thickness) reserved for the bottom divider (@pxref{Window
1785 Dividers}) of any window on the frame, in pixels.  A value of zero means
1786 to not draw bottom dividers.
1788 @vindex menu-bar-lines frame parameter
1789 @item menu-bar-lines
1790 The number of lines to allocate at the top of the frame for a menu bar
1791 (@pxref{Menu Bar}).  The default is one if Menu Bar mode is enabled and
1792 zero otherwise.  @xref{Menu Bars,,,emacs, The GNU Emacs Manual}.  For an
1793 external menu bar (@pxref{Frame Layout}), this value remains unchanged
1794 even when the menu bar wraps to two or more lines.  In that case, the
1795 @code{menu-bar-size} value returned by @code{frame-geometry}
1796 (@pxref{Frame Geometry}) allows to derive whether the menu bar actually
1797 occupies one or more lines.
1799 @vindex tool-bar-lines frame parameter
1800 @item tool-bar-lines
1801 The number of lines to use for the tool bar (@pxref{Tool Bar}).  The
1802 default is one if Tool Bar mode is enabled and zero otherwise.
1803 @xref{Tool Bars,,,emacs, The GNU Emacs Manual}.  This value may change
1804 whenever the tool bar wraps (@pxref{Frame Layout}).
1806 @vindex tool-bar-position frame parameter
1807 @item tool-bar-position
1808 The position of the tool bar when Emacs was built with GTK+.  Its value
1809 can be one of @code{top}, @code{bottom} @code{left}, @code{right}.  The
1810 default is @code{top}.
1812 @vindex line-spacing, a frame parameter
1813 @item line-spacing
1814 Additional space to leave below each text line, in pixels (a positive
1815 integer).  @xref{Line Height}, for more information.
1817 @vindex no-special-glyphs, a frame parameter
1818 @item no-special-glyphs
1819 If this is non-@code{nil}, it suppresses the display of any truncation
1820 and continuation glyphs (@pxref{Truncation}) for all buffers displayed
1821 by this frame.  This is useful to eliminate such glyphs when fitting a
1822 frame to its buffer via @code{fit-frame-to-buffer} (@pxref{Resizing
1823 Windows}).
1824 @end table
1827 @node Buffer Parameters
1828 @subsubsection Buffer Parameters
1829 @cindex frame, which buffers to display
1830 @cindex buffers to display on frame
1832   These frame parameters, meaningful on all kinds of terminals, deal
1833 with which buffers have been, or should, be displayed in the frame.
1835 @table @code
1836 @vindex minibuffer, a frame parameter
1837 @item minibuffer
1838 Whether this frame has its own minibuffer.  The value @code{t} means
1839 yes, @code{nil} means no, @code{only} means this frame is just a
1840 minibuffer.  If the value is a minibuffer window (in some other
1841 frame), the frame uses that minibuffer.
1843 This frame parameter takes effect when the frame is created, and can
1844 not be changed afterwards.
1846 @vindex buffer-predicate, a frame parameter
1847 @item buffer-predicate
1848 The buffer-predicate function for this frame.  The function
1849 @code{other-buffer} uses this predicate (from the selected frame) to
1850 decide which buffers it should consider, if the predicate is not
1851 @code{nil}.  It calls the predicate with one argument, a buffer, once for
1852 each buffer; if the predicate returns a non-@code{nil} value, it
1853 considers that buffer.
1855 @vindex buffer-list, a frame parameter
1856 @item buffer-list
1857 A list of buffers that have been selected in this frame, ordered
1858 most-recently-selected first.
1860 @vindex unsplittable, a frame parameter
1861 @item unsplittable
1862 If non-@code{nil}, this frame's window is never split automatically.
1863 @end table
1865 @node Frame Interaction Parameters
1866 @subsubsection Frame Interaction Parameters
1867 @cindex frame interaction parameters
1868 @cindex interaction parameters between frames
1870 These parameters supply forms of interactions between different frames.
1872 @table @code
1873 @vindex parent-frame, a frame parameter
1874 @item parent-frame
1875 If non-@code{nil}, this means that this frame is a child frame
1876 (@pxref{Child Frames}), and this parameter specifies its parent frame.
1877 If nil, this means that this frame is a normal, top-level frame.
1879 @vindex delete-before, a frame parameter
1880 @item delete-before
1881 If non-@code{nil}, this parameter specifies another frame whose deletion
1882 will automatically trigger the deletion of this frame.  @xref{Deleting
1883 Frames}.
1885 @vindex mouse-wheel-frame, a frame parameter
1886 @item mouse-wheel-frame
1887 If non-@code{nil}, this parameter specifies the frame whose windows will
1888 be scrolled whenever the mouse wheel is scrolled with the mouse pointer
1889 hovering over this frame, see @ref{Mouse Commands,,, emacs, The GNU
1890 Emacs Manual}.
1892 @vindex no-other-frame, a frame parameter
1893 @item no-other-frame
1894 If this is non-@code{nil}, then this frame is not eligible as candidate
1895 for the functions @code{next-frame}, @code{previous-frame}
1896 (@pxref{Finding All Frames}) and @code{other-frame}, see @ref{Frame
1897 Commands,,, emacs, The GNU Emacs Manual}.
1899 @vindex auto-hide-function, a frame parameter
1900 @item auto-hide-function
1901 When this parameter specifies a function, that function will be called
1902 instead of the function specified by the variable
1903 @code{frame-auto-hide-function} when quitting the frame's only window
1904 (@pxref{Quitting Windows}) and there are other frames left.
1906 @vindex minibuffer-exit, a frame parameter
1907 @item minibuffer-exit
1908 When this parameter is non-@code{nil}, Emacs will by default make this
1909 frame invisible whenever the minibuffer (@pxref{Minibuffers}) is exited.
1910 Alternatively, it can specify the functions @code{iconify-frame} and
1911 @code{delete-frame}.  This parameter is useful to make a child frame
1912 disappear automatically (similar to how Emacs deals with a window) when
1913 exiting the minibuffer.
1915 @vindex keep-ratio, a frame parameter
1916 @item keep-ratio
1917 This parameter is currently meaningful for child frames (@pxref{Child
1918 Frames}) only.  If it is non-@code{nil}, then Emacs will try to keep the
1919 frame's size (width and height) ratios (@pxref{Size Parameters}) as well
1920 as its left and right position ratios (@pxref{Position Parameters})
1921 unaltered whenever its parent frame is resized.
1923 If the value of this parameter is @code{nil}, the frame's position and
1924 size remain unaltered when the parent frame is resized, so the position
1925 and size ratios may change.  If the value of this parameter is @code{t},
1926 Emacs will try to preserve the frame's size and position ratios, hence
1927 the frame's size and position relative to its parent frame may change.
1929 More individual control is possible by using a cons cell: In that case
1930 the frame's width ratio is preserved if the @sc{car} of the cell is
1931 either @code{t} or @code{width-only}.  The height ratio is preserved if
1932 the @sc{car} of the cell is either @code{t} or @code{height-only}.  The
1933 left position ratio is preserved if the @sc{cdr} of the cell is either
1934 @code{t} or @code{left-only}.  The top position ratio is preserved if
1935 the @sc{cdr} of the cell is either @code{t} or @code{top-only}.
1936 @end table
1939 @node Mouse Dragging Parameters
1940 @subsubsection Mouse Dragging Parameters
1941 @cindex mouse dragging parameters
1942 @cindex parameters for resizing frames with the mouse
1943 @cindex parameters for moving frames with the mouse
1945 The parameters described below provide support for resizing a frame by
1946 dragging its internal borders with the mouse.  They also allow moving a
1947 frame with the mouse by dragging the header line of its topmost or the
1948 mode line of its bottommost window.
1950 These parameters are mostly useful for child frames (@pxref{Child
1951 Frames}) that come without window manager decorations.  If necessary,
1952 they can be used for undecorated top-level frames as well.
1954 @table @code
1955 @vindex drag-internal-border, a frame parameter
1956 @item drag-internal-border
1957 If non-@code{nil}, the frame can be resized by dragging its internal
1958 borders, if present, with the mouse.
1960 @vindex drag-with-header-line, a frame parameter
1961 @item drag-with-header-line
1962 If non-@code{nil}, the frame can be moved with the mouse by dragging the
1963 header line of its topmost window.
1965 @vindex drag-with-mode-line, a frame parameter
1966 @item drag-with-mode-line
1967 If non-@code{nil}, the frame can be moved with the mouse by dragging the
1968 mode line of its bottommost window.  Note that such a frame is not
1969 allowed to have its own minibuffer window.
1971 @vindex snap-width, a frame parameter
1972 @item snap-width
1973 A frame that is moved with the mouse will ``snap'' at the border(s) of
1974 the display or its parent frame whenever it is dragged as near to such
1975 an edge as the number of pixels specified by this parameter.
1977 @vindex top-visible, a frame parameter
1978 @item top-visible
1979 If this parameter is a number, the top edge of the frame never appears
1980 above the top edge of its display or parent frame.  Moreover, as many
1981 pixels of the frame as specified by that number will remain visible when
1982 the frame is moved against any of the remaining edges of its display or
1983 parent frame.  Setting this parameter is useful to guard against
1984 dragging a child frame with a non-@code{nil}
1985 @code{drag-with-header-line} parameter completely out of the area
1986 of its parent frame.
1988 @vindex bottom-visible, a frame parameter
1989 @item bottom-visible
1990 If this parameter is a number, the bottom edge of the frame never
1991 appears below the bottom edge of its display or parent frame.  Moreover,
1992 as many pixels of the frame as specified by that number will remain
1993 visible when the frame is moved against any of the remaining edges of
1994 its display or parent frame.  Setting this parameter is useful to guard
1995 against dragging a child frame with a non-@code{nil}
1996 @code{drag-with-mode-line} parameter completely out of the area of
1997 its parent frame.
1998 @end table
2001 @node Management Parameters
2002 @subsubsection Window Management Parameters
2003 @cindex window manager interaction, and frame parameters
2005   The following frame parameters control various aspects of the frame's
2006 interaction with the window manager or window system.  They have no
2007 effect on text terminals.
2009 @table @code
2010 @vindex visibility, a frame parameter
2011 @item visibility
2012 The state of visibility of the frame.  There are three possibilities:
2013 @code{nil} for invisible, @code{t} for visible, and @code{icon} for
2014 iconified.  @xref{Visibility of Frames}.
2016 @vindex auto-raise, a frame parameter
2017 @item auto-raise
2018 If non-@code{nil}, Emacs automatically raises the frame when it is
2019 selected.  Some window managers do not allow this.
2021 @vindex auto-lower, a frame parameter
2022 @item auto-lower
2023 If non-@code{nil}, Emacs automatically lowers the frame when it is
2024 deselected.  Some window managers do not allow this.
2026 @vindex icon-type, a frame parameter
2027 @item icon-type
2028 The type of icon to use for this frame.  If the value is a string,
2029 that specifies a file containing a bitmap to use; @code{nil} specifies
2030 no icon (in which case the window manager decides what to show); any
2031 other non-@code{nil} value specifies the default Emacs icon.
2033 @vindex icon-name, a frame parameter
2034 @item icon-name
2035 The name to use in the icon for this frame, when and if the icon
2036 appears.  If this is @code{nil}, the frame's title is used.
2038 @vindex window-id, a frame parameter
2039 @item window-id
2040 The ID number which the graphical display uses for this frame.  Emacs
2041 assigns this parameter when the frame is created; changing the
2042 parameter has no effect on the actual ID number.
2044 @vindex outer-window-id, a frame parameter
2045 @item outer-window-id
2046 The ID number of the outermost window-system window in which the frame
2047 exists.  As with @code{window-id}, changing this parameter has no
2048 actual effect.
2050 @vindex wait-for-wm, a frame parameter
2051 @item wait-for-wm
2052 If non-@code{nil}, tell Xt to wait for the window manager to confirm
2053 geometry changes.  Some window managers, including versions of Fvwm2
2054 and KDE, fail to confirm, so Xt hangs.  Set this to @code{nil} to
2055 prevent hanging with those window managers.
2057 @vindex sticky, a frame parameter
2058 @item sticky
2059 If non-@code{nil}, the frame is visible on all virtual desktops on systems
2060 with virtual desktops.
2062 @vindex inhibit-double-buffering, a frame parameter
2063 @item inhibit-double-buffering
2064 If non-@code{nil}, the frame is drawn to the screen without double
2065 buffering.  Emacs normally attempts to use double buffering, where
2066 available, to reduce flicker.  Set this property if you experience
2067 display bugs or pine for that retro, flicker-y feeling.
2069 @vindex skip-taskbar, a frame parameter
2070 @item skip-taskbar
2071 If non-@code{nil}, this tells the window manager to remove the frame's
2072 icon from the taskbar associated with the frame's display and inhibit
2073 switching to the frame's window via the combination @kbd{Alt-@key{TAB}}.
2074 On MS-Windows, iconifying such a frame will "roll in" its window-system
2075 window at the bottom of the desktop.  Some window managers may not honor
2076 this parameter.
2078 @vindex no-focus-on-map, a frame parameter
2079 @item no-focus-on-map
2080 If non-@code{nil}, this means that the frame does not want to receive
2081 input focus when it is mapped (@pxref{Visibility of Frames}).  Some
2082 window managers may not honor this parameter.
2084 @vindex no-accept-focus, a frame parameter
2085 @item no-accept-focus
2086 If non-@code{nil}, this means that the frame does not want to receive
2087 input focus via explicit mouse clicks or when moving the mouse into it
2088 either via @code{focus-follows-mouse} (@pxref{Input Focus}) or
2089 @code{mouse-autoselect-window} (@pxref{Mouse Window Auto-selection}).
2090 This may have the unwanted side-effect that a user cannot scroll a
2091 non-selected frame with the mouse.  Some window managers may not honor
2092 this parameter.
2094 @vindex undecorated, a frame parameter
2095 @item undecorated
2096 If non-@code{nil}, this frame's window-system window is drawn without
2097 decorations, like the title, minimize/maximize boxes and external
2098 borders.  This usually means that the window cannot be dragged, resized,
2099 iconified, maximized or deleted with the mouse.  If nil, the frame's
2100 window is usually drawn with all the elements listed above unless their
2101 display has been suspended via window manager settings.
2103 Under X, Emacs uses the Motif window manager hints to turn off
2104 decorations.  Some window managers may not honor these hints.
2106 NS builds consider the tool bar to be a decoration, and therefore hide
2107 it on an undecorated frame.
2109 @vindex override-redirect, a frame parameter
2110 @item override-redirect
2111 @cindex override redirect frames
2112 If non-@code{nil}, this means that this is an @dfn{override redirect}
2113 frame---a frame not handled by window managers under X.  Override
2114 redirect frames have no window manager decorations, can be positioned
2115 and resized only via Emacs' positioning and resizing functions and are
2116 usually drawn on top of all other frames.  Setting this parameter has
2117 no effect on MS-Windows.
2119 @ignore
2120 @vindex parent-id, a frame parameter
2121 @item parent-id
2122 @c ??? Not yet working.
2123 The X window number of the window that should be the parent of this one.
2124 Specifying this lets you create an Emacs window inside some other
2125 application's window.  (It is not certain this will be implemented; try
2126 it and see if it works.)
2127 @end ignore
2129 @vindex ns-appearance, a frame parameter
2130 @item ns-appearance
2131 Only available on macOS, if set to @code{dark} draw this frame's
2132 window-system window using the ``vibrant dark'' theme, otherwise use
2133 the system default.  The ``vibrant dark'' theme can be used to set the
2134 toolbar and scrollbars to a dark appearance when using an Emacs theme
2135 with a dark background.
2137 @vindex ns-transparent-titlebar, a frame parameter
2138 @item ns-transparent-titlebar
2139 Only available on macOS, if non-@code{nil}, set the titlebar and
2140 toolbar to be transparent.  This effectively sets the background color
2141 of both to match the Emacs background color.
2142 @end table
2145 @node Cursor Parameters
2146 @subsubsection Cursor Parameters
2147 @cindex cursor, and frame parameters
2149   This frame parameter controls the way the cursor looks.
2151 @table @code
2152 @vindex cursor-type, a frame parameter
2153 @item cursor-type
2154 How to display the cursor.  Legitimate values are:
2156 @table @code
2157 @item box
2158 Display a filled box.  (This is the default.)
2159 @item hollow
2160 Display a hollow box.
2161 @item nil
2162 Don't display a cursor.
2163 @item bar
2164 Display a vertical bar between characters.
2165 @item (bar . @var{width})
2166 Display a vertical bar @var{width} pixels wide between characters.
2167 @item hbar
2168 Display a horizontal bar.
2169 @item (hbar . @var{height})
2170 Display a horizontal bar @var{height} pixels high.
2171 @end table
2172 @end table
2174 @vindex cursor-type
2175 The @code{cursor-type} frame parameter may be overridden by the
2176 variables @code{cursor-type} and
2177 @code{cursor-in-non-selected-windows}:
2179 @defvar cursor-type
2180 This buffer-local variable controls how the cursor looks in a selected
2181 window showing the buffer.  If its value is @code{t}, that means to
2182 use the cursor specified by the @code{cursor-type} frame parameter.
2183 Otherwise, the value should be one of the cursor types listed above,
2184 and it overrides the @code{cursor-type} frame parameter.
2185 @end defvar
2187 @defopt cursor-in-non-selected-windows
2188 This buffer-local variable controls how the cursor looks in a window
2189 that is not selected.  It supports the same values as the
2190 @code{cursor-type} frame parameter; also, @code{nil} means don't
2191 display a cursor in nonselected windows, and @code{t} (the default)
2192 means use a standard modification of the usual cursor type (solid box
2193 becomes hollow box, and bar becomes a narrower bar).
2194 @end defopt
2196 @defopt x-stretch-cursor
2197 This variable controls the width of the block cursor displayed on
2198 extra-wide glyphs such as a tab or a stretch of white space.  By
2199 default, the block cursor is only as wide as the font's default
2200 character, and will not cover all of the width of the glyph under it
2201 if that glyph is extra-wide.  A non-@code{nil} value of this variable
2202 means draw the block cursor as wide as the glyph under it.  The
2203 default value is @code{nil}.
2205 This variable has no effect on text-mode frames, since the text-mode
2206 cursor is drawn by the terminal out of Emacs's control.
2207 @end defopt
2209 @defopt blink-cursor-alist
2210 This variable specifies how to blink the cursor.  Each element has the
2211 form @code{(@var{on-state} . @var{off-state})}.  Whenever the cursor
2212 type equals @var{on-state} (comparing using @code{equal}), the
2213 corresponding @var{off-state} specifies what the cursor looks like
2214 when it blinks off.  Both @var{on-state} and @var{off-state}
2215 should be suitable values for the @code{cursor-type} frame parameter.
2217 There are various defaults for how to blink each type of cursor, if
2218 the type is not mentioned as an @var{on-state} here.  Changes in this
2219 variable do not take effect immediately, only when you specify the
2220 @code{cursor-type} frame parameter.
2221 @end defopt
2223 @node Font and Color Parameters
2224 @subsubsection Font and Color Parameters
2225 @cindex font and color, frame parameters
2227   These frame parameters control the use of fonts and colors.
2229 @table @code
2230 @vindex font-backend, a frame parameter
2231 @item font-backend
2232 A list of symbols, specifying the @dfn{font backends} to use for
2233 drawing fonts in the frame, in order of priority.  On X, there are
2234 currently two available font backends: @code{x} (the X core font
2235 driver) and @code{xft} (the Xft font driver).  On MS-Windows, there are
2236 currently two available font backends: @code{gdi} and
2237 @code{uniscribe} (@pxref{Windows Fonts,,, emacs, The GNU Emacs
2238 Manual}).  On other systems, there is only one available font backend,
2239 so it does not make sense to modify this frame parameter.
2241 @vindex background-mode, a frame parameter
2242 @item background-mode
2243 This parameter is either @code{dark} or @code{light}, according
2244 to whether the background color is a light one or a dark one.
2246 @vindex tty-color-mode, a frame parameter
2247 @item tty-color-mode
2248 @cindex standard colors for character terminals
2249 This parameter overrides the terminal's color support as given by the
2250 system's terminal capabilities database in that this parameter's value
2251 specifies the color mode to use on a text terminal.  The value can be
2252 either a symbol or a number.  A number specifies the number of colors
2253 to use (and, indirectly, what commands to issue to produce each
2254 color).  For example, @code{(tty-color-mode . 8)} specifies use of the
2255 ANSI escape sequences for 8 standard text colors.  A value of -1 turns
2256 off color support.
2258 If the parameter's value is a symbol, it specifies a number through
2259 the value of @code{tty-color-mode-alist}, and the associated number is
2260 used instead.
2262 @vindex screen-gamma, a frame parameter
2263 @item screen-gamma
2264 @cindex gamma correction
2265 If this is a number, Emacs performs gamma correction which adjusts
2266 the brightness of all colors.  The value should be the screen gamma of
2267 your display.
2269 Usual PC monitors have a screen gamma of 2.2, so color values in
2270 Emacs, and in X windows generally, are calibrated to display properly
2271 on a monitor with that gamma value.  If you specify 2.2 for
2272 @code{screen-gamma}, that means no correction is needed.  Other values
2273 request correction, designed to make the corrected colors appear on
2274 your screen the way they would have appeared without correction on an
2275 ordinary monitor with a gamma value of 2.2.
2277 If your monitor displays colors too light, you should specify a
2278 @code{screen-gamma} value smaller than 2.2.  This requests correction
2279 that makes colors darker.  A screen gamma value of 1.5 may give good
2280 results for LCD color displays.
2282 @vindex alpha, a frame parameter
2283 @item alpha
2284 @cindex opacity, frame
2285 @cindex transparency, frame
2286 @vindex frame-alpha-lower-limit
2287 This parameter specifies the opacity of the frame, on graphical
2288 displays that support variable opacity.  It should be an integer
2289 between 0 and 100, where 0 means completely transparent and 100 means
2290 completely opaque.  It can also have a @code{nil} value, which tells
2291 Emacs not to set the frame opacity (leaving it to the window manager).
2293 To prevent the frame from disappearing completely from view, the
2294 variable @code{frame-alpha-lower-limit} defines a lower opacity limit.
2295 If the value of the frame parameter is less than the value of this
2296 variable, Emacs uses the latter.  By default,
2297 @code{frame-alpha-lower-limit} is 20.
2299 The @code{alpha} frame parameter can also be a cons cell
2300 @code{(@var{active} . @var{inactive})}, where @var{active} is the
2301 opacity of the frame when it is selected, and @var{inactive} is the
2302 opacity when it is not selected.
2304 Some window systems do not support the @code{alpha} parameter for child
2305 frames (@pxref{Child Frames}).
2306 @end table
2308 The following frame parameters are semi-obsolete in that they are
2309 automatically equivalent to particular face attributes of particular
2310 faces (@pxref{Standard Faces,,, emacs, The Emacs Manual}):
2312 @table @code
2313 @vindex font, a frame parameter
2314 @item font
2315 The name of the font for displaying text in the frame.  This is a
2316 string, either a valid font name for your system or the name of an Emacs
2317 fontset (@pxref{Fontsets}).  It is equivalent to the @code{font}
2318 attribute of the @code{default} face.
2320 @vindex foreground-color, a frame parameter
2321 @item foreground-color
2322 The color to use for the image of a character.  It is equivalent to
2323 the @code{:foreground} attribute of the @code{default} face.
2325 @vindex background-color, a frame parameter
2326 @item background-color
2327 The color to use for the background of characters.  It is equivalent to
2328 the @code{:background} attribute of the @code{default} face.
2330 @vindex mouse-color, a frame parameter
2331 @item mouse-color
2332 The color for the mouse pointer.  It is equivalent to the @code{:background}
2333 attribute of the @code{mouse} face.
2335 @vindex cursor-color, a frame parameter
2336 @item cursor-color
2337 The color for the cursor that shows point.  It is equivalent to the
2338 @code{:background} attribute of the @code{cursor} face.
2340 @vindex border-color, a frame parameter
2341 @item border-color
2342 The color for the border of the frame.  It is equivalent to the
2343 @code{:background} attribute of the @code{border} face.
2345 @vindex scroll-bar-foreground, a frame parameter
2346 @item scroll-bar-foreground
2347 If non-@code{nil}, the color for the foreground of scroll bars.  It is
2348 equivalent to the @code{:foreground} attribute of the
2349 @code{scroll-bar} face.
2351 @vindex scroll-bar-background, a frame parameter
2352 @item scroll-bar-background
2353 If non-@code{nil}, the color for the background of scroll bars.  It is
2354 equivalent to the @code{:background} attribute of the
2355 @code{scroll-bar} face.
2356 @end table
2359 @node Geometry
2360 @subsection Geometry
2362   Here's how to examine the data in an X-style window geometry
2363 specification:
2365 @defun x-parse-geometry geom
2366 @cindex geometry specification
2367 The function @code{x-parse-geometry} converts a standard X window
2368 geometry string to an alist that you can use as part of the argument to
2369 @code{make-frame}.
2371 The alist describes which parameters were specified in @var{geom}, and
2372 gives the values specified for them.  Each element looks like
2373 @code{(@var{parameter} . @var{value})}.  The possible @var{parameter}
2374 values are @code{left}, @code{top}, @code{width}, and @code{height}.
2376 For the size parameters, the value must be an integer.  The position
2377 parameter names @code{left} and @code{top} are not totally accurate,
2378 because some values indicate the position of the right or bottom edges
2379 instead.  The @var{value} possibilities for the position parameters are:
2380 an integer, a list @code{(+ @var{pos})}, or a list @code{(- @var{pos})};
2381 as previously described (@pxref{Position Parameters}).
2383 Here is an example:
2385 @example
2386 (x-parse-geometry "35x70+0-0")
2387      @result{} ((height . 70) (width . 35)
2388          (top - 0) (left . 0))
2389 @end example
2390 @end defun
2392 @node Terminal Parameters
2393 @section Terminal Parameters
2394 @cindex terminal parameters
2396   Each terminal has a list of associated parameters.  These
2397 @dfn{terminal parameters} are mostly a convenient way of storage for
2398 terminal-local variables, but some terminal parameters have a special
2399 meaning.
2401   This section describes functions to read and change the parameter values
2402 of a terminal.  They all accept as their argument either a terminal or
2403 a frame; the latter means use that frame's terminal.  An argument of
2404 @code{nil} means the selected frame's terminal.
2406 @defun terminal-parameters &optional terminal
2407 This function returns an alist listing all the parameters of
2408 @var{terminal} and their values.
2409 @end defun
2411 @defun terminal-parameter terminal parameter
2412 This function returns the value of the parameter @var{parameter} (a
2413 symbol) of @var{terminal}.  If @var{terminal} has no setting for
2414 @var{parameter}, this function returns @code{nil}.
2415 @end defun
2417 @defun set-terminal-parameter terminal parameter value
2418 This function sets the parameter @var{parameter} of @var{terminal} to the
2419 specified @var{value}, and returns the previous value of that
2420 parameter.
2421 @end defun
2423 Here's a list of a few terminal parameters that have a special
2424 meaning:
2426 @table @code
2427 @item background-mode
2428 The classification of the terminal's background color, either
2429 @code{light} or @code{dark}.
2430 @item normal-erase-is-backspace
2431 Value is either 1 or 0, depending on whether
2432 @code{normal-erase-is-backspace-mode} is turned on or off on this
2433 terminal.  @xref{DEL Does Not Delete,,, emacs, The Emacs Manual}.
2434 @item terminal-initted
2435 After the terminal is initialized, this is set to the
2436 terminal-specific initialization function.
2437 @item tty-mode-set-strings
2438 When present, a list of strings containing escape sequences that Emacs
2439 will output while configuring a tty for rendering.  Emacs emits these
2440 strings only when configuring a terminal: if you want to enable a mode
2441 on a terminal that is already active (for example, while in
2442 @code{tty-setup-hook}), explicitly output the necessary escape
2443 sequence using @code{send-string-to-terminal} in addition to adding
2444 the sequence to @code{tty-mode-set-strings}.
2445 @item tty-mode-reset-strings
2446 When present, a list of strings that undo the effects of the strings
2447 in @code{tty-mode-set-strings}.  Emacs emits these strings when
2448 exiting, deleting a terminal, or suspending itself.
2449 @end table
2451 @node Frame Titles
2452 @section Frame Titles
2453 @cindex frame title
2455   Every frame has a @code{name} parameter; this serves as the default
2456 for the frame title which window systems typically display at the top of
2457 the frame.  You can specify a name explicitly by setting the @code{name}
2458 frame property.
2460   Normally you don't specify the name explicitly, and Emacs computes the
2461 frame name automatically based on a template stored in the variable
2462 @code{frame-title-format}.  Emacs recomputes the name each time the
2463 frame is redisplayed.
2465 @defvar frame-title-format
2466 This variable specifies how to compute a name for a frame when you have
2467 not explicitly specified one.  The variable's value is actually a mode
2468 line construct, just like @code{mode-line-format}, except that the
2469 @samp{%c}, @samp{%C}, and @samp{%l} constructs are ignored.  @xref{Mode Line
2470 Data}.
2471 @end defvar
2473 @defvar icon-title-format
2474 This variable specifies how to compute the name for an iconified frame,
2475 when you have not explicitly specified the frame title.  This title
2476 appears in the icon itself.
2477 @end defvar
2479 @defvar multiple-frames
2480 This variable is set automatically by Emacs.  Its value is @code{t} when
2481 there are two or more frames (not counting minibuffer-only frames or
2482 invisible frames).  The default value of @code{frame-title-format} uses
2483 @code{multiple-frames} so as to put the buffer name in the frame title
2484 only when there is more than one frame.
2486 The value of this variable is not guaranteed to be accurate except
2487 while processing @code{frame-title-format} or
2488 @code{icon-title-format}.
2489 @end defvar
2491 @node Deleting Frames
2492 @section Deleting Frames
2493 @cindex deleting frames
2495 A @dfn{live frame} is one that has not been deleted.  When a frame is
2496 deleted, it is removed from its terminal display, although it may
2497 continue to exist as a Lisp object until there are no more references to
2500 @deffn Command delete-frame &optional frame force
2501 @vindex delete-frame-functions
2502 This function deletes the frame @var{frame}.  The argument @var{frame}
2503 must specify a live frame (see below) and defaults to the selected
2504 frame.
2506 It first deletes any child frame of @var{frame} (@pxref{Child Frames})
2507 and any frame whose @code{delete-before} frame parameter (@pxref{Frame
2508 Interaction Parameters}) specifies @var{frame}.  All such deletions are
2509 performed recursively; so this step makes sure that no other frames with
2510 @var{frame} as their ancestor will exist.  Then, unless @var{frame}
2511 specifies a tooltip, this function runs the hook
2512 @code{delete-frame-functions} (each function getting one argument,
2513 @var{frame}) before actually killing the frame.
2515 Note that a frame cannot be deleted as long as its minibuffer serves as
2516 surrogate minibuffer for another frame (@pxref{Minibuffers and Frames}).
2517 Normally, you cannot delete a frame if all other frames are invisible,
2518 but if @var{force} is non-@code{nil}, then you are allowed to do so.
2519 @end deffn
2521 @defun frame-live-p frame
2522 This function returns non-@code{nil} if the frame @var{frame} has not
2523 been deleted.  The possible non-@code{nil} return values are like those
2524 of @code{framep}.  @xref{Frames}.
2525 @end defun
2527   Some window managers provide a command to delete a window.  These work
2528 by sending a special message to the program that operates the window.
2529 When Emacs gets one of these commands, it generates a
2530 @code{delete-frame} event, whose normal definition is a command that
2531 calls the function @code{delete-frame}.  @xref{Misc Events}.
2533 @deffn Command delete-other-frames &optional frame
2534 This command deletes all frames on @var{frame}'s terminal, except
2535 @var{frame}.  If @var{frame} uses another frame's minibuffer, that
2536 minibuffer frame is left untouched.  The argument @var{frame} must
2537 specify a live frame and defaults to the selected frame.  Internally,
2538 this command works by calling @code{delete-frame} with @var{force}
2539 @code{nil} for all frames that shall be deleted.
2541 This function does not delete any of @var{frame}'s child frames
2542 (@pxref{Child Frames}).  If @var{frame} is a child frame, it deletes
2543 @var{frame}'s siblings only.
2544 @end deffn
2547 @node Finding All Frames
2548 @section Finding All Frames
2549 @cindex frames, scanning all
2551 @defun frame-list
2552 This function returns a list of all the live frames, i.e., those that
2553 have not been deleted.  It is analogous to @code{buffer-list} for
2554 buffers, and includes frames on all terminals.  The list that you get
2555 is newly created, so modifying the list doesn't have any effect on the
2556 internals of Emacs.
2557 @end defun
2559 @defun visible-frame-list
2560 This function returns a list of just the currently visible frames.
2561 @xref{Visibility of Frames}.  Frames on text terminals always count as
2562 visible, even though only the selected one is actually displayed.
2563 @end defun
2565 @defun frame-list-z-order &optional display
2566 This function returns a list of Emacs' frames, in Z (stacking) order
2567 (@pxref{Raising and Lowering}).  The optional argument @var{display}
2568 specifies which display to poll.  @var{display} should be either a frame
2569 or a display name (a string).  If omitted or @code{nil}, that stands for
2570 the selected frame's display.  It returns @code{nil} if @var{display}
2571 contains no Emacs frame.
2573 Frames are listed from topmost (first) to bottommost (last).  As a
2574 special case, if @var{display} is non-@code{nil} and specifies a live
2575 frame, it returns the child frames of that frame in Z (stacking) order.
2577 This function is not meaningful on text terminals.
2578 @end defun
2580 @defun next-frame &optional frame minibuf
2581 This function lets you cycle conveniently through all the frames on a
2582 specific terminal from an arbitrary starting point.  It returns the
2583 frame following @var{frame}, in the list of all live frames, on
2584 @var{frame}'s terminal.  The argument @var{frame} must specify a live
2585 frame and defaults to the selected frame.  It never returns a frame
2586 whose @code{no-other-frame} parameter (@pxref{Frame Interaction
2587 Parameters}) is non-@code{nil}.
2589 The second argument, @var{minibuf}, says which frames to consider:
2591 @table @asis
2592 @item @code{nil}
2593 Exclude minibuffer-only frames.
2594 @item @code{visible}
2595 Consider all visible frames.
2596 @item 0
2597 Consider all visible or iconified frames.
2598 @item a window
2599 Consider only the frames using that particular window as their
2600 minibuffer.
2601 @item anything else
2602 Consider all frames.
2603 @end table
2604 @end defun
2606 @defun previous-frame &optional frame minibuf
2607 Like @code{next-frame}, but cycles through all frames in the opposite
2608 direction.
2609 @end defun
2611   See also @code{next-window} and @code{previous-window}, in @ref{Cyclic
2612 Window Ordering}.
2614 @node Minibuffers and Frames
2615 @section Minibuffers and Frames
2617 Normally, each frame has its own minibuffer window at the bottom, which
2618 is used whenever that frame is selected.  You can get that window with
2619 the function @code{minibuffer-window} (@pxref{Minibuffer Windows}).
2621 @cindex frame without a minibuffer
2622 @cindex surrogate minibuffer frame
2623 However, you can also create a frame without a minibuffer.  Such a frame
2624 must use the minibuffer window of some other frame.  That other frame
2625 will serve as @dfn{surrogate minibuffer frame} for this frame and cannot
2626 be deleted via @code{delete-frame} (@pxref{Deleting Frames}) as long as
2627 this frame is live.
2629 When you create the frame, you can explicitly specify its minibuffer
2630 window (in some other frame) with the @code{minibuffer} frame parameter
2631 (@pxref{Buffer Parameters}).  If you don't, then the minibuffer is found
2632 in the frame which is the value of the variable
2633 @code{default-minibuffer-frame}.  Its value should be a frame that does
2634 have a minibuffer.
2636 If you use a minibuffer-only frame, you might want that frame to raise
2637 when you enter the minibuffer.  If so, set the variable
2638 @code{minibuffer-auto-raise} to @code{t}.  @xref{Raising and Lowering}.
2640 @defvar default-minibuffer-frame
2641 This variable specifies the frame to use for the minibuffer window, by
2642 default.  It does not affect existing frames.  It is always local to
2643 the current terminal and cannot be buffer-local.  @xref{Multiple
2644 Terminals}.
2645 @end defvar
2648 @node Input Focus
2649 @section Input Focus
2650 @cindex input focus
2651 @cindex selected frame
2653 At any time, one frame in Emacs is the @dfn{selected frame}.  The
2654 selected window always resides on the selected frame.
2656 When Emacs displays its frames on several terminals (@pxref{Multiple
2657 Terminals}), each terminal has its own selected frame.  But only one
2658 of these is @emph{the} selected frame: it's the frame that belongs
2659 to the terminal from which the most recent input came.  That is, when
2660 Emacs runs a command that came from a certain terminal, the selected
2661 frame is the one of that terminal.  Since Emacs runs only a single
2662 command at any given time, it needs to consider only one selected
2663 frame at a time; this frame is what we call @dfn{the selected frame}
2664 in this manual.  The display on which the selected frame is shown is
2665 the @dfn{selected frame's display}.
2667 @defun selected-frame
2668 This function returns the selected frame.
2669 @end defun
2671 Some window systems and window managers direct keyboard input to the
2672 window object that the mouse is in; others require explicit clicks or
2673 commands to @dfn{shift the focus} to various window objects.  Either
2674 way, Emacs automatically keeps track of which frame has the focus.  To
2675 explicitly switch to a different frame from a Lisp function, call
2676 @code{select-frame-set-input-focus}.
2678 Lisp programs can also switch frames temporarily by calling the
2679 function @code{select-frame}.  This does not alter the window system's
2680 concept of focus; rather, it escapes from the window manager's control
2681 until that control is somehow reasserted.
2683 When using a text terminal, only one frame can be displayed at a time
2684 on the terminal, so after a call to @code{select-frame}, the next
2685 redisplay actually displays the newly selected frame.  This frame
2686 remains selected until a subsequent call to @code{select-frame}.  Each
2687 frame on a text terminal has a number which appears in the mode line
2688 before the buffer name (@pxref{Mode Line Variables}).
2690 @defun select-frame-set-input-focus frame &optional norecord
2691 This function selects @var{frame}, raises it (should it happen to be
2692 obscured by other frames) and tries to give it the X server's focus.
2693 On a text terminal, the next redisplay displays the new frame on the
2694 entire terminal screen.  The optional argument @var{norecord} has the
2695 same meaning as for @code{select-frame} (see below).  The return value
2696 of this function is not significant.
2697 @end defun
2699 Ideally, the function described next should focus a frame without also
2700 raising it above other frames.  Unfortunately, many window-systems or
2701 window managers may refuse to comply.
2703 @defun x-focus-frame &optional frame noactivate
2704 This function gives @var{frame} the focus of the X server without
2705 necessarily raising it.  @var{frame} @code{nil} means use the selected
2706 frame.  Under X, the optional argument @var{noactivate}, if
2707 non-@code{nil}, means to avoid making @var{frame}'s window-system window
2708 the ``active'' window which should insist a bit more on avoiding to
2709 raise @var{frame} above other frames.
2711 On MS-Windows the @var{noactivate} argument has no effect.  However, if
2712 @var{frame} is a child frame (@pxref{Child Frames}), this function
2713 usually focuses @var{frame} without raising it above other child
2714 frames.
2716 If there is no window system support, this function does nothing.
2717 @end defun
2719 @deffn Command select-frame frame &optional norecord
2720 This function selects frame @var{frame}, temporarily disregarding the
2721 focus of the X server if any.  The selection of @var{frame} lasts until
2722 the next time the user does something to select a different frame, or
2723 until the next time this function is called.  (If you are using a
2724 window system, the previously selected frame may be restored as the
2725 selected frame after return to the command loop, because it still may
2726 have the window system's input focus.)
2728 The specified @var{frame} becomes the selected frame, and its terminal
2729 becomes the selected terminal.  This function then calls
2730 @code{select-window} as a subroutine, passing the window selected
2731 within @var{frame} as its first argument and @var{norecord} as its
2732 second argument (hence, if @var{norecord} is non-@code{nil}, this
2733 avoids changing the order of recently selected windows and the buffer
2734 list).  @xref{Selecting Windows}.
2736 This function returns @var{frame}, or @code{nil} if @var{frame} has
2737 been deleted.
2739 In general, you should never use @code{select-frame} in a way that
2740 could switch to a different terminal without switching back when
2741 you're done.
2742 @end deffn
2744 Emacs cooperates with the window system by arranging to select frames as
2745 the server and window manager request.  It does so by generating a
2746 special kind of input event, called a @dfn{focus} event, when
2747 appropriate.  The command loop handles a focus event by calling
2748 @code{handle-switch-frame}.  @xref{Focus Events}.
2750 @deffn Command handle-switch-frame frame
2751 This function handles a focus event by selecting frame @var{frame}.
2753 Focus events normally do their job by invoking this command.
2754 Don't call it for any other reason.
2755 @end deffn
2757 @defun redirect-frame-focus frame &optional focus-frame
2758 This function redirects focus from @var{frame} to @var{focus-frame}.
2759 This means that @var{focus-frame} will receive subsequent keystrokes and
2760 events intended for @var{frame}.  After such an event, the value of
2761 @code{last-event-frame} will be @var{focus-frame}.  Also, switch-frame
2762 events specifying @var{frame} will instead select @var{focus-frame}.
2764 If @var{focus-frame} is omitted or @code{nil}, that cancels any existing
2765 redirection for @var{frame}, which therefore once again receives its own
2766 events.
2768 One use of focus redirection is for frames that don't have minibuffers.
2769 These frames use minibuffers on other frames.  Activating a minibuffer
2770 on another frame redirects focus to that frame.  This puts the focus on
2771 the minibuffer's frame, where it belongs, even though the mouse remains
2772 in the frame that activated the minibuffer.
2774 Selecting a frame can also change focus redirections.  Selecting frame
2775 @code{bar}, when @code{foo} had been selected, changes any redirections
2776 pointing to @code{foo} so that they point to @code{bar} instead.  This
2777 allows focus redirection to work properly when the user switches from
2778 one frame to another using @code{select-window}.
2780 This means that a frame whose focus is redirected to itself is treated
2781 differently from a frame whose focus is not redirected.
2782 @code{select-frame} affects the former but not the latter.
2784 The redirection lasts until @code{redirect-frame-focus} is called to
2785 change it.
2786 @end defun
2788 @defvar focus-in-hook
2789 This is a normal hook run when an Emacs frame gains input focus.  The
2790 frame gaining focus is selected when this hook is run.
2791 @end defvar
2793 @defvar focus-out-hook
2794 This is a normal hook run when an Emacs frame has lost input focus and
2795 no other Emacs frame has gained input focus instead.
2796 @end defvar
2798 @defopt focus-follows-mouse
2799 This option informs Emacs whether and how the window manager transfers
2800 focus when you move the mouse pointer into a frame.  It can have three
2801 meaningful values:
2803 @table @asis
2804 @item @code{nil}
2805 The default value @code{nil} should be used when your window manager
2806 follows a ``click-to-focus'' policy where you have to click the mouse
2807 inside of a frame in order for that frame to gain focus.
2809 @item @code{t}
2810 The value @code{t} should be used when your window manager has the focus
2811 automatically follow the position of the mouse pointer but a frame that
2812 gains focus is not raised automatically and may even remain occluded by
2813 other window-system windows.
2815 @item @code{auto-raise}
2816 The value @code{auto-raise} should be used when your window manager has
2817 the focus automatically follow the position of the mouse pointer and a
2818 frame that gains focus is raised automatically.
2819 @end table
2821 If this option is non-@code{nil}, Emacs moves the mouse pointer to the
2822 frame selected by @code{select-frame-set-input-focus}.  That function is
2823 used by a number of commands like, for example, @code{other-frame} and
2824 @code{pop-to-buffer}.
2826 The distinction between the values @code{t} and @code{auto-raise} is not
2827 needed for ``normal'' frames because the window manager usually takes
2828 care of raising them.  It is useful to automatically raise child frames
2829 via @code{mouse-autoselect-window} (@pxref{Mouse Window
2830 Auto-selection}).
2832 Note that this option does not distinguish ``sloppy'' focus (where the
2833 frame that previously had focus retains focus as long as the mouse
2834 pointer does not move into another window manager window) from
2835 ``strict'' focus (where a frame immediately loses focus when it's left
2836 by the mouse pointer).  Neither does it recognize whether your window
2837 manager supports delayed focusing or auto-raising where you can
2838 explicitly specify the time until a new frame gets focus or is
2839 auto-raised.
2841 You can supply a ``focus follows mouse'' policy for individual Emacs
2842 windows by customizing the variable @code{mouse-autoselect-window}
2843 (@pxref{Mouse Window Auto-selection}).
2844 @end defopt
2847 @node Visibility of Frames
2848 @section Visibility of Frames
2849 @cindex visible frame
2850 @cindex invisible frame
2851 @cindex iconified frame
2852 @cindex minimized frame
2853 @cindex frame visibility
2855 A frame on a graphical display may be @dfn{visible}, @dfn{invisible}, or
2856 @dfn{iconified}.  If it is visible, its contents are displayed in the
2857 usual manner.  If it is iconified, its contents are not displayed, but
2858 there is a little icon somewhere to bring the frame back into view (some
2859 window managers refer to this state as @dfn{minimized} rather than
2860 @dfn{iconified}, but from Emacs' point of view they are the same thing).
2861 If a frame is invisible, it is not displayed at all.
2863 @cindex mapped frame
2864 @cindex unmapped frame
2865   The concept of visibility is strongly related to that of (un-)mapped
2866 frames.  A frame (or, more precisely, its window-system window) is and
2867 becomes @dfn{mapped} when it is displayed for the first time and
2868 whenever it changes its state of visibility from @code{iconified} or
2869 @code{invisible} to @code{visible}.  Conversely, a frame is and becomes
2870 @dfn{unmapped} whenever it changes its status from @code{visible} to
2871 @code{iconified} or @code{invisible}.
2873   Visibility is meaningless on text terminals, since only the selected
2874 frame is actually displayed in any case.
2876 @defun frame-visible-p frame
2877 This function returns the visibility status of frame @var{frame}.  The
2878 value is @code{t} if @var{frame} is visible, @code{nil} if it is
2879 invisible, and @code{icon} if it is iconified.
2881 On a text terminal, all frames are considered visible for the
2882 purposes of this function, even though only one frame is displayed.
2883 @xref{Raising and Lowering}.
2884 @end defun
2886 @deffn Command iconify-frame &optional frame
2887 This function iconifies frame @var{frame}.  If you omit @var{frame}, it
2888 iconifies the selected frame.  This usually makes all child frames of
2889 @var{frame} (and their descendants) invisible (@pxref{Child Frames}).
2890 @end deffn
2892 @deffn Command make-frame-visible &optional frame
2893 This function makes frame @var{frame} visible.  If you omit @var{frame},
2894 it makes the selected frame visible.  This does not raise the frame, but
2895 you can do that with @code{raise-frame} if you wish (@pxref{Raising and
2896 Lowering}).
2898 Making a frame visible usually makes all its child frames (and their
2899 descendants) visible as well (@pxref{Child Frames}).
2900 @end deffn
2902 @deffn Command make-frame-invisible &optional frame force
2903 This function makes frame @var{frame} invisible.  If you omit
2904 @var{frame}, it makes the selected frame invisible.  Usually, this makes
2905 all child frames of @var{frame} (and their descendants) invisible too
2906 (@pxref{Child Frames}).
2908 Unless @var{force} is non-@code{nil}, this function refuses to make
2909 @var{frame} invisible if all other frames are invisible.
2910 @end deffn
2912   The visibility status of a frame is also available as a frame
2913 parameter.  You can read or change it as such.  @xref{Management
2914 Parameters}.  The user can also iconify and deiconify frames with the
2915 window manager.  This happens below the level at which Emacs can exert
2916 any control, but Emacs does provide events that you can use to keep
2917 track of such changes.  @xref{Misc Events}.
2919 @defun x-double-buffered-p &optional frame
2920 This function returns non-@code{nil} if @var{frame} is currently
2921 being rendered with double buffering.  @var{frame} defaults to the
2922 selected frame.
2923 @end defun
2926 @node Raising and Lowering
2927 @section Raising, Lowering and Restacking Frames
2929 @cindex raising a frame
2930 @cindex lowering a frame
2931 @cindex restacking a frame
2932 @cindex frame stacking order
2933 @cindex frame Z-order
2934 @cindex Z-order
2935   Most window systems use a desktop metaphor.  Part of this metaphor is
2936 the idea that system-level windows (representing, e.g., Emacs frames)
2937 are stacked in a notional third dimension perpendicular to the screen
2938 surface.  The order induced by stacking is total and usually referred to
2939 as stacking (or Z-) order.  Where the areas of two windows overlap, the
2940 one higher up in that order will (partially) cover the one underneath.
2942   You can @dfn{raise} a frame to the top of that order or @dfn{lower} a
2943 frame to its bottom by using the functions @code{raise-frame} and
2944 @code{lower-frame}.  You can @dfn{restack} a frame directly above or
2945 below another frame using the function @code{frame-restack}.
2947   Note that all functions described below will respect the adherence of
2948 frames (and all other window-system windows) to their respective z-group
2949 (@pxref{Position Parameters}).  For example, you usually cannot lower a
2950 frame below that of the desktop window and you cannot raise a frame
2951 whose @code{z-group} parameter is @code{nil} above the window-system's
2952 taskbar or tooltip window.
2954 @deffn Command raise-frame &optional frame
2955 This function raises frame @var{frame} (default, the selected frame)
2956 above all other frames belonging to the same or a lower z-group as
2957 @var{frame}.  If @var{frame} is invisible or iconified, this makes it
2958 visible.  If @var{frame} is a child frame (@pxref{Child Frames}), this
2959 raises @var{frame} above all other child frames of its parent.
2960 @end deffn
2962 @deffn Command lower-frame &optional frame
2963 This function lowers frame @var{frame} (default, the selected frame)
2964 below all other frames belonging to the same or a higher z-group as
2965 @var{frame}.  If @var{frame} is a child frame (@pxref{Child Frames}),
2966 this lowers @var{frame} below all other child frames of its parent.
2967 @end deffn
2969 @defun frame-restack frame1 frame2 &optional above
2970 This function restacks @var{frame1} below @var{frame2}.  This implies
2971 that if both frames are visible and their display areas overlap,
2972 @var{frame2} will (partially) obscure @var{frame1}.  If the optional
2973 third argument @var{above} is non-@code{nil}, this function restacks
2974 @var{frame1} above @var{frame2}.  This means that if both frames are
2975 visible and their display areas overlap, @var{frame1} will (partially)
2976 obscure @var{frame2}.
2978 Technically, this function may be thought of as an atomic action
2979 performed in two steps: The first step removes @var{frame1}'s
2980 window-system window from the display.  The second step reinserts
2981 @var{frame1}'s window into the display below (above if @var{above} is
2982 true) that of @var{frame2}.  Hence the position of @var{frame2} in its
2983 display's Z (stacking) order relative to all other frames excluding
2984 @var{frame1} remains unaltered.
2986 Some window managers may refuse to restack windows.
2987 @end defun
2989 Note that the effect of restacking will only hold as long as neither of
2990 the involved frames is iconified or made invisible.  You can use the
2991 @code{z-group} (@pxref{Position Parameters}) frame parameter to add a
2992 frame to a group of frames permanently shown above or below other
2993 frames.  As long as a frame belongs to one of these groups, restacking
2994 it will only affect its relative stacking position within that group.
2995 The effect of restacking frames belonging to different z-groups is
2996 undefined.  You can list frames in their current stacking order with the
2997 function @code{frame-list-z-order} (@pxref{Finding All Frames}).
2999 @defopt minibuffer-auto-raise
3000 If this is non-@code{nil}, activation of the minibuffer raises the frame
3001 that the minibuffer window is in.
3002 @end defopt
3004   On window systems, you can also enable auto-raising (on frame
3005 selection) or auto-lowering (on frame deselection) using frame
3006 parameters.  @xref{Management Parameters}.
3008 @cindex top frame
3009   The concept of raising and lowering frames also applies to text
3010 terminal frames.  On each text terminal, only the top frame is
3011 displayed at any one time.
3013 @defun tty-top-frame &optional terminal
3014 This function returns the top frame on @var{terminal}.  @var{terminal}
3015 should be a terminal object, a frame (meaning that frame's terminal),
3016 or @code{nil} (meaning the selected frame's terminal).  If it does not
3017 refer to a text terminal, the return value is @code{nil}.
3018 @end defun
3021 @node Frame Configurations
3022 @section Frame Configurations
3023 @cindex frame configuration
3025   A @dfn{frame configuration} records the current arrangement of frames,
3026 all their properties, and the window configuration of each one.
3027 (@xref{Window Configurations}.)
3029 @defun current-frame-configuration
3030 This function returns a frame configuration list that describes
3031 the current arrangement of frames and their contents.
3032 @end defun
3034 @defun set-frame-configuration configuration &optional nodelete
3035 This function restores the state of frames described in
3036 @var{configuration}.  However, this function does not restore deleted
3037 frames.
3039 Ordinarily, this function deletes all existing frames not listed in
3040 @var{configuration}.  But if @var{nodelete} is non-@code{nil}, the
3041 unwanted frames are iconified instead.
3042 @end defun
3045 @node Child Frames
3046 @section Child Frames
3047 @cindex child frames
3048 @cindex parent frames
3050 Child frames are objects halfway between windows (@pxref{Windows}) and
3051 ``normal'' frames.  Like windows, they are attached to an owning frame.
3052 Unlike windows, they may overlap each other---changing the size or
3053 position of one child frame does not change the size or position of any
3054 of its sibling child frames.
3056   By design, operations to make or modify child frames are implemented
3057 with the help of frame parameters (@pxref{Frame Parameters}) without any
3058 specialized functions or customizable variables.  Note that child frames
3059 are meaningful on graphical terminals only.
3061   To create a new child frame or to convert a normal frame into a child
3062 frame, set that frame's @code{parent-frame} parameter (@pxref{Frame
3063 Interaction Parameters}) to that of an already existing frame.  The
3064 frame specified by that parameter will then be the frame's parent frame
3065 as long as the parameter is not changed or reset.  Technically, this
3066 makes the child frame's window-system window a child window of the
3067 parent frame's window-system window.
3069 @cindex top-level frame
3070 @cindex reparent frame
3071 @cindex nest frame
3072   The @code{parent-frame} parameter can be changed at any time.  Setting
3073 it to another frame @dfn{reparents} the child frame.  Setting it to
3074 another child frame makes the frame a @dfn{nested} child frame.  Setting
3075 it to @code{nil} restores the frame's status as a @dfn{top-level
3076 frame}---a frame whose window-system window is a child of its display's
3077 root window.
3079   Since child frames can be arbitrarily nested, a frame can be both a
3080 child and a parent frame.  Also, the relative roles of child and parent
3081 frame may be reversed at any time (though it's usually a good idea to
3082 keep the size of a child frame sufficiently smaller than that of its
3083 parent).  An error will be signaled for the attempt to make a frame an
3084 ancestor of itself.
3086    Most window-systems clip a child frame at the native edges
3087 (@pxref{Frame Geometry}) of its parent frame---everything outside these
3088 edges is usually invisible.  A child frame's @code{left} and @code{top}
3089 parameters specify a position relative to the top-left corner of its
3090 parent's native frame.  When the parent frame is resized, this position
3091 remains conceptually unaltered.
3093   NS builds do not clip child frames at the parent frame's edges,
3094 allowing them to be positioned so they do not obscure the parent frame
3095 while still being visible themselves.
3097   Usually, moving a parent frame moves along all its child frames and
3098 their descendants as well, keeping their relative positions unaltered.
3099 Note that the hook @code{move-frame-functions} (@pxref{Frame Position})
3100 is run for a child frame only when the position of the child frame
3101 relative to its parent frame changes.  It is not run for a child frame
3102 when the position of the parent frame changes.
3104   When a parent frame is resized, its child frames conceptually retain
3105 their previous sizes and their positions relative to the left upper
3106 corner of the parent.  This means that a child frame may become
3107 (partially) invisible when its parent frame shrinks.  The parameter
3108 @code{keep-ratio} (@pxref{Frame Interaction Parameters}) can be used to
3109 resize and reposition a child frame proportionally whenever its parent
3110 frame is resized.  This may avoid obscuring parts of a frame when its
3111 parent frame is shrunk.
3113   A visible child frame always appears on top of its parent frame thus
3114 obscuring parts of it, except on NS builds where it may be positioned
3115 beneath the parent.  This is comparable to the window-system window of a
3116 top-level frame which also always appears on top of its parent
3117 window---the desktop's root window.  When a parent frame is iconified or
3118 made invisible (@pxref{Visibility of Frames}), its child frames are made
3119 invisible.  When a parent frame is deiconified or made visible, its
3120 child frames are made visible.  When a parent frame is about to be
3121 deleted (@pxref{Deleting Frames}), its child frames are recursively
3122 deleted before it.
3124   Whether a child frame can have a menu or tool bar is window-system or
3125 window manager dependent.  Most window-systems explicitly disallow menus
3126 bars for child frames.  It seems advisable to disable both, menu and
3127 tool bars, via the frame's initial parameters settings.
3129   Usually, child frames do not exhibit window manager decorations like a
3130 title bar or external borders (@pxref{Frame Geometry}).  When the child
3131 frame does not show a menu or tool bar, any other of the frame's borders
3132 (@pxref{Layout Parameters}) can be used instead of the external borders.
3134   In particular, under X (but not when building with GTK+), the frame's
3135 outer border can be used.  On MS-Windows, specifying a non-zero outer
3136 border width will show a one-pixel wide external border.  Under all
3137 window-systems, the internal border can be used.  In either case, it's
3138 advisable to disable a child frame's window manager decorations with the
3139 @code{undecorated} frame parameter (@pxref{Management Parameters}).
3141   To resize or move an undecorated child frame with the mouse, special
3142 frame parameters (@pxref{Mouse Dragging Parameters}) have to be used.
3143 The internal border of a child frame, if present, can be used to resize
3144 the frame with the mouse, provided that frame has a non-@code{nil}
3145 @code{drag-internal-border} parameter.  If set, the @code{snap-width}
3146 parameter indicates the number of pixels where the frame @dfn{snaps} at
3147 the respective edge or corner of its parent frame.
3149   There are two ways to drag an entire child frame with the mouse: The
3150 @code{drag-with-mode-line} parameter, if non-@code{nil}, allows to drag
3151 a frame without minibuffer window (@pxref{Minibuffer Windows}) via the
3152 mode line area of its bottommost window.  The
3153 @code{drag-with-header-line} parameter, if non-@code{nil}, allows to
3154 drag the frame via the header line area of its topmost window.
3156   In order to give a child frame a draggable header or mode line, the
3157 window parameters @code{mode-line-format} and @code{header-line-format}
3158 are handy (@pxref{Window Parameters}).  These allow to remove an
3159 unwanted mode line (when @code{drag-with-header-line} is chosen) and to
3160 remove mouse-sensitive areas which might interfere with frame dragging.
3162   To avoid that dragging moves a frame completely out of its parent's
3163 native frame, something which might happen when the mouse cursor
3164 overshoots and makes the frame difficult to retrieve once the mouse
3165 button has been released, it is advisable to set the frame's
3166 @code{top-visible} or @code{bottom-visible} parameter correspondingly.
3168   The @code{top-visible} parameter specifies the number of pixels at the
3169 top of the frame that always remain visible within the parent's native
3170 frame during dragging and should be set when specifying a non-@code{nil}
3171 @code{drag-with-header-line} parameter.  The @code{bottom-visible}
3172 parameter specifies the number of pixels at the bottom of the frame that
3173 always remain visible within the parent's native frame during dragging
3174 and should be preferred when specifying a non-@code{nil}
3175 @code{drag-with-mode-line} parameter.
3177   When a child frame is used for displaying a buffer via
3178 @code{display-buffer-in-child-frame} (@pxref{Display Action Functions}),
3179 the frame's @code{auto-hide-function} parameter (@pxref{Frame
3180 Interaction Parameters}) can be set to a function, in order to
3181 appropriately deal with the frame when the window displaying the buffer
3182 shall be quit.
3184   When a child frame is used during minibuffer interaction, for example,
3185 to display completions in a separate window, the @code{minibuffer-exit}
3186 parameter (@pxref{Frame Interaction Parameters}) is useful in order to
3187 deal with the frame when the minibuffer is exited.
3189   The behavior of child frames deviates from that of top-level frames in
3190 a number of other ways as well.  Here we sketch a few of them:
3192 @itemize @bullet
3193 @item
3194 The semantics of maximizing and iconifying child frames is highly
3195 window-system dependent.  As a rule, applications should never invoke
3196 these operations for child frames.
3198 @item
3199 Raising, lowering and restacking child frames (@pxref{Raising and
3200 Lowering}) or changing the @code{z-group} (@pxref{Position Parameters})
3201 of a child frame changes only the stacking order of child frames with
3202 the same parent.
3204 @item
3205 Many window-systems are not able to change the opacity (@pxref{Font and
3206 Color Parameters}) of child frames.
3208 @item
3209 Transferring focus from a child frame to an ancestor that is not its
3210 parent by clicking with the mouse in a visible part of that ancestor's
3211 window may fail with some window-systems.  You may have to click into
3212 the direct parent's window-system window first.
3214 @item
3215 Window managers might not bother to extend their focus follows mouse
3216 policy to child frames.  Customizing @code{mouse-autoselect-window} can
3217 help in this regard (@pxref{Mouse Window Auto-selection}).
3219 @item
3220 Dropping (@pxref{Drag and Drop}) on child frames is not guaranteed to
3221 work on all window-systems.  Some will drop the object on the parent
3222 frame or on some ancestor instead.
3223 @end itemize
3225   The following two functions can be useful when working with child and
3226 parent frames:
3228 @defun frame-parent &optional frame
3229 This function returns the parent frame of @var{frame}.  The parent frame
3230 of @var{frame} is the Emacs frame whose window-system window is the
3231 parent window of @var{frame}'s window-system window.  If such a frame
3232 exists, @var{frame} is considered a child frame of that frame.
3234 This function returns @code{nil} if @var{frame} has no parent frame.
3235 @end defun
3237 @defun frame-ancestor-p &optional ancestor descendant
3238 This functions returns non-@code{nil} if @var{ancestor} is an ancestor
3239 of @var{descendant}.  @var{ancestor} is an ancestor of @var{descendant}
3240 when it is either @var{descendant}'s parent frame or it is an ancestor
3241 of @var{descendant}'s parent frame.  Both, @var{ancestor} and
3242 @var{descendant} must specify live frames and default to the selected
3243 frame.
3244 @end defun
3246 Note also the function @code{window-largest-empty-rectangle}
3247 (@pxref{Coordinates and Windows}) which can be used to inscribe a child
3248 frame in the largest empty area of an existing window.  This can be
3249 useful to avoid that a child frame obscures any text shown in that
3250 window.
3253 @node Mouse Tracking
3254 @section Mouse Tracking
3255 @cindex mouse tracking
3256 @c @cindex tracking the mouse   Duplicates track-mouse
3258   Sometimes it is useful to @dfn{track} the mouse, which means to display
3259 something to indicate where the mouse is and move the indicator as the
3260 mouse moves.  For efficient mouse tracking, you need a way to wait until
3261 the mouse actually moves.
3263   The convenient way to track the mouse is to ask for events to represent
3264 mouse motion.  Then you can wait for motion by waiting for an event.  In
3265 addition, you can easily handle any other sorts of events that may
3266 occur.  That is useful, because normally you don't want to track the
3267 mouse forever---only until some other event, such as the release of a
3268 button.
3270 @defspec track-mouse body@dots{}
3271 This special form executes @var{body}, with generation of mouse motion
3272 events enabled.  Typically, @var{body} would use @code{read-event} to
3273 read the motion events and modify the display accordingly.  @xref{Motion
3274 Events}, for the format of mouse motion events.
3276 The value of @code{track-mouse} is that of the last form in @var{body}.
3277 You should design @var{body} to return when it sees the up-event that
3278 indicates the release of the button, or whatever kind of event means
3279 it is time to stop tracking.
3281 The @code{track-mouse} form causes Emacs to generate mouse motion
3282 events by binding the variable @code{track-mouse} to a
3283 non-@code{nil} value.  If that variable has the special value
3284 @code{dragging}, it additionally instructs the display engine to
3285 refrain from changing the shape of the mouse pointer.  This is
3286 desirable in Lisp programs that require mouse dragging across large
3287 portions of Emacs display, which might otherwise cause the mouse
3288 pointer to change its shape according to the display portion it hovers
3289 on (@pxref{Pointer Shape}).  Therefore, Lisp programs that need the
3290 mouse pointer to retain its original shape during dragging should bind
3291 @code{track-mouse} to the value @code{dragging} at the beginning of
3292 their @var{body}.
3293 @end defspec
3295 The usual purpose of tracking mouse motion is to indicate on the screen
3296 the consequences of pushing or releasing a button at the current
3297 position.
3299 In many cases, you can avoid the need to track the mouse by using
3300 the @code{mouse-face} text property (@pxref{Special Properties}).
3301 That works at a much lower level and runs more smoothly than
3302 Lisp-level mouse tracking.
3304 @ignore
3305 @c These are not implemented yet.
3307 These functions change the screen appearance instantaneously.  The
3308 effect is transient, only until the next ordinary Emacs redisplay.  That
3309 is OK for mouse tracking, since it doesn't make sense for mouse tracking
3310 to change the text, and the body of @code{track-mouse} normally reads
3311 the events itself and does not do redisplay.
3313 @defun x-contour-region window beg end
3314 This function draws lines to make a box around the text from @var{beg}
3315 to @var{end}, in window @var{window}.
3316 @end defun
3318 @defun x-uncontour-region window beg end
3319 This function erases the lines that would make a box around the text
3320 from @var{beg} to @var{end}, in window @var{window}.  Use it to remove
3321 a contour that you previously made by calling @code{x-contour-region}.
3322 @end defun
3324 @defun x-draw-rectangle frame left top right bottom
3325 This function draws a hollow rectangle on frame @var{frame} with the
3326 specified edge coordinates, all measured in pixels from the inside top
3327 left corner.  It uses the cursor color, the one used for indicating the
3328 location of point.
3329 @end defun
3331 @defun x-erase-rectangle frame left top right bottom
3332 This function erases a hollow rectangle on frame @var{frame} with the
3333 specified edge coordinates, all measured in pixels from the inside top
3334 left corner.  Erasure means redrawing the text and background that
3335 normally belong in the specified rectangle.
3336 @end defun
3337 @end ignore
3339 @node Mouse Position
3340 @section Mouse Position
3341 @cindex mouse position
3342 @cindex position of mouse
3344   The functions @code{mouse-position} and @code{set-mouse-position}
3345 give access to the current position of the mouse.
3347 @defun mouse-position
3348 This function returns a description of the position of the mouse.  The
3349 value looks like @code{(@var{frame} @var{x} . @var{y})}, where @var{x}
3350 and @var{y} are integers giving the (possibly rounded) position in
3351 multiples of the default character size of @var{frame} (@pxref{Frame
3352 Font}) relative to the native position of @var{frame} (@pxref{Frame
3353 Geometry}).
3354 @end defun
3356 @defvar mouse-position-function
3357 If non-@code{nil}, the value of this variable is a function for
3358 @code{mouse-position} to call.  @code{mouse-position} calls this
3359 function just before returning, with its normal return value as the
3360 sole argument, and it returns whatever this function returns to it.
3362 This abnormal hook exists for the benefit of packages like
3363 @file{xt-mouse.el} that need to do mouse handling at the Lisp level.
3364 @end defvar
3366 @defun set-mouse-position frame x y
3367 This function @dfn{warps the mouse} to position @var{x}, @var{y} in
3368 frame @var{frame}.  The arguments @var{x} and @var{y} are integers,
3369 giving the position in multiples of the default character size of
3370 @var{frame} (@pxref{Frame Font}) relative to the native position of
3371 @var{frame} (@pxref{Frame Geometry}).
3373 The resulting mouse position is constrained to the native frame of
3374 @var{frame}.  If @var{frame} is not visible, this function does nothing.
3375 The return value is not significant.
3376 @end defun
3378 @defun mouse-pixel-position
3379 This function is like @code{mouse-position} except that it returns
3380 coordinates in units of pixels rather than units of characters.
3381 @end defun
3383 @defun set-mouse-pixel-position frame x y
3384 This function warps the mouse like @code{set-mouse-position} except that
3385 @var{x} and @var{y} are in units of pixels rather than units of
3386 characters.
3388 The resulting mouse position is not constrained to the native frame of
3389 @var{frame}.  If @var{frame} is not visible, this function does nothing.
3390 The return value is not significant.
3391 @end defun
3393 On a graphical terminal the following two functions allow the absolute
3394 position of the mouse cursor to be retrieved and set.
3396 @defun mouse-absolute-pixel-position
3397 This function returns a cons cell (@var{x} . @var{y}) of the coordinates
3398 of the mouse cursor position in pixels, relative to a position (0, 0) of
3399 the selected frame's display.
3400 @end defun
3402 @defun set-mouse-absolute-pixel-position x y
3403 This function moves the mouse cursor to the position (@var{x}, @var{y}).
3404 The coordinates @var{x} and @var{y} are interpreted in pixels relative
3405 to a position (0, 0) of the selected frame's display.
3406 @end defun
3408 The following function can tell whether the mouse cursor is currently
3409 visible on a frame:
3411 @defun frame-pointer-visible-p &optional frame
3412 This predicate function returns non-@code{nil} if the mouse pointer
3413 displayed on @var{frame} is visible; otherwise it returns @code{nil}.
3414 @var{frame} omitted or @code{nil} means the selected frame.  This is
3415 useful when @code{make-pointer-invisible} is set to @code{t}: it
3416 allows you to know if the pointer has been hidden.
3417 @xref{Mouse Avoidance,,,emacs, The Emacs Manual}.
3418 @end defun
3420 @need 3000
3422 @node Pop-Up Menus
3423 @section Pop-Up Menus
3424 @cindex menus, popup
3426   A Lisp program can pop up a menu so that the user can choose an
3427 alternative with the mouse.  On a text terminal, if the mouse is not
3428 available, the user can choose an alternative using the keyboard
3429 motion keys---@kbd{C-n}, @kbd{C-p}, or up- and down-arrow keys.
3431 @defun x-popup-menu position menu
3432 This function displays a pop-up menu and returns an indication of
3433 what selection the user makes.
3435 The argument @var{position} specifies where on the screen to put the
3436 top left corner of the menu.  It can be either a mouse button event
3437 (which says to put the menu where the user actuated the button) or a
3438 list of this form:
3440 @example
3441 ((@var{xoffset} @var{yoffset}) @var{window})
3442 @end example
3444 @noindent
3445 where @var{xoffset} and @var{yoffset} are coordinates, measured in
3446 pixels, counting from the top left corner of @var{window}.  @var{window}
3447 may be a window or a frame.
3449 If @var{position} is @code{t}, it means to use the current mouse
3450 position (or the top-left corner of the frame if the mouse is not
3451 available on a text terminal).  If @var{position} is @code{nil}, it
3452 means to precompute the key binding equivalents for the keymaps
3453 specified in @var{menu}, without actually displaying or popping up the
3454 menu.
3456 The argument @var{menu} says what to display in the menu.  It can be a
3457 keymap or a list of keymaps (@pxref{Menu Keymaps}).  In this case, the
3458 return value is the list of events corresponding to the user's choice.
3459 This list has more than one element if the choice occurred in a
3460 submenu.  (Note that @code{x-popup-menu} does not actually execute the
3461 command bound to that sequence of events.)  On text terminals and
3462 toolkits that support menu titles, the title is taken from the prompt
3463 string of @var{menu} if @var{menu} is a keymap, or from the prompt
3464 string of the first keymap in @var{menu} if it is a list of keymaps
3465 (@pxref{Defining Menus}).
3467 Alternatively, @var{menu} can have the following form:
3469 @example
3470 (@var{title} @var{pane1} @var{pane2}...)
3471 @end example
3473 @noindent
3474 where each pane is a list of form
3476 @example
3477 (@var{title} @var{item1} @var{item2}...)
3478 @end example
3480 Each @var{item} should be a cons cell, @code{(@var{line} . @var{value})},
3481 where @var{line} is a string and @var{value} is the value to return if
3482 that @var{line} is chosen.  Unlike in a menu keymap, a @code{nil}
3483 @var{value} does not make the menu item non-selectable.
3484 Alternatively, each @var{item} can be a string rather than a cons
3485 cell; this makes a non-selectable menu item.
3487 If the user gets rid of the menu without making a valid choice, for
3488 instance by clicking the mouse away from a valid choice or by typing
3489 @kbd{C-g}, then this normally results in a quit and
3490 @code{x-popup-menu} does not return.  But if @var{position} is a mouse
3491 button event (indicating that the user invoked the menu with the
3492 mouse) then no quit occurs and @code{x-popup-menu} returns @code{nil}.
3493 @end defun
3495   @strong{Usage note:} Don't use @code{x-popup-menu} to display a menu
3496 if you could do the job with a prefix key defined with a menu keymap.
3497 If you use a menu keymap to implement a menu, @kbd{C-h c} and @kbd{C-h
3498 a} can see the individual items in that menu and provide help for them.
3499 If instead you implement the menu by defining a command that calls
3500 @code{x-popup-menu}, the help facilities cannot know what happens inside
3501 that command, so they cannot give any help for the menu's items.
3503   The menu bar mechanism, which lets you switch between submenus by
3504 moving the mouse, cannot look within the definition of a command to see
3505 that it calls @code{x-popup-menu}.  Therefore, if you try to implement a
3506 submenu using @code{x-popup-menu}, it cannot work with the menu bar in
3507 an integrated fashion.  This is why all menu bar submenus are
3508 implemented with menu keymaps within the parent menu, and never with
3509 @code{x-popup-menu}.  @xref{Menu Bar}.
3511   If you want a menu bar submenu to have contents that vary, you should
3512 still use a menu keymap to implement it.  To make the contents vary, add
3513 a hook function to @code{menu-bar-update-hook} to update the contents of
3514 the menu keymap as necessary.
3516 @node Dialog Boxes
3517 @section Dialog Boxes
3518 @cindex dialog boxes
3520   A dialog box is a variant of a pop-up menu---it looks a little
3521 different, it always appears in the center of a frame, and it has just
3522 one level and one or more buttons.  The main use of dialog boxes is
3523 for asking questions that the user can answer with ``yes'', ``no'',
3524 and a few other alternatives.  With a single button, they can also
3525 force the user to acknowledge important information.  The functions
3526 @code{y-or-n-p} and @code{yes-or-no-p} use dialog boxes instead of the
3527 keyboard, when called from commands invoked by mouse clicks.
3529 @defun x-popup-dialog position contents &optional header
3530 This function displays a pop-up dialog box and returns an indication of
3531 what selection the user makes.  The argument @var{contents} specifies
3532 the alternatives to offer; it has this format:
3534 @example
3535 (@var{title} (@var{string} . @var{value})@dots{})
3536 @end example
3538 @noindent
3539 which looks like the list that specifies a single pane for
3540 @code{x-popup-menu}.
3542 The return value is @var{value} from the chosen alternative.
3544 As for @code{x-popup-menu}, an element of the list may be just a
3545 string instead of a cons cell @code{(@var{string} . @var{value})}.
3546 That makes a box that cannot be selected.
3548 If @code{nil} appears in the list, it separates the left-hand items from
3549 the right-hand items; items that precede the @code{nil} appear on the
3550 left, and items that follow the @code{nil} appear on the right.  If you
3551 don't include a @code{nil} in the list, then approximately half the
3552 items appear on each side.
3554 Dialog boxes always appear in the center of a frame; the argument
3555 @var{position} specifies which frame.  The possible values are as in
3556 @code{x-popup-menu}, but the precise coordinates or the individual
3557 window don't matter; only the frame matters.
3559 If @var{header} is non-@code{nil}, the frame title for the box is
3560 @samp{Information}, otherwise it is @samp{Question}.  The former is used
3561 for @code{message-box} (@pxref{message-box}).  (On text terminals, the
3562 box title is not displayed.)
3564 In some configurations, Emacs cannot display a real dialog box; so
3565 instead it displays the same items in a pop-up menu in the center of the
3566 frame.
3568 If the user gets rid of the dialog box without making a valid choice,
3569 for instance using the window manager, then this produces a quit and
3570 @code{x-popup-dialog} does not return.
3571 @end defun
3573 @node Pointer Shape
3574 @section Pointer Shape
3575 @cindex pointer shape
3576 @cindex mouse pointer shape
3578   You can specify the mouse pointer style for particular text or
3579 images using the @code{pointer} text property, and for images with the
3580 @code{:pointer} and @code{:map} image properties.  The values you can
3581 use in these properties are @code{text} (or @code{nil}), @code{arrow},
3582 @code{hand}, @code{vdrag}, @code{hdrag}, @code{modeline}, and
3583 @code{hourglass}.  @code{text} stands for the usual mouse pointer
3584 style used over text.
3586   Over void parts of the window (parts that do not correspond to any
3587 of the buffer contents), the mouse pointer usually uses the
3588 @code{arrow} style, but you can specify a different style (one of
3589 those above) by setting @code{void-text-area-pointer}.
3591 @defopt void-text-area-pointer
3592 This variable specifies the mouse pointer style for void text areas.
3593 These include the areas after the end of a line or below the last line
3594 in the buffer.  The default is to use the @code{arrow} (non-text)
3595 pointer style.
3596 @end defopt
3598   When using X, you can specify what the @code{text} pointer style
3599 really looks like by setting the variable @code{x-pointer-shape}.
3601 @defvar x-pointer-shape
3602 This variable specifies the pointer shape to use ordinarily in the
3603 Emacs frame, for the @code{text} pointer style.
3604 @end defvar
3606 @defvar x-sensitive-text-pointer-shape
3607 This variable specifies the pointer shape to use when the mouse
3608 is over mouse-sensitive text.
3609 @end defvar
3611   These variables affect newly created frames.  They do not normally
3612 affect existing frames; however, if you set the mouse color of a
3613 frame, that also installs the current value of those two variables.
3614 @xref{Font and Color Parameters}.
3616   The values you can use, to specify either of these pointer shapes, are
3617 defined in the file @file{lisp/term/x-win.el}.  Use @kbd{M-x apropos
3618 @key{RET} x-pointer @key{RET}} to see a list of them.
3620 @node Window System Selections
3621 @section Window System Selections
3622 @cindex selection (for window systems)
3623 @cindex clipboard
3624 @cindex primary selection
3625 @cindex secondary selection
3627   In window systems, such as X, data can be transferred between
3628 different applications by means of @dfn{selections}.  X defines an
3629 arbitrary number of @dfn{selection types}, each of which can store its
3630 own data; however, only three are commonly used: the @dfn{clipboard},
3631 @dfn{primary selection}, and @dfn{secondary selection}.  Other window
3632 systems support only the clipboard.  @xref{Cut and Paste,, Cut and
3633 Paste, emacs, The GNU Emacs Manual}, for Emacs commands that make use
3634 of these selections.  This section documents the low-level functions
3635 for reading and setting window-system selections.
3637 @deffn Command gui-set-selection type data
3638 This function sets a window-system selection.  It takes two arguments:
3639 a selection type @var{type}, and the value to assign to it, @var{data}.
3641 @var{type} should be a symbol; it is usually one of @code{PRIMARY},
3642 @code{SECONDARY} or @code{CLIPBOARD}.  These are symbols with
3643 upper-case names, in accord with X Window System conventions.  If
3644 @var{type} is @code{nil}, that stands for @code{PRIMARY}.
3646 If @var{data} is @code{nil}, it means to clear out the selection.
3647 Otherwise, @var{data} may be a string, a symbol, an integer (or a cons
3648 of two integers or list of two integers), an overlay, or a cons of two
3649 markers pointing to the same buffer.  An overlay or a pair of markers
3650 stands for text in the overlay or between the markers.  The argument
3651 @var{data} may also be a vector of valid non-vector selection values.
3653 This function returns @var{data}.
3654 @end deffn
3656 @defun gui-get-selection &optional type data-type
3657 This function accesses selections set up by Emacs or by other
3658 programs.  It takes two optional arguments, @var{type} and
3659 @var{data-type}.  The default for @var{type}, the selection type, is
3660 @code{PRIMARY}.
3662 The @var{data-type} argument specifies the form of data conversion to
3663 use, to convert the raw data obtained from another program into Lisp
3664 data.  Meaningful values include @code{TEXT}, @code{STRING},
3665 @code{UTF8_STRING}, @code{TARGETS}, @code{LENGTH}, @code{DELETE},
3666 @code{FILE_NAME}, @code{CHARACTER_POSITION}, @code{NAME},
3667 @code{LINE_NUMBER}, @code{COLUMN_NUMBER}, @code{OWNER_OS},
3668 @code{HOST_NAME}, @code{USER}, @code{CLASS}, @code{ATOM}, and
3669 @code{INTEGER}.  (These are symbols with upper-case names in accord
3670 with X conventions.)  The default for @var{data-type} is
3671 @code{STRING}.  Window systems other than X usually support only a
3672 small subset of these types, in addition to @code{STRING}.
3673 @end defun
3675 @defopt selection-coding-system
3676 This variable specifies the coding system to use when reading and
3677 writing selections or the clipboard.  @xref{Coding
3678 Systems}.  The default is @code{compound-text-with-extensions}, which
3679 converts to the text representation that X11 normally uses.
3680 @end defopt
3682 @cindex clipboard support (for MS-Windows)
3683 When Emacs runs on MS-Windows, it does not implement X selections in
3684 general, but it does support the clipboard.  @code{gui-get-selection}
3685 and @code{gui-set-selection} on MS-Windows support the text data type
3686 only; if the clipboard holds other types of data, Emacs treats the
3687 clipboard as empty.  The supported data type is @code{STRING}.
3689 For backward compatibility, there are obsolete aliases
3690 @code{x-get-selection} and @code{x-set-selection}, which were the
3691 names of @code{gui-get-selection} and @code{gui-set-selection} before
3692 Emacs 25.1.
3694 @node Drag and Drop
3695 @section Drag and Drop
3696 @cindex drag and drop
3698 @vindex x-dnd-test-function
3699 @vindex x-dnd-known-types
3700   When a user drags something from another application over Emacs, that other
3701 application expects Emacs to tell it if Emacs can handle the data that is
3702 dragged.  The variable @code{x-dnd-test-function} is used by Emacs to determine
3703 what to reply.  The default value is @code{x-dnd-default-test-function}
3704 which accepts drops if the type of the data to be dropped is present in
3705 @code{x-dnd-known-types}.  You can customize @code{x-dnd-test-function} and/or
3706 @code{x-dnd-known-types} if you want Emacs to accept or reject drops based
3707 on some other criteria.
3709 @vindex x-dnd-types-alist
3710   If you want to change the way Emacs handles drop of different types
3711 or add a new type, customize @code{x-dnd-types-alist}.  This requires
3712 detailed knowledge of what types other applications use for drag and
3713 drop.
3715 @vindex dnd-protocol-alist
3716   When an URL is dropped on Emacs it may be a file, but it may also be
3717 another URL type (ftp, http, etc.).  Emacs first checks
3718 @code{dnd-protocol-alist} to determine what to do with the URL@.  If
3719 there is no match there and if @code{browse-url-browser-function} is
3720 an alist, Emacs looks for a match there.  If no match is found the
3721 text for the URL is inserted.  If you want to alter Emacs behavior,
3722 you can customize these variables.
3724 @node Color Names
3725 @section Color Names
3727 @cindex color names
3728 @cindex specify color
3729 @cindex numerical RGB color specification
3730   A color name is text (usually in a string) that specifies a color.
3731 Symbolic names such as @samp{black}, @samp{white}, @samp{red}, etc.,
3732 are allowed; use @kbd{M-x list-colors-display} to see a list of
3733 defined names.  You can also specify colors numerically in forms such
3734 as @samp{#@var{rgb}} and @samp{RGB:@var{r}/@var{g}/@var{b}}, where
3735 @var{r} specifies the red level, @var{g} specifies the green level,
3736 and @var{b} specifies the blue level.  You can use either one, two,
3737 three, or four hex digits for @var{r}; then you must use the same
3738 number of hex digits for all @var{g} and @var{b} as well, making
3739 either 3, 6, 9 or 12 hex digits in all.  (See the documentation of the
3740 X Window System for more details about numerical RGB specification of
3741 colors.)
3743   These functions provide a way to determine which color names are
3744 valid, and what they look like.  In some cases, the value depends on the
3745 @dfn{selected frame}, as described below; see @ref{Input Focus}, for the
3746 meaning of the term ``selected frame''.
3748   To read user input of color names with completion, use
3749 @code{read-color} (@pxref{High-Level Completion, read-color}).
3751 @defun color-defined-p color &optional frame
3752 This function reports whether a color name is meaningful.  It returns
3753 @code{t} if so; otherwise, @code{nil}.  The argument @var{frame} says
3754 which frame's display to ask about; if @var{frame} is omitted or
3755 @code{nil}, the selected frame is used.
3757 Note that this does not tell you whether the display you are using
3758 really supports that color.  When using X, you can ask for any defined
3759 color on any kind of display, and you will get some result---typically,
3760 the closest it can do.  To determine whether a frame can really display
3761 a certain color, use @code{color-supported-p} (see below).
3763 @findex x-color-defined-p
3764 This function used to be called @code{x-color-defined-p},
3765 and that name is still supported as an alias.
3766 @end defun
3768 @defun defined-colors &optional frame
3769 This function returns a list of the color names that are defined
3770 and supported on frame @var{frame} (default, the selected frame).
3771 If @var{frame} does not support colors, the value is @code{nil}.
3773 @findex x-defined-colors
3774 This function used to be called @code{x-defined-colors},
3775 and that name is still supported as an alias.
3776 @end defun
3778 @defun color-supported-p color &optional frame background-p
3779 This returns @code{t} if @var{frame} can really display the color
3780 @var{color} (or at least something close to it).  If @var{frame} is
3781 omitted or @code{nil}, the question applies to the selected frame.
3783 Some terminals support a different set of colors for foreground and
3784 background.  If @var{background-p} is non-@code{nil}, that means you are
3785 asking whether @var{color} can be used as a background; otherwise you
3786 are asking whether it can be used as a foreground.
3788 The argument @var{color} must be a valid color name.
3789 @end defun
3791 @defun color-gray-p color &optional frame
3792 This returns @code{t} if @var{color} is a shade of gray, as defined on
3793 @var{frame}'s display.  If @var{frame} is omitted or @code{nil}, the
3794 question applies to the selected frame.  If @var{color} is not a valid
3795 color name, this function returns @code{nil}.
3796 @end defun
3798 @defun color-values color &optional frame
3799 @cindex rgb value
3800 This function returns a value that describes what @var{color} should
3801 ideally look like on @var{frame}.  If @var{color} is defined, the
3802 value is a list of three integers, which give the amount of red, the
3803 amount of green, and the amount of blue.  Each integer ranges in
3804 principle from 0 to 65535, but some displays may not use the full
3805 range.  This three-element list is called the @dfn{rgb values} of the
3806 color.
3808 If @var{color} is not defined, the value is @code{nil}.
3810 @example
3811 (color-values "black")
3812      @result{} (0 0 0)
3813 (color-values "white")
3814      @result{} (65280 65280 65280)
3815 (color-values "red")
3816      @result{} (65280 0 0)
3817 (color-values "pink")
3818      @result{} (65280 49152 51968)
3819 (color-values "hungry")
3820      @result{} nil
3821 @end example
3823 The color values are returned for @var{frame}'s display.  If
3824 @var{frame} is omitted or @code{nil}, the information is returned for
3825 the selected frame's display.  If the frame cannot display colors, the
3826 value is @code{nil}.
3828 @findex x-color-values
3829 This function used to be called @code{x-color-values},
3830 and that name is still supported as an alias.
3831 @end defun
3833 @node Text Terminal Colors
3834 @section Text Terminal Colors
3835 @cindex colors on text terminals
3837   Text terminals usually support only a small number of colors, and
3838 the computer uses small integers to select colors on the terminal.
3839 This means that the computer cannot reliably tell what the selected
3840 color looks like; instead, you have to inform your application which
3841 small integers correspond to which colors.  However, Emacs does know
3842 the standard set of colors and will try to use them automatically.
3844   The functions described in this section control how terminal colors
3845 are used by Emacs.
3847   Several of these functions use or return @dfn{rgb values}, described
3848 in @ref{Color Names}.
3850   These functions accept a display (either a frame or the name of a
3851 terminal) as an optional argument.  We hope in the future to make
3852 Emacs support different colors on different text terminals; then this
3853 argument will specify which terminal to operate on (the default being
3854 the selected frame's terminal; @pxref{Input Focus}).  At present,
3855 though, the @var{frame} argument has no effect.
3857 @defun tty-color-define name number &optional rgb frame
3858 This function associates the color name @var{name} with
3859 color number @var{number} on the terminal.
3861 The optional argument @var{rgb}, if specified, is an rgb value, a list
3862 of three numbers that specify what the color actually looks like.
3863 If you do not specify @var{rgb}, then this color cannot be used by
3864 @code{tty-color-approximate} to approximate other colors, because
3865 Emacs will not know what it looks like.
3866 @end defun
3868 @defun tty-color-clear &optional frame
3869 This function clears the table of defined colors for a text terminal.
3870 @end defun
3872 @defun tty-color-alist &optional frame
3873 This function returns an alist recording the known colors supported by
3874 a text terminal.
3876 Each element has the form @code{(@var{name} @var{number} . @var{rgb})}
3877 or @code{(@var{name} @var{number})}.  Here, @var{name} is the color
3878 name, @var{number} is the number used to specify it to the terminal.
3879 If present, @var{rgb} is a list of three color values (for red, green,
3880 and blue) that says what the color actually looks like.
3881 @end defun
3883 @defun tty-color-approximate rgb &optional frame
3884 This function finds the closest color, among the known colors
3885 supported for @var{display}, to that described by the rgb value
3886 @var{rgb} (a list of color values).  The return value is an element of
3887 @code{tty-color-alist}.
3888 @end defun
3890 @defun tty-color-translate color &optional frame
3891 This function finds the closest color to @var{color} among the known
3892 colors supported for @var{display} and returns its index (an integer).
3893 If the name @var{color} is not defined, the value is @code{nil}.
3894 @end defun
3896 @node Resources
3897 @section X Resources
3899 This section describes some of the functions and variables for
3900 querying and using X resources, or their equivalent on your operating
3901 system.  @xref{X Resources,, X Resources, emacs, The GNU Emacs
3902 Manual}, for more information about X resources.
3904 @defun x-get-resource attribute class &optional component subclass
3905 The function @code{x-get-resource} retrieves a resource value from the X
3906 Window defaults database.
3908 Resources are indexed by a combination of a @dfn{key} and a @dfn{class}.
3909 This function searches using a key of the form
3910 @samp{@var{instance}.@var{attribute}} (where @var{instance} is the name
3911 under which Emacs was invoked), and using @samp{Emacs.@var{class}} as
3912 the class.
3914 The optional arguments @var{component} and @var{subclass} add to the key
3915 and the class, respectively.  You must specify both of them or neither.
3916 If you specify them, the key is
3917 @samp{@var{instance}.@var{component}.@var{attribute}}, and the class is
3918 @samp{Emacs.@var{class}.@var{subclass}}.
3919 @end defun
3921 @defvar x-resource-class
3922 This variable specifies the application name that @code{x-get-resource}
3923 should look up.  The default value is @code{"Emacs"}.  You can examine X
3924 resources for other application names by binding this
3925 variable to some other string, around a call to @code{x-get-resource}.
3926 @end defvar
3928 @defvar x-resource-name
3929 This variable specifies the instance name that @code{x-get-resource}
3930 should look up.  The default value is the name Emacs was invoked with,
3931 or the value specified with the @samp{-name} or @samp{-rn} switches.
3932 @end defvar
3934 To illustrate some of the above, suppose that you have the line:
3936 @example
3937 xterm.vt100.background: yellow
3938 @end example
3940 @noindent
3941 in your X resources file (whose name is usually @file{~/.Xdefaults}
3942 or @file{~/.Xresources}).  Then:
3944 @example
3945 @group
3946 (let ((x-resource-class "XTerm") (x-resource-name "xterm"))
3947   (x-get-resource "vt100.background" "VT100.Background"))
3948      @result{} "yellow"
3949 @end group
3950 @group
3951 (let ((x-resource-class "XTerm") (x-resource-name "xterm"))
3952   (x-get-resource "background" "VT100" "vt100" "Background"))
3953      @result{} "yellow"
3954 @end group
3955 @end example
3957 @defvar inhibit-x-resources
3958 If this variable is non-@code{nil}, Emacs does not look up X
3959 resources, and X resources do not have any effect when creating new
3960 frames.
3961 @end defvar
3963 @node Display Feature Testing
3964 @section Display Feature Testing
3965 @cindex display feature testing
3967   The functions in this section describe the basic capabilities of a
3968 particular display.  Lisp programs can use them to adapt their behavior
3969 to what the display can do.  For example, a program that ordinarily uses
3970 a popup menu could use the minibuffer if popup menus are not supported.
3972   The optional argument @var{display} in these functions specifies which
3973 display to ask the question about.  It can be a display name, a frame
3974 (which designates the display that frame is on), or @code{nil} (which
3975 refers to the selected frame's display, @pxref{Input Focus}).
3977   @xref{Color Names}, @ref{Text Terminal Colors}, for other functions to
3978 obtain information about displays.
3980 @defun display-popup-menus-p &optional display
3981 This function returns @code{t} if popup menus are supported on
3982 @var{display}, @code{nil} if not.  Support for popup menus requires
3983 that the mouse be available, since the menu is popped up by clicking
3984 the mouse on some portion of the Emacs display.
3985 @end defun
3987 @defun display-graphic-p &optional display
3988 This function returns @code{t} if @var{display} is a graphic display
3989 capable of displaying several frames and several different fonts at
3990 once.  This is true for displays that use a window system such as X,
3991 and false for text terminals.
3992 @end defun
3994 @defun display-mouse-p &optional display
3995 @cindex mouse, availability
3996 This function returns @code{t} if @var{display} has a mouse available,
3997 @code{nil} if not.
3998 @end defun
4000 @defun display-color-p &optional display
4001 @findex x-display-color-p
4002 This function returns @code{t} if the screen is a color screen.
4003 It used to be called @code{x-display-color-p}, and that name
4004 is still supported as an alias.
4005 @end defun
4007 @defun display-grayscale-p &optional display
4008 This function returns @code{t} if the screen can display shades of gray.
4009 (All color displays can do this.)
4010 @end defun
4012 @defun display-supports-face-attributes-p attributes &optional display
4013 @anchor{Display Face Attribute Testing}
4014 This function returns non-@code{nil} if all the face attributes in
4015 @var{attributes} are supported (@pxref{Face Attributes}).
4017 The definition of ``supported'' is somewhat heuristic, but basically
4018 means that a face containing all the attributes in @var{attributes},
4019 when merged with the default face for display, can be represented in a
4020 way that's
4022 @enumerate
4023 @item
4024 different in appearance than the default face, and
4026 @item
4027 close in spirit to what the attributes specify, if not exact.
4028 @end enumerate
4030 Point (2) implies that a @code{:weight black} attribute will be
4031 satisfied by any display that can display bold, as will
4032 @code{:foreground "yellow"} as long as some yellowish color can be
4033 displayed, but @code{:slant italic} will @emph{not} be satisfied by
4034 the tty display code's automatic substitution of a dim face for
4035 italic.
4036 @end defun
4038 @defun display-selections-p &optional display
4039 This function returns @code{t} if @var{display} supports selections.
4040 Windowed displays normally support selections, but they may also be
4041 supported in some other cases.
4042 @end defun
4044 @defun display-images-p &optional display
4045 This function returns @code{t} if @var{display} can display images.
4046 Windowed displays ought in principle to handle images, but some
4047 systems lack the support for that.  On a display that does not support
4048 images, Emacs cannot display a tool bar.
4049 @end defun
4051 @defun display-screens &optional display
4052 This function returns the number of screens associated with the display.
4053 @end defun
4055 @defun display-pixel-height &optional display
4056 This function returns the height of the screen in pixels.
4057 On a character terminal, it gives the height in characters.
4059 For graphical terminals, note that on multi-monitor setups this
4060 refers to the pixel height for all physical monitors associated with
4061 @var{display}.  @xref{Multiple Terminals}.
4062 @end defun
4064 @defun display-pixel-width &optional display
4065 This function returns the width of the screen in pixels.
4066 On a character terminal, it gives the width in characters.
4068 For graphical terminals, note that on multi-monitor setups this
4069 refers to the pixel width for all physical monitors associated with
4070 @var{display}.  @xref{Multiple Terminals}.
4071 @end defun
4073 @defun display-mm-height &optional display
4074 This function returns the height of the screen in millimeters,
4075 or @code{nil} if Emacs cannot get that information.
4077 For graphical terminals, note that on multi-monitor setups this
4078 refers to the height for all physical monitors associated with
4079 @var{display}.  @xref{Multiple Terminals}.
4080 @end defun
4082 @defun display-mm-width &optional display
4083 This function returns the width of the screen in millimeters,
4084 or @code{nil} if Emacs cannot get that information.
4086 For graphical terminals, note that on multi-monitor setups this
4087 refers to the width for all physical monitors associated with
4088 @var{display}.  @xref{Multiple Terminals}.
4089 @end defun
4091 @defopt display-mm-dimensions-alist
4092 This variable allows the user to specify the dimensions of graphical
4093 displays returned by @code{display-mm-height} and
4094 @code{display-mm-width} in case the system provides incorrect values.
4095 @end defopt
4097 @cindex backing store
4098 @defun display-backing-store &optional display
4099 This function returns the backing store capability of the display.
4100 Backing store means recording the pixels of windows (and parts of
4101 windows) that are not exposed, so that when exposed they can be
4102 displayed very quickly.
4104 Values can be the symbols @code{always}, @code{when-mapped}, or
4105 @code{not-useful}.  The function can also return @code{nil}
4106 when the question is inapplicable to a certain kind of display.
4107 @end defun
4109 @cindex SaveUnder feature
4110 @defun display-save-under &optional display
4111 This function returns non-@code{nil} if the display supports the
4112 SaveUnder feature.  That feature is used by pop-up windows
4113 to save the pixels they obscure, so that they can pop down
4114 quickly.
4115 @end defun
4117 @defun display-planes &optional display
4118 This function returns the number of planes the display supports.
4119 This is typically the number of bits per pixel.
4120 For a tty display, it is log to base two of the number of colors supported.
4121 @end defun
4123 @defun display-visual-class &optional display
4124 This function returns the visual class for the screen.  The value is
4125 one of the symbols @code{static-gray} (a limited, unchangeable number
4126 of grays), @code{gray-scale} (a full range of grays),
4127 @code{static-color} (a limited, unchangeable number of colors),
4128 @code{pseudo-color} (a limited number of colors), @code{true-color} (a
4129 full range of colors), and @code{direct-color} (a full range of
4130 colors).
4131 @end defun
4133 @defun display-color-cells &optional display
4134 This function returns the number of color cells the screen supports.
4135 @end defun
4137   These functions obtain additional information about the window
4138 system in use where Emacs shows the specified @var{display}.  (Their
4139 names begin with @code{x-} for historical reasons.)
4141 @defun x-server-version &optional display
4142 This function returns the list of version numbers of the GUI window
4143 system running on @var{display}, such as the X server on GNU and Unix
4144 systems.  The value is a list of three integers: the major and minor
4145 version numbers of the protocol, and the distributor-specific release
4146 number of the window system software itself.  On GNU and Unix systems,
4147 these are normally the version of the X protocol and the
4148 distributor-specific release number of the X server software.  On
4149 MS-Windows, this is the version of the Windows OS.
4150 @end defun
4152 @defun x-server-vendor &optional display
4153 This function returns the vendor that provided the window system
4154 software (as a string).  On GNU and Unix systems this really means
4155 whoever distributes the X server.  On MS-Windows this is the vendor ID
4156 string of the Windows OS (Microsoft).
4158 When the developers of X labeled software distributors as
4159 ``vendors'', they showed their false assumption that no system could
4160 ever be developed and distributed noncommercially.
4161 @end defun
4163 @ignore
4164 @defvar x-no-window-manager
4165 This variable's value is @code{t} if no X window manager is in use.
4166 @end defvar
4167 @end ignore