Mercurial > emacs
annotate lispref/frames.texi @ 8110:bf6ecdddf78b
*** empty log message ***
| author | Richard M. Stallman <rms@gnu.org> |
|---|---|
| date | Fri, 01 Jul 1994 20:11:01 +0000 |
| parents | ec7caebc4a1d |
| children | bc548090f760 |
| rev | line source |
|---|---|
| 6547 | 1 @c -*-texinfo-*- |
| 2 @c This is part of the GNU Emacs Lisp Reference Manual. | |
| 3 @c Copyright (C) 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc. | |
| 4 @c See the file elisp.texi for copying conditions. | |
| 5 @setfilename ../info/frames | |
| 6 @node Frames, Positions, Windows, Top | |
| 7 @chapter Frames | |
| 8 @cindex frame | |
| 9 | |
| 10 A @var{frame} is a rectangle on the screen that contains one or more | |
| 11 Emacs windows. A frame initially contains a single main window (plus | |
| 12 perhaps a minibuffer window) which you can subdivide vertically or | |
| 13 horizontally into smaller windows. | |
| 14 | |
| 15 @cindex terminal frame | |
| 16 @cindex X window frame | |
| 17 When Emacs runs on a text-only terminal, it has just one frame, a | |
| 18 @dfn{terminal frame}. There is no way to create another terminal frame | |
| 19 after startup. If Emacs has an X display, it does not have a terminal | |
| 20 frame; instead, it starts with a single @dfn{X window frame}. You can | |
| 21 create more; see @ref{Creating Frames}. | |
| 22 | |
| 23 @defun framep object | |
| 24 This predicate returns @code{t} if @var{object} is a frame, and | |
| 25 @code{nil} otherwise. | |
| 26 @end defun | |
| 27 | |
| 28 @menu | |
| 29 * Creating Frames:: Creating additional X Window frames. | |
| 30 * Frame Parameters:: Controlling frame size, position, font, etc. | |
| 31 * Deleting Frames:: Frames last until explicitly deleted. | |
| 32 * Finding All Frames:: How to examine all existing frames. | |
| 33 * Frames and Windows:: A frame contains windows; | |
| 34 display of text always works through windows. | |
| 35 * Minibuffers and Frames:: How a frame finds the minibuffer to use. | |
| 36 * Input Focus:: Specifying the selected frame. | |
| 37 * Visibility of Frames:: Frames may be visible or invisible, or icons. | |
| 38 * Raising and Lowering:: Raising a frame makes it hide other X windows; | |
| 39 lowering it makes the others hide them. | |
| 40 * Frame Configurations:: Saving the state of all frames. | |
| 41 * Mouse Tracking:: Getting events that say when the mouse moves. | |
| 42 * Mouse Position:: Asking where the mouse is, or moving it. | |
| 43 * Pop-Up Menus:: Displaying a menu for the user to select from. | |
| 44 * Dialog Boxes:: Displaying a box to ask yes or no. | |
|
7684
ec7caebc4a1d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7174
diff
changeset
|
45 * Pointer Shapes:: Specifying the shape of the mouse pointer. |
| 6547 | 46 * X Selections:: Transferring text to and from other X clients. |
| 47 * X Connections:: Opening and closing the X server connection. | |
| 48 * Resources:: Getting resource values from the server. | |
| 49 * Server Data:: Getting info about the X server. | |
| 50 @end menu | |
| 51 | |
| 52 @xref{Display}, for related information. | |
| 53 | |
| 54 @node Creating Frames | |
| 55 @section Creating Frames | |
| 56 | |
| 57 To create a new frame, call the function @code{make-frame}. | |
| 58 | |
| 59 @defun make-frame alist | |
| 60 This function creates a new frame, if the display mechanism permits | |
| 61 creation of frames. (An X server does; an ordinary terminal does not.) | |
| 62 | |
| 63 The argument is an alist specifying frame parameters. Any parameters | |
| 64 not mentioned in @var{alist} default according to the value of the | |
| 65 variable @code{default-frame-alist}; parameters not specified there | |
| 66 either default from the standard X defaults file and X resources. | |
| 67 | |
| 68 The set of possible parameters depends in principle on what kind of | |
| 69 window system Emacs uses to display its the frames. @xref{X Frame | |
| 70 Parameters}, for documentation of individual parameters you can specify | |
| 71 when creating an X window frame. | |
| 72 @end defun | |
| 73 | |
| 74 @defvar before-make-frame-hook | |
| 75 A normal hook run by @code{make-frame} before it actually creates the | |
| 76 frame. | |
| 77 @end defvar | |
| 78 | |
| 79 @defvar after-make-frame-hook | |
| 80 A normal hook run by @code{make-frame} after it creates the frame. | |
| 81 @end defvar | |
| 82 | |
| 83 @node Frame Parameters | |
| 84 @section Frame Parameters | |
| 85 | |
| 86 A frame has many parameters that control its appearance and behavior. | |
| 87 Just what parameters a frame has depends on what display mechanism it | |
| 88 uses. | |
| 89 | |
| 90 Frame parameters exist for the sake of window systems. A terminal frame | |
| 91 has a few parameters, for compatibility's sake only. You can't change | |
| 92 these parameters directly; the only ones that ever change are the height | |
| 93 and width. | |
| 94 | |
| 95 @menu | |
| 96 * Parameter Access:: How to change a frame's parameters. | |
| 97 * Initial Parameters:: Specifying frame parameters when you make a frame. | |
| 98 * X Frame Parameters:: Individual parameters documented. | |
|
7174
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
99 * Size and Position:: Changing the size and position of a frame. |
| 6547 | 100 @end menu |
| 101 | |
| 102 @node Parameter Access | |
| 103 @subsection Access to Frame Parameters | |
| 104 | |
| 105 These functions let you read and change the parameter values of a | |
| 106 frame. | |
| 107 | |
| 108 @defun frame-parameters frame | |
| 109 The function @code{frame-parameters} returns an alist listing all the | |
| 110 parameters of @var{frame} and their values. | |
| 111 @end defun | |
| 112 | |
| 113 @defun modify-frame-parameters frame alist | |
| 114 This function alters the parameters of frame @var{frame} based on the | |
| 115 elements of @var{alist}. Each element of @var{alist} has the form | |
| 116 @code{(@var{parm} . @var{value})}, where @var{parm} is a symbol naming a | |
| 117 parameter. If you don't mention a parameter in @var{alist}, its value | |
| 118 doesn't change. | |
| 119 @end defun | |
| 120 | |
| 121 @node Initial Parameters | |
| 122 @subsection Initial Frame Parameters | |
| 123 | |
| 124 You can specify the parameters for the initial startup frame | |
| 125 by setting @code{initial-frame-alist} in your @file{.emacs} file. | |
| 126 | |
| 127 @defvar initial-frame-alist | |
| 128 This variable's value is an alist of parameter values used when creating | |
|
8110
bf6ecdddf78b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7684
diff
changeset
|
129 the initial X window frame. Each element has the form: |
|
bf6ecdddf78b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7684
diff
changeset
|
130 |
|
bf6ecdddf78b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7684
diff
changeset
|
131 @example |
|
bf6ecdddf78b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7684
diff
changeset
|
132 (@var{parameter} . @var{value}) |
|
bf6ecdddf78b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7684
diff
changeset
|
133 @end example |
|
bf6ecdddf78b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7684
diff
changeset
|
134 |
|
bf6ecdddf78b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7684
diff
changeset
|
135 Emacs creates the initial frame before it reads your @file{~/.emacs} |
|
bf6ecdddf78b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7684
diff
changeset
|
136 file. After reading that file, Emacs checks @code{initial-frame-alist}, |
|
bf6ecdddf78b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7684
diff
changeset
|
137 and applies the parameter settings in the altered value to the already |
|
bf6ecdddf78b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7684
diff
changeset
|
138 created initial frame. |
|
bf6ecdddf78b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7684
diff
changeset
|
139 |
|
bf6ecdddf78b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7684
diff
changeset
|
140 If these settings affect the frame geometry, you'll see the frame appear |
|
bf6ecdddf78b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7684
diff
changeset
|
141 with the wrong geometry and then change to the specified one. If you |
|
bf6ecdddf78b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7684
diff
changeset
|
142 like, you can specify the same geometry with X resources; those do take |
|
bf6ecdddf78b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7684
diff
changeset
|
143 affect before the frame is created. @xref{Resources X,, X Resources, |
|
bf6ecdddf78b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7684
diff
changeset
|
144 emacs, The GNU Emacs Manual}. |
|
bf6ecdddf78b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7684
diff
changeset
|
145 |
|
bf6ecdddf78b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7684
diff
changeset
|
146 X resource settings typically apply to all frames. If you want to |
|
bf6ecdddf78b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7684
diff
changeset
|
147 specify some X resources solely for the sake of the initial frame, and |
|
bf6ecdddf78b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7684
diff
changeset
|
148 you don't want them to apply to subsequent frames, here's how to achieve |
|
bf6ecdddf78b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7684
diff
changeset
|
149 this. Specify parameters in @code{default-frame-alist} to override the |
|
bf6ecdddf78b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7684
diff
changeset
|
150 X resources for subsequent frames; then, to prevent these from affecting |
|
bf6ecdddf78b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7684
diff
changeset
|
151 the initial frame, specify the same parameters in |
|
bf6ecdddf78b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7684
diff
changeset
|
152 @code{initial-frame-alist} with values that match the X resources. |
| 6547 | 153 @end defvar |
| 154 | |
| 155 If these parameters specify a separate minibuffer-only frame, | |
| 156 and you have not created one, Emacs creates one for you. | |
| 157 | |
| 158 @defvar minibuffer-frame-alist | |
| 159 This variable's value is an alist of parameter values used when creating | |
| 160 an initial minibuffer-only frame---if such a frame is needed, according | |
| 161 to the parameters for the main initial frame. | |
| 162 @end defvar | |
| 163 | |
|
8110
bf6ecdddf78b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7684
diff
changeset
|
164 @defvar special-display-frame-alist |
|
bf6ecdddf78b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7684
diff
changeset
|
165 The variable @code{special-display-frame-alist} specifies the frame |
|
bf6ecdddf78b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7684
diff
changeset
|
166 parameters for special display frames. |
|
bf6ecdddf78b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7684
diff
changeset
|
167 @end defvar |
|
bf6ecdddf78b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7684
diff
changeset
|
168 |
|
bf6ecdddf78b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7684
diff
changeset
|
169 @defvar default-frame-alist |
|
bf6ecdddf78b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7684
diff
changeset
|
170 This is an alist specifying default values of frame parameters for |
|
bf6ecdddf78b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7684
diff
changeset
|
171 subsequent Emacs frames (not the initial ones). |
|
bf6ecdddf78b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7684
diff
changeset
|
172 @end defvar |
|
bf6ecdddf78b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7684
diff
changeset
|
173 |
|
bf6ecdddf78b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7684
diff
changeset
|
174 If you use options that specify window appearance when you invoke Emacs, |
|
bf6ecdddf78b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7684
diff
changeset
|
175 they take effect by adding elements to @code{default-frame-alist}. One |
|
bf6ecdddf78b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7684
diff
changeset
|
176 exception is @samp{-geometry}, which adds to @code{initial-frame-alist} |
|
bf6ecdddf78b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7684
diff
changeset
|
177 instead. @xref{Command Arguments,,, emacs, The GNU Emacs Manual}. |
|
bf6ecdddf78b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7684
diff
changeset
|
178 |
| 6547 | 179 @node X Frame Parameters |
| 180 @subsection X Window Frame Parameters | |
| 181 | |
| 182 Just what parameters a frame has depends on what display mechanism it | |
| 183 uses. Here is a table of the parameters of an X window frame: | |
| 184 | |
| 185 @table @code | |
| 186 @item name | |
| 187 The name of the frame. Most window managers display the frame's name in | |
| 188 the frame's border, at the top of the frame. If you don't specify a | |
| 189 name, and you have more than one frame, Emacs sets the frame name based | |
| 190 on the buffer displayed in the frame's selected window. | |
| 191 | |
| 192 If you specify the frame name explicitly when you create the frame, the | |
| 193 name is also used (instead of the name of the Emacs executable) when | |
| 194 looking up X resources for the frame. | |
| 195 | |
| 196 @item left | |
|
7684
ec7caebc4a1d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7174
diff
changeset
|
197 The screen position of the left edge, in pixels. The value may be |
|
ec7caebc4a1d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7174
diff
changeset
|
198 @code{-} instead of a number; that represents @samp{-0} in a geometry |
|
ec7caebc4a1d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7174
diff
changeset
|
199 specification. |
| 6547 | 200 |
| 201 @item top | |
|
7684
ec7caebc4a1d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7174
diff
changeset
|
202 The screen position of the top edge, in pixels. The value may be |
|
ec7caebc4a1d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7174
diff
changeset
|
203 @code{-} instead of a number; that represents @samp{-0} in a geometry |
|
ec7caebc4a1d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7174
diff
changeset
|
204 specification. |
|
ec7caebc4a1d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7174
diff
changeset
|
205 |
|
ec7caebc4a1d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7174
diff
changeset
|
206 @item user-position |
|
ec7caebc4a1d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7174
diff
changeset
|
207 Non-@code{nil} if the screen position of the frame was explicitly |
|
ec7caebc4a1d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7174
diff
changeset
|
208 requested by the user (for example, with the @samp{-geometry} option). |
|
ec7caebc4a1d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7174
diff
changeset
|
209 Nothing automatically makes this parameter non-@code{nil}; it is up to |
|
ec7caebc4a1d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7174
diff
changeset
|
210 Lisp programs that call @code{make-frame} to specify this parameter as |
|
ec7caebc4a1d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7174
diff
changeset
|
211 well as specifying the @code{left} and @code{top} parameters. |
| 6547 | 212 |
| 213 @item height | |
|
7174
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
214 The height of the frame contents, in characters. (To get the height in |
|
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
215 pixels, call @code{frame-pixel-height}; see @ref{Size and Position}.) |
| 6547 | 216 |
| 217 @item width | |
|
7174
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
218 The width of the frame contents, in characters. (To get the height in |
|
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
219 pixels, call @code{frame-pixel-width}; see @ref{Size and Position}.) |
| 6547 | 220 |
| 221 @item window-id | |
| 222 The number of the X window for the frame. | |
| 223 | |
| 224 @item minibuffer | |
| 225 Whether this frame has its own minibuffer. The value @code{t} means | |
| 226 yes, @code{nil} means no, @code{only} means this frame is just a | |
| 227 minibuffer, a minibuffer window (in some other frame) means the new | |
| 228 frame uses that minibuffer. | |
| 229 | |
| 230 @item font | |
| 231 The name of the font for displaying text in the frame. This is a | |
| 232 string. | |
| 233 | |
| 234 @item auto-raise | |
| 235 Whether selecting the frame raises it (non-@code{nil} means yes). | |
| 236 | |
| 237 @item auto-lower | |
| 238 Whether deselecting the frame lowers it (non-@code{nil} means yes). | |
| 239 | |
| 240 @item vertical-scroll-bars | |
| 241 Whether the frame has scroll bars for vertical scrolling | |
| 242 (non-@code{nil} means yes). | |
| 243 | |
| 244 @item horizontal-scroll-bars | |
| 245 Whether the frame has scroll bars for horizontal scrolling | |
| 246 (non-@code{nil} means yes). (Horizontal scroll bars are not currently | |
| 247 implemented.) | |
| 248 | |
| 249 @item icon-type | |
| 250 The type of icon to use for this frame when it is iconified. | |
| 251 Non-@code{nil} specifies a bitmap icon, @code{nil} a text icon. | |
| 252 | |
| 253 @item foreground-color | |
| 254 The color to use for the inside of a character. This is a string; the X | |
| 255 server defines the meaningful color names. | |
| 256 | |
| 257 @item background-color | |
| 258 The color to use for the background of text. | |
| 259 | |
| 260 @item mouse-color | |
|
7684
ec7caebc4a1d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7174
diff
changeset
|
261 The color for the mouse pointer. |
| 6547 | 262 |
| 263 @item cursor-color | |
| 264 The color for the cursor that shows point. | |
| 265 | |
| 266 @item border-color | |
| 267 The color for the border of the frame. | |
| 268 | |
| 269 @item cursor-type | |
| 270 The way to display the cursor. There are two legitimate values: | |
| 271 @code{bar} and @code{box}. The symbol @code{bar} specifies a vertical | |
| 272 bar between characters as the cursor. The symbol @code{box} specifies | |
| 273 an ordinary black box overlaying the character after point; that is the | |
| 274 default. | |
| 275 | |
| 276 @item border-width | |
| 277 The width in pixels of the window border. | |
| 278 | |
| 279 @item internal-border-width | |
| 280 The distance in pixels between text and border. | |
| 281 | |
| 282 @item unsplittable | |
| 283 If non-@code{nil}, this frame's window is never split automatically. | |
| 284 | |
| 285 @item visibility | |
| 286 The state of visibility of the frame. There are three possibilities: | |
| 287 @code{nil} for invisible, @code{t} for visible, and @code{icon} for | |
| 288 iconified. @xref{Visibility of Frames}. | |
| 289 | |
| 290 @item menu-bar-lines | |
| 291 The number of lines to allocate at the top of the frame for a menu bar. | |
| 292 The default is 1. @xref{Menu Bar}. | |
| 293 | |
| 294 @item parent-id | |
| 295 @c ??? Not yet working. | |
| 296 The X window number of the window that should be the parent of this one. | |
| 297 Specifying this lets you create an Emacs window inside some other | |
| 298 application's window. (It is not certain this will be implemented; try | |
| 299 it and see if it works.) | |
| 300 @end table | |
| 301 | |
|
7174
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
302 @node Size and Position |
| 6547 | 303 @subsection Frame Size And Position |
| 304 | |
| 305 You can read or change the size and position of a frame using the | |
| 306 frame parameters @code{left}, @code{top}, @code{height} and | |
|
7684
ec7caebc4a1d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7174
diff
changeset
|
307 @code{width}. Whatever geometry parameters you don't specify are chosen |
|
ec7caebc4a1d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7174
diff
changeset
|
308 by the window manager in its usual fashion. |
| 6547 | 309 |
| 310 Here are some special features for working with sizes and positions: | |
| 311 | |
| 312 @defun set-frame-position frame left top | |
| 313 This function sets the position of the top left corner of | |
| 314 @var{frame}---to @var{left} and @var{top}. These arguments are measured | |
| 315 in pixels, counting from the top left corner of the screen. | |
| 316 @end defun | |
| 317 | |
| 318 @defun frame-height &optional frame | |
| 319 @defunx frame-width &optional frame | |
| 320 These functions return the height and width of @var{frame}, measured in | |
| 321 characters. If you don't supply @var{frame}, they use the selected | |
| 322 frame. | |
| 323 @end defun | |
| 324 | |
| 325 @defun frame-pixel-height &optional frame | |
| 326 @defunx frame-pixel-width &optional frame | |
| 327 These functions return the height and width of @var{frame}, measured in | |
| 328 pixels. If you don't supply @var{frame}, they use the selected frame. | |
| 329 @end defun | |
| 330 | |
| 331 @defun frame-char-height &optional frame | |
| 332 @defunx frame-char-width &optional frame | |
| 333 These functions return the height and width, respectively, of a | |
| 334 character in @var{frame}, measured in pixels. The values depend on the | |
| 335 choice of font. If you don't supply @var{frame}, these functions use | |
| 336 the selected frame. | |
| 337 @end defun | |
| 338 | |
| 339 @defun set-frame-size frame cols rows | |
|
7174
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
340 This function sets the size of @var{frame}, measured in characters; |
|
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
341 @var{cols} and @var{rows} specify the new width and height. |
| 6547 | 342 |
|
7174
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
343 To set the size based on values measured in pixels, use |
|
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
344 @code{frame-char-height} and @code{frame-char-width} to convert |
|
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
345 them to units of characters. |
| 6547 | 346 @end defun |
| 347 | |
| 348 The old-fashioned functions @code{set-screen-height} and | |
| 349 @code{set-screen-width}, which were used to specify the height and width | |
| 350 of the screen in Emacs versions that did not support multiple frames, | |
| 351 are still usable. They apply to the selected frame. @xref{Screen | |
| 352 Size}. | |
| 353 | |
| 354 @defun x-parse-geometry geom | |
| 355 @cindex geometry specification | |
| 356 The function @code{x-parse-geometry} converts a standard X windows | |
| 357 geometry string to an alist which you can use as part of the argument to | |
| 358 @code{make-frame}. | |
| 359 | |
| 360 The alist describes which parameters were specified in @var{geom}, and | |
| 361 gives the values specified for them. Each element looks like | |
| 362 @code{(@var{parameter} . @var{value})}. The possible @var{parameter} | |
| 363 values are @code{left}, @code{top}, @code{width}, and @code{height}. | |
| 364 | |
| 365 @smallexample | |
| 366 (x-parse-geometry "35x70+0-0") | |
| 367 @result{} ((width . 35) (height . 70) (left . 0) (top . -1)) | |
| 368 @end smallexample | |
| 369 @end defun | |
| 370 | |
| 371 @ignore | |
| 372 New functions @code{set-frame-height} and @code{set-frame-width} set the | |
| 373 size of a specified frame. The frame is the first argument; the size is | |
| 374 the second. | |
| 375 @end ignore | |
| 376 | |
| 377 @node Deleting Frames | |
| 378 @section Deleting Frames | |
| 379 @cindex deletion of frames | |
| 380 | |
| 381 Frames remain potentially visible until you explicitly @dfn{delete} | |
| 382 them. A deleted frame cannot appear on the screen, but continues to | |
| 383 exist as a Lisp object until there are no references to it. There is no | |
| 384 way to cancel the deletion of a frame aside from restoring a saved frame | |
| 385 configuration (@pxref{Frame Configurations}); this is similar to the | |
| 386 way windows behave. | |
| 387 | |
| 388 @deffn Command delete-frame &optional frame | |
| 389 This function deletes the frame @var{frame}. By default, @var{frame} is | |
| 390 the selected frame. | |
| 391 @end deffn | |
| 392 | |
| 393 @defun frame-live-p frame | |
| 394 The function @code{frame-live-p} returns non-@code{nil} if the frame | |
| 395 @var{frame} has not been deleted. | |
| 396 @end defun | |
| 397 | |
| 398 @node Finding All Frames | |
| 399 @section Finding All Frames | |
| 400 | |
| 401 @defun frame-list | |
| 402 The function @code{frame-list} returns a list of all the frames that | |
| 403 have not been deleted. It is analogous to @code{buffer-list} for | |
| 404 buffers. The list that you get is newly created, so modifying the list | |
| 405 doesn't have any effect on the internals of Emacs. | |
| 406 @end defun | |
| 407 | |
| 408 @defun visible-frame-list | |
| 409 This function returns a list of just the currently visible frames. | |
| 410 @xref{Visibility of Frames}. | |
| 411 @end defun | |
| 412 | |
| 413 @defun next-frame &optional frame minibuf | |
| 414 The function @code{next-frame} lets you cycle conveniently through all | |
| 415 the frames from an arbitrary starting point. It returns the ``next'' | |
| 416 frame after @var{frame} in the cycle. If @var{frame} is omitted or | |
| 417 @code{nil}, it defaults to the selected frame. | |
| 418 | |
| 419 The second argument, @var{minibuf}, says which frames to consider: | |
| 420 | |
| 421 @table @asis | |
| 422 @item @code{nil} | |
| 423 Exclude minibuffer-only frames. | |
| 424 @item @code{visible} | |
| 425 Consider all visible frames. | |
| 426 @item a window | |
| 427 Consider only the frames using that particular window as their | |
| 428 minibuffer. | |
| 429 @item anything else | |
| 430 Consider all frames. | |
| 431 @end table | |
| 432 @end defun | |
| 433 | |
| 434 @defun previous-frame &optional frame minibuf | |
| 435 Like @code{next-frame}, but cycles through all frames in the opposite | |
| 436 direction. | |
| 437 @end defun | |
| 438 | |
| 439 @node Frames and Windows | |
| 440 @section Frames and Windows | |
| 441 | |
|
7174
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
442 Each window is part of one and only one frame; you can get the frame |
|
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
443 with @code{window-frame}. |
| 6547 | 444 |
| 445 @defun window-frame window | |
| 446 This function returns the frame that @var{window} is on. | |
| 447 @end defun | |
| 448 | |
|
7174
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
449 All the non-minibuffer windows in a frame are arranged in a cyclic |
|
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
450 order. The order runs from the frame's top window, which is at the |
|
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
451 upper left corner, down and to the right, until it reaches the window at |
|
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
452 the lower right corner (always the minibuffer window, if the frame has |
|
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
453 one), and then it moves back to the top. |
|
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
454 |
|
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
455 @defun frame-top-window frame |
|
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
456 This returns the topmost, leftmost window of frame @var{frame}. |
|
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
457 This is a window |
|
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
458 @end defun |
|
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
459 |
| 6547 | 460 At any time, exactly one window on any frame is @dfn{selected within the |
| 461 frame}. The significance of this designation is that selecting the | |
| 462 frame also selects this window. You can get the frame's current | |
| 463 selected window with @code{frame-selected-window}. | |
| 464 | |
| 465 @defun frame-selected-window frame | |
| 466 This function returns the window on @var{frame} which is selected within | |
| 467 @var{frame}. | |
| 468 @end defun | |
| 469 | |
| 470 Conversely, selecting a window for Emacs with @code{select-window} also | |
| 471 makes that window selected within its frame. @xref{Selecting Windows}. | |
| 472 | |
| 473 @node Minibuffers and Frames | |
| 474 @section Minibuffers and Frames | |
| 475 | |
| 476 Normally, each frame has its own minibuffer window at the bottom, which | |
| 477 is used whenever that frame is selected. If the frame has a minibuffer, | |
| 478 you can get it with @code{minibuffer-window} (@pxref{Minibuffer Misc}). | |
| 479 | |
| 480 However, you can also create a frame with no minibuffer. Such a frame | |
| 481 must use the minibuffer window of some other frame. When you create the | |
| 482 frame, you can specify explicitly the frame on which to find the | |
| 483 minibuffer to use. If you don't, then the minibuffer is found in the | |
| 484 frame which is the value of the variable | |
| 485 @code{default-minibuffer-frame}. Its value should be a frame which does | |
| 486 have a minibuffer. | |
| 487 | |
| 488 If you use a minibuffer-only frame, you might want that frame to raise | |
| 489 when you enter the minibuffer. If so, set the variable | |
| 490 @code{minibuffer-auto-raise} to @code{t}. @xref{Raising and Lowering}. | |
| 491 | |
| 492 @node Input Focus | |
| 493 @section Input Focus | |
| 494 @cindex input focus | |
| 495 @cindex selected frame | |
| 496 | |
| 497 At any time, one frame in Emacs is the @dfn{selected frame}. The selected | |
| 498 window always resides on the selected frame. | |
| 499 | |
| 500 @defun selected-frame | |
| 501 This function returns the selected frame. | |
| 502 @end defun | |
| 503 | |
| 504 The X server normally directs keyboard input to the X window that the | |
| 505 mouse is in. Some window managers use mouse clicks or keyboard events | |
| 506 to @dfn{shift the focus} to various X windows, overriding the normal | |
| 507 behavior of the server. | |
| 508 | |
| 509 Lisp programs can switch frames ``temporarily'' by calling | |
| 510 the function @code{select-frame}. This does not override the window | |
| 511 manager; rather, it escapes from the window manager's control until | |
| 512 that control is somehow reasserted. | |
| 513 | |
| 514 @c ??? This is not yet implemented properly. | |
| 515 @defun select-frame frame | |
| 516 This function selects frame @var{frame}, temporarily disregarding the | |
| 517 focus of the X server. The selection of @var{frame} lasts until the | |
| 518 next time the user does something to select a different frame, or until | |
| 519 the next time this function is called. | |
| 520 @end defun | |
| 521 | |
| 522 Emacs cooperates with the X server and the window managers by arranging | |
| 523 to select frames according to what the server and window manager ask | |
| 524 for. It does so by generating a special kind of input event, called a | |
| 525 @dfn{focus} event. The command loop handles a focus event by calling | |
| 526 @code{handle-select-frame}. @xref{Focus Events}. | |
| 527 | |
| 528 @deffn Command handle-switch-frame frame | |
| 529 This function handles a focus event by selecting frame @var{frame}. | |
| 530 | |
| 531 Focus events normally do their job by invoking this command. | |
| 532 Don't call it for any other reason. | |
| 533 @end deffn | |
| 534 | |
| 535 @defun redirect-frame-focus frame focus-frame | |
| 536 This function redirects focus from @var{frame} to @var{focus-frame}. | |
| 537 This means that @var{focus-frame} will receive subsequent keystrokes and | |
| 538 intended for @var{frame}. After such an event, the value of | |
| 539 @code{last-event-frame} will be @var{focus-frame}. Also, switch-frame | |
| 540 events specifying @var{frame} will instead select @var{focus-frame}. | |
| 541 | |
| 542 If @var{focus-frame} is @code{nil}, that cancels any existing | |
| 543 redirection for @var{frame}, which therefore once again receives its own | |
| 544 events. | |
| 545 | |
| 546 One use of focus redirection is for frames that don't have minibuffers. | |
| 547 These frames use minibuffers on other frames. Activating a minibuffer | |
| 548 on another frame redirects focus to that frame. This puts the focus on | |
| 549 the minibuffer's frame, where it belongs, even though the mouse remains | |
| 550 in the frame which activated the minibuffer. | |
| 551 | |
| 552 Selecting a frame can also change focus redirections. Selecting frame | |
| 553 @code{bar}, when @code{foo} had been selected, changes any redirections | |
| 554 pointing to @code{foo} so that they point to @code{bar} instead. This | |
| 555 allows focus redirection to work properly when the user switches from | |
| 556 one frame to another using @code{select-window}. | |
| 557 | |
| 558 This means that a frame whose focus is redirected to itself is treated | |
| 559 differently from a frame whose focus is not redirected. | |
| 560 @code{select-frame} affects the former but not the latter. | |
| 561 | |
| 562 The redirection lasts until @code{redirect-frame-focus} is called to | |
| 563 change it. | |
| 564 @end defun | |
| 565 | |
| 566 @node Visibility of Frames | |
| 567 @section Visibility of Frames | |
| 568 @cindex visible frame | |
| 569 @cindex invisible frame | |
| 570 @cindex iconified frame | |
| 571 @cindex frame visibility | |
| 572 | |
| 573 A frame may be @dfn{visible}, @dfn{invisible}, or @dfn{iconified}. If | |
| 574 it is visible, you can see its contents. If it is iconified, the | |
| 575 frame's contents do not appear on the screen, but an icon does. If the | |
| 576 frame is invisible, it doesn't show in the screen, not even as an icon. | |
| 577 | |
| 578 @deffn Command make-frame-visible &optional frame | |
| 579 This function makes frame @var{frame} visible. If you omit @var{frame}, | |
| 580 it makes the selected frame visible. | |
| 581 @end deffn | |
| 582 | |
| 583 @deffn Command make-frame-invisible &optional frame | |
| 584 This function makes frame @var{frame} invisible. If you omit | |
| 585 @var{frame}, it makes the selected frame invisible. | |
| 586 @end deffn | |
| 587 | |
| 588 @deffn Command iconify-frame &optional frame | |
| 589 This function iconifies frame @var{frame}. If you omit @var{frame}, it | |
| 590 iconifies the selected frame. | |
| 591 @end deffn | |
| 592 | |
| 593 @defun frame-visible-p frame | |
| 594 This returns the visibility status of frame @var{frame}. The value is | |
| 595 @code{t} if @var{frame} is visible, @code{nil} if it is invisible, and | |
| 596 @code{icon} if it is iconified. | |
| 597 @end defun | |
| 598 | |
| 599 The visibility status of a frame is also available as a frame | |
| 600 parameter. You can read or change it as such. @xref{X Frame | |
| 601 Parameters}. | |
| 602 | |
| 603 @node Raising and Lowering | |
| 604 @section Raising and Lowering Frames | |
| 605 | |
| 606 The X Window System uses a desktop metaphor. Part of this metaphor is | |
| 607 the idea that windows are stacked in a notional third dimension | |
| 608 perpendicular to the screen surface, and thus ordered from ``highest'' | |
| 609 to ``lowest''. Where two windows overlap, the one higher up covers the | |
| 610 one underneath. Even a window at the bottom of the stack can be seen if | |
| 611 no other window overlaps it. | |
| 612 | |
| 613 @cindex raising a frame | |
| 614 @cindex lowering a frame | |
| 615 A window's place in this ordering is not fixed; in fact, users tend to | |
| 616 change the order frequently. @dfn{Raising} a window means moving it | |
| 617 ``up'', to the top of the stack. @dfn{Lowering} a window means moving | |
| 618 it to the bottom of the stack. This motion is in the notional third | |
| 619 dimension only, and does not change the position of the window on the | |
| 620 screen. | |
| 621 | |
| 622 You can raise and lower Emacs's X windows with these functions: | |
| 623 | |
| 624 @defun raise-frame frame | |
| 625 This function raises frame @var{frame}. | |
| 626 @end defun | |
| 627 | |
| 628 @defun lower-frame frame | |
| 629 This function lowers frame @var{frame}. | |
| 630 @end defun | |
| 631 | |
| 632 @defopt minibuffer-auto-raise | |
| 633 If this is non-@code{nil}, activation of the minibuffer raises the frame | |
| 634 that the minibuffer window is in. | |
| 635 @end defopt | |
| 636 | |
| 637 You can also enable auto-raise (raising automatically when a frame is | |
| 638 selected) or auto-lower (lowering automatically when it is deselected) | |
| 639 for any frame using frame parameters. @xref{X Frame Parameters}. | |
| 640 | |
| 641 @node Frame Configurations | |
| 642 @section Frame Configurations | |
| 643 @cindex frame configuration | |
| 644 | |
| 645 A @dfn{frame configuration} records the current arrangement of frames, | |
| 646 all their properties, and the window configuration of each one. | |
| 647 | |
| 648 @defun current-frame-configuration | |
| 649 This function returns a frame configuration list which describes | |
| 650 the current arrangement of frames and their contents. | |
| 651 @end defun | |
| 652 | |
| 653 @defun set-frame-configuration configuration | |
| 654 This function restores the state of frames described in | |
| 655 @var{configuration}. | |
| 656 @end defun | |
| 657 | |
| 658 @node Mouse Tracking | |
| 659 @section Mouse Tracking | |
| 660 @cindex mouse tracking | |
| 661 @cindex tracking the mouse | |
| 662 | |
| 663 Sometimes it is useful to @dfn{track} the mouse, which means, to display | |
| 664 something to indicate where the mouse is and move the indicator as the | |
| 665 mouse moves. For efficient mouse tracking, you need a way to wait until | |
| 666 the mouse actually moves. | |
| 667 | |
| 668 The convenient way to track the mouse is to ask for events to represent | |
| 669 mouse motion. Then you can wait for motion by waiting for an event. In | |
| 670 addition, you can easily handle any other sorts of events that may | |
| 671 occur. That is useful, because normally you don't want to track the | |
| 672 mouse forever---only until some other event, such as the release of a | |
| 673 button. | |
| 674 | |
| 675 @defspec track-mouse body@dots{} | |
| 676 Execute @var{body}, meanwhile generating input events for mouse motion. | |
| 677 The code in @var{body} can read these events with @code{read-event} or | |
| 678 @code{read-key-sequence}. @xref{Motion Events}, for the format of mouse | |
| 679 motion events. | |
| 680 | |
| 681 The value of @code{track-mouse} is that of the last form in @var{body}. | |
| 682 @end defspec | |
| 683 | |
| 684 The usual purpose of tracking mouse motion is to indicate on the screen | |
| 685 the consequences of pushing or releasing a button at the current | |
| 686 position. | |
| 687 | |
| 688 @ignore | |
| 689 @c These are not implemented yet. | |
| 690 | |
| 691 These functions change the screen appearance instantaneously. The | |
| 692 effect is transient, only until the next ordinary Emacs redisplay. That | |
| 693 is ok for mouse tracking, since it doesn't make sense for mouse tracking | |
| 694 to change the text, and the body of @code{track-mouse} normally reads | |
| 695 the events itself and does not do redisplay. | |
| 696 | |
| 697 @defun x-contour-region window beg end | |
| 698 This function draws lines to make a box around the text from @var{beg} | |
| 699 to @var{end}, in window @var{window}. | |
| 700 @end defun | |
| 701 | |
| 702 @defun x-uncontour-region window beg end | |
| 703 This function erases the lines that would make a box around the text | |
| 704 from @var{beg} to @var{end}, in window @var{window}. Use it to remove | |
| 705 a contour that you previously made by calling @code{x-contour-region}. | |
| 706 @end defun | |
| 707 | |
| 708 @defun x-draw-rectangle frame left top right bottom | |
| 709 This function draws a hollow rectangle on frame @var{frame} with the | |
| 710 specified edge coordinates, all measured in pixels from the inside top | |
| 711 left corner. It uses the cursor color, the one used for indicating the | |
| 712 location of point. | |
| 713 @end defun | |
| 714 | |
| 715 @defun x-erase-rectangle frame left top right bottom | |
| 716 This function erases a hollow rectangle on frame @var{frame} with the | |
| 717 specified edge coordinates, all measured in pixels from the inside top | |
| 718 left corner. Erasure means redrawing the text and background that | |
| 719 normally belong in the specified rectangle. | |
| 720 @end defun | |
| 721 @end ignore | |
| 722 | |
| 723 @node Mouse Position | |
| 724 @section Mouse Position | |
| 725 @cindex mouse position | |
| 726 @cindex position of mouse | |
| 727 | |
| 728 The functions @code{mouse-position} and @code{set-mouse-position} | |
| 729 give access to the current position of the mouse. | |
| 730 | |
| 731 @defun mouse-position | |
| 732 This function returns a description of the position of the mouse. The | |
| 733 value looks like @code{(@var{frame} @var{x} . @var{y})}, where @var{x} | |
|
7174
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
734 and @var{y} are integers giving the position in characters relative to |
|
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
735 the top left corner of the inside of @var{frame}. |
| 6547 | 736 @end defun |
| 737 | |
| 738 @defun set-mouse-position frame x y | |
| 739 This function @dfn{warps the mouse} to position @var{x}, @var{y} in | |
| 740 frame @var{frame}. The arguments @var{x} and @var{y} are integers, | |
|
7174
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
741 giving the position in characters relative to the top left corner of the |
| 6547 | 742 inside of @var{frame}. |
|
7174
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
743 @end defun |
| 6547 | 744 |
|
7174
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
745 @defun mouse-pixel-position |
|
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
746 This function is like @code{mouse-position} except that it returns |
|
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
747 coordinates in units of pixels rather than units of characters. |
|
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
748 @end defun |
|
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
749 |
|
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
750 @defun set-mouse-pixel-position frame x y |
|
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
751 This function warps the mouse like @code{set-mouse-position} except that |
|
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
752 @var{x} and @var{y} are in units of pixels rather than units of |
|
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
753 characters. These coordinates are not required to be within the frame. |
| 6547 | 754 @end defun |
| 755 | |
| 756 @need 3000 | |
| 757 | |
| 758 @node Pop-Up Menus | |
| 759 @section Pop-Up Menus | |
| 760 | |
| 761 @defun x-popup-menu position menu | |
| 762 This function displays a pop-up menu and returns an indication of | |
| 763 what selection the user makes. | |
| 764 | |
| 765 The argument @var{position} specifies where on the screen to put the | |
| 766 menu. It can be either a mouse button event (which says to put the menu | |
| 767 where the user actuated the button) or a list of this form: | |
| 768 | |
| 769 @example | |
| 770 ((@var{xoffset} @var{yoffset}) @var{window}) | |
| 771 @end example | |
| 772 | |
| 773 @noindent | |
|
7174
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
774 where @var{xoffset} and @var{yoffset} are coordinates, measured in |
|
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
775 pixels, counting from the top left corner of @var{window}'s frame. |
| 6547 | 776 |
| 777 If @var{position} is @code{t}, it means to use the current mouse | |
| 778 position. If @var{position} is @code{nil}, it means to precompute the | |
| 779 key binding equivalents for the keymaps specified in @var{menu}, | |
| 780 without actually displaying or popping up the menu. | |
| 781 | |
| 782 The argument @var{menu} says what to display in the menu. It can be a | |
| 783 keymap or a list of keymaps (@pxref{Menu Keymaps}). Alternatively, it | |
| 784 can have the following form: | |
| 785 | |
| 786 @example | |
| 787 (@var{title} @var{pane1} @var{pane2}...) | |
| 788 @end example | |
| 789 | |
| 790 @noindent | |
| 791 where each pane is a list of form | |
| 792 | |
| 793 @example | |
| 794 (@var{title} (@var{line} @var{item})...) | |
| 795 @end example | |
| 796 | |
| 797 Each @var{line} should be a string, and each @var{item} should be the | |
| 798 value to return if that @var{line} is chosen. | |
| 799 @end defun | |
| 800 | |
| 801 @strong{Usage note:} Don't use @code{x-popup-menu} to display a menu if | |
| 802 a prefix key with a menu keymap would do the job. If you use a menu | |
| 803 keymap to implement a menu, @kbd{C-h c} and @kbd{C-h a} can see the | |
| 804 individual items in that menu and provide help for them. If instead you | |
| 805 implement the menu by defining a command that calls @code{x-popup-menu}, | |
| 806 the help facilities cannot know what happens inside that command, so | |
| 807 they cannot give any help for the menu's items. This is the reason why | |
| 808 all the menu bar items except @samp{Buffers} are implemented with menu | |
| 809 keymaps (@pxref{Menu Keymaps}). | |
| 810 | |
| 811 @node Dialog Boxes | |
| 812 @section Dialog Boxes | |
| 813 @cindex dialog boxes | |
| 814 | |
| 815 A dialog box is a variant of a pop-up menu. It looks a little | |
| 816 different (if Emacs uses an X toolkit), it always appears in the center | |
| 817 of a frame, and it has just one level and one pane. The main use of | |
| 818 dialog boxes is for asking questions that the user can answer with | |
| 819 ``yes'', ``no'', and a few other alternatives. The functions | |
| 820 @code{y-or-n-p} and @code{yes-or-no-p} use dialog boxes instead of the | |
| 821 keyboard, when called from commands invoked by mouse clicks. | |
| 822 | |
| 823 @defun x-popup-dialog position contents | |
| 824 This function displays a pop-up dialog box and returns an indication of | |
| 825 what selection the user makes. The argument @var{contents} specifies | |
| 826 the alternatives to offer; it has this format: | |
| 827 | |
| 828 @example | |
|
7174
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
829 (@var{title} (@var{string} . @var{value})@dots{}) |
| 6547 | 830 @end example |
| 831 | |
| 832 @noindent | |
| 833 which looks like the list that specifies a single pane for | |
| 834 @code{x-popup-menu}. | |
| 835 | |
|
7174
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
836 The return value is @var{value} from the chosen alternative. |
|
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
837 |
|
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
838 An element of the list may be just a string instead of a cons cell |
|
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
839 @code{(@var{string} . @var{value})}. That makes a box that cannot |
|
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
840 be selected. |
|
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
841 |
|
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
842 If @code{nil} appears in the list, it separates the left-hand items from |
|
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
843 the right-hand items; items that precede the @code{nil} appear on the |
|
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
844 left, and items that follow the @code{nil} appear on the right. If you |
|
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
845 don't include a @code{nil} in the list, then approximately half the |
|
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
846 items appear on each side. |
|
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
847 |
| 6547 | 848 Dialog boxes always appear in the center of a frame; the argument |
| 849 @var{position} specifies which frame. The possible values are as in | |
| 850 @code{x-popup-menu}, but the precise coordinates don't matter; only the | |
| 851 frame matters. | |
|
7174
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
852 |
|
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
853 If your Emacs executable does not use an X toolkit, then it cannot |
|
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
854 display a real dialog box; so instead it displays the same items in a |
|
0313f520a4d9
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6547
diff
changeset
|
855 pop-up menu in the center of the frame. |
| 6547 | 856 @end defun |
| 857 | |
|
7684
ec7caebc4a1d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7174
diff
changeset
|
858 @node Pointer Shapes |
|
ec7caebc4a1d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7174
diff
changeset
|
859 @section Pointer Shapes |
|
ec7caebc4a1d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7174
diff
changeset
|
860 @cindex pointer shape |
|
ec7caebc4a1d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7174
diff
changeset
|
861 @cindex mouse pointer shape |
|
ec7caebc4a1d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7174
diff
changeset
|
862 |
|
ec7caebc4a1d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7174
diff
changeset
|
863 These variables specify which mouse pointer shape to use in various |
|
ec7caebc4a1d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7174
diff
changeset
|
864 situations: |
|
ec7caebc4a1d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7174
diff
changeset
|
865 |
|
ec7caebc4a1d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7174
diff
changeset
|
866 @table @code |
|
ec7caebc4a1d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7174
diff
changeset
|
867 @item x-pointer-shape |
|
ec7caebc4a1d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7174
diff
changeset
|
868 @vindex x-pointer-shape |
|
ec7caebc4a1d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7174
diff
changeset
|
869 This variable specifies the pointer shape to use ordinarily in the Emacs |
|
ec7caebc4a1d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7174
diff
changeset
|
870 frame. |
|
ec7caebc4a1d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7174
diff
changeset
|
871 |
|
ec7caebc4a1d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7174
diff
changeset
|
872 @item x-sensitive-text-pointer-shape |
|
ec7caebc4a1d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7174
diff
changeset
|
873 @vindex x-sensitive-text-pointer-shape |
|
ec7caebc4a1d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7174
diff
changeset
|
874 This variable specifies the pointer shape to use when the mouse |
|
ec7caebc4a1d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7174
diff
changeset
|
875 is over mouse-sensitive text. |
|
ec7caebc4a1d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7174
diff
changeset
|
876 @end table |
|
ec7caebc4a1d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7174
diff
changeset
|
877 |
|
ec7caebc4a1d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7174
diff
changeset
|
878 These variables affect newly created frames. They do not normally |
|
ec7caebc4a1d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7174
diff
changeset
|
879 affect existing frames; however, if you set the mouse color of a frame, |
|
ec7caebc4a1d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7174
diff
changeset
|
880 that also updates its pointer shapes based on the current values of |
|
ec7caebc4a1d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7174
diff
changeset
|
881 these variables. @xref{X Frame Parameters}. |
|
ec7caebc4a1d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7174
diff
changeset
|
882 |
|
ec7caebc4a1d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7174
diff
changeset
|
883 The values you can use, to specify either of these pointer shapes, are |
|
ec7caebc4a1d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7174
diff
changeset
|
884 defined in the file @file{lisp/x-win.el}. Use @kbd{M-x apropos |
|
ec7caebc4a1d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7174
diff
changeset
|
885 @key{RET} x-pointer @key{RET}} to see a list of them. |
|
ec7caebc4a1d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7174
diff
changeset
|
886 |
| 6547 | 887 @node X Selections |
| 888 @section X Selections | |
| 889 @cindex selection (for X windows) | |
| 890 | |
| 891 The X server records a set of @dfn{selections} which permit transfer of | |
| 892 data between application programs. The various selections are | |
| 893 distinguished by @dfn{selection types}, represented in Emacs by | |
| 894 symbols. X clients including Emacs can read or set the selection for | |
| 895 any given type. | |
| 896 | |
| 897 @defun x-set-selection type data | |
| 898 This function sets a ``selection'' in the X server. It takes two | |
| 899 arguments: a selection type @var{type}, and the value to assign to it, | |
| 900 @var{data}. If @var{data} is @code{nil}, it means to clear out the | |
| 901 selection. Otherwise, @var{data} may be a string, a symbol, an integer | |
| 902 (or a cons of two integers or list of two integers), an overlay, or a | |
| 903 cons of two markers pointing to the same buffer. An overlay or a pair | |
| 904 of markers stands for text in the overlay or between the markers. | |
| 905 | |
| 906 The data may also be a vector of valid non-vector selection values. | |
| 907 | |
| 908 Each possible @var{type} has its own selection value, which changes | |
| 909 independently. The usual values of @var{type} are @code{PRIMARY} and | |
| 910 @code{SECONDARY}; these are symbols with upper-case names, in accord | |
| 911 with X Window System conventions. The default is @code{PRIMARY}. | |
| 912 @end defun | |
| 913 | |
| 914 @defun x-get-selection type data-type | |
| 915 This function accesses selections set up by Emacs or by other X | |
| 916 clients. It takes two optional arguments, @var{type} and | |
| 917 @var{data-type}. The default for @var{type}, the selection type, is | |
| 918 @code{PRIMARY}. | |
| 919 | |
| 920 The @var{data-type} argument specifies the form of data conversion to | |
| 921 use, to convert the raw data obtained from another X client into Lisp | |
| 922 data. Meaningful values include @code{TEXT}, @code{STRING}, | |
| 923 @code{TARGETS}, @code{LENGTH}, @code{DELETE}, @code{FILE_NAME}, | |
| 924 @code{CHARACTER_POSITION}, @code{LINE_NUMBER}, @code{COLUMN_NUMBER}, | |
| 925 @code{OWNER_OS}, @code{HOST_NAME}, @code{USER}, @code{CLASS}, | |
| 926 @code{NAME}, @code{ATOM}, and @code{INTEGER}. (These are symbols with | |
| 927 upper-case names in accord with X conventions.) The default for | |
| 928 @var{data-type} is @code{STRING}. | |
| 929 @end defun | |
| 930 | |
| 931 @cindex cut buffer | |
| 932 The X server also has a set of numbered @dfn{cut buffers} which can | |
| 933 store text or other data being moved between applications. Cut buffers | |
| 934 are considered obsolete, but Emacs supports them for the sake of X | |
| 935 clients that still use them. | |
| 936 | |
| 937 @defun x-get-cut-buffer n | |
| 938 This function returns the contents of cut buffer number @var{n}. | |
| 939 @end defun | |
| 940 | |
| 941 @defun x-set-cut-buffer string | |
| 942 This function stores @var{string} into the first cut buffer (cut buffer | |
| 943 0), moving the other values down through the series of cut buffers, much | |
| 944 like the way successive kills in Emacs move down the kill ring. | |
| 945 @end defun | |
| 946 | |
| 947 @node X Connections | |
| 948 @section X Connections | |
| 949 | |
| 950 You can close the connection with the X server with the function | |
| 951 @code{x-close-current-connection}, and open a new one with | |
| 952 @code{x-open-connection} (perhaps with a different server and display). | |
| 953 | |
| 954 @defun x-close-current-connection | |
| 955 This function closes the connection to the X server. It deletes all | |
| 956 frames, making Emacs effectively inaccessible to the user; therefore, a | |
| 957 Lisp program that closes the connection should open another one. | |
| 958 @end defun | |
| 959 | |
| 960 @defun x-open-connection display &optional resource-string | |
| 961 This function opens a connection to an X server, for use of display | |
| 962 @var{display}. | |
| 963 | |
| 964 The optional argument @var{resource-string} is a string of resource | |
| 965 names and values, in the same format used in the @file{.Xresources} | |
| 966 file. The values you specify override the resource values recorded in | |
| 967 the X server itself. Here's an example of what this string might look | |
| 968 like: | |
| 969 | |
| 970 @example | |
| 971 "*BorderWidth: 3\n*InternalBorder: 2\n" | |
| 972 @end example | |
| 973 | |
| 974 @xref{Resources}. | |
| 975 @end defun | |
| 976 | |
| 977 @defun x-display-color-p | |
| 978 This returns @code{t} if the connected X display has color, and | |
| 979 @code{nil} otherwise. | |
| 980 @end defun | |
| 981 | |
| 982 @defun x-color-defined-p color | |
| 983 This function reports whether a color name is meaningful and supported | |
| 984 on the X display Emacs is using. It returns @code{t} if the display | |
| 985 supports that color; otherwise, @code{nil}. | |
| 986 | |
| 987 Black-and-white displays support just two colors, @code{"black"} or | |
| 988 @code{"white"}. Color displays support many other colors. | |
| 989 @end defun | |
| 990 | |
| 991 @defun x-synchronize flag | |
| 992 The function @code{x-synchronize} enables or disables synchronous | |
| 993 communication with the X server. It enables synchronous communication | |
| 994 if @var{flag} is non-@code{nil}, and disables it if @var{flag} is | |
| 995 @code{nil}. | |
| 996 | |
| 997 In synchronous mode, Emacs waits for a response to each X protocol | |
| 998 command before doing anything else. This is useful for debugging Emacs, | |
| 999 because protocol errors are reported right away, which helps you find | |
| 1000 the erroneous command. Synchronous mode is not the default because it | |
| 1001 is much slower. | |
| 1002 @end defun | |
| 1003 | |
| 1004 @node Resources | |
| 1005 @section X Resources | |
| 1006 | |
| 1007 @defun x-get-resource attribute &optional name class | |
| 1008 The function @code{x-get-resource} retrieves a resource value from the X | |
| 1009 Windows defaults database. | |
| 1010 | |
| 1011 Resources are indexed by a combination of a @dfn{key} and a @dfn{class}. | |
| 1012 This function searches using a key of the form | |
| 1013 @samp{@var{instance}.@var{attribute}}, using the name under which Emacs | |
| 1014 was invoked as @var{instance}, and using @samp{Emacs} as the class. | |
| 1015 | |
| 1016 The optional arguments @var{component} and @var{subclass} add to the key | |
| 1017 and the class, respectively. You must specify both of them or neither. | |
| 1018 If you specify them, the key is | |
| 1019 @samp{@var{instance}.@var{component}.@var{attribute}}, and the class is | |
| 1020 @samp{Emacs.@var{subclass}}. | |
| 1021 @end defun | |
| 1022 | |
| 1023 @xref{Resources X, X Resources,, emacs, The GNU Emacs Manual}. | |
| 1024 | |
| 1025 @node Server Data | |
| 1026 @section Data about the X Server | |
| 1027 | |
| 1028 This section describes functions and a variable that you can use to | |
| 1029 get information about the capabilities and origin of the X server that | |
| 1030 Emacs is displaying its frames on. | |
| 1031 | |
| 1032 @defun x-display-screens | |
| 1033 This function returns the number of screens associated with the current | |
| 1034 display. | |
| 1035 @end defun | |
| 1036 | |
| 1037 @defun x-server-version | |
| 1038 This function returns the list of version numbers of the X server in | |
| 1039 use. | |
| 1040 @end defun | |
| 1041 | |
| 1042 @defun x-server-vendor | |
| 1043 This function returns the vendor supporting the X server in use. | |
| 1044 @end defun | |
| 1045 | |
| 1046 @defun x-display-pixel-height | |
| 1047 This function returns the height of this X screen in pixels. | |
| 1048 @end defun | |
| 1049 | |
| 1050 @defun x-display-mm-height | |
| 1051 This function returns the height of this X screen in millimeters. | |
| 1052 @end defun | |
| 1053 | |
| 1054 @defun x-display-pixel-width | |
| 1055 This function returns the width of this X screen in pixels. | |
| 1056 @end defun | |
| 1057 | |
| 1058 @defun x-display-mm-width | |
| 1059 This function returns the width of this X screen in millimeters. | |
| 1060 @end defun | |
| 1061 | |
| 1062 @defun x-display-backing-store | |
| 1063 This function returns the backing store capability of this screen. | |
| 1064 Values can be the symbols @code{always}, @code{when-mapped}, or | |
| 1065 @code{not-useful}. | |
| 1066 @end defun | |
| 1067 | |
| 1068 @defun x-display-save-under | |
| 1069 This function returns non-@code{nil} if this X screen supports the | |
| 1070 SaveUnder feature. | |
| 1071 @end defun | |
| 1072 | |
| 1073 @defun x-display-planes | |
| 1074 This function returns the number of planes this display supports. | |
| 1075 @end defun | |
| 1076 | |
| 1077 @defun x-display-visual-class | |
| 1078 This function returns the visual class for this X screen. The value is | |
| 1079 one of the symbols @code{static-gray}, @code{gray-scale}, | |
| 1080 @code{static-color}, @code{pseudo-color}, @code{true-color}, and | |
| 1081 @code{direct-color}. | |
| 1082 @end defun | |
| 1083 | |
| 1084 @defun x-display-color-p | |
| 1085 This function returns @code{t} if the X screen in use is a color | |
| 1086 screen. | |
| 1087 @end defun | |
| 1088 | |
| 1089 @defun x-display-color-cells | |
| 1090 This function returns the number of color cells this X screen supports. | |
| 1091 @end defun | |
| 1092 | |
| 1093 @ignore | |
| 1094 @defvar x-no-window-manager | |
| 1095 This variable's value is is @code{t} if no X window manager is in use. | |
| 1096 @end defvar | |
| 1097 @end ignore | |
| 1098 | |
| 1099 @ignore | |
| 1100 @item | |
| 1101 The functions @code{x-pixel-width} and @code{x-pixel-height} return the | |
| 1102 width and height of an X Window frame, measured in pixels. | |
| 1103 @end ignore |
