aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Rudalics2017-04-13 17:45:12 +0200
committerMartin Rudalics2017-04-13 17:45:12 +0200
commit7cc613dc68b8c388a7ccd8f79e37a641ad05312c (patch)
tree57f988d412897fd139405b42b9f5e8a46aa904bf
parent4e77ff0d45b88cade7836c01344cd8d892adfde8 (diff)
downloademacs-7cc613dc68b8c388a7ccd8f79e37a641ad05312c.tar.gz
emacs-7cc613dc68b8c388a7ccd8f79e37a641ad05312c.zip
Describe recent frame and window changes in manuals
* doc/emacs/emacs.texi (Top): * doc/emacs/cmdargs.texi (Borders X): Clearly separate the terms "outer border" (for the X border which can be set from within Emacs) and "external border" (for the border which is added by the window manager). * doc/lispref/display.texi (Tooltips): Clarify slightly. * doc/lispref/elisp.texi (Top): Update node and section names. * doc/lispref/frames.texi (Frames): Describe difference between top-level and child frames. (Frame Layout): Describe outer border. Add more details about how Emacs obtains the outer size and position of a frame and about menu bar/tool bar wrapping. Add references to new frame parameters. (Size and Position): Remove subsection. (Frame Position): New subsection excerpted from the earlier Size and Position subsection. Clarify positioning concepts and some of their shortcomings. Describe `move-frame-functions'. (Frame Size): New subsection excerpted from the earlier Size and Position subsection. Describe how to track frame size changes and the new function `frame-size-changed-p'. (Position Parameters): Describe child frame positioning. Warn about negative offsets. Describe 'z-group' parameter. (Size Parameters): Describe 'text-pixels' specification facility and new 'min-width' and 'min-height' parameters. (Layout Parameters): Clarify description of 'tool-bar-lines' and 'menu-bar-lines' parameters. (Frame Interaction Parameters): New subsubsection describing 'parent-frame', 'delete-before', 'mouse-wheel-frame' and 'no-other-frame' parameters. (Management Parameters): Describe 'skip-taskbar', 'no-focus-on-map', 'no-accept-focus', 'undecorated' and 'override-redirect' parameters. (Deleting Frames): Describe handling of 'delete-before' parameter and child frames for `delete-frame' and `delete-other-frames'. (Finding All Frames): Describe `frame-list-z-order' and handling of 'no-other-frame' parameter by `next-frame'. (Minibuffers and Frames): Minor clarifications. (Input Focus): Document `x-focus-frame'. Clarify descriptions of `focus-in-hook', `focus-out-hook' and `focus-follows-mouse'. (Visibility of Frames): Describe mapping and how the visibility of a parent frame affects that of its child frames. (Raising and Lowering): Describe restacking of frames and z-groups. (Child Frames): New section. * doc/lispref/windows.texi (Selecting Windows): Describe additional semantics of NORECORD argument of `select-window' and how `buffer-list-update-hook' can emulate a "select window hook". (Mouse Window Auto-selection): New section.
-rw-r--r--doc/emacs/cmdargs.texi26
-rw-r--r--doc/emacs/emacs.texi2
-rw-r--r--doc/lispref/display.texi26
-rw-r--r--doc/lispref/elisp.texi12
-rw-r--r--doc/lispref/frames.texi1091
-rw-r--r--doc/lispref/windows.texi122
6 files changed, 997 insertions, 282 deletions
diff --git a/doc/emacs/cmdargs.texi b/doc/emacs/cmdargs.texi
index 6c866708245..721a2cebb22 100644
--- a/doc/emacs/cmdargs.texi
+++ b/doc/emacs/cmdargs.texi
@@ -71,7 +71,7 @@ arguments.)
71* Font X:: Choosing a font for text, under X. 71* Font X:: Choosing a font for text, under X.
72* Colors X:: Choosing display colors. 72* Colors X:: Choosing display colors.
73* Window Size X:: Start-up window size, under X. 73* Window Size X:: Start-up window size, under X.
74* Borders X:: Internal and external borders, under X. 74* Borders X:: Internal and outer borders, under X.
75* Title X:: Specifying the initial frame's title. 75* Title X:: Specifying the initial frame's title.
76* Icons X:: Choosing what sort of icon to use, under X. 76* Icons X:: Choosing what sort of icon to use, under X.
77* Misc X:: Other display options. 77* Misc X:: Other display options.
@@ -1053,15 +1053,15 @@ program-specified and user-specified positions. If these are set,
1053Emacs fails to position the window correctly. 1053Emacs fails to position the window correctly.
1054 1054
1055@node Borders X 1055@node Borders X
1056@appendixsec Internal and External Borders 1056@appendixsec Internal and Outer Borders
1057@cindex borders (X Window System) 1057@cindex borders (X Window System)
1058 1058
1059 An Emacs frame has an internal border and an external border. The 1059 An Emacs frame has an internal border and an outer border. The
1060internal border is an extra strip of the background color around the 1060internal border is an extra strip of the background color around the
1061text portion of the frame. Emacs itself draws the internal border. 1061text portion of the frame. Emacs itself draws the internal border. The
1062The external border is added by the window manager outside the frame; 1062outer border is drawn by X outside the tool and menu bars of the frame.
1063depending on the window manager you use, it may contain various boxes 1063There is also an external border which is drawn by the window manager.
1064you can click on to move or iconify the window. 1064The size of the external border cannot be set from within Emacs.
1065 1065
1066@table @samp 1066@table @samp
1067@item -ib @var{width} 1067@item -ib @var{width}
@@ -1069,15 +1069,15 @@ you can click on to move or iconify the window.
1069@itemx --internal-border=@var{width} 1069@itemx --internal-border=@var{width}
1070@opindex --internal-border 1070@opindex --internal-border
1071@cindex internal border width, command-line argument 1071@cindex internal border width, command-line argument
1072Specify @var{width} as the width of the internal border (between the text 1072Specify @var{width} as the width of the internal border (around the
1073and the main border), in pixels. 1073frame's text area), in pixels.
1074 1074
1075@item -bw @var{width} 1075@item -bw @var{width}
1076@opindex -bw 1076@opindex -bw
1077@itemx --border-width=@var{width} 1077@itemx --border-width=@var{width}
1078@opindex --border-width 1078@opindex --border-width
1079@cindex main border width, command-line argument 1079@cindex main border width, command-line argument
1080Specify @var{width} as the width of the main border, in pixels. 1080Specify @var{width} as the width of the outer border, in pixels.
1081@end table 1081@end table
1082 1082
1083 When you specify the size of the frame, that does not count the 1083 When you specify the size of the frame, that does not count the
@@ -1086,9 +1086,9 @@ external border.
1086 1086
1087 Use the @samp{-ib @var{n}} option to specify an internal border 1087 Use the @samp{-ib @var{n}} option to specify an internal border
1088@var{n} pixels wide. The default is 1. Use @samp{-bw @var{n}} to 1088@var{n} pixels wide. The default is 1. Use @samp{-bw @var{n}} to
1089specify the width of the external border (though the window manager may 1089specify the width of the outer border (though the window manager may not
1090not pay attention to what you specify). The default width of the 1090pay attention to what you specify). The default width of the outer
1091external border is 2. 1091border is 2.
1092 1092
1093@node Title X 1093@node Title X
1094@appendixsec Frame Titles 1094@appendixsec Frame Titles
diff --git a/doc/emacs/emacs.texi b/doc/emacs/emacs.texi
index a6f2896231b..599b373fd4c 100644
--- a/doc/emacs/emacs.texi
+++ b/doc/emacs/emacs.texi
@@ -1198,7 +1198,7 @@ Command Line Arguments for Emacs Invocation
1198* Font X:: Choosing a font for text, under X. 1198* Font X:: Choosing a font for text, under X.
1199* Colors X:: Choosing display colors. 1199* Colors X:: Choosing display colors.
1200* Window Size X:: Start-up window size, under X. 1200* Window Size X:: Start-up window size, under X.
1201* Borders X:: Internal and external borders, under X. 1201* Borders X:: Internal and outer borders, under X.
1202* Title X:: Specifying the initial frame's title. 1202* Title X:: Specifying the initial frame's title.
1203* Icons X:: Choosing what sort of icon to use, under X. 1203* Icons X:: Choosing what sort of icon to use, under X.
1204* Misc X:: Other display options. 1204* Misc X:: Other display options.
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
index 57dd16decaf..7a6a21649e4 100644
--- a/doc/lispref/display.texi
+++ b/doc/lispref/display.texi
@@ -7190,20 +7190,22 @@ changing the value of the variable @code{x-gtk-use-system-tooltips} to
7190@code{nil}. The rest of this subsection describes how to control 7190@code{nil}. The rest of this subsection describes how to control
7191non-GTK+ tooltips, which are presented by Emacs itself. 7191non-GTK+ tooltips, which are presented by Emacs itself.
7192 7192
7193Since tooltips are special frames, they have their frame parameters 7193@cindex tooltip frames
7194(@pxref{Frame Parameters}). Unlike other frames, the frame parameters 7194Tooltips are displayed in special frames called tooltip frames, which
7195for tooltips are stored in a special variable. 7195have their own frame parameters (@pxref{Frame Parameters}). Unlike
7196other frames, the default parameters for tooltip frames are stored in a
7197special variable.
7196 7198
7197@defvar tooltip-frame-parameters 7199@defvar tooltip-frame-parameters
7198This customizable option holds the frame parameters used for 7200This customizable option holds the default frame parameters used for
7199displaying tooltips. Any font and color parameters are ignored, and 7201displaying tooltips. Any font and color parameters are ignored, and the
7200the corresponding attributes of the @code{tooltip} face are used 7202corresponding attributes of the @code{tooltip} face are used instead.
7201instead. If @code{left} or @code{top} parameters are included, they 7203If @code{left} or @code{top} parameters are included, they are used as
7202are used as absolute frame-relative coordinates where the tooltip 7204absolute frame-relative coordinates where the tooltip should be shown.
7203should be shown. (Mouse-relative position of the tooltip can be 7205(Mouse-relative position of the tooltip can be customized using the
7204customized using the variables described in @ref{Tooltips,,, emacs, 7206variables described in @ref{Tooltips,,, emacs, The GNU Emacs Manual}.)
7205The GNU Emacs Manual}.) Note that the @code{left} and @code{top} 7207Note that the @code{left} and @code{top} parameters, if present,
7206parameters, if present, override the values of mouse-relative offsets. 7208override the values of mouse-relative offsets.
7207@end defvar 7209@end defvar
7208 7210
7209@vindex tooltip@r{ face} 7211@vindex tooltip@r{ face}
diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi
index bff3112d73b..7cc91a8f7e3 100644
--- a/doc/lispref/elisp.texi
+++ b/doc/lispref/elisp.texi
@@ -1062,6 +1062,7 @@ Windows
1062* Vertical Scrolling:: Moving the contents up and down on the window. 1062* Vertical Scrolling:: Moving the contents up and down on the window.
1063* Horizontal Scrolling:: Moving the contents sideways on the window. 1063* Horizontal Scrolling:: Moving the contents sideways on the window.
1064* Coordinates and Windows:: Converting coordinates to windows. 1064* Coordinates and Windows:: Converting coordinates to windows.
1065* Mouse Window Auto-selection:: Automatically selecting windows with the mouse.
1065* Window Configurations:: Saving and restoring the state of the screen. 1066* Window Configurations:: Saving and restoring the state of the screen.
1066* Window Parameters:: Associating additional information with windows. 1067* Window Parameters:: Associating additional information with windows.
1067* Window Hooks:: Hooks for scrolling, window size changes, 1068* Window Hooks:: Hooks for scrolling, window size changes,
@@ -1089,16 +1090,16 @@ Frames
1089* Minibuffers and Frames:: How a frame finds the minibuffer to use. 1090* Minibuffers and Frames:: How a frame finds the minibuffer to use.
1090* Input Focus:: Specifying the selected frame. 1091* Input Focus:: Specifying the selected frame.
1091* Visibility of Frames:: Frames may be visible or invisible, or icons. 1092* Visibility of Frames:: Frames may be visible or invisible, or icons.
1092* Raising and Lowering:: Raising a frame makes it hide other windows; 1093* Raising and Lowering:: Raising, Lowering and Restacking Frames.
1093 lowering it makes the others hide it.
1094* Frame Configurations:: Saving the state of all frames. 1094* Frame Configurations:: Saving the state of all frames.
1095* Child Frames:: Making a frame the child of another.
1095* Mouse Tracking:: Getting events that say when the mouse moves. 1096* Mouse Tracking:: Getting events that say when the mouse moves.
1096* Mouse Position:: Asking where the mouse is, or moving it. 1097* Mouse Position:: Asking where the mouse is, or moving it.
1097* Pop-Up Menus:: Displaying a menu for the user to select from. 1098* Pop-Up Menus:: Displaying a menu for the user to select from.
1098* Dialog Boxes:: Displaying a box to ask yes or no. 1099* Dialog Boxes:: Displaying a box to ask yes or no.
1099* Pointer Shape:: Specifying the shape of the mouse pointer. 1100* Pointer Shape:: Specifying the shape of the mouse pointer.
1100* Window System Selections::Transferring text to and from other X clients. 1101* Window System Selections::Transferring text to and from other X clients.
1101* Drag and Drop:: Internals of Drag-and-Drop implementation. 1102* Drag and Drop:: Internals of Drag-and-Drop implementation.
1102* Color Names:: Getting the definitions of color names. 1103* Color Names:: Getting the definitions of color names.
1103* Text Terminal Colors:: Defining colors for text terminals. 1104* Text Terminal Colors:: Defining colors for text terminals.
1104* Resources:: Getting resource values from the server. 1105* Resources:: Getting resource values from the server.
@@ -1108,7 +1109,8 @@ Frame Geometry
1108 1109
1109* Frame Layout:: Basic layout of frames. 1110* Frame Layout:: Basic layout of frames.
1110* Frame Font:: The default font of a frame and how to set it. 1111* Frame Font:: The default font of a frame and how to set it.
1111* Size and Position:: Changing the size and position of a frame. 1112* Frame Position:: The position of a frame on its display.
1113* Frame Size:: Specifying and retrieving a frame's size.
1112* Implied Frame Resizing:: Implied resizing of frames and how to prevent it. 1114* Implied Frame Resizing:: Implied resizing of frames and how to prevent it.
1113 1115
1114Frame Parameters 1116Frame Parameters
@@ -1126,6 +1128,8 @@ Window Frame Parameters
1126* Layout Parameters:: Size of parts of the frame, and 1128* Layout Parameters:: Size of parts of the frame, and
1127 enabling or disabling some parts. 1129 enabling or disabling some parts.
1128* Buffer Parameters:: Which buffers have been or should be shown. 1130* Buffer Parameters:: Which buffers have been or should be shown.
1131* Frame Interaction Parameters:: Parameters for interacting with other
1132 frames.
1129* Management Parameters:: Communicating with the window manager. 1133* Management Parameters:: Communicating with the window manager.
1130* Cursor Parameters:: Controlling the cursor appearance. 1134* Cursor Parameters:: Controlling the cursor appearance.
1131* Font and Color Parameters:: Fonts and colors for the frame text. 1135* Font and Color Parameters:: Fonts and colors for the frame text.
diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi
index 68aa40fe4dd..2fac8020ffb 100644
--- a/doc/lispref/frames.texi
+++ b/doc/lispref/frames.texi
@@ -77,6 +77,13 @@ displayed on that terminal; the list of possible values is the same as
77for @code{framep} above. 77for @code{framep} above.
78@end defun 78@end defun
79 79
80@cindex top-level frame
81On 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
83of the window-system's root window for that terminal. A child frame is
84a frame whose window-system window is the child of the window-system
85window of another Emacs frame. @xref{Child Frames}.
86
80@menu 87@menu
81* Creating Frames:: Creating additional frames. 88* Creating Frames:: Creating additional frames.
82* Multiple Terminals:: Displaying on several different devices. 89* Multiple Terminals:: Displaying on several different devices.
@@ -89,9 +96,9 @@ for @code{framep} above.
89* Minibuffers and Frames:: How a frame finds the minibuffer to use. 96* Minibuffers and Frames:: How a frame finds the minibuffer to use.
90* Input Focus:: Specifying the selected frame. 97* Input Focus:: Specifying the selected frame.
91* Visibility of Frames:: Frames may be visible or invisible, or icons. 98* Visibility of Frames:: Frames may be visible or invisible, or icons.
92* Raising and Lowering:: Raising a frame makes it hide other windows; 99* Raising and Lowering:: Raising, Lowering and Restacking Frames.
93 lowering it makes the others hide it.
94* Frame Configurations:: Saving the state of all frames. 100* Frame Configurations:: Saving the state of all frames.
101* Child Frames:: Making a frame the child of another.
95* Mouse Tracking:: Getting events that say when the mouse moves. 102* Mouse Tracking:: Getting events that say when the mouse moves.
96* Mouse Position:: Asking where the mouse is, or moving it. 103* Mouse Position:: Asking where the mouse is, or moving it.
97* Pop-Up Menus:: Displaying a menu for the user to select from. 104* Pop-Up Menus:: Displaying a menu for the user to select from.
@@ -436,7 +443,8 @@ has to specify a live frame (@pxref{Deleting Frames}). If omitted or
436@menu 443@menu
437* Frame Layout:: Basic layout of frames. 444* Frame Layout:: Basic layout of frames.
438* Frame Font:: The default font of a frame and how to set it. 445* Frame Font:: The default font of a frame and how to set it.
439* Size and Position:: Changing the size and position of a frame. 446* Frame Position:: The position of a frame on its display.
447* Frame Size:: Specifying and retrieving a frame's size.
440* Implied Frame Resizing:: Implied resizing of frames and how to prevent it. 448* Implied Frame Resizing:: Implied resizing of frames and how to prevent it.
441@end menu 449@end menu
442 450
@@ -446,14 +454,16 @@ has to specify a live frame (@pxref{Deleting Frames}). If omitted or
446@cindex frame layout 454@cindex frame layout
447@cindex layout of frame 455@cindex layout of frame
448 456
449The drawing below sketches the layout of a frame on a graphical 457A visible frame occupies a rectangular area on its terminal's display.
450terminal: 458This area may contain a number of nested rectangles, each serving a
459different purpose. The drawing below sketches the layout of a frame on
460a graphical terminal:
451@smallexample 461@smallexample
452@group 462@group
453 463
454 <------------ Outer Frame Width -----------> 464 <------------ Outer Frame Width ----------->
455 ___________________________________________ 465 ____________________________________________
456 ^(0) ___________ External Border __________ | 466 ^(0) ________ External/Outer Border _______ |
457 | | |_____________ Title Bar ______________| | 467 | | |_____________ Title Bar ______________| |
458 | | (1)_____________ Menu Bar ______________| | ^ 468 | | (1)_____________ Menu Bar ______________| | ^
459 | | (2)_____________ Tool Bar ______________| | ^ 469 | | (2)_____________ Tool Bar ______________| | ^
@@ -468,14 +478,14 @@ Height | | | Height | | | Height
468 | | | | | | | | | 478 | | | | | | | | |
469 | | | |___v______________________________| | | | 479 | | | |___v______________________________| | | |
470 | | |___________ Internal Border __________| | v 480 | | |___________ Internal Border __________| | v
471 v |______________ External Border _____________| 481 v |___________ External/Outer Border __________|
472 <-------- Native Frame Width --------> 482 <-------- Native Frame Width -------->
473 483
474@end group 484@end group
475@end smallexample 485@end smallexample
476 486
477In practice not all of the areas shown in the drawing will or may be 487In practice not all of the areas shown in the drawing will or may be
478present. The meaning of these areas is: 488present. The meaning of these areas is described below.
479 489
480@table @samp 490@table @samp
481@item Outer Frame 491@item Outer Frame
@@ -483,50 +493,100 @@ present. The meaning of these areas is:
483@cindex outer edges 493@cindex outer edges
484@cindex outer width 494@cindex outer width
485@cindex outer height 495@cindex outer height
496@cindex outer size
486The @dfn{outer frame} is a rectangle comprising all areas shown in the 497The @dfn{outer frame} is a rectangle comprising all areas shown in the
487drawing. The edges of that rectangle are called the @dfn{outer edges} 498drawing. The edges of that rectangle are called the @dfn{outer edges}
488of the frame. The @dfn{outer width} and @dfn{outer height} of the frame 499of the frame. Together, the @dfn{outer width} and @dfn{outer height} of
489specify the size of that rectangle. 500the frame specify the @dfn{outer size} of that rectangle.
501
502Knowing the outer size of a frame is useful for fitting a frame into the
503working area of its display (@pxref{Multiple Terminals}) or for placing
504two frames adjacent to each other on the screen. Usually, the outer
505size of a frame is available only after the frame has been mapped (made
506visible, @pxref{Visibility of Frames}) at least once. For the initial
507frame or a frame that has not been created yet, the outer size can be
508estimated only or must be calculated from the window-system's or window
509manager defaults. One workaround is to obtain the differences of the
510outer and native (see below) sizes of a mapped frame and use them for
511calculating the outer size of the new frame.
490 512
491@cindex outer position 513@cindex outer position
492The upper left corner of the outer frame (indicated by @samp{(0)} in the 514The upper left corner of the outer frame (indicated by @samp{(0)} in the
493drawing above) is the @dfn{outer position} or the frame. It is 515drawing above) is the @dfn{outer position} of the frame. The outer
494specified by and settable via the @code{left} and @code{top} frame 516position of a graphical frame is also referred to as ``the position'' of
495parameters (@pxref{Position Parameters}) as well as the functions 517the frame because it usually remains unchanged on its display whenever
496@code{frame-position} and @code{set-frame-position} (@pxref{Size and 518the frame is resized or its layout is changed.
497Position}). 519
520The outer position is specified by and can be set via the @code{left}
521and @code{top} frame parameters (@pxref{Position Parameters}). For a
522normal, top-level frame these parameters usually represent its absolute
523position (see below) with respect to its display's origin. For a child
524frame (@pxref{Child Frames}) these parameters represent its position
525relative to the native position (see below) of its parent frame. For
526frames on text terminals the values of these parameters are meaningless
527and always zero.
498 528
499@item External Border 529@item External Border
500@cindex external border 530@cindex external border
501The @dfn{external border} is part of the decorations supplied by the 531The @dfn{external border} is part of the decorations supplied by the
502window manager. It's typically used for resizing the frame with the 532window manager. It is typically used for resizing the frame with the
503mouse. The external border is normally not shown on ``fullboth'' and 533mouse and is therefore not shown on ``fullboth'' and maximized frames
504maximized frames (@pxref{Size Parameters}) and doesn't exist for text 534(@pxref{Size Parameters}). Its width is determined by the window
505terminal frames. 535manager and cannot be changed by Emacs' functions.
506 536
507 The external border should not be confused with the @dfn{outer 537External borders don't exist on text terminal frames. For graphical
508border} specified by the @code{border-width} frame parameter 538frames, their display can be suppressed by setting the
509(@pxref{Layout Parameters}). Since the outer border is usually ignored 539@code{override-redirect} or @code{undecorated} frame parameter
510on most platforms it is not covered here. 540(@pxref{Management Parameters}).
541
542@item Outer Border
543@cindex outer border
544The @dfn{outer border} is a separate border whose width can be specified
545with the @code{border-width} frame parameter (@pxref{Layout
546Parameters}). In practice, either the external or the outer border of a
547frame are displayed but never both at the same time. Usually, the outer
548border is shown only for special frames that are not (fully) controlled
549by the window manager like tooltip frames (@pxref{Tooltips}), child
550frames (@pxref{Child Frames}) and @code{undecorated} or
551@code{override-redirect} frames (@pxref{Management Parameters}).
552
553Outer borders are never shown on text terminal frames and on frames
554generated by GTK+ routines. On Windows, the outer border is emulated
555with the help of a one pixel wide external border. Non-toolkit builds
556allow to change the color of the outer border by setting the
557@code{border-color} frame parameter (@pxref{Layout Parameters}).
511 558
512@item Title Bar 559@item Title Bar
513@cindex title bar 560@cindex title bar
514The @dfn{title bar} is also part of the window manager's decorations and 561The @dfn{title bar} is also part of the window manager's decorations and
515typically displays the title of the frame (@pxref{Frame Titles}) as well 562typically displays the title of the frame (@pxref{Frame Titles}) as well
516as buttons for minimizing, maximizing and deleting the frame. The title 563as buttons for minimizing, maximizing and deleting the frame. It can be
517bar is usually not displayed on fullboth (@pxref{Size Parameters}) 564also used for dragging the frame with the mouse. The title bar is
518or tooltip frames. Title bars don't exist for text terminal frames. 565usually not displayed for fullboth (@pxref{Size Parameters}), tooltip
566(@pxref{Tooltips}) and child frames (@pxref{Child Frames}) and doesn't
567exist for terminal frames. Display of the title bar can be suppressed
568by setting the @code{override-redirect} or the @code{undecorated} frame
569parameters (@pxref{Management Parameters}).
519 570
520@item Menu Bar 571@item Menu Bar
521@cindex internal menu bar 572@cindex internal menu bar
522@cindex external menu bar 573@cindex external menu bar
523The menu bar (@pxref{Menu Bar}) can be either internal (drawn by Emacs 574The menu bar (@pxref{Menu Bar}) can be either internal (drawn by Emacs
524itself) or external (drawn by a toolkit). Most builds (GTK+, Lucid, 575itself) or external (drawn by the toolkit). Most builds (GTK+, Lucid,
525Motif and Windows) rely on an external menu bar. NS also uses an 576Motif and Windows) rely on an external menu bar. NS also uses an
526external menu bar which, however, is not part of the outer frame. 577external menu bar which, however, is not part of the outer frame.
527Non-toolkit builds can provide an internal menu bar. On text terminal 578Non-toolkit builds can provide an internal menu bar. On text terminal
528frames, the menu bar is part of the frame's root window (@pxref{Windows 579frames, the menu bar is part of the frame's root window (@pxref{Windows
529and Frames}). 580and Frames}). As a rule, menu bars are never shown on child frames
581(@pxref{Child Frames}). Display of the menu bar can be suppressed by
582setting the @code{menu-bar-lines} parameter (@pxref{Layout Parameters})
583to zero.
584
585It depends on the toolkit whether to wrap or truncate the menu bar
586whenever it becomes too long to fit on its frame. Usually, only Motif
587and Windows builds can wrap the menu bar. When they (un-)wrap the menu
588bar, they try to keep the outer height of the frame unchanged, so the
589native height of the frame (see below) will change instead.
530 590
531@item Tool Bar 591@item Tool Bar
532@cindex internal tool bar 592@cindex internal tool bar
@@ -536,21 +596,39 @@ internal (drawn by Emacs itself) or external (drawn by a toolkit). The
536GTK+ and NS builds have the tool bar drawn by the toolkit. The 596GTK+ and NS builds have the tool bar drawn by the toolkit. The
537remaining builds use internal tool bars. With GTK+ the tool bar can be 597remaining builds use internal tool bars. With GTK+ the tool bar can be
538located on either side of the frame, immediately outside the internal 598located on either side of the frame, immediately outside the internal
539border, see below. 599border, see below. Tool bars are usually not shown for child frames
600(@pxref{Child Frames}). Display of the tool bar can be suppressed by
601setting the @code{tool-bar-lines} parameter (@pxref{Layout
602Parameters}) to zero.
603
604If the variable @code{auto-resize-tool-bars} is non-@code{nil}, Emacs
605wraps the internal tool bar when it becomes too long for its frame. If
606and when Emacs (un-)wraps the internal tool bar, it by default keeps the
607outer height of the frame unchanged, so the native height of the frame
608(see below) will change instead. Emacs built with GTK+, on the other
609hand, never wraps the tool bar but may automatically increase the outer
610width of a frame in order to accommodate an overlong tool bar.
540 611
541@item Native Frame 612@item Native Frame
542@cindex native frame 613@cindex native frame
543@cindex native edges 614@cindex native edges
544@cindex native width 615@cindex native width
545@cindex native height 616@cindex native height
546@cindex display area 617@cindex native size
547The @dfn{native frame} is a rectangle located entirely within the outer 618The @dfn{native frame} is a rectangle located entirely within the outer
548frame. It excludes the areas occupied by the external border, the title 619frame. It excludes the areas occupied by an external or outer border,
549bar and any external menu or external tool bar. The area enclosed by 620the title bar and any external menu or tool bar. The edges of the
550the native frame is sometimes also referred to as the @dfn{display area} 621native frame are called the @dfn{native edges} of the frame. Together,
551of the frame. The edges of the native frame are called the @dfn{native 622the @dfn{native width} and @dfn{native height} of a frame specify the
552edges} of the frame. The @dfn{native width} and @dfn{native height} of 623@dfn{native size} of the frame.
553the frame specify the size of the rectangle. 624
625The native size of a frame is the size Emacs passes to the window-system
626or window manager when creating or resizing the frame from within Emacs.
627It is also the size Emacs receives from the window-system or window
628manager whenever these resize the frame's window-system window, for
629example, after maximizing the frame by clicking on the corresponding
630button in the title bar or when dragging its external border with the
631mouse.
554 632
555@cindex native position 633@cindex native position
556The top left corner of the native frame specifies the @dfn{native 634The top left corner of the native frame specifies the @dfn{native
@@ -565,30 +643,42 @@ position for the various builds:
565@item (3) GTK+ and NS frames 643@item (3) GTK+ and NS frames
566@end itemize 644@end itemize
567 645
568Accordingly, the native height of a frame includes the height of the 646Accordingly, the native height of a frame may include the height of the
569tool bar but not that of the menu bar (Lucid, Motif, Windows) or those 647tool bar but not that of the menu bar (Lucid, Motif, Windows) or those
570of the menu bar and the tool bar (non-toolkit and text terminal frames). 648of the menu bar and the tool bar (non-toolkit and text terminal frames).
571 649
572The native position of a frame is the reference position of functions 650The native position of a frame is the reference position for functions
573that set or return the current position of the mouse (@pxref{Mouse 651that set or return the current position of the mouse (@pxref{Mouse
574Position}) and for functions dealing with the position of windows like 652Position}) and for functions dealing with the position of windows like
575@code{window-edges}, @code{window-at} or @code{coordinates-in-window-p} 653@code{window-edges}, @code{window-at} or @code{coordinates-in-window-p}
576(@pxref{Coordinates and Windows}). 654(@pxref{Coordinates and Windows}). It also specifies the (0, 0) origin
655for locating and positioning child frames within this frame
656(@pxref{Child Frames}).
657
658Note also that the native position of a frame usually remains unaltered
659on its display when removing or adding the window manager decorations by
660changing the frame's @code{override-redirect} or @code{undecorated}
661parameter (@pxref{Management Parameters}).
577 662
578@item Internal Border 663@item Internal Border
579The internal border (@pxref{Layout Parameters}) is a border drawn by 664The internal border is a border drawn by Emacs around the inner frame
580Emacs around the inner frame (see below). 665(see below). Its width is specified by the @code{internal-border-width}
666frame parameter (@pxref{Layout Parameters}). Its color is specified by
667the background of the @code{internal-border} face.
581 668
582@item Inner Frame 669@item Inner Frame
583@cindex inner frame 670@cindex inner frame
584@cindex inner edges 671@cindex inner edges
585@cindex inner width 672@cindex inner width
586@cindex inner height 673@cindex inner height
674@cindex inner size
675@cindex display area
587The @dfn{inner frame} is the rectangle reserved for the frame's windows. 676The @dfn{inner frame} is the rectangle reserved for the frame's windows.
588It's enclosed by the internal border which, however, is not part of the 677It's enclosed by the internal border which, however, is not part of the
589inner frame. Its edges are called the @dfn{inner edges} of the frame. 678inner frame. Its edges are called the @dfn{inner edges} of the frame.
590The @dfn{inner width} and @dfn{inner height} specify the size of the 679The @dfn{inner width} and @dfn{inner height} specify the @dfn{inner
591rectangle. 680size} of the rectangle. The inner frame is sometimes also referred to
681as the @dfn{display area} of the frame.
592 682
593@cindex minibuffer-less frame 683@cindex minibuffer-less frame
594@cindex minibuffer-only frame 684@cindex minibuffer-only frame
@@ -603,22 +693,39 @@ configurations.
603 693
604@item Text Area 694@item Text Area
605@cindex text area 695@cindex text area
606The @dfn{text area} of a frame is a somewhat fictitious area located 696The @dfn{text area} of a frame is a somewhat fictitious area that can be
607entirely within the native frame. It can be obtained by removing from 697embedded in the native frame. Its position is unspecified. Its width
608the native frame any internal borders, one vertical and one horizontal 698can be obtained by removing from that of the native width the widths of
609scroll bar, and one left and one right fringe as specified for this 699the internal border, one vertical scroll bar, and one left and one right
610frame, see @ref{Layout Parameters}. 700fringe as specified for this frame, see @ref{Layout Parameters}. Its
701height can be obtained by removing from that of the native height the
702widths of the internal border and the heights of the frame's internal
703menu and tool bars and one horizontal scroll bar as specified for this
704frame.
611@end table 705@end table
612 706
613@cindex absolute position 707@cindex absolute position
614The @dfn{absolute position} of a frame or its edges is usually given in 708@cindex absolute frame position
615terms of pixels counted from an origin at position (0, 0) of the frame's 709@cindex absolute edges
616display. Note that with multiple monitors the origin does not 710@cindex absolute frame edges
617necessarily coincide with the top left corner of the entire usable 711@cindex display origin
618display area. Hence the absolute outer position of a frame or the 712@cindex origin of display
619absolute positions of the edges of the outer, native or inner frame can 713The @dfn{absolute position} of a frame is given as a pair (X, Y) of
620be negative in such an environment even when that frame is completely 714horizontal and vertical pixel offsets relative to an origin (0, 0) of
621visible. 715the frame's display. Correspondingly, the @dfn{absolute edges} of a
716frame are given as pixel offsets from that origin.
717
718 Note that with multiple monitors the origin of the display does not
719necessarily coincide with the top-left corner of the entire usable
720display area of the terminal. Hence the absolute position of a frame
721can be negative in such an environment even when that frame is
722completely visible.
723
724 By convention, vertical offsets increase ``downwards''. This means
725that the height of a frame is obtained by subtracting the offset of its
726top edge from that of its bottom edge. Horizontal offsets increase
727``leftwards'' as expected so a frame's width is calculated by
728subtracting the offset of its left edge from that of its right edge.
622 729
623 For a frame on a graphical terminal the following function returns the 730 For a frame on a graphical terminal the following function returns the
624sizes of the areas described above: 731sizes of the areas described above:
@@ -626,13 +733,15 @@ sizes of the areas described above:
626@defun frame-geometry &optional frame 733@defun frame-geometry &optional frame
627This function returns geometric attributes of @var{frame}. The return 734This function returns geometric attributes of @var{frame}. The return
628value is an association list of the attributes listed below. All 735value is an association list of the attributes listed below. All
629coordinate, height and width values are integers counting pixels. 736coordinate, height and width values are integers counting pixels. Note
737that if @var{frame} has not been mapped (@pxref{Visibility of Frames})
738yet, some of the return values may only represent approximations of the
739actual values---those that can be seen after the frame has been mapped.
630 740
631@table @code 741@table @code
632@item outer-position 742@item outer-position
633A cons of the absolute X- and Y-coordinates of the outer position of 743A cons representing the absolute position of the outer @var{frame},
634@var{frame}, relative to the origin at position (0, 0) of @var{frame}'s 744relative to the origin at position (0, 0) of @var{frame}'s display.
635display.
636 745
637@item outer-size 746@item outer-size
638A cons of the outer width and height of @var{frame}. 747A cons of the outer width and height of @var{frame}.
@@ -643,6 +752,10 @@ borders as supplied by the window manager. If the window manager
643doesn't supply these values, Emacs will try to guess them from the 752doesn't supply these values, Emacs will try to guess them from the
644coordinates of the outer and inner frame. 753coordinates of the outer and inner frame.
645 754
755@item outer-border-width
756The width of the outer border of @var{frame}. The value is meaningful
757for non-GTK+ X builds only.
758
646@item title-bar-size 759@item title-bar-size
647A cons of the width and height of the title bar of @var{frame} as 760A cons of the width and height of the title bar of @var{frame} as
648supplied by the window manager or operating system. If both of them are 761supplied by the window manager or operating system. If both of them are
@@ -677,24 +790,27 @@ The following function can be used to retrieve the edges of the outer,
677native and inner frame. 790native and inner frame.
678 791
679@defun frame-edges &optional frame type 792@defun frame-edges &optional frame type
680This function returns the edges of the outer, native or inner frame of 793This function returns the absolute edges of the outer, native or inner
681@var{frame}. @var{frame} must be a live frame and defaults to the 794frame of @var{frame}. @var{frame} must be a live frame and defaults to
682selected one. The list returned has the form (@var{left} @var{top} 795the selected one. The list returned has the form (@var{left} @var{top}
683@var{right} @var{bottom}) where all values are in pixels relative to the 796@var{right} @var{bottom}) where all values are in pixels relative to the
684position (0, 0) of @var{frame}'s display. For terminal frames 797origin of @var{frame}'s display. For terminal frames the values
685@var{left} and @var{top} are both zero. 798returned for @var{left} and @var{top} are always zero.
686 799
687Optional argument @var{type} specifies the type of the edges to return: 800Optional argument @var{type} specifies the type of the edges to return:
688@var{type} @code{outer-edges} means to return the outer edges of 801@code{outer-edges} means to return the outer edges of @var{frame},
689@var{frame}, @code{native-edges} (or @code{nil}) means to return its 802@code{native-edges} (or @code{nil}) means to return its native edges and
690native edges and @code{inner-edges} means to return its inner edges. 803@code{inner-edges} means to return its inner edges.
691 804
692Notice that the pixels at the positions @var{bottom} and @var{right} 805By convention, the pixels of the display at the values returned for
693lie immediately outside the corresponding frame. This means that if you 806@var{left} and @var{top} are inside (part of) @var{frame}. Hence, if
694have, for example, two side-by-side frames positioned such that the 807@var{left} and @var{top} are both zero, the pixel at the display's
695right outer edge of the frame on the left equals the left outer edge of 808origin is part of @var{frame}. The pixels at @var{bottom} and
696the frame on the right, the pixels representing that edge are part 809@var{right}, on the other hand, lie immediately outside @var{frame}.
697of the frame on the right. 810This means that if you have, for example, two side-by-side frames
811positioned such that the right outer edge of the frame on the left
812equals the left outer edge of the frame on the right, the pixels at that
813edge show a part of the frame on the right.
698@end defun 814@end defun
699 815
700 816
@@ -751,62 +867,112 @@ and all future graphical frames.
751@end deffn 867@end deffn
752 868
753 869
754@node Size and Position 870@node Frame Position
755@subsection Size and Position 871@subsection Frame Position
756@cindex frame size
757@cindex frame position 872@cindex frame position
758@cindex position of frame 873@cindex position of frame
759 874
760You can read or change the position of a frame using the frame 875On graphical systems, the position of a normal top-level frame is
761parameters @code{left} and @code{top} (@pxref{Position Parameters}) and 876specified as the absolute position of its outer frame (@pxref{Frame
762its size using the @code{height} and @code{width} parameters 877Geometry}). The position of a child frame (@pxref{Child Frames}) is
763(@pxref{Size Parameters}). Here are some special features for working 878specified via pixel offsets of its outer edges relative to the native
764with sizes and positions. For all of these functions the argument 879position of its parent frame.
765@var{frame} must denote a live frame and defaults to the selected frame. 880
881 You can read or change the position of a frame using the frame
882parameters @code{left} and @code{top} (@pxref{Position Parameters}).
883Here are two additional functions for working with the positions of an
884existing, visible frame. For both functions, the argument @var{frame}
885must denote a live frame and defaults to the selected frame.
766 886
767@defun frame-position &optional frame 887@defun frame-position &optional frame
768This function returns the outer position (@pxref{Frame Layout}) of 888For a normal, non-child frame this function returns a cons of the (X, Y)
769@var{frame} in pixels. The value is a cons giving the coordinates of 889pixel coordinates of its outer position (@pxref{Frame Layout}) with
770the top left corner of the outer frame of @var{frame} relative to an 890respect to the origin (0, 0) of its display. For a child frame
771origin at the position (0, 0) of the frame's display. On a text 891(@pxref{Child Frames}) this function returns the pixel coordinates of
772terminal frame both values are zero. 892its outer position with respect to an origin (0, 0) at the native
893position of @var{frame}'s parent.
894
895Negative return values never indicate an offset from the right or bottom
896edge of @var{frame}'s display or parent frame. Rather, they mean that
897@var{frame}'s outer position is on the left and/or above the origin of
898its display or the native position of its parent frame. This usually
899means that @var{frame} is only partially visible (or completely
900invisible). However, on systems where the display's origin does not
901coincide with its top-left corner, the frame may be visible on a
902secondary monitor.
903
904On a text terminal frame both values are zero.
773@end defun 905@end defun
774 906
775@defun set-frame-position frame x y 907@defun set-frame-position frame x y
776This function sets the outer frame position of @var{frame} to @var{x} 908This function sets the outer frame position of @var{frame} to (@var{x},
777and @var{y}. The latter arguments specify pixels and normally count 909@var{y}). The latter arguments specify pixels and normally count from
778from an origin at the position (0, 0) of @var{frame}'s display. 910an origin at the position (0, 0) of @var{frame}'s display. For child
911frames, they count from the native position of @var{frame}'s parent
912frame.
913
914Negative parameter values position the right edge of the outer frame by
915@var{-x} pixels left from the right edge of the screen (or the parent
916frame's native rectangle) and the bottom edge by @var{-y} pixels up from
917the bottom edge of the screen (or the parent frame's native rectangle).
779 918
780A negative parameter value positions the right edge of the outer frame 919Note that negative values do not permit to align the right or bottom
781by @var{-x} pixels left from the right edge of the screen or the bottom 920edge of @var{frame} exactly at the right or bottom edge of its display
782edge by @var{-y} pixels up from the bottom edge of the screen. 921or parent frame. Neither do they allow to specify a position that does
922not lie within the edges of the display or parent frame. The frame
923parameters @code{left} and @code{top} (@pxref{Position Parameters})
924allow to do that but may still fail to provide good results for the
925initial or a new frame.
783 926
784This function has no effect on text terminal frames. 927This function has no effect on text terminal frames.
785@end defun 928@end defun
786 929
787@defun frame-pixel-height &optional frame 930@defvar move-frame-functions
788@defunx frame-pixel-width &optional frame 931This hook specifies the functions run when an Emacs frame is moved
789 These functions return the inner height and width (the height and 932(assigned a new position) by the window-system or window manager. The
790width of the display area, see @ref{Frame Layout}) of @var{frame} in 933functions are run with one argument, the frame that moved. For a child
791pixels. For a text terminal, the results are in characters rather than 934frame (@pxref{Child Frames}), the functions are run only when the
792pixels. 935position of the frame changes in relation to that of its parent frame.
793@end defun 936@end defvar
937
938
939@node Frame Size
940@subsection Frame Size
941@cindex frame size
942@cindex text width of a frame
943@cindex text height of a frame
944@cindex text size of a frame
945The canonical way to specify the @dfn{size of a frame} from within Emacs
946is by specifying its @dfn{text size}---a tuple of the width and height
947of the frame's text area (@pxref{Frame Layout}). It can be measured
948either in pixels or in terms of the frame's canonical character size
949(@pxref{Frame Font}).
950
951 For frames with an internal menu or tool bar, the frame's native
952height cannot be told exactly before the frame has been actually drawn.
953This means that in general you cannot use the native size to specify the
954initial size of a frame. As soon as you know the native size of a
955visible frame, you can calculate its outer size (@pxref{Frame Layout})
956by adding in the remaining components from the return value of
957@code{frame-geometry} . For invisible frames or for frames that have
958yet to be created, however, the outer size can be estimated only. This
959also means that calculating an exact initial position of a frame
960specified via offsets from the right or bottom edge of the screen
961(@pxref{Frame Position}) is impossible.
962
963 The text size of any frame can be set and retrieved with the help of
964the @code{height} and @code{width} frame parameters (@pxref{Size
965Parameters}). The text size of the initial frame can be also set with
966the help of an X-style geometry specification. @xref{Emacs Invocation,,
967Command Line Arguments for Emacs Invocation, emacs, The GNU Emacs
968Manual}. Below we list some functions to access and set the size of an
969existing, visible frame.
794 970
795@defun frame-text-height &optional frame 971@defun frame-text-height &optional frame
796@defunx frame-text-width &optional frame 972@defunx frame-text-width &optional frame
797These functions return the height and width of the text area of 973These functions return the height and width of the text area of
798@var{frame} (@pxref{Frame Layout}), measured in pixels. For a text 974@var{frame} (@pxref{Frame Layout}), measured in pixels. For a text
799terminal, the results are in characters rather than pixels. 975terminal, the results are in characters rather than pixels.
800
801The value returned by @code{frame-text-height} differs from that
802returned by @code{frame-pixel-height} by not including the heights of
803any internal tool bar or menu bar, the height of one horizontal scroll
804bar and the widths of the internal border.
805
806The value returned by @code{frame-text-width} differs from that returned
807by @code{frame-pixel-width} by not including the width of one vertical
808scroll bar, the widths of one left and one right fringe and the widths
809of the internal border.
810@end defun 976@end defun
811 977
812@defun frame-height &optional frame 978@defun frame-height &optional frame
@@ -823,12 +989,28 @@ rounded down to the number of characters of the default font that fully
823fit into the text area. 989fit into the text area.
824@end defun 990@end defun
825 991
992@defun frame-pixel-height &optional frame
993@defunx frame-pixel-width &optional frame
994These functions return the native width and height, see @ref{Frame
995Layout}) of @var{frame} in pixels. For a text terminal, the results are
996in characters rather than pixels.
997@end defun
998
999On window systems that support it, Emacs tries by default to make the
1000text size of a frame measured in pixels a multiple of the frame's
1001character size. This, however, usually means that a frame can be
1002resized only in character size increments when dragging its external
1003borders. It also may break attempts to truly maximize the frame or
1004making it ``fullheight'' or ``fullwidth'' (@pxref{Size Parameters})
1005leaving some empty space below and/or on the right of the frame. The
1006following option may help in that case.
1007
826@defopt frame-resize-pixelwise 1008@defopt frame-resize-pixelwise
827If this option is @code{nil}, a frame's size is usually rounded to a 1009If this option is @code{nil}, a frame's text pixel size is usually
828multiple of the current values of that frame's @code{frame-char-height} 1010rounded to a multiple of the current values of that frame's
829and @code{frame-char-width} whenever the frame is resized. If this is 1011@code{frame-char-height} and @code{frame-char-width} whenever the frame
830non-@code{nil}, no rounding occurs, hence frame sizes can 1012is resized. If this is non-@code{nil}, no rounding occurs, hence frame
831increase/decrease by one pixel. 1013sizes can increase/decrease by one pixel.
832 1014
833Setting this variable usually causes the next resize operation to pass 1015Setting this variable usually causes the next resize operation to pass
834the corresponding size hints to the window manager. This means that 1016the corresponding size hints to the window manager. This means that
@@ -855,7 +1037,7 @@ terms of the canonical height and width of a character on @var{frame}
855The optional argument @var{pixelwise} non-@code{nil} means to measure 1037The optional argument @var{pixelwise} non-@code{nil} means to measure
856the new width and height in units of pixels instead. Note that if 1038the new width and height in units of pixels instead. Note that if
857@code{frame-resize-pixelwise} is @code{nil}, some toolkits may refuse to 1039@code{frame-resize-pixelwise} is @code{nil}, some toolkits may refuse to
858fully honor the request if it does not increase/decrease the frame size 1040truly honor the request if it does not increase/decrease the frame size
859to a multiple of its character size. 1041to a multiple of its character size.
860@end defun 1042@end defun
861 1043
@@ -876,9 +1058,9 @@ text terminals.
876 1058
877The optional fourth argument @var{pixelwise} non-@code{nil} means that 1059The optional fourth argument @var{pixelwise} non-@code{nil} means that
878@var{frame} should be @var{height} pixels high. Note that if 1060@var{frame} should be @var{height} pixels high. Note that if
879@code{frame-resize-pixelwise} is @code{nil}, some toolkits may refuse to 1061@code{frame-resize-pixelwise} is @code{nil}, some window managers may
880fully honor the request if it does not increase/decrease the frame 1062refuse to truly honor the request if it does not increase/decrease the
881height to a multiple of its character height. 1063frame height to a multiple of its character height.
882@end defun 1064@end defun
883 1065
884@defun set-frame-width frame width &optional pretend pixelwise 1066@defun set-frame-width frame width &optional pretend pixelwise
@@ -888,9 +1070,9 @@ in characters. The argument @var{pretend} has the same meaning as in
888 1070
889The optional fourth argument @var{pixelwise} non-@code{nil} means that 1071The optional fourth argument @var{pixelwise} non-@code{nil} means that
890@var{frame} should be @var{width} pixels wide. Note that if 1072@var{frame} should be @var{width} pixels wide. Note that if
891@code{frame-resize-pixelwise} is @code{nil}, some toolkits may refuse to 1073@code{frame-resize-pixelwise} is @code{nil}, some window managers may
892fully honor the request if it does not increase/decrease the frame width 1074refuse to fully honor the request if it does not increase/decrease the
893to a multiple of its character width. 1075frame width to a multiple of its character width.
894@end defun 1076@end defun
895 1077
896None of these three functions will make a frame smaller than needed to 1078None of these three functions will make a frame smaller than needed to
@@ -899,7 +1081,25 @@ margins, dividers, mode and header lines. This contrasts with requests
899by the window manager triggered, for example, by dragging the external 1081by the window manager triggered, for example, by dragging the external
900border of a frame with the mouse. Such requests are always honored by 1082border of a frame with the mouse. Such requests are always honored by
901clipping, if necessary, portions that cannot be displayed at the right, 1083clipping, if necessary, portions that cannot be displayed at the right,
902bottom corner of the frame. 1084bottom corner of the frame. The parameters @code{min-width} and
1085@code{min-height} (@pxref{Size Parameters}) can be used to obtain a
1086similar behavior when changing the frame size from within Emacs.
1087
1088@cindex tracking frame size changes
1089 The abnormal hook @code{window-size-change-functions} (@pxref{Window
1090Hooks}) tracks all changes of the inner size of a frame including those
1091induced by request of the window-system or window manager. To rule out
1092false positives that might occur when changing only the sizes of a
1093frame's windows without actually changing the size of the inner frame,
1094use the following function.
1095
1096@defun frame-size-changed-p &optional frame
1097This function returns non-@code{nil} when the inner width or height of
1098@var{frame} has changed since @code{window-size-change-functions} was
1099run the last time for @var{frame}. It always returns @code{nil}
1100immediately after running @code{window-size-change-functions} for
1101@var{frame}.
1102@end defun
903 1103
904 1104
905@node Implied Frame Resizing 1105@node Implied Frame Resizing
@@ -916,7 +1116,7 @@ size change. Note that wrapping a menu or tool bar usually does not
916resize the frame's outer size, hence this will alter the number of 1116resize the frame's outer size, hence this will alter the number of
917displayed lines. 1117displayed lines.
918 1118
919 Occasionally, such @dfn{implied frame resizing} may be unwanted, for 1119 Occasionally, such @dfn{implied frame resizing} may be unwanted, for
920example, when the frame is maximized or made full-screen (where it's 1120example, when the frame is maximized or made full-screen (where it's
921turned off by default). In other cases you can disable implied resizing 1121turned off by default). In other cases you can disable implied resizing
922with the following option: 1122with the following option:
@@ -928,7 +1128,7 @@ implicitly resize the frame's display area in order to preserve the
928number of columns or lines the frame displays. If this option is 1128number of columns or lines the frame displays. If this option is
929non-@code{nil}, no implied resizing is done. 1129non-@code{nil}, no implied resizing is done.
930 1130
931The value of this option can be also be a list of frame parameters. In 1131The value of this option can be also a list of frame parameters. In
932that case, implied resizing is inhibited when changing a parameter that 1132that case, implied resizing is inhibited when changing a parameter that
933appears in this list. The frame parameters currently handled by this 1133appears in this list. The frame parameters currently handled by this
934option are: @code{font}, @code{font-backend}, 1134option are: @code{font}, @code{font-backend},
@@ -1135,6 +1335,8 @@ text terminals.
1135* Layout Parameters:: Size of parts of the frame, and 1335* Layout Parameters:: Size of parts of the frame, and
1136 enabling or disabling some parts. 1336 enabling or disabling some parts.
1137* Buffer Parameters:: Which buffers have been or should be shown. 1337* Buffer Parameters:: Which buffers have been or should be shown.
1338* Frame Interaction Parameters:: Parameters for interacting with other
1339 frames.
1138* Management Parameters:: Communicating with the window manager. 1340* Management Parameters:: Communicating with the window manager.
1139* Cursor Parameters:: Controlling the cursor appearance. 1341* Cursor Parameters:: Controlling the cursor appearance.
1140* Font and Color Parameters:: Fonts and colors for the frame text. 1342* Font and Color Parameters:: Fonts and colors for the frame text.
@@ -1180,64 +1382,81 @@ If you specify the frame name explicitly when you create the frame, the
1180name is also used (instead of the name of the Emacs executable) when 1382name is also used (instead of the name of the Emacs executable) when
1181looking up X resources for the frame. 1383looking up X resources for the frame.
1182 1384
1385@vindex explicit-name, a frame parameter
1183@item explicit-name 1386@item explicit-name
1184If the frame name was specified explicitly when the frame was created, 1387If the frame name was specified explicitly when the frame was created,
1185this parameter will be that name. If the frame wasn't explicitly 1388this parameter will be that name. If the frame wasn't explicitly
1186named, this parameter will be @code{nil}. 1389named, this parameter will be @code{nil}.
1187@end table 1390@end table
1188 1391
1392
1189@node Position Parameters 1393@node Position Parameters
1190@subsubsection Position Parameters 1394@subsubsection Position Parameters
1191@cindex window position on display 1395@cindex window position on display
1192@cindex frame position 1396@cindex frame position
1193 1397
1194 Position parameters' values are measured in pixels. (Note that none 1398Parameters describing the X- and Y-offsets of a frame are always
1195of these parameters exist on TTY frames.) 1399measured in pixels. For normal, non-child frames they specify the
1400frame's absolute outer position (@pxref{Frame Geometry}) with respect to
1401its display's origin. For a child frame (@pxref{Child Frames}) they
1402specify the frame's outer position relative to the native position of
1403the frame's parent frame. (Note that none of these parameters is
1404meaningful on TTY frames.)
1196 1405
1197@table @code 1406@table @code
1198@vindex left, a frame parameter 1407@vindex left, a frame parameter
1199@item left 1408@item left
1200The position, in pixels, of the left (or right) edge of the frame with 1409The position, in pixels, of the left outer edge of the frame with
1201respect to the left (or right) edge of the screen. The value may be: 1410respect to the left edge of the frame's display or parent frame.
1202 1411
1203@table @asis 1412@table @asis
1204@item an integer 1413@item an integer
1205A positive integer relates the left edge of the frame to the left edge 1414A positive integer always relates the left edge of the frame to the left
1206of the screen. A negative integer relates the right frame edge to the 1415edge of its display or parent frame. A negative integer relates the
1207right screen edge. 1416right frame edge to the right edge of the display or parent frame.
1208 1417
1209@item @code{(+ @var{pos})} 1418@item @code{(+ @var{pos})}
1210This specifies the position of the left frame edge relative to the left 1419This specifies the position of the left frame edge relative to the left
1211screen edge. The integer @var{pos} may be positive or negative; a 1420edge of its display or parent frame. The integer @var{pos} may be
1212negative value specifies a position outside the screen or on a monitor 1421positive or negative; a negative value specifies a position outside the
1213other than the primary one (for multi-monitor displays). 1422screen or parent frame or on a monitor other than the primary one (for
1423multi-monitor displays).
1214 1424
1215@item @code{(- @var{pos})} 1425@item @code{(- @var{pos})}
1216This specifies the position of the right frame edge relative to the right 1426This specifies the position of the right frame edge relative to the
1217screen edge. The integer @var{pos} may be positive or negative; a 1427right edge of the display or parent frame. The integer @var{pos} may be
1218negative value specifies a position outside the screen or on a monitor 1428positive or negative; a negative value specifies a position outside the
1219other than the primary one (for multi-monitor displays). 1429screen or parent frame or on a monitor other than the primary one (for
1430multi-monitor displays).
1220@end table 1431@end table
1221 1432
1222Some window managers ignore program-specified positions. If you want to 1433Some window managers ignore program-specified positions. If you want to
1223be sure the position you specify is not ignored, specify a 1434be sure the position you specify is not ignored, specify a
1224non-@code{nil} value for the @code{user-position} parameter as well. 1435non-@code{nil} value for the @code{user-position} parameter as in the
1225 1436following example:
1226If the window manager refuses to align a frame at the left or top screen
1227edge, combining position notation and @code{user-position} as in
1228 1437
1229@example 1438@example
1230(modify-frame-parameters 1439(modify-frame-parameters
1231 nil '((user-position . t) (left . (+ -4)))) 1440 nil '((user-position . t) (left . (+ -4))))
1232@end example 1441@end example
1233 1442
1234may help to override that. 1443In general, it is not a good idea to specify negative offsets to
1444position a frame relative to the right or bottom edge of its display.
1445Positioning the initial or a new frame is either not accurate (because
1446the size of the outer frame is not yet fully known before the frame has
1447been made visible) or will cause additional flicker (if the frame is
1448repositioned after becoming visible).
1449
1450 Note also, that negative offsets are not stored internally and are not
1451returned by the function @code{frame-parameters}. This means that the
1452desktop saving routines will restore the frame from the positive offsets
1453obtained by that function.
1235 1454
1236@vindex top, a frame parameter 1455@vindex top, a frame parameter
1237@item top 1456@item top
1238The screen position of the top (or bottom) edge, in pixels, with respect 1457The screen position of the top (or bottom) edge, in pixels, with respect
1239to the top (or bottom) edge of the screen. It works just like 1458to the top (or bottom) edge of the display or parent frame. It works
1240@code{left}, except vertically instead of horizontally. 1459just like @code{left}, except vertically instead of horizontally.
1241 1460
1242@vindex icon-left, a frame parameter 1461@vindex icon-left, a frame parameter
1243@item icon-left 1462@item icon-left
@@ -1273,6 +1492,22 @@ When you call @code{make-frame}, you should specify a non-@code{nil}
1273value for this parameter if the values of the @code{left} and @code{top} 1492value for this parameter if the values of the @code{left} and @code{top}
1274parameters represent the user's stated preference; otherwise, use 1493parameters represent the user's stated preference; otherwise, use
1275@code{nil}. 1494@code{nil}.
1495
1496@vindex z-group, a frame parameter
1497@item z-group
1498This parameter specifies a relative position of the frame's
1499window-system window in the stacking (Z-) order of the frame's display.
1500
1501If this is @code{above}, the frame's window-system window is displayed
1502above all other window-system windows that do not have the @code{above}
1503property set. If this is nil, the frame's window is displayed below all
1504windows that have the @code{above} property set and above all windows
1505that have the @code{below} property set. If this is @code{below}, the
1506frame's window is displayed below all windows that do not have the
1507@code{below} property set.
1508
1509To position the frame above or below a specific other frame use the
1510function @code{frame-restack} (@pxref{Raising and Lowering}).
1276@end table 1511@end table
1277 1512
1278 1513
@@ -1285,15 +1520,19 @@ graphical displays, the @code{default} face determines the actual
1285pixel sizes of these character units (@pxref{Face Attributes}). 1520pixel sizes of these character units (@pxref{Face Attributes}).
1286 1521
1287@table @code 1522@table @code
1288@vindex height, a frame parameter
1289@item height
1290The height of the frame's text area (@pxref{Frame Geometry}), in
1291characters.
1292
1293@vindex width, a frame parameter 1523@vindex width, a frame parameter
1294@item width 1524@item width
1295The width of the frame's text area (@pxref{Frame Geometry}), in 1525The width of the frame's text area (@pxref{Frame Geometry}), in
1296characters. 1526characters. The value can be also a cons cell of the symbol
1527@code{text-pixels} and an integer denoting the width of the text area in
1528pixels.
1529
1530@vindex height, a frame parameter
1531@item height
1532The height of the frame's text area (@pxref{Frame Geometry}), in
1533characters. The value can be also a cons cell of the symbol
1534@code{text-pixels} and an integer denoting the height of the text area
1535in pixels.
1297 1536
1298@vindex user-size, a frame parameter 1537@vindex user-size, a frame parameter
1299@item user-size 1538@item user-size
@@ -1302,6 +1541,28 @@ the @code{user-position} parameter (@pxref{Position Parameters,
1302user-position}) does for the position parameters @code{top} and 1541user-position}) does for the position parameters @code{top} and
1303@code{left}. 1542@code{left}.
1304 1543
1544@vindex min-width, a frame parameter
1545@item min-width
1546This parameter specifies the minimum native width of the frame
1547(@pxref{Frame Geometry}), in characters. Normally, the functions that
1548establish a frame's initial width or resize a frame horizontally make
1549sure that all the frame's windows, vertical scroll bars, fringes,
1550margins and vertical dividers can be displayed. This parameter, if
1551non-@code{nil} allows to make a frame narrower than that with the
1552consequence that any components that do not fit on the frame will be
1553clipped by the window manager.
1554
1555@vindex min-height, a frame parameter
1556@item min-height
1557This parameter specifies the minimum height of the native (@pxref{Frame
1558Geometry}), in characters. Normally, the functions that establish a
1559frame's initial size or resize a frame make sure that all the frame's
1560windows, horizontal scroll bars and dividers, mode and header lines, the
1561echo area and the internal menu and tool bar can be displayed. This
1562parameter, if non-@code{nil} allows to make a frame smaller than that
1563with the consequence that any components that do not fit on the frame
1564will be clipped by the window-system or window manager.
1565
1305@cindex fullboth frames 1566@cindex fullboth frames
1306@cindex fullheight frames 1567@cindex fullheight frames
1307@cindex fullwidth frames 1568@cindex fullwidth frames
@@ -1327,10 +1588,10 @@ of maximized and full-height frames and the widths of maximized and
1327full-width frames often differ by a few pixels. 1588full-width frames often differ by a few pixels.
1328 1589
1329With some window managers you may have to customize the variable 1590With some window managers you may have to customize the variable
1330@code{frame-resize-pixelwise} (@pxref{Size and Position}) in order to 1591@code{frame-resize-pixelwise} (@pxref{Frame Size}) in order to make a
1331make a frame truly appear maximized or full-screen. Moreover, 1592frame truly appear maximized or full-screen. Moreover, some window
1332some window managers might not support smooth transition between the 1593managers might not support smooth transition between the various
1333various full-screen or maximization states. Customizing the variable 1594full-screen or maximization states. Customizing the variable
1334@code{x-frame-normalize-before-maximize} can help to overcome that. 1595@code{x-frame-normalize-before-maximize} can help to overcome that.
1335 1596
1336@vindex fullscreen-restore, a frame parameter 1597@vindex fullscreen-restore, a frame parameter
@@ -1364,11 +1625,12 @@ frame, or control their sizes.
1364@table @code 1625@table @code
1365@vindex border-width, a frame parameter 1626@vindex border-width, a frame parameter
1366@item border-width 1627@item border-width
1367The width in pixels of the frame's border. 1628The width in pixels of the frame's outer border (@pxref{Frame Geometry}).
1368 1629
1369@vindex internal-border-width, a frame parameter 1630@vindex internal-border-width, a frame parameter
1370@item internal-border-width 1631@item internal-border-width
1371The distance in pixels between text (or fringe) and the frame's border. 1632The width in pixels of the frame's internal border (@pxref{Frame
1633Geometry}).
1372 1634
1373@vindex vertical-scroll-bars, a frame parameter 1635@vindex vertical-scroll-bars, a frame parameter
1374@item vertical-scroll-bars 1636@item vertical-scroll-bars
@@ -1418,21 +1680,25 @@ to not draw bottom dividers.
1418 1680
1419@vindex menu-bar-lines frame parameter 1681@vindex menu-bar-lines frame parameter
1420@item menu-bar-lines 1682@item menu-bar-lines
1421The number of lines to allocate at the top of the frame for a menu 1683The number of lines to allocate at the top of the frame for a menu bar.
1422bar. The default is 1 if Menu Bar mode is enabled, and 0 otherwise. 1684The default is one if Menu Bar mode is enabled and zero otherwise.
1423@xref{Menu Bars,,,emacs, The GNU Emacs Manual}. 1685@xref{Menu Bars,,,emacs, The GNU Emacs Manual}. For an external menu
1686bar, this value remains unchanged even when the menu bar wraps to two or
1687more lines. In that case, the @code{menu-bar-size} value returned by
1688@code{frame-geometry} (@pxref{Frame Geometry}) allows to derive whether
1689the menu bar actually occupies one or more lines.
1424 1690
1425@vindex tool-bar-lines frame parameter 1691@vindex tool-bar-lines frame parameter
1426@item tool-bar-lines 1692@item tool-bar-lines
1427The number of lines to use for the tool bar. The default is 1 if Tool 1693The number of lines to use for the tool bar. The default is one if Tool
1428Bar mode is enabled, and 0 otherwise. @xref{Tool Bars,,,emacs, The 1694Bar mode is enabled and zero otherwise. @xref{Tool Bars,,,emacs, The
1429GNU Emacs Manual}. 1695GNU Emacs Manual}. This value may change whenever the tool bar wraps.
1430 1696
1431@vindex tool-bar-position frame parameter 1697@vindex tool-bar-position frame parameter
1432@item tool-bar-position 1698@item tool-bar-position
1433The position of the tool bar. Currently only for the GTK tool bar. 1699The position of the tool bar. Currently only for the GTK tool bar.
1434Value can be one of @code{top}, @code{bottom} @code{left}, @code{right}. 1700Value can be one of @code{top}, @code{bottom} @code{left}, @code{right}.
1435The default is @code{top}. 1701The default is @code{top}.
1436 1702
1437@vindex line-spacing, a frame parameter 1703@vindex line-spacing, a frame parameter
1438@item line-spacing 1704@item line-spacing
@@ -1440,6 +1706,7 @@ Additional space to leave below each text line, in pixels (a positive
1440integer). @xref{Line Height}, for more information. 1706integer). @xref{Line Height}, for more information.
1441@end table 1707@end table
1442 1708
1709
1443@node Buffer Parameters 1710@node Buffer Parameters
1444@subsubsection Buffer Parameters 1711@subsubsection Buffer Parameters
1445@cindex frame, which buffers to display 1712@cindex frame, which buffers to display
@@ -1478,6 +1745,40 @@ most-recently-selected first.
1478If non-@code{nil}, this frame's window is never split automatically. 1745If non-@code{nil}, this frame's window is never split automatically.
1479@end table 1746@end table
1480 1747
1748@node Frame Interaction Parameters
1749@subsubsection Frame Interaction Parameters
1750
1751These parameters supply forms of interactions between different frames.
1752
1753@table @code
1754@vindex parent-frame, a frame parameter
1755@item parent-frame
1756If non-@code{nil}, this means that this frame is a child frame
1757(@pxref{Child Frames}) and this parameter specifies its parent frame.
1758If nil, this means that this frame is a normal, top-level frame.
1759
1760@vindex delete-before, a frame parameter
1761@item delete-before
1762If non-@code{nil}, this parameter specifies another frame whose deletion
1763will automatically trigger the deletion of this frame. @xref{Deleting
1764Frames}.
1765
1766@vindex mouse-wheel-frame, a frame parameter
1767@item mouse-wheel-frame
1768If non-@code{nil}, this parameter specifies the frame whose windows will
1769be scrolled whenever the mouse wheel is scrolled with the mouse pointer
1770hovering over this frame (@pxref{Mouse Commands,,, emacs, The GNU Emacs
1771Manual}).
1772
1773@vindex no-other-frame, a frame parameter
1774@item no-other-frame
1775If this is non-@code{nil}, then this frame is not eligible as candidate
1776for the functions @code{next-frame}, @code{previous-frame}
1777(@pxref{Finding All Frames}) and @code{other-frame} (@pxref{Frame
1778Commands,,, emacs, The GNU Emacs Manual}).
1779@end table
1780
1781
1481@node Management Parameters 1782@node Management Parameters
1482@subsubsection Window Management Parameters 1783@subsubsection Window Management Parameters
1483@cindex window manager interaction, and frame parameters 1784@cindex window manager interaction, and frame parameters
@@ -1541,10 +1842,56 @@ with virtual desktops.
1541 1842
1542@vindex inhibit-double-buffering, a frame parameter 1843@vindex inhibit-double-buffering, a frame parameter
1543@item inhibit-double-buffering 1844@item inhibit-double-buffering
1544If non-@code{nil}, the frame is drawn to the screen without double buffering. 1845If non-@code{nil}, the frame is drawn to the screen without double
1545Emacs normally attempts to use double buffering, where available, to 1846buffering. Emacs normally attempts to use double buffering, where
1546reduce flicker. Set this property if you experience display bugs or 1847available, to reduce flicker. Set this property if you experience
1547pine for that retro, flicker-y feeling. 1848display bugs or pine for that retro, flicker-y feeling.
1849
1850@vindex skip-taskbar, a frame parameter
1851@item skip-taskbar
1852If non-@code{nil}, this tells the window manager to remove the frame's
1853icon from the taskbar associated with the frame's display and inhibit
1854switching to the frame's window via the combination @kbd{Alt-@key{TAB}}.
1855On Windows, iconifying such a frame will "roll in" its window-system
1856window at the bottom of the desktop. Some window managers may not honor
1857this parameter.
1858
1859@vindex no-focus-on-map, a frame parameter
1860@item no-focus-on-map
1861If non-@code{nil}, this means that the frame dos not want to receive
1862input focus when it is mapped (@pxref{Visibility of Frames}). Some
1863window managers may not honor this parameter.
1864
1865@vindex no-accept-focus, a frame parameter
1866@item no-accept-focus
1867If non-@code{nil}, this means that the frame does not want to receive
1868input focus via explicit mouse clicks or when moving the mouse into it
1869either via @code{focus-follows-mouse} (@pxref{Input Focus}) or
1870@code{mouse-autoselect-window} (@pxref{Mouse Window Auto-selection}).
1871This may have the unwanted side-effect that a user cannot scroll a
1872non-selected frame with the mouse. Some window managers may not honor
1873this parameter.
1874
1875@vindex undecorated, a frame parameter
1876@item undecorated
1877If non-@code{nil}, this frame's window-system window is drawn without
1878decorations like title, minimize/maximize boxes and external borders.
1879This usually means that the window cannot be dragged, resized,
1880iconified, maximized or deleted with the mouse. If nil, the frame's
1881window is usually drawn with all the elements listed above unless their
1882display has been suspended via window manager settings.
1883
1884Under X, Emacs uses the Motif window manager hints to turn off
1885decorations. Some window managers may not honor these hints.
1886
1887@vindex override-redirect, a frame parameter
1888@item override-redirect
1889@cindex override redirect frames
1890If non-@code{nil}, this means that this is an @dfn{override redirect}
1891frame---a frame not handled by window managers under X. Override
1892redirect frames have no window manager decorations, can be positioned
1893and resized only via Emacs' positioning and resizing functions and are
1894usually drawn on top of all other frames.
1548 1895
1549@ignore 1896@ignore
1550@vindex parent-id, a frame parameter 1897@vindex parent-id, a frame parameter
@@ -1557,6 +1904,7 @@ it and see if it works.)
1557@end ignore 1904@end ignore
1558@end table 1905@end table
1559 1906
1907
1560@node Cursor Parameters 1908@node Cursor Parameters
1561@subsubsection Cursor Parameters 1909@subsubsection Cursor Parameters
1562@cindex cursor, and frame parameters 1910@cindex cursor, and frame parameters
@@ -1904,21 +2252,28 @@ while processing @code{frame-title-format} or
1904@section Deleting Frames 2252@section Deleting Frames
1905@cindex deleting frames 2253@cindex deleting frames
1906 2254
1907 A @dfn{live frame} is one that has not been deleted. When a frame 2255A @dfn{live frame} is one that has not been deleted. When a frame is
1908is deleted, it is removed from its terminal display, although it may 2256deleted, it is removed from its terminal display, although it may
1909continue to exist as a Lisp object until there are no more references 2257continue to exist as a Lisp object until there are no more references to
1910to it. 2258it.
1911 2259
1912@deffn Command delete-frame &optional frame force 2260@deffn Command delete-frame &optional frame force
1913@vindex delete-frame-functions 2261@vindex delete-frame-functions
1914This function deletes the frame @var{frame}. The argument @var{frame} 2262This function deletes the frame @var{frame}. The argument @var{frame}
1915must specify a live frame (see below) and defaults to the selected 2263must specify a live frame (see below) and defaults to the selected
1916frame. Unless @var{frame} specifies a tooltip, this function first runs 2264frame.
1917the hook @code{delete-frame-functions} (each function getting one
1918argument, @var{frame}).
1919 2265
1920A frame cannot be deleted as long as its minibuffer serves as surrogate 2266It first deletes any child frame of @var{frame} (@pxref{Child Frames})
1921minibuffer for another frame (@pxref{Minibuffers and Frames}). 2267and any frame whose @code{delete-before} frame parameter (@pxref{Frame
2268Interaction Parameters}) specifies @var{frame}. All such deletions are
2269performed recursively; so this step makes sure that there will not exist
2270any other frames with @var{frame} as their ancestor. Then, unless
2271@var{frame} specifies a tooltip, this function runs the hook
2272@code{delete-frame-functions} (each function getting one argument,
2273@var{frame}) before actually killing the frame.
2274
2275Note that a frame cannot be deleted as long as its minibuffer serves as
2276surrogate minibuffer for another frame (@pxref{Minibuffers and Frames}).
1922Normally, you cannot delete a frame if all other frames are invisible, 2277Normally, you cannot delete a frame if all other frames are invisible,
1923but if @var{force} is non-@code{nil}, then you are allowed to do so. 2278but if @var{force} is non-@code{nil}, then you are allowed to do so.
1924@end deffn 2279@end deffn
@@ -1942,8 +2297,13 @@ minibuffer frame is left untouched. The argument @var{frame} must
1942specify a live frame and defaults to the selected frame. Internally, 2297specify a live frame and defaults to the selected frame. Internally,
1943this command works by calling @code{delete-frame} with @var{force} 2298this command works by calling @code{delete-frame} with @var{force}
1944@code{nil} for all frames that shall be deleted. 2299@code{nil} for all frames that shall be deleted.
2300
2301This function does not delete any of @var{frame}'s child frames
2302(@pxref{Child Frames}). If @var{frame} is a child frame, it deletes
2303@var{frame}'s siblings only.
1945@end deffn 2304@end deffn
1946 2305
2306
1947@node Finding All Frames 2307@node Finding All Frames
1948@section Finding All Frames 2308@section Finding All Frames
1949@cindex frames, scanning all 2309@cindex frames, scanning all
@@ -1962,12 +2322,29 @@ This function returns a list of just the currently visible frames.
1962visible, even though only the selected one is actually displayed. 2322visible, even though only the selected one is actually displayed.
1963@end defun 2323@end defun
1964 2324
2325@defun frame-list-z-order &optional display
2326This function returns a list of Emacs' frames, in Z (stacking) order
2327(@pxref{Raising and Lowering}). The optional argument @var{display}
2328specifies which display to poll. @var{display} should be either a frame
2329or a display name (a string). If omitted or @code{nil}, that stands for
2330the selected frame's display. It returns @code{nil} if @var{display}
2331contains no Emacs frame.
2332
2333Frames are listed from topmost (first) to bottommost (last). As a
2334special case, if @var{display} is non-@code{nil} and specifies a live
2335frame, it returns the child frames of that frame in Z (stacking) order.
2336
2337This function is not meaningful on text terminals.
2338@end defun
2339
1965@defun next-frame &optional frame minibuf 2340@defun next-frame &optional frame minibuf
1966This function lets you cycle conveniently through all the frames on a 2341This function lets you cycle conveniently through all the frames on a
1967specific terminal from an arbitrary starting point. It returns the 2342specific terminal from an arbitrary starting point. It returns the
1968frame following @var{frame}, in the list of all live frames, on 2343frame following @var{frame}, in the list of all live frames, on
1969@var{frame}'s terminal. The argument @var{frame} must specify a live 2344@var{frame}'s terminal. The argument @var{frame} must specify a live
1970frame and defaults to the selected frame. 2345frame and defaults to the selected frame. It never returns a frame
2346whose @code{no-other-frame} parameter (@pxref{Frame Interaction
2347Parameters}) is non-@code{nil}.
1971 2348
1972The second argument, @var{minibuf}, says which frames to consider: 2349The second argument, @var{minibuf}, says which frames to consider:
1973 2350
@@ -1998,8 +2375,8 @@ Window Ordering}.
1998@section Minibuffers and Frames 2375@section Minibuffers and Frames
1999 2376
2000Normally, each frame has its own minibuffer window at the bottom, which 2377Normally, each frame has its own minibuffer window at the bottom, which
2001is used whenever that frame is selected. If the frame has a minibuffer, 2378is used whenever that frame is selected. You can get that window with
2002you can get it with @code{minibuffer-window} (@pxref{Minibuffer Windows}). 2379the function @code{minibuffer-window} (@pxref{Minibuffer Windows}).
2003 2380
2004@cindex frame without a minibuffer 2381@cindex frame without a minibuffer
2005@cindex surrogate minibuffer frame 2382@cindex surrogate minibuffer frame
@@ -2009,9 +2386,10 @@ will serve as @dfn{surrogate minibuffer frame} for this frame and cannot
2009be deleted via @code{delete-frame} (@pxref{Deleting Frames}) as long as 2386be deleted via @code{delete-frame} (@pxref{Deleting Frames}) as long as
2010this frame is live. 2387this frame is live.
2011 2388
2012When you create the frame, you can explicitly specify the minibuffer 2389When you create the frame, you can explicitly specify its minibuffer
2013window to use (in some other frame). If you don't, then the minibuffer 2390window (in some other frame) with the @code{minibuffer} frame parameter
2014is found in the frame which is the value of the variable 2391(@pxref{Buffer Parameters}). If you don't, then the minibuffer is found
2392in the frame which is the value of the variable
2015@code{default-minibuffer-frame}. Its value should be a frame that does 2393@code{default-minibuffer-frame}. Its value should be a frame that does
2016have a minibuffer. 2394have a minibuffer.
2017 2395
@@ -2026,13 +2404,14 @@ the current terminal and cannot be buffer-local. @xref{Multiple
2026Terminals}. 2404Terminals}.
2027@end defvar 2405@end defvar
2028 2406
2407
2029@node Input Focus 2408@node Input Focus
2030@section Input Focus 2409@section Input Focus
2031@cindex input focus 2410@cindex input focus
2032@c @cindex selected frame Duplicates selected-frame, same for selected-window. 2411@cindex selected frame
2033 2412
2034At any time, one frame in Emacs is the @dfn{selected frame}. The selected 2413At any time, one frame in Emacs is the @dfn{selected frame}. The
2035window always resides on the selected frame. 2414selected window always resides on the selected frame.
2036 2415
2037When Emacs displays its frames on several terminals (@pxref{Multiple 2416When Emacs displays its frames on several terminals (@pxref{Multiple
2038Terminals}), each terminal has its own selected frame. But only one 2417Terminals}), each terminal has its own selected frame. But only one
@@ -2077,6 +2456,26 @@ same meaning as for @code{select-frame} (see below). The return value
2077of this function is not significant. 2456of this function is not significant.
2078@end defun 2457@end defun
2079 2458
2459Ideally, the function described next should focus a frame without also
2460raising it above other frames. Unfortunately, many window-systems or
2461window managers may refuse to comply.
2462
2463@defun x-focus-frame &optional frame noactivate
2464This function gives @var{frame} the focus of the X server without
2465necessarily raising it. @var{frame} @code{nil} means use the selected
2466frame. Under X, the optional argument @var{noactivate}, if
2467non-@code{nil}, means to avoid making @var{frame}'s window-system window
2468the ``active'' window which should insist a bit more on avoiding to
2469raise @var{frame} above other frames.
2470
2471On Windows the @var{noactivate} argument has no effect. However, if
2472@var{frame} is a child frame (@pxref{Child Frames}), this function
2473usualy does focus @var{frame} without raising it above other child
2474frames.
2475
2476If there is no window system support, this function does nothing.
2477@end defun
2478
2080@deffn Command select-frame frame &optional norecord 2479@deffn Command select-frame frame &optional norecord
2081This function selects frame @var{frame}, temporarily disregarding the 2480This function selects frame @var{frame}, temporarily disregarding the
2082focus of the X server if any. The selection of @var{frame} lasts until 2481focus of the X server if any. The selection of @var{frame} lasts until
@@ -2091,7 +2490,7 @@ becomes the selected terminal. This function then calls
2091@code{select-window} as a subroutine, passing the window selected 2490@code{select-window} as a subroutine, passing the window selected
2092within @var{frame} as its first argument and @var{norecord} as its 2491within @var{frame} as its first argument and @var{norecord} as its
2093second argument (hence, if @var{norecord} is non-@code{nil}, this 2492second argument (hence, if @var{norecord} is non-@code{nil}, this
2094avoids changing the order of recently selected windows nor the buffer 2493avoids changing the order of recently selected windows and the buffer
2095list). @xref{Selecting Windows}. 2494list). @xref{Selecting Windows}.
2096 2495
2097This function returns @var{frame}, or @code{nil} if @var{frame} has 2496This function returns @var{frame}, or @code{nil} if @var{frame} has
@@ -2147,20 +2546,64 @@ change it.
2147@end defun 2546@end defun
2148 2547
2149@defvar focus-in-hook 2548@defvar focus-in-hook
2150This is a normal hook run when an Emacs frame gains input focus. 2549This is a normal hook run when an Emacs frame gains input focus. The
2550frame gaining focus is selected when this hook is run.
2151@end defvar 2551@end defvar
2152 2552
2153@defvar focus-out-hook 2553@defvar focus-out-hook
2154This is a normal hook run when an Emacs frame loses input focus. 2554This is a normal hook run when an Emacs frame has lost input focus and
2555no other Emacs frame has gained input focus instead.
2155@end defvar 2556@end defvar
2156 2557
2157@defopt focus-follows-mouse 2558@defopt focus-follows-mouse
2158This option is how you inform Emacs whether the window manager transfers 2559This option informs Emacs whether and how the window manager transfers
2159focus when the user moves the mouse. Non-@code{nil} says that it does. 2560focus when you move the mouse pointer into a frame. It can have three
2160When this is so, the command @code{other-frame} moves the mouse to a 2561meaningful values:
2161position consistent with the new selected frame. 2562
2563@table @asis
2564@item @code{nil}
2565The default value @code{nil} should be used when your window manager
2566follows a ``click-to-focus'' policy where you have to click the mouse
2567inside of a frame in order for that frame to gain focus.
2568
2569@item @code{t}
2570The value @code{t} should be used when your window manager has the focus
2571automatically follow the position of the mouse pointer but a frame that
2572gains focus is not raised automatically and may even remain occluded by
2573other window-system windows.
2574
2575@item @code{auto-raise}
2576The value @code{auto-raise} should be used when your window manager has
2577the focus automatically follow the position of the mouse pointer and a
2578frame that gains focus is raised automatically.
2579@end table
2580
2581If this option is non-@code{nil}, Emacs moves the mouse pointer to the
2582frame selected by @code{select-frame-set-input-focus}. That function is
2583used by a number of commands like, for example, @code{other-frame} and
2584@code{pop-to-buffer}.
2585
2586The distinction between the values @code{t} and @code{auto-raise} is not
2587needed for ``normal'' frames because the window manager usually takes
2588care of raising them. It is useful to automatically raise child frames
2589via @code{mouse-autoselect-window} (@pxref{Mouse Window
2590Auto-selection}).
2591
2592Note that this option does not distinguish ``sloppy'' focus (where the
2593frame that previously had focus retains focus as long as the mouse
2594pointer does not move into another window manager window) from
2595``strict'' focus (where a frame immediately loses focus when it's left
2596by the mouse pointer). It neither recognizes whether your window
2597manager supports delayed focusing or auto-raising where you can
2598explicitly specify the time until a new frame gets focus or is
2599auto-raised.
2600
2601You can supply a ``focus follows mouse'' policy for individual Emacs
2602windows by customizing the variable @code{mouse-autoselect-window}
2603(@pxref{Mouse Window Auto-selection}).
2162@end defopt 2604@end defopt
2163 2605
2606
2164@node Visibility of Frames 2607@node Visibility of Frames
2165@section Visibility of Frames 2608@section Visibility of Frames
2166@cindex visible frame 2609@cindex visible frame
@@ -2169,16 +2612,26 @@ position consistent with the new selected frame.
2169@cindex minimized frame 2612@cindex minimized frame
2170@cindex frame visibility 2613@cindex frame visibility
2171 2614
2172A frame on a graphical display may be @dfn{visible}, @dfn{invisible}, 2615A frame on a graphical display may be @dfn{visible}, @dfn{invisible}, or
2173or @dfn{iconified}. If it is visible, its contents are displayed in 2616@dfn{iconified}. If it is visible, its contents are displayed in the
2174the usual manner. If it is iconified, its contents are not displayed, 2617usual manner. If it is iconified, its contents are not displayed, but
2175but there is a little icon somewhere to bring the frame back into view 2618there is a little icon somewhere to bring the frame back into view (some
2176(some window managers refer to this state as @dfn{minimized} rather 2619window managers refer to this state as @dfn{minimized} rather than
2177than @dfn{iconified}, but from Emacs' point of view they are the same 2620@dfn{iconified}, but from Emacs' point of view they are the same thing).
2178thing). If a frame is invisible, it is not displayed at all. 2621If a frame is invisible, it is not displayed at all.
2622
2623@cindex mapped frame
2624@cindex unmapped frame
2625 The concept of visibility is strongly related to that of (un-)mapped
2626frames. A frame (or, more precisely, its window-system window) is and
2627becomes @dfn{mapped} when it is displayed for the first time and
2628whenever it changes its state of visibility from @code{iconified} or
2629@code{invisible} to @code{visible}. Conversely, a frame is and becomes
2630@dfn{unmapped} whenever it changes its status from @code{visible} to
2631@code{iconified} or @code{invisible}.
2179 2632
2180 Visibility is meaningless on text terminals, since only the selected 2633 Visibility is meaningless on text terminals, since only the selected
2181one is actually displayed in any case. 2634frame is actually displayed in any case.
2182 2635
2183@defun frame-visible-p frame 2636@defun frame-visible-p frame
2184This function returns the visibility status of frame @var{frame}. The 2637This function returns the visibility status of frame @var{frame}. The
@@ -2192,22 +2645,28 @@ purposes of this function, even though only one frame is displayed.
2192 2645
2193@deffn Command iconify-frame &optional frame 2646@deffn Command iconify-frame &optional frame
2194This function iconifies frame @var{frame}. If you omit @var{frame}, it 2647This function iconifies frame @var{frame}. If you omit @var{frame}, it
2195iconifies the selected frame. 2648iconifies the selected frame. This usually makes all child frames of
2649@var{frame} (and their descendants) invisible (@pxref{Child Frames}).
2196@end deffn 2650@end deffn
2197 2651
2198@deffn Command make-frame-visible &optional frame 2652@deffn Command make-frame-visible &optional frame
2199This function makes frame @var{frame} visible. If you omit 2653This function makes frame @var{frame} visible. If you omit @var{frame},
2200@var{frame}, it makes the selected frame visible. This does not raise 2654it makes the selected frame visible. This does not raise the frame, but
2201the frame, but you can do that with @code{raise-frame} if you wish 2655you can do that with @code{raise-frame} if you wish (@pxref{Raising and
2202(@pxref{Raising and Lowering}). 2656Lowering}).
2657
2658Making a frame visible usually makes all its child frames (and their
2659descendants) visible too (@pxref{Child Frames}).
2203@end deffn 2660@end deffn
2204 2661
2205@deffn Command make-frame-invisible &optional frame force 2662@deffn Command make-frame-invisible &optional frame force
2206This function makes frame @var{frame} invisible. If you omit 2663This function makes frame @var{frame} invisible. If you omit
2207@var{frame}, it makes the selected frame invisible. 2664@var{frame}, it makes the selected frame invisible. Usually, this makes
2665all child frames of @var{frame} (and their descendants) invisible too
2666(@pxref{Child Frames}).
2208 2667
2209Unless @var{force} is non-@code{nil}, this function refuses to make 2668Unless @var{force} is non-@code{nil}, this function refuses to make
2210@var{frame} invisible if all other frames are invisible.. 2669@var{frame} invisible if all other frames are invisible.
2211@end deffn 2670@end deffn
2212 2671
2213 The visibility status of a frame is also available as a frame 2672 The visibility status of a frame is also available as a frame
@@ -2223,27 +2682,79 @@ being rendered with double buffering. @var{frame} defaults to the
2223selected frame. 2682selected frame.
2224@end defun 2683@end defun
2225 2684
2685
2226@node Raising and Lowering 2686@node Raising and Lowering
2227@section Raising and Lowering Frames 2687@section Raising, Lowering and Restacking Frames
2228 2688
2229@cindex raising a frame 2689@cindex raising a frame
2230@cindex lowering a frame 2690@cindex lowering a frame
2231 Most window systems use a desktop metaphor. Part of this metaphor 2691@cindex restacking a frame
2232is the idea that system-level windows (e.g., Emacs frames) are 2692@cindex frame stacking order
2233stacked in a notional third dimension perpendicular to the screen 2693@cindex frame Z-order
2234surface. Where two overlap, the one higher up covers the one 2694 Most window systems use a desktop metaphor. Part of this metaphor is
2235underneath. You can @dfn{raise} or @dfn{lower} a frame using the 2695the idea that system-level windows (representing, e.g., Emacs frames)
2236functions @code{raise-frame} and @code{lower-frame}. 2696are stacked in a notional third dimension perpendicular to the screen
2697surface. The order induced by stacking is total and usually referred to
2698as stacking (or Z-) order. Where the areas of two windows overlap, the
2699one higher up in that order will (partially) cover the one underneath.
2700
2701 You can @dfn{raise} a frame to the top of that order or @dfn{lower} a
2702frame to its bottom by using the functions @code{raise-frame} and
2703@code{lower-frame}. You can @dfn{restack} a frame directly above or
2704below another frame using the function @code{frame-restack}.
2705
2706 Note that all functions described below will respect the adherence of
2707frames (and all other window-system windows) to their respective z-group
2708(@pxref{Position Parameters}). For example, you usually cannot lower a
2709frame below that of the desktop window and you cannot raise a frame
2710whose @code{z-group} parameter is @code{nil} above the window-system's
2711taskbar or tooltip window.
2237 2712
2238@deffn Command raise-frame &optional frame 2713@deffn Command raise-frame &optional frame
2239This function raises frame @var{frame} (default, the selected frame). 2714This function raises frame @var{frame} (default, the selected frame)
2240If @var{frame} is invisible or iconified, this makes it visible. 2715above all other frames belonging to the same or a lower z-group as
2716@var{frame}. If @var{frame} is invisible or iconified, this makes it
2717visible. If @var{frame} is a child frame (@pxref{Child Frames}), this
2718raises @var{frame} above all other child frames of its parent.
2241@end deffn 2719@end deffn
2242 2720
2243@deffn Command lower-frame &optional frame 2721@deffn Command lower-frame &optional frame
2244This function lowers frame @var{frame} (default, the selected frame). 2722This function lowers frame @var{frame} (default, the selected frame)
2723below all other frames belonging to the same or a higher z-group as
2724@var{frame}. If @var{frame} is a child frame (@pxref{Child Frames}),
2725this lowers @var{frame} below all other child frames of its parent.
2245@end deffn 2726@end deffn
2246 2727
2728@defun frame-restack frame1 frame2 &optional above
2729This function restacks @var{frame1} below @var{frame2}. This implies
2730that if both frames are visible and their display areas overlap,
2731@var{frame2} will (partially) obscure @var{frame1}. If the optional
2732third argument @var{above} is non-@code{nil}, this function restacks
2733@var{frame1} above @var{frame2}. This means that if both frames are
2734visible and their display areas overlap, @var{frame1} will (partially)
2735obscure @var{frame2}.
2736
2737Technically, this function may be thought of as an atomic action
2738performed in two steps: The first step removes @var{frame1}'s
2739window-system window from the display. The second step reinserts
2740@var{frame1}'s window into the display below (above if @var{above} is
2741true) that of @var{frame2}. Hence the position of @var{frame2} in its
2742display's Z (stacking) order relative to all other frames excluding
2743@var{frame1} remains unaltered.
2744
2745Some window managers may refuse to restack windows.
2746@end defun
2747
2748Note that the effect of restacking will only hold as long as neither of
2749the involved frames is iconified or made invisible. You can use the
2750@code{z-group} (@pxref{Position Parameters}) frame parameter to add a
2751frame to a group of frames permanently shown above or below other
2752frames. As long as a frame belongs to one of these groups, restacking
2753it will only affect its relative stacking position within that group.
2754The effect of restacking frames belonging to different z-groups is
2755undefined. You can list frames in their current stacking order with the
2756function @code{frame-list-z-order} (@pxref{Finding All Frames}).
2757
2247@defopt minibuffer-auto-raise 2758@defopt minibuffer-auto-raise
2248If this is non-@code{nil}, activation of the minibuffer raises the frame 2759If this is non-@code{nil}, activation of the minibuffer raises the frame
2249that the minibuffer window is in. 2760that the minibuffer window is in.
@@ -2265,6 +2776,7 @@ or @code{nil} (meaning the selected frame's terminal). If it does not
2265refer to a text terminal, the return value is @code{nil}. 2776refer to a text terminal, the return value is @code{nil}.
2266@end defun 2777@end defun
2267 2778
2779
2268@node Frame Configurations 2780@node Frame Configurations
2269@section Frame Configurations 2781@section Frame Configurations
2270@cindex frame configuration 2782@cindex frame configuration
@@ -2288,6 +2800,135 @@ Ordinarily, this function deletes all existing frames not listed in
2288unwanted frames are iconified instead. 2800unwanted frames are iconified instead.
2289@end defun 2801@end defun
2290 2802
2803
2804@node Child Frames
2805@section Child Frames
2806@cindex child frames
2807@cindex parent frames
2808
2809On some window-systems the @code{parent-frame} parameter (@pxref{Frame
2810Interaction Parameters}) can be used to make a frame a child of the
2811frame specified by that parameter. The frame specified by that
2812parameter will then be the frame's parent frame as long as the parameter
2813is not changed or reset. Technically, this makes the child frame's
2814window-system window a child window of the parent frame's window-system
2815window.
2816
2817 The @code{parent-frame} parameter can be changed at any time. Setting
2818it to another frame ``reparents'' the child frame. Setting it to
2819another child frame makes the frame a ``nested'' child frame. Setting
2820it to @code{nil} restores the frame's status as a top-level frame---one
2821whose window-system window is a child of its display's root window.
2822
2823 Since child frames can be arbitrarily nested, a frame can be both a
2824child and a parent frame. Also, the relative roles of child and parent
2825frame may be reversed at any time (though it's usually a good idea to
2826keep the size of child frames sufficiently smaller than that of their
2827parent). An error will be signalled for the attempt to make a frame an
2828ancestor of itself.
2829
2830 A child frame is clipped at the native edges (@pxref{Frame Geometry})
2831of its parent frame---everything outside these edges is invisible. Its
2832@code{left} and @code{top} parameters specify positions relative to the
2833top-left corner of its parent's native frame. When either of the frames
2834is resized, the relative position of the child frame remains unaltered.
2835Hence, resizing either of these frames can hide or reveal parts of the
2836child frame.
2837
2838 Usually, moving a parent frame moves along all its child frames and
2839their descendants as well, keeping their relative positions unaltered.
2840The hook @code{move-frame-functions} (@pxref{Frame Position}) is run for
2841a child frame only when the position of the child frame relative to its
2842parent frame changes. When a parent frame is resized, the child frame
2843retains its position respective to the left and upper native edges of
2844its parent. In this case, the position respective to the lower or right
2845native edge of the parent frame is usually lost.
2846
2847 A visible child frame always appears on top of its parent frame thus
2848obscuring parts of it. This is comparable to the window-system window
2849of a top-level frame which also always appears on top of its parent
2850window---the desktop's root window. When a parent frame is iconified or
2851made invisible (@pxref{Visibility of Frames}), its child frames are made
2852invisible. When a parent frame is deiconified or made visible, its
2853child frames are made visible. When a parent frame is about to be
2854deleted, (@pxref{Deleting Frames}) its child frames are recursively
2855deleted before it.
2856
2857 Whether a child frame can have a menu or tool bar is window-system or
2858window manager dependent. Most window-systems explicitly disallow menus
2859bars for child frames. It seems advisable to disable both, menu and
2860tool bars, via the frame's initial parameters settings.
2861
2862 Usually, child frames do not exhibit window manager decorations like a
2863title bar or external borders (@pxref{Frame Geometry}). When the child
2864frame does not show a menu or tool bar, any other of the frame's borders
2865(@pxref{Layout Parameters}) can be used instead of the external borders.
2866
2867 In particular, under X (but not when building with GTK+), the frame's
2868outer border can be used. On Windows, specifying a non-zero outer
2869border width will show a one pixel wide external border. Under all
2870window-systems, the internal border can be used. In either case, it's
2871advisable to disable a child frame's window manager decorations with the
2872@code{undecorated} frame parameter @pxref{Management Parameters}).
2873
2874 The behavior of child frames deviates from that of top-level frames in
2875a number of other ways as well. Here we sketch a few of them:
2876
2877@itemize @bullet
2878@item
2879The semantics of maximizing and iconifying child frames is highly
2880window-system dependent. As a rule, applications should never invoke
2881these operations for child frames.
2882
2883@item
2884Raising, lowering and restacking child frames (@pxref{Raising and
2885Lowering}) or changing the @code{z-group} (@pxref{Position Parameters})
2886of a child frame changes only the stacking order of child frames with
2887the same parent.
2888
2889@item
2890Many window-systems are not able to change the opacity (@pxref{Font and
2891Color Parameters}) of child frames.
2892
2893@item
2894Transferring focus from a child frame to an ancestor that is not its
2895parent by clicking with the mouse in a visible part of that ancestor's
2896window may fail with some window-systems. You may have to click into
2897the direct parent's window-system window first.
2898
2899@item
2900Window managers might not bother to extend their focus follows mouse
2901policy to child frames. Customizing @code{mouse-autoselect-window} can
2902help in this regard (@pxref{Mouse Window Auto-selection}).
2903
2904@item
2905Dropping (@pxref{Drag and Drop}) on child frames is not guaranteed too
2906work on all window-systems. Some will drop the object on the parent
2907frame or some ancestor instead.
2908@end itemize
2909
2910 The following two functions may be useful when working with child and
2911parent frames:
2912
2913@defun frame-parent &optional frame
2914This function returns the parent frame of @var{frame}. The parent frame
2915of @var{frame} is the Emacs frame whose window-system window is the
2916parent window of @var{frame}'s window-system window. If such a frame
2917exists, @var{frame} is considered a child frame of that frame.
2918
2919This function returns @code{nil} if @var{frame} has no parent frame.
2920@end defun
2921
2922@defun frame-ancestor-p &optional ancestor descendant
2923This functions returns non-@code{nil} if @var{ancestor} is an ancestor
2924of @var{descendant}. @var{ancestor} is an ancestor of @var{descendant}
2925when it is either @var{descendant}'s parent frame or it is an ancestor
2926of @var{descendant}'s parent frame. Both, @var{ancestor} and
2927@var{descendant} must specify live frames and default to the selected
2928frame.
2929@end defun
2930
2931
2291@node Mouse Tracking 2932@node Mouse Tracking
2292@section Mouse Tracking 2933@section Mouse Tracking
2293@cindex mouse tracking 2934@cindex mouse tracking
@@ -3203,9 +3844,3 @@ ever be developed and distributed noncommercially.
3203This variable's value is @code{t} if no X window manager is in use. 3844This variable's value is @code{t} if no X window manager is in use.
3204@end defvar 3845@end defvar
3205@end ignore 3846@end ignore
3206
3207@ignore
3208@item
3209The functions @code{x-pixel-width} and @code{x-pixel-height} return the
3210width and height of an X Window frame, measured in pixels.
3211@end ignore
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi
index 6aa9591e09f..931d1060d5d 100644
--- a/doc/lispref/windows.texi
+++ b/doc/lispref/windows.texi
@@ -42,6 +42,7 @@ is displayed in windows.
42* Vertical Scrolling:: Moving the contents up and down on the window. 42* Vertical Scrolling:: Moving the contents up and down on the window.
43* Horizontal Scrolling:: Moving the contents sideways on the window. 43* Horizontal Scrolling:: Moving the contents sideways on the window.
44* Coordinates and Windows:: Converting coordinates to windows. 44* Coordinates and Windows:: Converting coordinates to windows.
45* Mouse Window Auto-selection:: Automatically selecting windows with the mouse.
45* Window Configurations:: Saving and restoring the state of the screen. 46* Window Configurations:: Saving and restoring the state of the screen.
46* Window Parameters:: Associating additional information with windows. 47* Window Parameters:: Associating additional information with windows.
47* Window Hooks:: Hooks for scrolling, window size changes, 48* Window Hooks:: Hooks for scrolling, window size changes,
@@ -763,7 +764,7 @@ changing the size of its frame. Because live windows do not overlap,
763these functions are meaningful only on frames that contain two or more 764these functions are meaningful only on frames that contain two or more
764windows: resizing a window also changes the size of a neighboring 765windows: resizing a window also changes the size of a neighboring
765window. If there is just one window on a frame, its size cannot be 766window. If there is just one window on a frame, its size cannot be
766changed except by resizing the frame (@pxref{Size and Position}). 767changed except by resizing the frame (@pxref{Frame Size}).
767 768
768 Except where noted, these functions also accept internal windows as 769 Except where noted, these functions also accept internal windows as
769arguments. Resizing an internal window causes its child windows to be 770arguments. Resizing an internal window causes its child windows to be
@@ -1016,7 +1017,7 @@ A window can get resized explicitly by using one of the functions from
1016the preceding section or implicitly, for example, when resizing an 1017the preceding section or implicitly, for example, when resizing an
1017adjacent window, when splitting or deleting a window (@pxref{Splitting 1018adjacent window, when splitting or deleting a window (@pxref{Splitting
1018Windows}, @pxref{Deleting Windows}) or when resizing the window's frame 1019Windows}, @pxref{Deleting Windows}) or when resizing the window's frame
1019(@pxref{Size and Position}). 1020(@pxref{Frame Size}).
1020 1021
1021 It is possible to avoid implicit resizing of a specific window when 1022 It is possible to avoid implicit resizing of a specific window when
1022there are one or more other resizable windows on the same frame. For 1023there are one or more other resizable windows on the same frame. For
@@ -1716,23 +1717,47 @@ value of @code{window-point} (@pxref{Window Point}) in @var{window}.
1716@var{window} must be a live window. The return value is @var{window}. 1717@var{window} must be a live window. The return value is @var{window}.
1717 1718
1718By default, this function also moves @var{window}'s buffer to the front 1719By default, this function also moves @var{window}'s buffer to the front
1719of the buffer list (@pxref{Buffer List}), and makes @var{window} the 1720of the buffer list (@pxref{Buffer List}) and makes @var{window} the most
1720most recently selected window. However, if the optional argument 1721recently selected window. If the optional argument @var{norecord} is
1721@var{norecord} is non-@code{nil}, these additional actions are omitted. 1722non-@code{nil}, these additional actions are omitted.
1722 1723
1723This function runs @code{buffer-list-update-hook} (@pxref{Buffer List}) 1724In addition, this function by default also tells the display engine to
1724unless @var{norecord} is non-@code{nil}. Note that applications and 1725update the display of @var{window} when its frame gets redisplayed the
1725internal routines often temporarily select a window in order to simplify 1726next time. If @var{norecord} is non-@code{nil}, such updates are
1726coding. As a rule, such selections (including those made by the macros 1727usually not performed. If, however, @var{norecord} equals the special
1727@code{save-selected-window} and @code{with-selected-window} below) are 1728symbol @code{mark-for-redisplay}, the additional actions mentioned above
1728not recorded thus avoiding to pollute @code{buffer-list-update-hook}. 1729are omitted but @var{window} will be nevertheless updated.
1729Selections that really count are those causing a visible change in
1730the next redisplay of @var{window}'s frame and should be always
1731recorded. This also means that to run a function each time a window
1732gets selected, putting it on @code{buffer-list-update-hook} should be
1733the right choice.
1734@end defun 1730@end defun
1735 1731
1732@cindex select window hook
1733@cindex running a hook when a windows gets selected
1734For historical reasons, Emacs does not run a separate hook whenever a
1735window gets selected. Applications and internal routines often
1736temporarily select a window to perform a few actions on it. They do
1737that either to simplify coding---because many functions by default
1738operate on the selected window when no @var{window} argument is
1739specified---or because some functions did not (and still do not) take a
1740window as argument and always operate(d) on the selected window instead.
1741Running a hook every time a window gets selected for a short time and
1742once more when the previously selected window gets restored is not
1743useful.
1744
1745 However, when its @var{norecord} argument is @code{nil},
1746@code{select-window} updates the buffer list and thus indirectly runs
1747the normal hook @code{buffer-list-update-hook} (@pxref{Buffer List}).
1748Consequently, that hook provides a reasonable way to run a function
1749whenever a window gets selected more ``permanently''.
1750
1751 Since @code{buffer-list-update-hook} is also run by functions that are
1752not related to window management, it will usually make sense to save the
1753value of the selected window somewhere and compare it with the value of
1754@code{selected-window} while running that hook. Also, to avoid false
1755positives when using @code{buffer-list-update-hook} it is good practice
1756that every @code{select-window} call supposed to select a window only
1757temporarily, passes a non-@code{nil} @var{norecord} argument. If
1758possible, the macro @code{with-selected-window} (see below) should be
1759used in such cases.
1760
1736@cindex most recently selected windows 1761@cindex most recently selected windows
1737 The sequence of calls to @code{select-window} with a non-@code{nil} 1762 The sequence of calls to @code{select-window} with a non-@code{nil}
1738@var{norecord} argument determines an ordering of windows by their 1763@var{norecord} argument determines an ordering of windows by their
@@ -1761,13 +1786,13 @@ the buffer list.
1761 1786
1762@defmac with-selected-window window forms@dots{} 1787@defmac with-selected-window window forms@dots{}
1763This macro selects @var{window}, executes @var{forms} in sequence, then 1788This macro selects @var{window}, executes @var{forms} in sequence, then
1764restores the previously selected window and current buffer. The ordering 1789restores the previously selected window and current buffer. The
1765of recently selected windows and the buffer list remain unchanged unless 1790ordering of recently selected windows and the buffer list remain
1766you deliberately change them within @var{forms}; for example, by calling 1791unchanged unless you deliberately change them within @var{forms}; for
1767@code{select-window} with argument @var{norecord} @code{nil}. 1792example, by calling @code{select-window} with argument @var{norecord}
1768 1793@code{nil}. Hence, this macro is the preferred way to temporarily work
1769This macro does not change the order of recently selected windows or 1794with @var{window} as the selected window without needlessly running
1770the buffer list. 1795@code{buffer-list-update-hook}.
1771@end defmac 1796@end defmac
1772 1797
1773@defun frame-selected-window &optional frame 1798@defun frame-selected-window &optional frame
@@ -4566,6 +4591,55 @@ point in the selected window, it's sufficient to write:
4566@end defun 4591@end defun
4567 4592
4568 4593
4594@node Mouse Window Auto-selection
4595@section Mouse Window Auto-selection
4596@cindex window auto-selection
4597@cindex auto-selection of window
4598The following option allows to automatically select the window under the
4599mouse pointer. This accomplishes a policy similar to that of window
4600managers that give focus to a frame (and thus trigger its subsequent
4601selection) whenever the mouse pointer enters its window-system window
4602(@pxref{Input Focus}).
4603
4604@defvar mouse-autoselect-window
4605If this variable is non-@code{nil}, Emacs will try to automatically
4606select the window under the mouse pointer. The following values are
4607meaningful:
4608
4609@table @asis
4610@item A positive number
4611This specifies a delay in seconds after which auto-selection triggers.
4612The window under the mouse pointer is selected after the mouse has
4613remained in it for the entire duration of the delay.
4614
4615@item A negative number
4616A negative number has a similar effect as a positive number, but selects
4617the window under the mouse pointer only after the mouse pointer has
4618remained in it for the entire duration of the absolute value of that
4619number and in addition has stopped moving.
4620
4621@item Other value
4622Any other non-@code{nil} value means to select a window instantaneously
4623as soon as the mouse pointer enters it.
4624@end table
4625
4626In either case the mouse pointer must enter the text area of a window in
4627order to trigger its selection. Dragging the scroll bar slider or the
4628mode line of a window conceptually should not cause its auto-selection.
4629
4630Mouse auto-selection selects the minibuffer window only if it is active,
4631and never deselects the active minibuffer window.
4632@end defvar
4633
4634Mouse auto-selection can be used to emulate a focus follows mouse policy
4635for child frames (@pxref{Child Frames}) which usually are not tracked by
4636the window manager. This requires to set the value of
4637@code{focus-follows-mouse} (@pxref{Input Focus}) to a non-@code{nil}
4638value. If the value of @code{focus-follows-mouse} is @code{auto-raise},
4639entering a child frame with the mouse will raise it automatically above
4640all other child frames of that frame's parent frame.
4641
4642
4569@node Window Configurations 4643@node Window Configurations
4570@section Window Configurations 4644@section Window Configurations
4571@cindex window configurations 4645@cindex window configurations