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