777
|
1
|
765
|
2 /* Generic frame functions.
|
708
|
3 Copyright (C) 1989, 1992 Free Software Foundation.
|
286
|
4
|
|
5 This file is part of GNU Emacs.
|
|
6
|
|
7 GNU Emacs is free software; you can redistribute it and/or modify
|
|
8 it under the terms of the GNU General Public License as published by
|
708
|
9 the Free Software Foundation; either version 2, or (at your option)
|
286
|
10 any later version.
|
|
11
|
|
12 GNU Emacs is distributed in the hope that it will be useful,
|
|
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15 GNU General Public License for more details.
|
|
16
|
|
17 You should have received a copy of the GNU General Public License
|
|
18 along with GNU Emacs; see the file COPYING. If not, write to
|
|
19 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|
20
|
363
|
21 #include <stdio.h>
|
|
22
|
286
|
23 #include "config.h"
|
732
|
24
|
765
|
25 #ifdef MULTI_FRAME
|
732
|
26
|
286
|
27 #include "lisp.h"
|
765
|
28 #include "frame.h"
|
286
|
29 #include "window.h"
|
363
|
30 #include "termhooks.h"
|
286
|
31
|
|
32 Lisp_Object Vemacs_iconified;
|
765
|
33 Lisp_Object Qframep;
|
|
34 Lisp_Object Qlive_frame_p;
|
|
35 Lisp_Object Vframe_list;
|
|
36 Lisp_Object Vterminal_frame;
|
|
37 Lisp_Object Vdefault_minibuffer_frame;
|
|
38 Lisp_Object Vdefault_frame_alist;
|
539
|
39 Lisp_Object Qminibuffer;
|
286
|
40
|
|
41 extern Lisp_Object Vminibuffer_list;
|
|
42 extern Lisp_Object get_minibuffer ();
|
|
43
|
765
|
44 DEFUN ("framep", Fframep, Sframep, 1, 1, 0,
|
|
45 "Return non-nil if OBJECT is a frame.\n\
|
|
46 Value is t for a termcap frame (a character-only terminal),\n\
|
|
47 `x' for an Emacs frame that is really an X window.\n\
|
|
48 Also see `live-frame-p'.")
|
454
|
49 (object)
|
|
50 Lisp_Object object;
|
286
|
51 {
|
765
|
52 if (XTYPE (object) != Lisp_Frame)
|
286
|
53 return Qnil;
|
765
|
54 switch (XFRAME (object)->output_method)
|
286
|
55 {
|
|
56 case output_termcap:
|
|
57 return Qt;
|
|
58 case output_x_window:
|
|
59 return intern ("x");
|
|
60 default:
|
|
61 abort ();
|
|
62 }
|
|
63 }
|
|
64
|
765
|
65 DEFUN ("live-frame-p", Flive_frame_p, Slive_frame_p, 1, 1, 0,
|
|
66 "Return non-nil if OBJECT is a frame which has not been deleted.\n\
|
|
67 Value is nil if OBJECT is not a live frame. If object is a live\n\
|
|
68 frame, the return value indicates what sort of output device it is\n\
|
|
69 displayed on. Value is t for a termcap frame (a character-only\n\
|
|
70 terminal), `x' for an Emacs frame being displayed in an X window.")
|
454
|
71 (object)
|
|
72 Lisp_Object object;
|
|
73 {
|
765
|
74 return ((FRAMEP (object)
|
|
75 && FRAME_LIVE_P (XFRAME (object)))
|
|
76 ? Fframep (object)
|
454
|
77 : Qnil);
|
|
78 }
|
|
79
|
765
|
80 struct frame *
|
|
81 make_frame (mini_p)
|
286
|
82 int mini_p;
|
|
83 {
|
765
|
84 Lisp_Object frame;
|
|
85 register struct frame *f;
|
286
|
86 register Lisp_Object root_window;
|
|
87 register Lisp_Object mini_window;
|
|
88
|
765
|
89 frame = Fmake_vector (((sizeof (struct frame) - (sizeof (Lisp_Vector)
|
363
|
90 - sizeof (Lisp_Object)))
|
|
91 / sizeof (Lisp_Object)),
|
286
|
92 make_number (0));
|
765
|
93 XSETTYPE (frame, Lisp_Frame);
|
|
94 f = XFRAME (frame);
|
286
|
95
|
765
|
96 f->cursor_x = 0;
|
|
97 f->cursor_y = 0;
|
|
98 f->current_glyphs = 0;
|
|
99 f->desired_glyphs = 0;
|
|
100 f->visible = 0;
|
|
101 f->display.nothing = 0;
|
|
102 f->iconified = 0;
|
|
103 f->wants_modeline = 1;
|
|
104 f->auto_raise = 0;
|
|
105 f->auto_lower = 0;
|
|
106 f->no_split = 0;
|
|
107 f->garbaged = 0;
|
|
108 f->has_minibuffer = mini_p;
|
|
109 f->focus_frame = frame;
|
286
|
110
|
765
|
111 f->param_alist = Qnil;
|
286
|
112
|
|
113 root_window = make_window (0);
|
|
114 if (mini_p)
|
|
115 {
|
|
116 mini_window = make_window (0);
|
|
117 XWINDOW (root_window)->next = mini_window;
|
|
118 XWINDOW (mini_window)->prev = root_window;
|
|
119 XWINDOW (mini_window)->mini_p = Qt;
|
765
|
120 XWINDOW (mini_window)->frame = frame;
|
|
121 f->minibuffer_window = mini_window;
|
286
|
122 }
|
|
123 else
|
|
124 {
|
|
125 mini_window = Qnil;
|
|
126 XWINDOW (root_window)->next = Qnil;
|
765
|
127 f->minibuffer_window = Qnil;
|
286
|
128 }
|
|
129
|
765
|
130 XWINDOW (root_window)->frame = frame;
|
286
|
131
|
|
132 /* 10 is arbitrary,
|
|
133 just so that there is "something there."
|
765
|
134 Correct size will be set up later with change_frame_size. */
|
286
|
135
|
765
|
136 f->width = 10;
|
|
137 f->height = 10;
|
286
|
138
|
|
139 XFASTINT (XWINDOW (root_window)->width) = 10;
|
|
140 XFASTINT (XWINDOW (root_window)->height) = (mini_p ? 9 : 10);
|
|
141
|
|
142 if (mini_p)
|
|
143 {
|
|
144 XFASTINT (XWINDOW (mini_window)->width) = 10;
|
|
145 XFASTINT (XWINDOW (mini_window)->top) = 9;
|
|
146 XFASTINT (XWINDOW (mini_window)->height) = 1;
|
|
147 }
|
|
148
|
765
|
149 /* Choose a buffer for the frame's root window. */
|
386
|
150 {
|
|
151 Lisp_Object buf;
|
|
152
|
|
153 XWINDOW (root_window)->buffer = Qt;
|
|
154 buf = Fcurrent_buffer ();
|
|
155 /* If buf is a 'hidden' buffer (i.e. one whose name starts with
|
|
156 a space), try to find another one. */
|
|
157 if (XSTRING (Fbuffer_name (buf))->data[0] == ' ')
|
|
158 buf = Fother_buffer (buf);
|
|
159 Fset_window_buffer (root_window, buf);
|
|
160 }
|
|
161
|
286
|
162 if (mini_p)
|
|
163 {
|
|
164 XWINDOW (mini_window)->buffer = Qt;
|
|
165 Fset_window_buffer (mini_window,
|
485
|
166 (NILP (Vminibuffer_list)
|
286
|
167 ? get_minibuffer (0)
|
|
168 : Fcar (Vminibuffer_list)));
|
|
169 }
|
|
170
|
765
|
171 f->root_window = root_window;
|
|
172 f->selected_window = root_window;
|
363
|
173 /* Make sure this window seems more recently used than
|
|
174 a newly-created, never-selected window. */
|
765
|
175 XFASTINT (XWINDOW (f->selected_window)->use_time) = ++window_select_count;
|
286
|
176
|
765
|
177 Vframe_list = Fcons (frame, Vframe_list);
|
286
|
178
|
765
|
179 return f;
|
286
|
180 }
|
|
181
|
765
|
182 /* Make a frame using a separate minibuffer window on another frame.
|
286
|
183 MINI_WINDOW is the minibuffer window to use. nil means use the
|
|
184 default (the global minibuffer). */
|
|
185
|
765
|
186 struct frame *
|
|
187 make_frame_without_minibuffer (mini_window)
|
286
|
188 register Lisp_Object mini_window;
|
|
189 {
|
765
|
190 register struct frame *f;
|
286
|
191
|
|
192 /* Choose the minibuffer window to use. */
|
485
|
193 if (NILP (mini_window))
|
286
|
194 {
|
765
|
195 if (XTYPE (Vdefault_minibuffer_frame) != Lisp_Frame)
|
|
196 error ("default-minibuffer-frame must be set when creating minibufferless frames");
|
|
197 if (! FRAME_LIVE_P (XFRAME (Vdefault_minibuffer_frame)))
|
|
198 error ("default-minibuffer-frame must be a live frame");
|
|
199 mini_window = XFRAME (Vdefault_minibuffer_frame)->minibuffer_window;
|
286
|
200 }
|
|
201 else
|
|
202 {
|
|
203 CHECK_WINDOW (mini_window, 0);
|
|
204 }
|
|
205
|
765
|
206 /* Make a frame containing just a root window. */
|
|
207 f = make_frame (0);
|
286
|
208
|
|
209 /* Install the chosen minibuffer window, with proper buffer. */
|
765
|
210 f->minibuffer_window = mini_window;
|
286
|
211 Fset_window_buffer (mini_window,
|
485
|
212 (NILP (Vminibuffer_list)
|
286
|
213 ? get_minibuffer (0)
|
|
214 : Fcar (Vminibuffer_list)));
|
765
|
215 return f;
|
286
|
216 }
|
|
217
|
765
|
218 /* Make a frame containing only a minibuffer window. */
|
286
|
219
|
765
|
220 struct frame *
|
|
221 make_minibuffer_frame ()
|
286
|
222 {
|
765
|
223 /* First make a frame containing just a root window, no minibuffer. */
|
286
|
224
|
765
|
225 register struct frame *f = make_frame (0);
|
286
|
226 register Lisp_Object mini_window;
|
765
|
227 register Lisp_Object frame;
|
286
|
228
|
765
|
229 XSET (frame, Lisp_Frame, f);
|
286
|
230
|
|
231 /* ??? Perhaps leave it to the user program to set auto_raise. */
|
765
|
232 f->auto_raise = 1;
|
|
233 f->auto_lower = 0;
|
|
234 f->no_split = 1;
|
|
235 f->wants_modeline = 0;
|
|
236 f->has_minibuffer = 1;
|
286
|
237
|
|
238 /* Now label the root window as also being the minibuffer.
|
|
239 Avoid infinite looping on the window chain by marking next pointer
|
|
240 as nil. */
|
|
241
|
765
|
242 mini_window = f->minibuffer_window = f->root_window;
|
286
|
243 XWINDOW (mini_window)->mini_p = Qt;
|
|
244 XWINDOW (mini_window)->next = Qnil;
|
|
245 XWINDOW (mini_window)->prev = mini_window;
|
765
|
246 XWINDOW (mini_window)->frame = frame;
|
286
|
247
|
|
248 /* Put the proper buffer in that window. */
|
|
249
|
|
250 Fset_window_buffer (mini_window,
|
485
|
251 (NILP (Vminibuffer_list)
|
286
|
252 ? get_minibuffer (0)
|
|
253 : Fcar (Vminibuffer_list)));
|
765
|
254 return f;
|
286
|
255 }
|
|
256
|
765
|
257 /* Construct a frame that refers to the terminal (stdin and stdout). */
|
286
|
258
|
765
|
259 struct frame *
|
|
260 make_terminal_frame ()
|
286
|
261 {
|
765
|
262 register struct frame *f;
|
286
|
263
|
765
|
264 Vframe_list = Qnil;
|
|
265 f = make_frame (1);
|
|
266 f->name = build_string ("terminal");
|
|
267 f->visible = 1;
|
|
268 f->display.nothing = 1; /* Nonzero means frame isn't deleted. */
|
|
269 XSET (Vterminal_frame, Lisp_Frame, f);
|
|
270 return f;
|
286
|
271 }
|
|
272
|
765
|
273 DEFUN ("select-frame", Fselect_frame, Sselect_frame, 1, 2, 0,
|
|
274 "Select the frame FRAME. FRAMES's selected window becomes \"the\"\n\
|
363
|
275 selected window. If the optional parameter NO-ENTER is non-nil, don't\n\
|
765
|
276 focus on that frame.")
|
|
277 (frame, no_enter)
|
|
278 Lisp_Object frame, no_enter;
|
286
|
279 {
|
765
|
280 CHECK_LIVE_FRAME (frame, 0);
|
286
|
281
|
765
|
282 if (selected_frame == XFRAME (frame))
|
|
283 return frame;
|
286
|
284
|
765
|
285 selected_frame = XFRAME (frame);
|
|
286 if (! FRAME_MINIBUF_ONLY_P (selected_frame))
|
|
287 last_nonminibuf_frame = selected_frame;
|
363
|
288
|
765
|
289 Fselect_window (XFRAME (frame)->selected_window);
|
286
|
290
|
|
291 #ifdef HAVE_X_WINDOWS
|
765
|
292 #ifdef MULTI_FRAME
|
|
293 if (FRAME_IS_X (XFRAME (frame))
|
485
|
294 && NILP (no_enter))
|
286
|
295 {
|
765
|
296 Ffocus_frame (frame);
|
286
|
297 }
|
|
298 #endif
|
|
299 #endif
|
765
|
300 choose_minibuf_frame ();
|
286
|
301
|
765
|
302 return frame;
|
286
|
303 }
|
|
304
|
765
|
305 DEFUN ("selected-frame", Fselected_frame, Sselected_frame, 0, 0, 0,
|
|
306 "Return the frame that is now selected.")
|
286
|
307 ()
|
|
308 {
|
|
309 Lisp_Object tem;
|
765
|
310 XSET (tem, Lisp_Frame, selected_frame);
|
286
|
311 return tem;
|
|
312 }
|
|
313
|
765
|
314 DEFUN ("window-frame", Fwindow_frame, Swindow_frame, 1, 1, 0,
|
|
315 "Return the frame object that window WINDOW is on.")
|
286
|
316 (window)
|
|
317 Lisp_Object window;
|
|
318 {
|
|
319 CHECK_WINDOW (window, 0);
|
765
|
320 return XWINDOW (window)->frame;
|
286
|
321 }
|
|
322
|
765
|
323 DEFUN ("frame-root-window", Fframe_root_window, Sframe_root_window, 0, 1, 0,
|
|
324 "Returns the root-window of FRAME.")
|
|
325 (frame)
|
|
326 Lisp_Object frame;
|
286
|
327 {
|
765
|
328 if (NILP (frame))
|
|
329 XSET (frame, Lisp_Frame, selected_frame);
|
454
|
330 else
|
765
|
331 CHECK_LIVE_FRAME (frame, 0);
|
286
|
332
|
765
|
333 return XFRAME (frame)->root_window;
|
286
|
334 }
|
|
335
|
765
|
336 DEFUN ("frame-selected-window", Fframe_selected_window,
|
|
337 Sframe_selected_window, 0, 1, 0,
|
|
338 "Return the selected window of frame object FRAME.")
|
|
339 (frame)
|
|
340 Lisp_Object frame;
|
286
|
341 {
|
765
|
342 if (NILP (frame))
|
|
343 XSET (frame, Lisp_Frame, selected_frame);
|
454
|
344 else
|
765
|
345 CHECK_LIVE_FRAME (frame, 0);
|
286
|
346
|
765
|
347 return XFRAME (frame)->selected_window;
|
286
|
348 }
|
|
349
|
765
|
350 DEFUN ("frame-list", Fframe_list, Sframe_list,
|
286
|
351 0, 0, 0,
|
765
|
352 "Return a list of all frames.")
|
286
|
353 ()
|
|
354 {
|
765
|
355 return Fcopy_sequence (Vframe_list);
|
286
|
356 }
|
|
357
|
765
|
358 #ifdef MULTI_FRAME
|
454
|
359
|
765
|
360 /* Return the next frame in the frame list after FRAME.
|
|
361 If MINIBUF is non-nil, include all frames.
|
|
362 If MINIBUF is nil, exclude minibuffer-only frames.
|
|
363 If MINIBUF is a window, include only frames using that window for
|
454
|
364 their minibuffer. */
|
286
|
365 Lisp_Object
|
765
|
366 next_frame (frame, minibuf)
|
|
367 Lisp_Object frame;
|
454
|
368 Lisp_Object minibuf;
|
286
|
369 {
|
|
370 Lisp_Object tail;
|
|
371 int passed = 0;
|
|
372
|
765
|
373 /* There must always be at least one frame in Vframe_list. */
|
|
374 if (! CONSP (Vframe_list))
|
454
|
375 abort ();
|
|
376
|
286
|
377 while (1)
|
765
|
378 for (tail = Vframe_list; CONSP (tail); tail = XCONS (tail)->cdr)
|
286
|
379 {
|
|
380 if (passed)
|
363
|
381 {
|
765
|
382 Lisp_Object f = XCONS (tail)->car;
|
335
|
383
|
765
|
384 /* Decide whether this frame is eligible to be returned,
|
454
|
385 according to minibuf. */
|
765
|
386 if ((NILP (minibuf) && ! FRAME_MINIBUF_ONLY_P (XFRAME (f)))
|
454
|
387 || XTYPE (minibuf) != Lisp_Window
|
765
|
388 || EQ (FRAME_MINIBUF_WINDOW (XFRAME (f)), minibuf)
|
|
389 || EQ (f, frame))
|
|
390 return f;
|
363
|
391 }
|
286
|
392
|
765
|
393 if (EQ (frame, XCONS (tail)->car))
|
286
|
394 passed++;
|
|
395 }
|
|
396 }
|
|
397
|
765
|
398 /* Return the previous frame in the frame list before FRAME.
|
|
399 If MINIBUF is non-nil, include all frames.
|
|
400 If MINIBUF is nil, exclude minibuffer-only frames.
|
|
401 If MINIBUF is a window, include only frames using that window for
|
454
|
402 their minibuffer. */
|
286
|
403 Lisp_Object
|
765
|
404 prev_frame (frame, minibuf)
|
|
405 Lisp_Object frame;
|
454
|
406 Lisp_Object minibuf;
|
286
|
407 {
|
|
408 Lisp_Object tail;
|
|
409 Lisp_Object prev;
|
|
410
|
765
|
411 /* There must always be at least one frame in Vframe_list. */
|
|
412 if (! CONSP (Vframe_list))
|
454
|
413 abort ();
|
|
414
|
286
|
415 prev = Qnil;
|
|
416 while (1)
|
454
|
417 {
|
765
|
418 for (tail = Vframe_list; CONSP (tail); tail = XCONS (tail)->cdr)
|
454
|
419 {
|
|
420 Lisp_Object scr = XCONS (tail)->car;
|
|
421
|
765
|
422 if (XTYPE (scr) != Lisp_Frame)
|
454
|
423 abort ();
|
|
424
|
765
|
425 if (EQ (frame, scr) && !NILP (prev))
|
454
|
426 return prev;
|
|
427
|
765
|
428 /* Decide whether this frame is eligible to be returned,
|
454
|
429 according to minibuf. */
|
765
|
430 if ((NILP (minibuf) && ! FRAME_MINIBUF_ONLY_P (XFRAME (scr)))
|
454
|
431 || XTYPE (minibuf) != Lisp_Window
|
765
|
432 || EQ (FRAME_MINIBUF_WINDOW (XFRAME (scr)), minibuf))
|
454
|
433 prev = scr;
|
|
434 }
|
|
435
|
485
|
436 if (NILP (prev))
|
765
|
437 /* We went through the whole frame list without finding a single
|
|
438 acceptable frame. Return the original frame. */
|
|
439 prev = frame;
|
454
|
440 }
|
|
441
|
286
|
442 }
|
|
443
|
765
|
444 DEFUN ("next-frame", Fnext_frame, Snext_frame, 0, 2, 0,
|
|
445 "Return the next frame in the frame list after FRAME.\n\
|
|
446 If optional argument MINIBUF is non-nil, include all frames. If\n\
|
|
447 MINIBUF is nil or omitted, exclude minibuffer-only frames. If\n\
|
|
448 MINIBUF is a window, include only frames using that window for their\n\
|
454
|
449 minibuffer.")
|
765
|
450 (frame, miniframe)
|
|
451 Lisp_Object frame, miniframe;
|
286
|
452 {
|
|
453 Lisp_Object tail;
|
|
454
|
765
|
455 if (NILP (frame))
|
|
456 XSET (frame, Lisp_Frame, selected_frame);
|
454
|
457 else
|
765
|
458 CHECK_LIVE_FRAME (frame, 0);
|
286
|
459
|
765
|
460 return next_frame (frame, miniframe);
|
286
|
461 }
|
765
|
462 #endif /* MULTI_FRAME */
|
286
|
463
|
765
|
464 DEFUN ("delete-frame", Fdelete_frame, Sdelete_frame, 0, 1, "",
|
|
465 "Delete FRAME, permanently eliminating it from use.\n\
|
|
466 If omitted, FRAME defaults to the selected frame.\n\
|
|
467 A frame may not be deleted if its minibuffer is used by other frames.")
|
|
468 (frame)
|
|
469 Lisp_Object frame;
|
286
|
470 {
|
765
|
471 struct frame *f;
|
286
|
472 union display displ;
|
|
473
|
765
|
474 if (EQ (frame, Qnil))
|
286
|
475 {
|
765
|
476 f = selected_frame;
|
|
477 XSET (frame, Lisp_Frame, f);
|
286
|
478 }
|
|
479 else
|
|
480 {
|
765
|
481 CHECK_FRAME (frame, 0);
|
|
482 f = XFRAME (frame);
|
286
|
483 }
|
|
484
|
765
|
485 if (! FRAME_LIVE_P (f))
|
454
|
486 return;
|
|
487
|
765
|
488 /* Are there any other frames besides this one? */
|
|
489 if (f == selected_frame && EQ (next_frame (frame, Qt), frame))
|
|
490 error ("Attempt to delete the only frame");
|
286
|
491
|
765
|
492 /* Does this frame have a minibuffer, and is it the surrogate
|
|
493 minibuffer for any other frame? */
|
|
494 if (FRAME_HAS_MINIBUF (XFRAME (frame)))
|
363
|
495 {
|
765
|
496 Lisp_Object frames;
|
708
|
497
|
765
|
498 for (frames = Vframe_list;
|
|
499 CONSP (frames);
|
|
500 frames = XCONS (frames)->cdr)
|
708
|
501 {
|
765
|
502 Lisp_Object this = XCONS (frames)->car;
|
363
|
503
|
765
|
504 if (! EQ (this, frame)
|
|
505 && EQ (frame,
|
|
506 (WINDOW_FRAME
|
708
|
507 (XWINDOW
|
765
|
508 (FRAME_MINIBUF_WINDOW
|
|
509 (XFRAME (this)))))))
|
|
510 error ("Attempt to delete a surrogate minibuffer frame");
|
708
|
511 }
|
286
|
512 }
|
|
513
|
765
|
514 /* Don't let the frame remain selected. */
|
|
515 if (f == selected_frame)
|
|
516 Fselect_frame (next_frame (frame, Qt));
|
286
|
517
|
765
|
518 /* Don't allow minibuf_window to remain on a deleted frame. */
|
|
519 if (EQ (f->minibuffer_window, minibuf_window))
|
286
|
520 {
|
765
|
521 Fset_window_buffer (selected_frame->minibuffer_window,
|
286
|
522 XWINDOW (minibuf_window)->buffer);
|
765
|
523 minibuf_window = selected_frame->minibuffer_window;
|
286
|
524 }
|
|
525
|
765
|
526 Vframe_list = Fdelq (frame, Vframe_list);
|
|
527 f->visible = 0;
|
|
528 displ = f->display;
|
|
529 f->display.nothing = 0;
|
286
|
530
|
363
|
531 #ifdef HAVE_X_WINDOWS
|
765
|
532 if (FRAME_IS_X (f))
|
|
533 x_destroy_window (f, displ);
|
363
|
534 #endif
|
|
535
|
765
|
536 /* If we've deleted the last_nonminibuf_frame, then try to find
|
363
|
537 another one. */
|
765
|
538 if (f == last_nonminibuf_frame)
|
363
|
539 {
|
765
|
540 Lisp_Object frames;
|
708
|
541
|
765
|
542 last_nonminibuf_frame = 0;
|
363
|
543
|
765
|
544 for (frames = Vframe_list;
|
|
545 CONSP (frames);
|
|
546 frames = XCONS (frames)->cdr)
|
363
|
547 {
|
765
|
548 f = XFRAME (XCONS (frames)->car);
|
|
549 if (!FRAME_MINIBUF_ONLY_P (f))
|
363
|
550 {
|
765
|
551 last_nonminibuf_frame = f;
|
363
|
552 break;
|
|
553 }
|
|
554 }
|
|
555 }
|
286
|
556
|
765
|
557 /* If we've deleted Vdefault_minibuffer_frame, try to find another
|
|
558 one. Prefer minibuffer-only frames, but also notice frames
|
708
|
559 with other windows. */
|
765
|
560 if (EQ (frame, Vdefault_minibuffer_frame))
|
708
|
561 {
|
765
|
562 Lisp_Object frames;
|
708
|
563
|
765
|
564 /* The last frame we saw with a minibuffer, minibuffer-only or not. */
|
|
565 Lisp_Object frame_with_minibuf = Qnil;
|
708
|
566
|
765
|
567 for (frames = Vframe_list;
|
|
568 CONSP (frames);
|
|
569 frames = XCONS (frames)->cdr)
|
708
|
570 {
|
765
|
571 Lisp_Object this = XCONS (frames)->car;
|
708
|
572
|
765
|
573 if (XTYPE (this) != Lisp_Frame)
|
708
|
574 abort ();
|
765
|
575 f = XFRAME (this);
|
708
|
576
|
765
|
577 if (FRAME_HAS_MINIBUF (f))
|
708
|
578 {
|
765
|
579 frame_with_minibuf = this;
|
|
580 if (FRAME_MINIBUF_ONLY_P (f))
|
708
|
581 break;
|
|
582 }
|
|
583 }
|
|
584
|
765
|
585 /* We know that there must be some frame with a minibuffer out
|
|
586 there. If this were not true, all of the frames present
|
708
|
587 would have to be minibufferless, which implies that at some
|
765
|
588 point their minibuffer frames must have been deleted, but
|
708
|
589 that is prohibited at the top; you can't delete surrogate
|
765
|
590 minibuffer frames. */
|
|
591 if (NILP (frame_with_minibuf))
|
708
|
592 abort ();
|
|
593
|
765
|
594 Vdefault_minibuffer_frame = frame_with_minibuf;
|
708
|
595 }
|
|
596
|
286
|
597 return Qnil;
|
|
598 }
|
|
599
|
|
600 /* Return mouse position in character cell units. */
|
|
601
|
454
|
602 DEFUN ("mouse-position", Fmouse_position, Smouse_position, 0, 0, 0,
|
765
|
603 "Return a list (FRAME X . Y) giving the current mouse frame and position.\n\
|
454
|
604 If Emacs is running on a mouseless terminal or hasn't been programmed\n\
|
765
|
605 to read the mouse position, it returns the selected frame for FRAME\n\
|
454
|
606 and nil for X and Y.")
|
|
607 ()
|
286
|
608 {
|
454
|
609 Lisp_Object x, y, dummy;
|
765
|
610 FRAME_PTR f;
|
286
|
611
|
454
|
612 if (mouse_position_hook)
|
765
|
613 (*mouse_position_hook) (&f, &x, &y, &dummy);
|
454
|
614 else
|
|
615 {
|
765
|
616 f = selected_frame;
|
454
|
617 x = y = Qnil;
|
|
618 }
|
286
|
619
|
765
|
620 XSET (dummy, Lisp_Frame, f);
|
454
|
621 return Fcons (dummy, Fcons (make_number (x), make_number (y)));
|
286
|
622 }
|
|
623
|
|
624 DEFUN ("set-mouse-position", Fset_mouse_position, Sset_mouse_position, 3, 3, 0,
|
765
|
625 "Move the mouse pointer to the center of cell (X,Y) in FRAME.\n\
|
|
626 WARNING: If you use this under X, you should do `unfocus-frame' afterwards.")
|
|
627 (frame, x, y)
|
|
628 Lisp_Object frame, x, y;
|
286
|
629 {
|
765
|
630 CHECK_LIVE_FRAME (frame, 0);
|
286
|
631 CHECK_NUMBER (x, 2);
|
|
632 CHECK_NUMBER (y, 1);
|
|
633
|
|
634 #ifdef HAVE_X_WINDOWS
|
765
|
635 if (FRAME_IS_X (XFRAME (frame)))
|
286
|
636 /* Warping the mouse will cause enternotify and focus events. */
|
765
|
637 x_set_mouse_position (XFRAME (frame), x, y);
|
286
|
638 #endif
|
|
639
|
|
640 return Qnil;
|
|
641 }
|
|
642
|
|
643 #if 0
|
|
644 /* ??? Can this be replaced with a Lisp function?
|
756
|
645 It is used in minibuf.c. Can we get rid of that?
|
|
646 Yes. All uses in minibuf.c are gone, and parallels to these
|
765
|
647 functions have been defined in frame.el. */
|
286
|
648
|
765
|
649 DEFUN ("frame-configuration", Fframe_configuration, Sframe_configuration,
|
286
|
650 0, 0, 0,
|
765
|
651 "Return object describing current frame configuration.\n\
|
|
652 The frame configuration is the current mouse position and selected frame.\n\
|
|
653 This object can be given to `restore-frame-configuration'\n\
|
|
654 to restore this frame configuration.")
|
286
|
655 ()
|
|
656 {
|
454
|
657 Lisp_Object c, time;
|
286
|
658
|
454
|
659 c = Fmake_vector (make_number(4), Qnil);
|
765
|
660 XVECTOR (c)->contents[0] = Fselected_frame();
|
454
|
661 if (mouse_position_hook)
|
|
662 (*mouse_position_hook) (&XVECTOR (c)->contents[1]
|
|
663 &XVECTOR (c)->contents[2],
|
|
664 &XVECTOR (c)->contents[3],
|
|
665 &time);
|
286
|
666 return c;
|
|
667 }
|
|
668
|
765
|
669 DEFUN ("restore-frame-configuration", Frestore_frame_configuration,
|
|
670 Srestore_frame_configuration,
|
286
|
671 1, 1, 0,
|
765
|
672 "Restores frame configuration CONFIGURATION.")
|
286
|
673 (config)
|
|
674 Lisp_Object config;
|
|
675 {
|
765
|
676 Lisp_Object x_pos, y_pos, frame;
|
286
|
677
|
|
678 CHECK_VECTOR (config, 0);
|
|
679 if (XVECTOR (config)->size != 3)
|
|
680 {
|
765
|
681 error ("Wrong size vector passed to restore-frame-configuration");
|
286
|
682 }
|
765
|
683 frame = XVECTOR (config)->contents[0];
|
|
684 CHECK_LIVE_FRAME (frame, 0);
|
286
|
685
|
765
|
686 Fselect_frame (frame, Qnil);
|
286
|
687
|
|
688 #if 0
|
765
|
689 /* This seems to interfere with the frame selection mechanism. jla */
|
454
|
690 x_pos = XVECTOR (config)->contents[2];
|
|
691 y_pos = XVECTOR (config)->contents[3];
|
765
|
692 set_mouse_position (frame, XINT (x_pos), XINT (y_pos));
|
286
|
693 #endif
|
|
694
|
765
|
695 return frame;
|
286
|
696 }
|
|
697 #endif
|
|
698
|
765
|
699 DEFUN ("make-frame-visible", Fmake_frame_visible, Smake_frame_visible,
|
286
|
700 1, 1, 0,
|
765
|
701 "Make the frame FRAME visible (assuming it is an X-window).\n\
|
|
702 Also raises the frame so that nothing obscures it.")
|
|
703 (frame)
|
|
704 Lisp_Object frame;
|
286
|
705 {
|
765
|
706 CHECK_LIVE_FRAME (frame, 0);
|
286
|
707
|
765
|
708 if (FRAME_IS_X (XFRAME (frame)))
|
|
709 x_make_frame_visible (XFRAME (frame));
|
286
|
710
|
765
|
711 return frame;
|
286
|
712 }
|
|
713
|
765
|
714 DEFUN ("make-frame-invisible", Fmake_frame_invisible, Smake_frame_invisible,
|
286
|
715 1, 1, 0,
|
765
|
716 "Make the frame FRAME invisible (assuming it is an X-window).")
|
|
717 (frame)
|
|
718 Lisp_Object frame;
|
286
|
719 {
|
765
|
720 CHECK_LIVE_FRAME (frame, 0);
|
286
|
721
|
765
|
722 if (FRAME_IS_X (XFRAME (frame)))
|
|
723 x_make_frame_invisible (XFRAME (frame));
|
286
|
724
|
|
725 return Qnil;
|
|
726 }
|
|
727
|
765
|
728 DEFUN ("iconify-frame", Ficonify_frame, Siconify_frame,
|
286
|
729 1, 1, 0,
|
765
|
730 "Make the frame FRAME into an icon.")
|
|
731 (frame)
|
|
732 Lisp_Object frame;
|
286
|
733 {
|
765
|
734 CHECK_LIVE_FRAME (frame, 0);
|
286
|
735
|
765
|
736 if (FRAME_IS_X (XFRAME (frame)))
|
|
737 x_iconify_frame (XFRAME (frame));
|
286
|
738
|
|
739 return Qnil;
|
|
740 }
|
|
741
|
765
|
742 DEFUN ("frame-visible-p", Fframe_visible_p, Sframe_visible_p,
|
286
|
743 1, 1, 0,
|
765
|
744 "Return t if FRAME is now \"visible\" (actually in use for display).\n\
|
|
745 A frame that is not \"visible\" is not updated and, if it works through\n\
|
286
|
746 a window system, it may not show at all.\n\
|
|
747 Return the symbol `icon' if window is visible only as an icon.")
|
765
|
748 (frame)
|
|
749 Lisp_Object frame;
|
286
|
750 {
|
765
|
751 CHECK_LIVE_FRAME (frame, 0);
|
286
|
752
|
765
|
753 if (XFRAME (frame)->visible)
|
286
|
754 return Qt;
|
765
|
755 if (XFRAME (frame)->iconified)
|
286
|
756 return intern ("icon");
|
|
757 return Qnil;
|
|
758 }
|
|
759
|
765
|
760 DEFUN ("visible-frame-list", Fvisible_frame_list, Svisible_frame_list,
|
286
|
761 0, 0, 0,
|
765
|
762 "Return a list of all frames now \"visible\" (being updated).")
|
286
|
763 ()
|
|
764 {
|
765
|
765 Lisp_Object tail, frame;
|
|
766 struct frame *f;
|
286
|
767 Lisp_Object value;
|
|
768
|
|
769 value = Qnil;
|
765
|
770 for (tail = Vframe_list; CONSP (tail); tail = XCONS (tail)->cdr)
|
286
|
771 {
|
765
|
772 frame = XCONS (tail)->car;
|
|
773 if (XTYPE (frame) != Lisp_Frame)
|
286
|
774 continue;
|
765
|
775 f = XFRAME (frame);
|
|
776 if (f->visible)
|
|
777 value = Fcons (frame, value);
|
286
|
778 }
|
|
779 return value;
|
|
780 }
|
363
|
781
|
|
782
|
|
783
|
765
|
784 DEFUN ("redirect-frame-focus", Fredirect_frame_focus, Sredirect_frame_focus,
|
363
|
785 1, 2, 0,
|
765
|
786 "Arrange for keystrokes typed at FRAME to be sent to FOCUS-FRAME.\n\
|
|
787 This means that, after reading a keystroke typed at FRAME,\n\
|
|
788 `last-event-frame' will be FOCUS-FRAME.\n\
|
363
|
789 \n\
|
765
|
790 If FOCUS-FRAME is omitted or eq to FRAME, any existing redirection is\n\
|
|
791 cancelled, and the frame again receives its own keystrokes.\n\
|
363
|
792 \n\
|
765
|
793 The redirection lasts until the next call to `redirect-frame-focus'\n\
|
|
794 or `select-frame'.\n\
|
363
|
795 \n\
|
|
796 This is useful for temporarily redirecting keystrokes to the minibuffer\n\
|
765
|
797 window when a frame doesn't have its own minibuffer.")
|
|
798 (frame, focus_frame)
|
|
799 Lisp_Object frame, focus_frame;
|
363
|
800 {
|
765
|
801 CHECK_LIVE_FRAME (frame, 0);
|
454
|
802
|
765
|
803 if (NILP (focus_frame))
|
|
804 focus_frame = frame;
|
363
|
805 else
|
765
|
806 CHECK_LIVE_FRAME (focus_frame, 1);
|
363
|
807
|
765
|
808 XFRAME (frame)->focus_frame = focus_frame;
|
363
|
809
|
765
|
810 if (frame_rehighlight_hook)
|
|
811 (*frame_rehighlight_hook) ();
|
363
|
812
|
|
813 return Qnil;
|
|
814 }
|
|
815
|
|
816
|
765
|
817 DEFUN ("frame-focus", Fframe_focus, Sframe_focus, 1, 1, 0,
|
|
818 "Return the frame to which FRAME's keystrokes are currently being sent.\n\
|
|
819 See `redirect-frame-focus'.")
|
|
820 (frame)
|
|
821 Lisp_Object frame;
|
363
|
822 {
|
765
|
823 CHECK_LIVE_FRAME (frame, 0);
|
|
824 return FRAME_FOCUS_FRAME (XFRAME (frame));
|
363
|
825 }
|
|
826
|
|
827
|
286
|
828
|
|
829 Lisp_Object
|
765
|
830 get_frame_param (frame, prop)
|
|
831 register struct frame *frame;
|
286
|
832 Lisp_Object prop;
|
|
833 {
|
|
834 register Lisp_Object tem;
|
|
835
|
765
|
836 tem = Fassq (prop, frame->param_alist);
|
286
|
837 if (EQ (tem, Qnil))
|
|
838 return tem;
|
|
839 return Fcdr (tem);
|
|
840 }
|
|
841
|
|
842 void
|
|
843 store_in_alist (alistptr, propname, val)
|
|
844 Lisp_Object *alistptr, val;
|
|
845 char *propname;
|
|
846 {
|
|
847 register Lisp_Object tem;
|
|
848 register Lisp_Object prop;
|
|
849
|
|
850 prop = intern (propname);
|
|
851 tem = Fassq (prop, *alistptr);
|
|
852 if (EQ (tem, Qnil))
|
|
853 *alistptr = Fcons (Fcons (prop, val), *alistptr);
|
|
854 else
|
|
855 Fsetcdr (tem, val);
|
|
856 }
|
|
857
|
|
858 void
|
765
|
859 store_frame_param (f, prop, val)
|
|
860 struct frame *f;
|
286
|
861 Lisp_Object prop, val;
|
|
862 {
|
|
863 register Lisp_Object tem;
|
|
864
|
765
|
865 tem = Fassq (prop, f->param_alist);
|
286
|
866 if (EQ (tem, Qnil))
|
765
|
867 f->param_alist = Fcons (Fcons (prop, val), f->param_alist);
|
286
|
868 else
|
|
869 Fsetcdr (tem, val);
|
539
|
870
|
|
871 if (EQ (prop, Qminibuffer)
|
|
872 && XTYPE (val) == Lisp_Window)
|
|
873 {
|
|
874 if (! MINI_WINDOW_P (XWINDOW (val)))
|
|
875 error ("Surrogate minibuffer windows must be minibuffer windows.");
|
|
876
|
765
|
877 if (FRAME_HAS_MINIBUF (f) || FRAME_MINIBUF_ONLY_P (f))
|
|
878 error ("Can't change the surrogate minibuffer of a frame with its own minibuffer.");
|
539
|
879
|
|
880 /* Install the chosen minibuffer window, with proper buffer. */
|
765
|
881 f->minibuffer_window = val;
|
539
|
882 }
|
286
|
883 }
|
|
884
|
765
|
885 DEFUN ("frame-parameters", Fframe_parameters, Sframe_parameters, 0, 1, 0,
|
|
886 "Return the parameters-alist of frame FRAME.\n\
|
286
|
887 It is a list of elements of the form (PARM . VALUE), where PARM is a symbol.\n\
|
777
|
888 The meaningful PARMs depend on the kind of frame.\n\
|
|
889 If FRAME is omitted, return information on the currently selected frame.")
|
765
|
890 (frame)
|
|
891 Lisp_Object frame;
|
286
|
892 {
|
|
893 Lisp_Object alist;
|
765
|
894 struct frame *f;
|
286
|
895
|
765
|
896 if (EQ (frame, Qnil))
|
|
897 f = selected_frame;
|
286
|
898 else
|
|
899 {
|
765
|
900 CHECK_FRAME (frame, 0);
|
|
901 f = XFRAME (frame);
|
286
|
902 }
|
|
903
|
765
|
904 if (f->display.nothing == 0)
|
286
|
905 return Qnil;
|
|
906
|
765
|
907 alist = Fcopy_alist (f->param_alist);
|
|
908 store_in_alist (&alist, "name", f->name);
|
|
909 store_in_alist (&alist, "height", make_number (f->height));
|
|
910 store_in_alist (&alist, "width", make_number (f->width));
|
|
911 store_in_alist (&alist, "modeline", (f->wants_modeline ? Qt : Qnil));
|
454
|
912 store_in_alist (&alist, "minibuffer",
|
765
|
913 (FRAME_HAS_MINIBUF (f)
|
|
914 ? (FRAME_MINIBUF_ONLY_P (f) ? intern ("only") : Qt)
|
|
915 : FRAME_MINIBUF_WINDOW (f)));
|
|
916 store_in_alist (&alist, "unsplittable", (f->no_split ? Qt : Qnil));
|
286
|
917
|
765
|
918 if (FRAME_IS_X (f))
|
|
919 x_report_frame_params (f, &alist);
|
286
|
920 return alist;
|
|
921 }
|
|
922
|
765
|
923 DEFUN ("modify-frame-parameters", Fmodify_frame_parameters,
|
|
924 Smodify_frame_parameters, 2, 2, 0,
|
|
925 "Modify the parameters of frame FRAME according to ALIST.\n\
|
286
|
926 ALIST is an alist of parameters to change and their new values.\n\
|
|
927 Each element of ALIST has the form (PARM . VALUE), where PARM is a symbol.\n\
|
765
|
928 The meaningful PARMs depend on the kind of frame; undefined PARMs are ignored.")
|
|
929 (frame, alist)
|
|
930 Lisp_Object frame, alist;
|
286
|
931 {
|
765
|
932 register struct frame *f;
|
286
|
933 register Lisp_Object tail, elt, prop, val;
|
|
934
|
765
|
935 if (EQ (frame, Qnil))
|
|
936 f = selected_frame;
|
286
|
937 else
|
|
938 {
|
765
|
939 CHECK_LIVE_FRAME (frame, 0);
|
|
940 f = XFRAME (frame);
|
286
|
941 }
|
|
942
|
765
|
943 if (FRAME_IS_X (f))
|
286
|
944 for (tail = alist; !EQ (tail, Qnil); tail = Fcdr (tail))
|
|
945 {
|
|
946 elt = Fcar (tail);
|
|
947 prop = Fcar (elt);
|
|
948 val = Fcdr (elt);
|
765
|
949 x_set_frame_param (f, prop, val,
|
|
950 get_frame_param (f, prop));
|
|
951 store_frame_param (f, prop, val);
|
286
|
952 }
|
|
953
|
|
954 return Qnil;
|
|
955 }
|
|
956
|
|
957
|
777
|
958 #if 0
|
|
959 /* This function isn't useful enough by itself to include; we need to
|
|
960 add functions to allow the user to find the size of a font before
|
|
961 this is actually useful. */
|
|
962
|
765
|
963 DEFUN ("frame-pixel-size", Fframe_pixel_size,
|
|
964 Sframe_pixel_size, 1, 1, 0,
|
|
965 "Return a cons (width . height) of FRAME's size in pixels.")
|
|
966 (frame)
|
|
967 Lisp_Object frame;
|
286
|
968 {
|
765
|
969 register struct frame *f;
|
286
|
970 int width, height;
|
|
971
|
765
|
972 CHECK_LIVE_FRAME (frame, 0);
|
|
973 f = XFRAME (frame);
|
286
|
974
|
765
|
975 return Fcons (make_number (x_pixel_width (f)),
|
|
976 make_number (x_pixel_height (f)));
|
286
|
977 }
|
777
|
978 #endif
|
|
979
|
|
980 #if 0
|
|
981 /* These functions have no C callers, and can be written nicely in lisp. */
|
286
|
982
|
765
|
983 DEFUN ("frame-height", Fframe_height, Sframe_height, 0, 0, 0,
|
|
984 "Return number of lines available for display on selected frame.")
|
286
|
985 ()
|
|
986 {
|
765
|
987 return make_number (FRAME_HEIGHT (selected_frame));
|
286
|
988 }
|
|
989
|
765
|
990 DEFUN ("frame-width", Fframe_width, Sframe_width, 0, 0, 0,
|
|
991 "Return number of columns available for display on selected frame.")
|
286
|
992 ()
|
|
993 {
|
765
|
994 return make_number (FRAME_WIDTH (selected_frame));
|
286
|
995 }
|
777
|
996 #endif
|
286
|
997
|
765
|
998 DEFUN ("set-frame-height", Fset_frame_height, Sset_frame_height, 2, 3, 0,
|
|
999 "Specify that the frame FRAME has LINES lines.\n\
|
286
|
1000 Optional third arg non-nil means that redisplay should use LINES lines\n\
|
765
|
1001 but that the idea of the actual height of the frame should not be changed.")
|
|
1002 (frame, rows, pretend)
|
286
|
1003 Lisp_Object rows, pretend;
|
|
1004 {
|
765
|
1005 register struct frame *f;
|
286
|
1006
|
|
1007 CHECK_NUMBER (rows, 0);
|
765
|
1008 if (NILP (frame))
|
|
1009 f = selected_frame;
|
286
|
1010 else
|
|
1011 {
|
765
|
1012 CHECK_LIVE_FRAME (frame, 0);
|
|
1013 f = XFRAME (frame);
|
286
|
1014 }
|
|
1015
|
765
|
1016 if (FRAME_IS_X (f))
|
286
|
1017 {
|
765
|
1018 if (XINT (rows) != f->width)
|
|
1019 x_set_window_size (f, f->width, XINT (rows));
|
286
|
1020 }
|
|
1021 else
|
765
|
1022 change_frame_size (f, XINT (rows), 0, !NILP (pretend));
|
286
|
1023 return Qnil;
|
|
1024 }
|
|
1025
|
765
|
1026 DEFUN ("set-frame-width", Fset_frame_width, Sset_frame_width, 2, 3, 0,
|
|
1027 "Specify that the frame FRAME has COLS columns.\n\
|
286
|
1028 Optional third arg non-nil means that redisplay should use COLS columns\n\
|
765
|
1029 but that the idea of the actual width of the frame should not be changed.")
|
|
1030 (frame, cols, pretend)
|
286
|
1031 Lisp_Object cols, pretend;
|
|
1032 {
|
765
|
1033 register struct frame *f;
|
286
|
1034 CHECK_NUMBER (cols, 0);
|
765
|
1035 if (NILP (frame))
|
|
1036 f = selected_frame;
|
286
|
1037 else
|
|
1038 {
|
765
|
1039 CHECK_LIVE_FRAME (frame, 0);
|
|
1040 f = XFRAME (frame);
|
286
|
1041 }
|
|
1042
|
765
|
1043 if (FRAME_IS_X (f))
|
286
|
1044 {
|
765
|
1045 if (XINT (cols) != f->width)
|
|
1046 x_set_window_size (f, XINT (cols), f->height);
|
286
|
1047 }
|
|
1048 else
|
765
|
1049 change_frame_size (selected_frame, 0, XINT (cols), !NILP (pretend));
|
286
|
1050 return Qnil;
|
|
1051 }
|
|
1052
|
765
|
1053 DEFUN ("set-frame-size", Fset_frame_size, Sset_frame_size, 3, 3, 0,
|
|
1054 "Sets size of FRAME to COLS by ROWS, measured in characters.")
|
|
1055 (frame, cols, rows)
|
|
1056 Lisp_Object frame, cols, rows;
|
286
|
1057 {
|
765
|
1058 register struct frame *f;
|
286
|
1059 int mask;
|
|
1060
|
765
|
1061 CHECK_LIVE_FRAME (frame, 0);
|
286
|
1062 CHECK_NUMBER (cols, 2);
|
|
1063 CHECK_NUMBER (rows, 1);
|
765
|
1064 f = XFRAME (frame);
|
286
|
1065
|
765
|
1066 if (FRAME_IS_X (f))
|
286
|
1067 {
|
765
|
1068 if (XINT (rows) != f->height || XINT (cols) != f->width)
|
|
1069 x_set_window_size (f, XINT (cols), XINT (rows));
|
286
|
1070 }
|
|
1071 else
|
765
|
1072 change_frame_size (f, XINT (rows), XINT (cols), 0);
|
286
|
1073
|
|
1074 return Qnil;
|
|
1075 }
|
|
1076
|
765
|
1077 DEFUN ("set-frame-position", Fset_frame_position,
|
|
1078 Sset_frame_position, 3, 3, 0,
|
|
1079 "Sets position of FRAME in pixels to XOFFSET by YOFFSET.\n\
|
454
|
1080 If XOFFSET or YOFFSET are negative, they are interpreted relative to\n\
|
765
|
1081 the leftmost or bottommost position FRAME could occupy without going\n\
|
|
1082 off the frame.")
|
|
1083 (frame, xoffset, yoffset)
|
|
1084 Lisp_Object frame, xoffset, yoffset;
|
286
|
1085 {
|
765
|
1086 register struct frame *f;
|
286
|
1087 int mask;
|
|
1088
|
765
|
1089 CHECK_LIVE_FRAME (frame, 0);
|
286
|
1090 CHECK_NUMBER (xoffset, 1);
|
|
1091 CHECK_NUMBER (yoffset, 2);
|
765
|
1092 f = XFRAME (frame);
|
286
|
1093
|
765
|
1094 if (FRAME_IS_X (f))
|
|
1095 x_set_offset (f, XINT (xoffset), XINT (yoffset));
|
286
|
1096
|
|
1097 return Qt;
|
|
1098 }
|
777
|
1099
|
286
|
1100
|
|
1101 #ifndef HAVE_X11
|
|
1102 DEFUN ("rubber-band-rectangle", Frubber_band_rectangle, Srubber_band_rectangle,
|
|
1103 3, 3, "",
|
765
|
1104 "Ask user to specify a window position and size on FRAME with the mouse.\n\
|
|
1105 Arguments are FRAME, NAME and GEO. NAME is a name to be displayed as\n\
|
286
|
1106 the purpose of this rectangle. GEO is an X-windows size spec that can\n\
|
|
1107 specify defaults for some sizes/positions. If GEO specifies everything,\n\
|
|
1108 the mouse is not used.\n\
|
765
|
1109 Returns a list of five values: (FRAME LEFT TOP WIDTH HEIGHT).")
|
|
1110 (frame, name, geo)
|
|
1111 Lisp_Object frame;
|
286
|
1112 Lisp_Object name;
|
|
1113 Lisp_Object geo;
|
|
1114 {
|
|
1115 int vals[4];
|
|
1116 Lisp_Object nums[4];
|
|
1117 int i;
|
|
1118
|
765
|
1119 CHECK_FRAME (frame, 0);
|
286
|
1120 CHECK_STRING (name, 1);
|
|
1121 CHECK_STRING (geo, 2);
|
|
1122
|
765
|
1123 switch (XFRAME (frame)->output_method)
|
286
|
1124 {
|
|
1125 case output_x_window:
|
765
|
1126 x_rubber_band (XFRAME (frame), &vals[0], &vals[1], &vals[2], &vals[3],
|
286
|
1127 XSTRING (geo)->data, XSTRING (name)->data);
|
|
1128 break;
|
|
1129
|
|
1130 default:
|
|
1131 return Qnil;
|
|
1132 }
|
|
1133
|
|
1134 for (i = 0; i < 4; i++)
|
|
1135 XFASTINT (nums[i]) = vals[i];
|
765
|
1136 return Fcons (frame, Flist (4, nums));
|
286
|
1137 return Qnil;
|
|
1138 }
|
|
1139 #endif /* not HAVE_X11 */
|
|
1140
|
765
|
1141 choose_minibuf_frame ()
|
286
|
1142 {
|
765
|
1143 /* For lowest-level minibuf, put it on currently selected frame
|
|
1144 if frame has a minibuffer. */
|
286
|
1145 if (minibuf_level == 0
|
765
|
1146 && selected_frame != 0
|
|
1147 && !EQ (minibuf_window, selected_frame->minibuffer_window)
|
|
1148 && !EQ (Qnil, selected_frame->minibuffer_window))
|
286
|
1149 {
|
765
|
1150 Fset_window_buffer (selected_frame->minibuffer_window,
|
286
|
1151 XWINDOW (minibuf_window)->buffer);
|
765
|
1152 minibuf_window = selected_frame->minibuffer_window;
|
286
|
1153 }
|
|
1154 }
|
|
1155
|
765
|
1156 syms_of_frame ()
|
286
|
1157 {
|
765
|
1158 Qframep = intern ("framep");
|
|
1159 Qlive_frame_p = intern ("live_frame_p");
|
539
|
1160 Qminibuffer = intern ("minibuffer");
|
454
|
1161
|
765
|
1162 staticpro (&Qframep);
|
|
1163 staticpro (&Qlive_frame_p);
|
539
|
1164 staticpro (&Qminibuffer);
|
286
|
1165
|
765
|
1166 staticpro (&Vframe_list);
|
286
|
1167
|
765
|
1168 DEFVAR_LISP ("terminal-frame", &Vterminal_frame,
|
|
1169 "The initial frame-object, which represents Emacs's stdout.");
|
286
|
1170
|
|
1171 DEFVAR_LISP ("emacs-iconified", &Vemacs_iconified,
|
765
|
1172 "Non-nil if all of emacs is iconified and frame updates are not needed.");
|
286
|
1173 Vemacs_iconified = Qnil;
|
|
1174
|
765
|
1175 DEFVAR_LISP ("default-minibuffer-frame", &Vdefault_minibuffer_frame,
|
|
1176 "Minibufferless frames use this frame's minibuffer.\n\
|
454
|
1177 \n\
|
765
|
1178 Emacs cannot create minibufferless frames unless this is set to an\n\
|
454
|
1179 appropriate surrogate.\n\
|
|
1180 \n\
|
|
1181 Emacs consults this variable only when creating minibufferless\n\
|
765
|
1182 frames; once the frame is created, it sticks with its assigned\n\
|
454
|
1183 minibuffer, no matter what this variable is set to. This means that\n\
|
|
1184 this variable doesn't necessarily say anything meaningful about the\n\
|
765
|
1185 current set of frames, or where the minibuffer is currently being\n\
|
454
|
1186 displayed.");
|
765
|
1187 Vdefault_minibuffer_frame = Qnil;
|
286
|
1188
|
765
|
1189 DEFVAR_LISP ("default-frame-alist", &Vdefault_frame_alist,
|
|
1190 "Alist of default values for frame creation.\n\
|
386
|
1191 These may be set in your init file, like this:\n\
|
765
|
1192 (setq default-frame-alist '((width . 80) (height . 55)))\n\
|
386
|
1193 These override values given in window system configuration data, like\n\
|
|
1194 X Windows' defaults database.\n\
|
765
|
1195 For values specific to the first Emacs frame, see `initial-frame-alist'.\n\
|
|
1196 For values specific to the separate minibuffer frame, see\n\
|
|
1197 `minibuffer-frame-alist'.");
|
|
1198 Vdefault_frame_alist = Qnil;
|
386
|
1199
|
765
|
1200 defsubr (&Sframep);
|
|
1201 defsubr (&Slive_frame_p);
|
|
1202 defsubr (&Sselect_frame);
|
|
1203 defsubr (&Sselected_frame);
|
|
1204 defsubr (&Swindow_frame);
|
|
1205 defsubr (&Sframe_root_window);
|
|
1206 defsubr (&Sframe_selected_window);
|
|
1207 defsubr (&Sframe_list);
|
|
1208 defsubr (&Snext_frame);
|
|
1209 defsubr (&Sdelete_frame);
|
454
|
1210 defsubr (&Smouse_position);
|
286
|
1211 defsubr (&Sset_mouse_position);
|
|
1212 #if 0
|
765
|
1213 defsubr (&Sframe_configuration);
|
|
1214 defsubr (&Srestore_frame_configuration);
|
286
|
1215 #endif
|
765
|
1216 defsubr (&Smake_frame_visible);
|
|
1217 defsubr (&Smake_frame_invisible);
|
|
1218 defsubr (&Siconify_frame);
|
|
1219 defsubr (&Sframe_visible_p);
|
|
1220 defsubr (&Svisible_frame_list);
|
|
1221 defsubr (&Sredirect_frame_focus);
|
|
1222 defsubr (&Sframe_focus);
|
|
1223 defsubr (&Sframe_parameters);
|
|
1224 defsubr (&Smodify_frame_parameters);
|
785
|
1225 #if 0
|
765
|
1226 defsubr (&Sframe_pixel_size);
|
|
1227 defsubr (&Sframe_height);
|
|
1228 defsubr (&Sframe_width);
|
785
|
1229 #endif
|
765
|
1230 defsubr (&Sset_frame_height);
|
|
1231 defsubr (&Sset_frame_width);
|
|
1232 defsubr (&Sset_frame_size);
|
|
1233 defsubr (&Sset_frame_position);
|
286
|
1234 #ifndef HAVE_X11
|
|
1235 defsubr (&Srubber_band_rectangle);
|
|
1236 #endif /* HAVE_X11 */
|
|
1237 }
|
732
|
1238
|
|
1239 #endif
|