0
|
1 /* Generic frame functions.
|
|
2 Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
|
|
3 Copyright (C) 1995, 1996 Ben Wing.
|
|
4 Copyright (C) 1995 Sun Microsystems, Inc.
|
|
5
|
|
6 This file is part of XEmacs.
|
|
7
|
|
8 XEmacs is free software; you can redistribute it and/or modify it
|
|
9 under the terms of the GNU General Public License as published by the
|
|
10 Free Software Foundation; either version 2, or (at your option) any
|
|
11 later version.
|
|
12
|
|
13 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
16 for more details.
|
|
17
|
|
18 You should have received a copy of the GNU General Public License
|
|
19 along with XEmacs; see the file COPYING. If not, write to
|
|
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
21 Boston, MA 02111-1307, USA. */
|
|
22
|
|
23 /* Synched up with: FSF 19.30. */
|
|
24
|
2
|
25 /* This file has been Mule-ized. */
|
0
|
26
|
|
27 #include <config.h>
|
|
28 #include "lisp.h"
|
|
29
|
|
30 #include "buffer.h" /* for Vbuffer_alist */
|
|
31 #include "console.h"
|
|
32 #include "events.h"
|
|
33 #include "extents.h"
|
|
34 #include "faces.h"
|
|
35 #include "frame.h"
|
|
36 #include "glyphs.h"
|
|
37 #include "menubar.h"
|
|
38 #ifdef MSDOS
|
|
39 #include "msdos.h"
|
|
40 #endif
|
|
41 #include "redisplay.h"
|
|
42 #include "scrollbar.h"
|
|
43 #include "window.h"
|
|
44
|
|
45 #include <errno.h>
|
|
46 #include "sysdep.h"
|
|
47
|
|
48 Lisp_Object Vselect_frame_hook, Qselect_frame_hook;
|
|
49 Lisp_Object Vdeselect_frame_hook, Qdeselect_frame_hook;
|
|
50 Lisp_Object Vcreate_frame_hook, Qcreate_frame_hook;
|
|
51 Lisp_Object Vdelete_frame_hook, Qdelete_frame_hook;
|
|
52 Lisp_Object Vmouse_enter_frame_hook, Qmouse_enter_frame_hook;
|
|
53 Lisp_Object Vmouse_leave_frame_hook, Qmouse_leave_frame_hook;
|
|
54 Lisp_Object Vmap_frame_hook, Qmap_frame_hook;
|
|
55 Lisp_Object Vunmap_frame_hook, Qunmap_frame_hook;
|
146
|
56 int allow_deletion_of_last_visible_frame;
|
249
|
57 #if defined (HAVE_CDE) || defined (HAVE_OFFIX_DND) || defined(HAVE_MS_WINDOWS)
|
0
|
58 Lisp_Object Vdrag_and_drop_functions, Qdrag_and_drop_functions;
|
|
59 #endif
|
|
60 Lisp_Object Vmouse_motion_handler;
|
|
61 Lisp_Object Vsynchronize_minibuffers;
|
|
62 Lisp_Object Qsynchronize_minibuffers;
|
|
63 Lisp_Object Qbuffer_predicate;
|
|
64 Lisp_Object Qmake_initial_minibuffer_frame;
|
197
|
65 Lisp_Object Qcustom_initialize_frame;
|
0
|
66
|
|
67 /* We declare all these frame properties here even though many of them
|
|
68 are currently only used in frame-x.c, because we should generalize
|
|
69 them. */
|
|
70
|
|
71 Lisp_Object Qminibuffer;
|
|
72 Lisp_Object Qunsplittable;
|
|
73 Lisp_Object Qinternal_border_width;
|
|
74 Lisp_Object Qtop_toolbar_shadow_color;
|
|
75 Lisp_Object Qbottom_toolbar_shadow_color;
|
|
76 Lisp_Object Qbackground_toolbar_color;
|
|
77 Lisp_Object Qtop_toolbar_shadow_pixmap;
|
|
78 Lisp_Object Qbottom_toolbar_shadow_pixmap;
|
|
79 Lisp_Object Qtoolbar_shadow_thickness;
|
|
80 Lisp_Object Qscrollbar_placement;
|
|
81 Lisp_Object Qinter_line_space;
|
|
82 Lisp_Object Qvisual_bell;
|
|
83 Lisp_Object Qbell_volume;
|
|
84 Lisp_Object Qpointer_background;
|
|
85 Lisp_Object Qpointer_color;
|
|
86 Lisp_Object Qtext_pointer;
|
|
87 Lisp_Object Qspace_pointer;
|
|
88 Lisp_Object Qmodeline_pointer;
|
|
89 Lisp_Object Qgc_pointer;
|
|
90 Lisp_Object Qinitially_unmapped;
|
|
91 Lisp_Object Quse_backing_store;
|
|
92 Lisp_Object Qborder_color;
|
|
93 Lisp_Object Qborder_width;
|
|
94
|
|
95 Lisp_Object Qframep, Qframe_live_p;
|
|
96 Lisp_Object Qframe_x_p, Qframe_tty_p;
|
|
97 Lisp_Object Qdelete_frame;
|
|
98
|
2
|
99 Lisp_Object Qframe_title_format, Vframe_title_format;
|
|
100 Lisp_Object Qframe_icon_title_format, Vframe_icon_title_format;
|
0
|
101
|
|
102 Lisp_Object Vdefault_frame_name;
|
|
103 Lisp_Object Vdefault_frame_plist;
|
|
104
|
|
105 Lisp_Object Vframe_icon_glyph;
|
|
106
|
108
|
107 Lisp_Object Qhidden;
|
|
108
|
0
|
109 Lisp_Object Qvisible, Qiconic, Qinvisible, Qvisible_iconic, Qinvisible_iconic;
|
|
110 Lisp_Object Qnomini, Qvisible_nomini, Qiconic_nomini, Qinvisible_nomini;
|
|
111 Lisp_Object Qvisible_iconic_nomini, Qinvisible_iconic_nomini;
|
|
112
|
|
113 Lisp_Object Qset_specifier, Qset_glyph_image, Qset_face_property;
|
|
114 Lisp_Object Qface_property_instance;
|
|
115
|
|
116 Lisp_Object Qframe_property_alias;
|
|
117
|
|
118 /* If this is non-nil, it is the frame that make-frame is currently
|
|
119 creating. We can't set the current frame to this in case the
|
|
120 debugger goes off because it would try and display to it. However,
|
|
121 there are some places which need to reference it which have no
|
|
122 other way of getting it if it isn't the selected frame. */
|
|
123 Lisp_Object Vframe_being_created;
|
|
124 Lisp_Object Qframe_being_created;
|
|
125
|
|
126 static void store_minibuf_frame_prop (struct frame *f, Lisp_Object val);
|
|
127
|
272
|
128 EXFUN (Fset_frame_properties, 2);
|
0
|
129
|
|
130
|
|
131 static Lisp_Object
|
|
132 mark_frame (Lisp_Object obj, void (*markobj) (Lisp_Object))
|
|
133 {
|
|
134 struct frame *f = XFRAME (obj);
|
|
135
|
|
136 #define MARKED_SLOT(x) ((markobj) (f->x));
|
|
137 #include "frameslots.h"
|
|
138 #undef MARKED_SLOT
|
|
139
|
|
140 #ifdef HAVE_TOOLBARS
|
|
141 ((markobj) (f->toolbar_data[0]));
|
|
142 ((markobj) (f->toolbar_data[1]));
|
|
143 ((markobj) (f->toolbar_data[2]));
|
|
144 ((markobj) (f->toolbar_data[3]));
|
|
145
|
|
146 ((markobj) (f->toolbar_size[0]));
|
|
147 ((markobj) (f->toolbar_size[1]));
|
|
148 ((markobj) (f->toolbar_size[2]));
|
|
149 ((markobj) (f->toolbar_size[3]));
|
|
150
|
|
151 ((markobj) (f->toolbar_visible_p[0]));
|
|
152 ((markobj) (f->toolbar_visible_p[1]));
|
|
153 ((markobj) (f->toolbar_visible_p[2]));
|
|
154 ((markobj) (f->toolbar_visible_p[3]));
|
16
|
155 #endif /* HAVE_TOOLBARS */
|
0
|
156
|
|
157 if (FRAME_LIVE_P (f)) /* device is nil for a dead frame */
|
|
158 MAYBE_FRAMEMETH (f, mark_frame, (f, markobj));
|
|
159
|
|
160 return Qnil;
|
|
161 }
|
|
162
|
|
163 static void
|
|
164 print_frame (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
|
|
165 {
|
|
166 struct frame *frm = XFRAME (obj);
|
|
167 char buf[200];
|
173
|
168
|
0
|
169 if (print_readably)
|
|
170 error ("printing unreadable object #<frame %s 0x%x>",
|
16
|
171 XSTRING_DATA (frm->name), frm->header.uid);
|
0
|
172
|
|
173 sprintf (buf, "#<%s-frame ", !FRAME_LIVE_P (frm) ? "dead" :
|
|
174 FRAME_TYPE_NAME (frm));
|
|
175 write_c_string (buf, printcharfun);
|
|
176 print_internal (frm->name, printcharfun, 1);
|
|
177 sprintf (buf, " 0x%x>", frm->header.uid);
|
|
178 write_c_string (buf, printcharfun);
|
|
179 }
|
|
180
|
272
|
181 DEFINE_LRECORD_IMPLEMENTATION ("frame", frame,
|
|
182 mark_frame, print_frame, 0, 0, 0,
|
|
183 struct frame);
|
0
|
184
|
|
185 static void
|
|
186 nuke_all_frame_slots (struct frame *f)
|
|
187 {
|
|
188 #define MARKED_SLOT(x) f->x = Qnil;
|
|
189 #include "frameslots.h"
|
|
190 #undef MARKED_SLOT
|
|
191
|
|
192 #ifdef HAVE_TOOLBARS
|
|
193 f->toolbar_data[0] = Qnil;
|
|
194 f->toolbar_data[1] = Qnil;
|
|
195 f->toolbar_data[2] = Qnil;
|
|
196 f->toolbar_data[3] = Qnil;
|
|
197
|
|
198 f->toolbar_size[0] = Qnil;
|
|
199 f->toolbar_size[1] = Qnil;
|
|
200 f->toolbar_size[2] = Qnil;
|
|
201 f->toolbar_size[3] = Qnil;
|
|
202
|
|
203 f->toolbar_visible_p[0] = Qnil;
|
|
204 f->toolbar_visible_p[1] = Qnil;
|
|
205 f->toolbar_visible_p[2] = Qnil;
|
|
206 f->toolbar_visible_p[3] = Qnil;
|
16
|
207 #endif /* HAVE_TOOLBARS */
|
0
|
208 }
|
|
209
|
|
210 /* Allocate a new frame object and set all its fields to reasonable
|
|
211 values. The root window is created but the minibuffer will be done
|
|
212 later. */
|
|
213
|
|
214 static struct frame *
|
|
215 allocate_frame_core (Lisp_Object device)
|
|
216 {
|
|
217 /* This function can GC */
|
272
|
218 Lisp_Object frame;
|
0
|
219 Lisp_Object root_window;
|
185
|
220 struct frame *f = alloc_lcrecord_type (struct frame, lrecord_frame);
|
0
|
221
|
|
222 zero_lcrecord (f);
|
|
223 nuke_all_frame_slots (f);
|
|
224 XSETFRAME (frame, f);
|
|
225
|
|
226 f->device = device;
|
|
227 f->framemeths = XDEVICE (device)->devmeths;
|
|
228 f->buffer_alist = Fcopy_sequence (Vbuffer_alist);
|
|
229
|
|
230 root_window = allocate_window ();
|
|
231 XWINDOW (root_window)->frame = frame;
|
|
232
|
|
233 /* 10 is arbitrary,
|
|
234 just so that there is "something there."
|
|
235 Correct size will be set up later with change_frame_size. */
|
|
236
|
|
237 f->width = 10;
|
|
238 f->height = 10;
|
|
239
|
|
240 XWINDOW (root_window)->pixel_width = 10;
|
|
241 XWINDOW (root_window)->pixel_height = 9;
|
|
242
|
|
243 /* The size of the minibuffer window is now set in x_create_frame
|
|
244 in xfns.c. */
|
|
245
|
|
246 f->root_window = root_window;
|
|
247 f->selected_window = root_window;
|
|
248 f->last_nonminibuf_window = root_window;
|
|
249
|
|
250 /* Choose a buffer for the frame's root window. */
|
|
251 XWINDOW (root_window)->buffer = Qt;
|
|
252 {
|
|
253 Lisp_Object buf;
|
|
254
|
|
255 buf = Fcurrent_buffer ();
|
|
256 /* If buf is a 'hidden' buffer (i.e. one whose name starts with
|
|
257 a space), try to find another one. */
|
|
258 if (string_char (XSTRING (Fbuffer_name (buf)), 0) == ' ')
|
|
259 buf = Fother_buffer (buf, Qnil, Qnil);
|
|
260 Fset_window_buffer (root_window, buf);
|
|
261 }
|
|
262
|
|
263 return f;
|
|
264 }
|
|
265
|
|
266 static void
|
|
267 setup_normal_frame (struct frame *f)
|
|
268 {
|
|
269 Lisp_Object mini_window;
|
|
270 Lisp_Object frame;
|
|
271
|
|
272 XSETFRAME (frame, f);
|
|
273
|
|
274 mini_window = allocate_window ();
|
|
275 XWINDOW (f->root_window)->next = mini_window;
|
|
276 XWINDOW (mini_window)->prev = f->root_window;
|
|
277 XWINDOW (mini_window)->mini_p = Qt;
|
|
278 XWINDOW (mini_window)->frame = frame;
|
|
279 f->minibuffer_window = mini_window;
|
|
280 f->has_minibuffer = 1;
|
|
281
|
|
282 XWINDOW (mini_window)->buffer = Qt;
|
|
283 Fset_window_buffer (mini_window, Vminibuffer_zero);
|
|
284 }
|
|
285
|
|
286 /* Make a frame using a separate minibuffer window on another frame.
|
|
287 MINI_WINDOW is the minibuffer window to use. nil means use the
|
|
288 default-minibuffer-frame. */
|
|
289
|
|
290 static void
|
|
291 setup_frame_without_minibuffer (struct frame *f, Lisp_Object mini_window)
|
|
292 {
|
|
293 /* This function can GC */
|
|
294 Lisp_Object device = f->device;
|
|
295
|
|
296 if (!NILP (mini_window))
|
|
297 CHECK_LIVE_WINDOW (mini_window);
|
173
|
298
|
0
|
299 if (!NILP (mini_window)
|
|
300 && !EQ (DEVICE_CONSOLE (XDEVICE (device)),
|
|
301 FRAME_CONSOLE (XFRAME (XWINDOW (mini_window)->frame))))
|
|
302 error ("frame and minibuffer must be on the same console");
|
|
303
|
|
304 if (NILP (mini_window))
|
|
305 {
|
|
306 struct console *con = XCONSOLE (FRAME_CONSOLE (f));
|
|
307 /* Use default-minibuffer-frame if possible. */
|
|
308 if (!FRAMEP (con->default_minibuffer_frame)
|
|
309 || ! FRAME_LIVE_P (XFRAME (con->default_minibuffer_frame)))
|
|
310 {
|
|
311 /* If there's no minibuffer frame to use, create one. */
|
|
312 con->default_minibuffer_frame
|
|
313 = call1 (Qmake_initial_minibuffer_frame, device);
|
|
314 }
|
|
315 mini_window = XFRAME (con->default_minibuffer_frame)->minibuffer_window;
|
|
316 }
|
|
317
|
|
318 /* Install the chosen minibuffer window, with proper buffer. */
|
|
319 store_minibuf_frame_prop (f, mini_window);
|
|
320 Fset_window_buffer (mini_window, Vminibuffer_zero);
|
|
321 }
|
|
322
|
|
323 /* Make a frame containing only a minibuffer window. */
|
|
324
|
|
325 static void
|
|
326 setup_minibuffer_frame (struct frame *f)
|
|
327 {
|
|
328 /* This function can GC */
|
|
329 /* First make a frame containing just a root window, no minibuffer. */
|
|
330 Lisp_Object mini_window;
|
|
331 Lisp_Object frame;
|
|
332
|
|
333 XSETFRAME (frame, f);
|
|
334
|
|
335 f->no_split = 1;
|
|
336 f->has_minibuffer = 1;
|
|
337
|
|
338 /* Now label the root window as also being the minibuffer.
|
|
339 Avoid infinite looping on the window chain by marking next pointer
|
|
340 as nil. */
|
|
341
|
|
342 mini_window = f->minibuffer_window = f->root_window;
|
|
343 XWINDOW (mini_window)->mini_p = Qt;
|
16
|
344 XWINDOW (mini_window)->next = Qnil;
|
|
345 XWINDOW (mini_window)->prev = Qnil;
|
|
346 XWINDOW (mini_window)->frame = frame;
|
0
|
347
|
|
348 /* Put the proper buffer in that window. */
|
|
349
|
|
350 Fset_window_buffer (mini_window, Vminibuffer_zero);
|
|
351 }
|
|
352
|
|
353 static Lisp_Object
|
|
354 make_sure_its_a_fresh_plist (Lisp_Object foolist)
|
|
355 {
|
|
356 if (CONSP (Fcar (foolist)))
|
|
357 {
|
|
358 /* looks like an alist to me. */
|
|
359 foolist = Fcopy_alist (foolist);
|
|
360 foolist = Fdestructive_alist_to_plist (foolist);
|
|
361 }
|
|
362 else
|
|
363 foolist = Fcopy_sequence (foolist);
|
|
364
|
|
365 return foolist;
|
|
366 }
|
|
367
|
20
|
368 DEFUN ("make-frame", Fmake_frame, 0, 2, "", /*
|
272
|
369 Create and return a new frame, displaying the current buffer.
|
155
|
370 Runs the functions listed in `create-frame-hook' after frame creation.
|
0
|
371
|
|
372 Optional argument PROPS is a property list (a list of alternating
|
151
|
373 keyword-value specifications) of properties for the new frame.
|
0
|
374 \(An alist is accepted for backward compatibility but should not
|
|
375 be passed in.)
|
|
376
|
|
377 See `set-frame-properties', `default-x-frame-plist', and
|
|
378 `default-tty-frame-plist' for the specially-recognized properties.
|
20
|
379 */
|
|
380 (props, device))
|
0
|
381 {
|
|
382 struct frame *f;
|
|
383 struct device *d;
|
|
384 Lisp_Object frame = Qnil, name = Qnil, minibuf;
|
|
385 struct gcpro gcpro1, gcpro2, gcpro3;
|
|
386 int speccount = specpdl_depth ();
|
|
387 int first_frame_on_device = 0;
|
|
388 int first_frame_on_console = 0;
|
|
389
|
|
390 d = decode_device (device);
|
|
391 XSETDEVICE (device, d);
|
|
392
|
|
393 /* PROPS and NAME may be freshly-created, so make sure to GCPRO. */
|
|
394 GCPRO3 (frame, props, name);
|
|
395
|
|
396 props = make_sure_its_a_fresh_plist (props);
|
|
397 if (DEVICE_SPECIFIC_FRAME_PROPS (d))
|
|
398 /* Put the device-specific props before the more general ones so
|
|
399 that they override them. */
|
|
400 props = nconc2 (props,
|
|
401 make_sure_its_a_fresh_plist
|
|
402 (*DEVICE_SPECIFIC_FRAME_PROPS (d)));
|
|
403 props = nconc2 (props, make_sure_its_a_fresh_plist (Vdefault_frame_plist));
|
|
404 Fcanonicalize_lax_plist (props, Qnil);
|
|
405
|
|
406 name = Flax_plist_get (props, Qname, Qnil);
|
|
407 if (!NILP (name))
|
|
408 CHECK_STRING (name);
|
|
409 else if (STRINGP (Vdefault_frame_name))
|
|
410 name = Vdefault_frame_name;
|
|
411 else
|
|
412 name = build_string ("emacs");
|
|
413
|
|
414 if (!NILP (Fstring_match (make_string ((CONST Bufbyte *) "\\.", 2), name,
|
|
415 Qnil, Qnil)))
|
|
416 signal_simple_error (". not allowed in frame names", name);
|
|
417
|
|
418 f = allocate_frame_core (device);
|
280
|
419 XSETFRAME (frame, f);
|
0
|
420
|
|
421 specbind (Qframe_being_created, name);
|
|
422 f->name = name;
|
|
423
|
|
424 FRAMEMETH (f, init_frame_1, (f, props));
|
|
425
|
|
426 minibuf = Flax_plist_get (props, Qminibuffer, Qunbound);
|
|
427 if (UNBOUNDP (minibuf))
|
|
428 {
|
|
429 /* If minibuf is unspecified, then look for a minibuffer X resource. */
|
|
430 /* #### Not implemented any more. We need to fix things up so
|
|
431 that we search out all X resources and append them to the end of
|
|
432 props, above. This is the only way in general to assure
|
|
433 coherent behavior for all frame properties/resources/etc. */
|
|
434 }
|
|
435 else
|
|
436 props = Flax_plist_remprop (props, Qminibuffer);
|
|
437
|
|
438 if (EQ (minibuf, Qnone) || NILP (minibuf))
|
|
439 setup_frame_without_minibuffer (f, Qnil);
|
|
440 else if (EQ (minibuf, Qonly))
|
|
441 setup_minibuffer_frame (f);
|
|
442 else if (WINDOWP (minibuf))
|
|
443 setup_frame_without_minibuffer (f, minibuf);
|
|
444 else if (EQ (minibuf, Qt) || UNBOUNDP (minibuf))
|
|
445 setup_normal_frame (f);
|
|
446 else
|
|
447 signal_simple_error ("Invalid value for `minibuffer'", minibuf);
|
|
448
|
|
449 update_frame_window_mirror (f);
|
|
450
|
|
451 if (initialized)
|
|
452 {
|
|
453 if (!NILP (f->minibuffer_window))
|
|
454 reset_face_cachels (XWINDOW (f->minibuffer_window));
|
|
455 reset_face_cachels (XWINDOW (f->root_window));
|
|
456 }
|
|
457
|
155
|
458 /* If no frames on this device formerly existed, say this is the
|
|
459 first frame. It kind of assumes that frameless devices don't
|
|
460 exist, but it shouldn't be too harmful. */
|
|
461 if (NILP (DEVICE_FRAME_LIST (d)))
|
|
462 first_frame_on_device = 1;
|
|
463
|
0
|
464 /* This *must* go before the init_*() methods. Those functions
|
|
465 call Lisp code, and if any of them causes a warning to be displayed
|
|
466 and the *Warnings* buffer to be created, it won't get added to
|
|
467 the frame-specific version of the buffer-alist unless the frame
|
|
468 is accessible from the device. */
|
|
469
|
98
|
470 #if 0
|
0
|
471 DEVICE_FRAME_LIST (d) = nconc2 (DEVICE_FRAME_LIST (d), Fcons (frame, Qnil));
|
98
|
472 #endif
|
|
473 DEVICE_FRAME_LIST (d) = Fcons (frame, DEVICE_FRAME_LIST (d));
|
0
|
474 RESET_CHANGED_SET_FLAGS;
|
|
475
|
|
476 /* Now make sure that the initial cached values are set correctly.
|
|
477 Do this after the init_frame method is called because that may
|
|
478 do things (e.g. create widgets) that are necessary for the
|
|
479 specifier value-changed methods to work OK. */
|
|
480 recompute_all_cached_specifiers_in_frame (f);
|
|
481
|
|
482 if (!DEVICE_STREAM_P (d))
|
|
483 {
|
|
484 init_frame_faces (f);
|
|
485
|
|
486 #ifdef HAVE_SCROLLBARS
|
|
487 /* Finish up resourcing the scrollbars. */
|
|
488 init_frame_scrollbars (f);
|
|
489 #endif
|
|
490
|
|
491 #ifdef HAVE_TOOLBARS
|
|
492 /* Create the initial toolbars. We have to do this after the frame
|
|
493 methods are called because it may potentially call some things itself
|
|
494 which depend on the normal frame methods having initialized
|
|
495 things. */
|
|
496 init_frame_toolbars (f);
|
|
497 #endif
|
|
498
|
|
499 reset_face_cachels (XWINDOW (FRAME_SELECTED_WINDOW (f)));
|
|
500 reset_glyph_cachels (XWINDOW (FRAME_SELECTED_WINDOW (f)));
|
|
501 change_frame_size (f, f->height, f->width, 0);
|
|
502 }
|
|
503
|
|
504 MAYBE_FRAMEMETH (f, init_frame_2, (f, props));
|
|
505 Fset_frame_properties (frame, props);
|
|
506 MAYBE_FRAMEMETH (f, init_frame_3, (f));
|
|
507
|
|
508 /* Hallelujah, praise the lord. */
|
|
509 f->init_finished = 1;
|
|
510
|
|
511 /* If this is the first frame on the device, make it the selected one. */
|
155
|
512 if (first_frame_on_device && NILP (DEVICE_SELECTED_FRAME (d)))
|
|
513 set_device_selected_frame (d, frame);
|
0
|
514
|
|
515 /* If at startup or if the current console is a stream console
|
|
516 (usually also at startup), make this console the selected one
|
|
517 so that messages show up on it. */
|
|
518 if (NILP (Fselected_console ()) ||
|
|
519 CONSOLE_STREAM_P (XCONSOLE (Fselected_console ())))
|
|
520 Fselect_console (DEVICE_CONSOLE (d));
|
|
521
|
|
522 first_frame_on_console =
|
|
523 (first_frame_on_device &&
|
|
524 XINT (Flength (CONSOLE_DEVICE_LIST (XCONSOLE (DEVICE_CONSOLE (d)))))
|
|
525 == 1);
|
|
526
|
|
527 /* #### all this calling of frame methods at various odd times
|
|
528 is somewhat of a mess. It's necessary to do it this way due
|
|
529 to strange console-type-specific things that need to be done. */
|
|
530 MAYBE_FRAMEMETH (f, after_init_frame, (f, first_frame_on_device,
|
|
531 first_frame_on_console));
|
|
532
|
|
533 if (first_frame_on_device)
|
|
534 {
|
|
535 if (first_frame_on_console)
|
|
536 va_run_hook_with_args (Qcreate_console_hook, 1, DEVICE_CONSOLE (d));
|
|
537 va_run_hook_with_args (Qcreate_device_hook, 1, device);
|
|
538 }
|
|
539 va_run_hook_with_args (Qcreate_frame_hook, 1, frame);
|
|
540
|
197
|
541 /* Initialize custom-specific stuff. */
|
|
542 if (!UNBOUNDP (symbol_function (XSYMBOL (Qcustom_initialize_frame))))
|
|
543 call1 (Qcustom_initialize_frame, frame);
|
|
544
|
0
|
545 unbind_to (speccount, Qnil);
|
|
546
|
|
547 UNGCPRO;
|
|
548 return frame;
|
|
549 }
|
|
550
|
|
551
|
|
552 /* this function should be used in most cases when a Lisp function is passed
|
|
553 a FRAME argument. Use this unless you don't accept nil == current frame
|
|
554 (in which case, do a CHECK_LIVE_FRAME() and then an XFRAME()) or you
|
|
555 allow dead frames. Note that very few functions should accept dead
|
|
556 frames. It could be argued that functions should just do nothing when
|
|
557 given a dead frame, but the presence of a dead frame usually indicates
|
|
558 an oversight in the Lisp code that could potentially lead to strange
|
|
559 results and so it is better to catch the error early.
|
|
560
|
|
561 If you only accept X frames, use decode_x_frame(), which does what this
|
|
562 function does but also makes sure the frame is an X frame. */
|
|
563
|
|
564 struct frame *
|
|
565 decode_frame (Lisp_Object frame)
|
|
566 {
|
|
567 if (NILP (frame))
|
|
568 return selected_frame ();
|
173
|
569
|
16
|
570 CHECK_LIVE_FRAME (frame);
|
173
|
571 return XFRAME (frame);
|
0
|
572 }
|
|
573
|
|
574 struct frame *
|
|
575 decode_frame_or_selected (Lisp_Object cdf)
|
|
576 {
|
|
577 if (CONSOLEP (cdf))
|
|
578 cdf = CONSOLE_SELECTED_DEVICE (decode_console (cdf));
|
|
579 if (DEVICEP (cdf))
|
|
580 cdf = DEVICE_SELECTED_FRAME (decode_device (cdf));
|
|
581 return decode_frame (cdf);
|
|
582 }
|
|
583
|
|
584 Lisp_Object
|
|
585 make_frame (struct frame *f)
|
|
586 {
|
272
|
587 Lisp_Object frame;
|
0
|
588 XSETFRAME (frame, f);
|
|
589 return frame;
|
|
590 }
|
|
591
|
|
592
|
|
593 /*
|
|
594 * window size changes are held up during critical regions. Afterwards,
|
|
595 * we want to deal with any delayed changes.
|
|
596 */
|
|
597 void
|
|
598 hold_frame_size_changes (void)
|
|
599 {
|
|
600 in_display = 1;
|
|
601 }
|
|
602
|
|
603 void
|
|
604 unhold_one_frame_size_changes (struct frame *f)
|
|
605 {
|
|
606 in_display = 0;
|
|
607
|
|
608 if (f->size_change_pending)
|
|
609 change_frame_size (f, f->new_height, f->new_width, 0);
|
|
610 }
|
|
611
|
|
612 void
|
|
613 unhold_frame_size_changes (void)
|
|
614 {
|
|
615 Lisp_Object frmcons, devcons, concons;
|
|
616
|
|
617 FRAME_LOOP_NO_BREAK (frmcons, devcons, concons)
|
|
618 unhold_one_frame_size_changes (XFRAME (XCAR (frmcons)));
|
|
619 }
|
|
620
|
|
621
|
|
622
|
20
|
623 DEFUN ("framep", Fframep, 1, 1, 0, /*
|
0
|
624 Return non-nil if OBJECT is a frame.
|
|
625 Also see `frame-live-p'.
|
|
626 Note that FSF Emacs kludgily returns a value indicating what type of
|
|
627 frame this is. Use the cleaner function `frame-type' for that.
|
20
|
628 */
|
|
629 (object))
|
0
|
630 {
|
16
|
631 return FRAMEP (object) ? Qt : Qnil;
|
0
|
632 }
|
|
633
|
20
|
634 DEFUN ("frame-live-p", Fframe_live_p, 1, 1, 0, /*
|
0
|
635 Return non-nil if OBJECT is a frame which has not been deleted.
|
20
|
636 */
|
|
637 (object))
|
0
|
638 {
|
16
|
639 return FRAMEP (object) && FRAME_LIVE_P (XFRAME (object)) ? Qt : Qnil;
|
0
|
640 }
|
|
641
|
|
642
|
|
643 /* Called from Fselect_window() */
|
|
644 void
|
|
645 select_frame_1 (Lisp_Object frame)
|
|
646 {
|
|
647 struct frame *f = XFRAME (frame);
|
|
648 Lisp_Object old_selected_frame = Fselected_frame (Qnil);
|
149
|
649
|
0
|
650 if (EQ (frame, old_selected_frame))
|
|
651 return;
|
|
652
|
|
653 /* now select the frame's device */
|
|
654 set_device_selected_frame (XDEVICE (FRAME_DEVICE (f)), frame);
|
|
655 select_device_1 (FRAME_DEVICE (f));
|
|
656
|
|
657 update_frame_window_mirror (f);
|
|
658 }
|
|
659
|
20
|
660 DEFUN ("select-frame", Fselect_frame, 1, 1, 0, /*
|
0
|
661 Select the frame FRAME.
|
|
662 Subsequent editing commands apply to its selected window.
|
|
663 The selection of FRAME lasts until the next time the user does
|
|
664 something to select a different frame, or until the next time this
|
|
665 function is called.
|
|
666
|
|
667 Note that this does not actually cause the window-system focus to
|
|
668 be set to this frame, or the select-frame-hook or deselect-frame-hook
|
|
669 to be run, until the next time that XEmacs is waiting for an event.
|
280
|
670
|
|
671 Also note that when focus-follows-mouse is non-nil, the frame
|
|
672 selection is temporary and is reverted when the current command
|
|
673 terminates, much like the buffer selected by `set-buffer'. In order
|
|
674 to effect a permanent focus change in this case, bind
|
|
675 focus-follows-mouse to nil, select the frame you want, and do
|
|
676 a (sit-for 0) within the scope of the binding.
|
20
|
677 */
|
|
678 (frame))
|
0
|
679 {
|
|
680 CHECK_LIVE_FRAME (frame);
|
|
681
|
|
682 /* select the frame's selected window. This will call
|
|
683 selected_frame_1(). */
|
|
684 Fselect_window (FRAME_SELECTED_WINDOW (XFRAME (frame)));
|
|
685
|
|
686 /* Nothing should be depending on the return value of this function.
|
|
687 But, of course, there is stuff out there which is. */
|
|
688 return frame;
|
|
689 }
|
|
690
|
|
691 /* use this to retrieve the currently selected frame. You should use
|
|
692 this in preference to Fselected_frame (Qnil) unless you are prepared
|
|
693 to handle the possibility of there being no selected frame (this
|
|
694 happens at some points during startup). */
|
|
695
|
|
696 struct frame *
|
|
697 selected_frame (void)
|
|
698 {
|
|
699 Lisp_Object device = Fselected_device (Qnil);
|
|
700 Lisp_Object frame = DEVICE_SELECTED_FRAME (XDEVICE (device));
|
|
701 if (NILP (frame))
|
|
702 signal_simple_error ("No frames exist on device", device);
|
|
703 return XFRAME (frame);
|
|
704 }
|
|
705
|
|
706 /* use this instead of XFRAME (DEVICE_SELECTED_FRAME (d)) to catch
|
|
707 the possibility of there being no frames on the device (just created).
|
|
708 There is no point doing this inside of redisplay because errors
|
|
709 cause an abort(), indicating a flaw in the logic, and error_check_frame()
|
|
710 will catch this just as well. */
|
|
711
|
|
712 struct frame *
|
|
713 device_selected_frame (struct device *d)
|
|
714 {
|
|
715 Lisp_Object frame = DEVICE_SELECTED_FRAME (d);
|
|
716 if (NILP (frame))
|
|
717 {
|
|
718 Lisp_Object device;
|
|
719 XSETDEVICE (device, d);
|
|
720 signal_simple_error ("No frames exist on device", device);
|
|
721 }
|
|
722 return XFRAME (frame);
|
|
723 }
|
|
724
|
|
725 #if 0 /* FSFmacs */
|
|
726
|
149
|
727 xxDEFUN ("handle-switch-frame", Fhandle_switch_frame, 1, 2, "e", /*
|
0
|
728 Handle a switch-frame event EVENT.
|
|
729 Switch-frame events are usually bound to this function.
|
|
730 A switch-frame event tells Emacs that the window manager has requested
|
|
731 that the user's events be directed to the frame mentioned in the event.
|
|
732 This function selects the selected window of the frame of EVENT.
|
|
733
|
|
734 If EVENT is frame object, handle it as if it were a switch-frame event
|
|
735 to that frame.
|
149
|
736 */
|
|
737 (frame, no_enter))
|
0
|
738 {
|
|
739 /* Preserve prefix arg that the command loop just cleared. */
|
|
740 XCONSOLE (Vselected_console)->prefix_arg = Vcurrent_prefix_arg;
|
|
741 #if 0 /* unclean! */
|
|
742 run_hook (Qmouse_leave_buffer_hook);
|
|
743 #endif
|
|
744 return do_switch_frame (frame, no_enter, 0);
|
|
745 }
|
|
746
|
173
|
747 /* A load of garbage. */
|
149
|
748 xxDEFUN ("ignore-event", Fignore_event, 0, 0, "", /*
|
0
|
749 Do nothing, but preserve any prefix argument already specified.
|
|
750 This is a suitable binding for iconify-frame and make-frame-visible.
|
149
|
751 */
|
|
752 ())
|
0
|
753 {
|
|
754 struct console *c = XCONSOLE (Vselected_console);
|
|
755
|
|
756 c->prefix_arg = Vcurrent_prefix_arg;
|
|
757 return Qnil;
|
|
758 }
|
|
759
|
149
|
760 #endif /* 0 */
|
0
|
761
|
20
|
762 DEFUN ("selected-frame", Fselected_frame, 0, 1, 0, /*
|
0
|
763 Return the frame that is now selected on device DEVICE.
|
|
764 If DEVICE is not specified, the selected device will be used.
|
|
765 If no frames exist on the device, nil is returned.
|
20
|
766 */
|
|
767 (device))
|
0
|
768 {
|
|
769 if (NILP (device) && NILP (Fselected_device (Qnil)))
|
|
770 return Qnil; /* happens early in temacs */
|
|
771 return DEVICE_SELECTED_FRAME (decode_device (device));
|
|
772 }
|
|
773
|
|
774 Lisp_Object
|
|
775 frame_first_window (struct frame *f)
|
|
776 {
|
|
777 Lisp_Object w = f->root_window;
|
|
778
|
|
779 while (1)
|
|
780 {
|
|
781 if (! NILP (XWINDOW (w)->hchild))
|
|
782 w = XWINDOW (w)->hchild;
|
|
783 else if (! NILP (XWINDOW (w)->vchild))
|
|
784 w = XWINDOW (w)->vchild;
|
|
785 else
|
|
786 break;
|
|
787 }
|
|
788
|
|
789 return w;
|
|
790 }
|
|
791
|
20
|
792 DEFUN ("active-minibuffer-window", Factive_minibuffer_window, 0, 0, 0, /*
|
0
|
793 Return the currently active minibuffer window, or nil if none.
|
20
|
794 */
|
|
795 ())
|
0
|
796 {
|
|
797 return minibuf_level ? minibuf_window : Qnil;
|
|
798 }
|
|
799
|
20
|
800 DEFUN ("last-nonminibuf-frame", Flast_nonminibuf_frame, 0, 1, 0, /*
|
0
|
801 Return the most-recently-selected non-minibuffer-only frame on CONSOLE.
|
|
802 This will always be the same as (selected-frame device) unless the
|
|
803 selected frame is a minibuffer-only frame.
|
|
804 CONSOLE defaults to the selected console if omitted.
|
20
|
805 */
|
|
806 (console))
|
0
|
807 {
|
|
808 Lisp_Object result;
|
|
809
|
|
810 XSETCONSOLE (console, decode_console (console));
|
|
811 /* Just in case the machinations in delete_frame_internal() resulted
|
|
812 in the last-nonminibuf-frame getting out of sync, make sure and
|
|
813 return the selected frame if it's acceptable. */
|
|
814 result = Fselected_frame (CONSOLE_SELECTED_DEVICE (XCONSOLE (console)));
|
|
815 if (!NILP (result) && !FRAME_MINIBUF_ONLY_P (XFRAME (result)))
|
|
816 return result;
|
|
817 return CONSOLE_LAST_NONMINIBUF_FRAME (XCONSOLE (console));
|
|
818 }
|
|
819
|
20
|
820 DEFUN ("frame-root-window", Fframe_root_window, 0, 1, 0, /*
|
0
|
821 Return the root-window of FRAME.
|
|
822 If omitted, FRAME defaults to the currently selected frame.
|
20
|
823 */
|
|
824 (frame))
|
0
|
825 {
|
272
|
826 struct frame *f = decode_frame (frame);
|
|
827 return FRAME_ROOT_WINDOW (f);
|
0
|
828 }
|
|
829
|
20
|
830 DEFUN ("frame-selected-window", Fframe_selected_window, 0, 1, 0, /*
|
0
|
831 Return the selected window of frame object FRAME.
|
|
832 If omitted, FRAME defaults to the currently selected frame.
|
20
|
833 */
|
|
834 (frame))
|
0
|
835 {
|
272
|
836 struct frame *f = decode_frame (frame);
|
|
837 return FRAME_SELECTED_WINDOW (f);
|
0
|
838 }
|
|
839
|
|
840 void
|
|
841 set_frame_selected_window (struct frame *f, Lisp_Object window)
|
|
842 {
|
|
843 assert (XFRAME (WINDOW_FRAME (XWINDOW (window))) == f);
|
|
844 f->selected_window = window;
|
|
845 if (!MINI_WINDOW_P (XWINDOW (window)) || FRAME_MINIBUF_ONLY_P (f))
|
|
846 f->last_nonminibuf_window = window;
|
|
847 }
|
|
848
|
20
|
849 DEFUN ("set-frame-selected-window", Fset_frame_selected_window, 2, 2, 0, /*
|
0
|
850 Set the selected window of frame object FRAME to WINDOW.
|
|
851 If FRAME is nil, the selected frame is used.
|
|
852 If FRAME is the selected frame, this makes WINDOW the selected window.
|
20
|
853 */
|
|
854 (frame, window))
|
0
|
855 {
|
|
856 XSETFRAME (frame, decode_frame (frame));
|
|
857 CHECK_LIVE_WINDOW (window);
|
|
858
|
|
859 if (! EQ (frame, WINDOW_FRAME (XWINDOW (window))))
|
|
860 error ("In `set-frame-selected-window', WINDOW is not on FRAME");
|
|
861
|
|
862 if (XFRAME (frame) == selected_frame ())
|
|
863 return Fselect_window (window);
|
|
864
|
|
865 set_frame_selected_window (XFRAME (frame), window);
|
|
866 return window;
|
|
867 }
|
|
868
|
|
869
|
20
|
870 DEFUN ("frame-device", Fframe_device, 0, 1, 0, /*
|
0
|
871 Return the device that FRAME is on.
|
|
872 If omitted, FRAME defaults to the currently selected frame.
|
20
|
873 */
|
|
874 (frame))
|
0
|
875 {
|
173
|
876 return FRAME_DEVICE (decode_frame (frame));
|
0
|
877 }
|
|
878
|
|
879 int
|
|
880 is_surrogate_for_selected_frame (struct frame *f)
|
|
881 {
|
|
882 struct device *d = XDEVICE (f->device);
|
|
883 struct frame *dsf = device_selected_frame (d);
|
|
884
|
|
885 /* Can't be a surrogate for ourselves. */
|
|
886 if (f == dsf)
|
|
887 return 0;
|
|
888
|
|
889 if (!FRAME_HAS_MINIBUF_P (dsf) &&
|
|
890 f == XFRAME (WINDOW_FRAME (XWINDOW (FRAME_MINIBUF_WINDOW (dsf)))))
|
|
891 return 1;
|
|
892 else
|
|
893 return 0;
|
|
894 }
|
|
895
|
|
896 static int
|
|
897 frame_matches_frametype (Lisp_Object frame, Lisp_Object type)
|
|
898 {
|
|
899 struct frame *f = XFRAME (frame);
|
|
900
|
|
901 if (WINDOWP (type))
|
|
902 {
|
|
903 CHECK_LIVE_WINDOW (type);
|
|
904
|
|
905 if (EQ (FRAME_MINIBUF_WINDOW (f), type)
|
|
906 /* Check that F either is, or has forwarded
|
|
907 its focus to, TYPE's frame. */
|
|
908 && (EQ (WINDOW_FRAME (XWINDOW (type)), frame)
|
|
909 || EQ (WINDOW_FRAME (XWINDOW (type)),
|
|
910 FRAME_FOCUS_FRAME (f))))
|
|
911 return 1;
|
|
912 else
|
|
913 return 0;
|
|
914 }
|
|
915
|
|
916 #if 0 /* FSFmacs */
|
|
917 if (EQ (type, Qvisible) || EQ (type, Qiconic) || EQ (type, Qvisible_iconic)
|
|
918 || EQ (type, Qvisible_nomini) || EQ (type, Qiconic_nomini)
|
|
919 || EQ (type, Qvisible_iconic_nomini))
|
|
920 FRAME_SAMPLE_VISIBILITY (f);
|
|
921 #endif
|
|
922
|
|
923 if (NILP (type))
|
|
924 type = Qnomini;
|
|
925 if (ZEROP (type))
|
88
|
926 type = Qvisible_iconic;
|
0
|
927
|
|
928 if (EQ (type, Qvisible))
|
|
929 return FRAME_VISIBLE_P (f);
|
|
930 if (EQ (type, Qiconic))
|
|
931 return FRAME_ICONIFIED_P (f);
|
|
932 if (EQ (type, Qinvisible))
|
|
933 return !FRAME_VISIBLE_P (f) && !FRAME_ICONIFIED_P (f);
|
|
934 if (EQ (type, Qvisible_iconic))
|
|
935 return FRAME_VISIBLE_P (f) || FRAME_ICONIFIED_P (f);
|
|
936 if (EQ (type, Qinvisible_iconic))
|
|
937 return !FRAME_VISIBLE_P (f);
|
|
938
|
|
939 if (EQ (type, Qnomini))
|
|
940 return !FRAME_MINIBUF_ONLY_P (f);
|
|
941 if (EQ (type, Qvisible_nomini))
|
|
942 return FRAME_VISIBLE_P (f) && !FRAME_MINIBUF_ONLY_P (f);
|
|
943 if (EQ (type, Qiconic_nomini))
|
|
944 return FRAME_ICONIFIED_P (f) && !FRAME_MINIBUF_ONLY_P (f);
|
|
945 if (EQ (type, Qinvisible_nomini))
|
|
946 return !FRAME_VISIBLE_P (f) && !FRAME_ICONIFIED_P (f) &&
|
|
947 !FRAME_MINIBUF_ONLY_P (f);
|
|
948 if (EQ (type, Qvisible_iconic_nomini))
|
|
949 return ((FRAME_VISIBLE_P (f) || FRAME_ICONIFIED_P (f))
|
|
950 && !FRAME_MINIBUF_ONLY_P (f));
|
|
951 if (EQ (type, Qinvisible_iconic_nomini))
|
|
952 return !FRAME_VISIBLE_P (f) && !FRAME_MINIBUF_ONLY_P (f);
|
173
|
953
|
0
|
954 return 1;
|
|
955 }
|
|
956
|
|
957 int
|
|
958 device_matches_console_spec (Lisp_Object frame, Lisp_Object device,
|
|
959 Lisp_Object console)
|
|
960 {
|
|
961 if (EQ (console, Qwindow_system))
|
|
962 return DEVICE_WIN_P (XDEVICE (device));
|
|
963 if (NILP (console))
|
|
964 console = (DEVICE_CONSOLE (XDEVICE (FRAME_DEVICE (XFRAME (frame)))));
|
|
965 if (DEVICEP (console))
|
|
966 return EQ (device, console);
|
|
967 if (CONSOLEP (console))
|
|
968 return EQ (DEVICE_CONSOLE (XDEVICE (device)), console);
|
|
969 if (valid_console_type_p (console))
|
|
970 return EQ (DEVICE_TYPE (XDEVICE (device)), console);
|
|
971 return 1;
|
|
972 }
|
|
973
|
|
974 /* Return the next frame in the frame list after FRAME.
|
|
975 FRAMETYPE and CONSOLE control which frames and devices
|
|
976 are considered; see `next-frame'. */
|
|
977
|
|
978 static Lisp_Object
|
|
979 next_frame_internal (Lisp_Object frame, Lisp_Object frametype,
|
|
980 Lisp_Object console, int called_from_delete_device)
|
|
981 {
|
|
982 int passed = 0;
|
|
983 int started_over = 0;
|
|
984
|
|
985 /* If this frame is dead, it won't be in frame_list, and we'll loop
|
|
986 forever. Forestall that. */
|
|
987 CHECK_LIVE_FRAME (frame);
|
|
988
|
|
989 while (1)
|
|
990 {
|
|
991 Lisp_Object devcons, concons;
|
|
992
|
|
993 DEVICE_LOOP_NO_BREAK (devcons, concons)
|
|
994 {
|
|
995 Lisp_Object device = XCAR (devcons);
|
|
996 Lisp_Object frmcons;
|
|
997
|
|
998 if (!device_matches_console_spec (frame, device, console))
|
|
999 continue;
|
|
1000
|
|
1001 DEVICE_FRAME_LOOP (frmcons, XDEVICE (device))
|
|
1002 {
|
|
1003 Lisp_Object f = XCAR (frmcons);
|
|
1004 if (passed)
|
|
1005 {
|
|
1006 /* #### Doing this here is bad and is now
|
|
1007 unnecessary. The real bug was that f->iconified
|
|
1008 was never, ever updated unless a user explicitly
|
|
1009 called frame-iconified-p. That has now been
|
|
1010 fixed. With this change removed all of the other
|
|
1011 changes made to support this routine having the
|
|
1012 called_from_delete_device arg could be removed.
|
|
1013 But it is too close to release to do that now. */
|
|
1014 #if 0
|
|
1015 /* Make sure the visibility and iconified flags are
|
|
1016 up-to-date unless we're being deleted. */
|
|
1017 if (!called_from_delete_device)
|
|
1018 {
|
|
1019 Fframe_iconified_p (f);
|
|
1020 Fframe_visible_p (f);
|
|
1021 }
|
|
1022 #endif
|
|
1023
|
|
1024 /* Decide whether this frame is eligible to be returned. */
|
173
|
1025
|
0
|
1026 /* If we've looped all the way around without finding any
|
|
1027 eligible frames, return the original frame. */
|
|
1028 if (EQ (f, frame))
|
|
1029 return f;
|
|
1030
|
155
|
1031 if (frame_matches_frametype (f, frametype))
|
0
|
1032 return f;
|
|
1033 }
|
173
|
1034
|
0
|
1035 if (EQ (frame, f))
|
|
1036 passed++;
|
|
1037 }
|
|
1038 }
|
|
1039 /* We hit the end of the list, and need to start over again. */
|
|
1040 if (started_over)
|
|
1041 return Qnil;
|
|
1042 started_over++;
|
|
1043 }
|
|
1044 }
|
|
1045
|
|
1046 Lisp_Object
|
|
1047 next_frame (Lisp_Object frame, Lisp_Object frametype, Lisp_Object console)
|
|
1048 {
|
|
1049 return next_frame_internal (frame, frametype, console, 0);
|
|
1050 }
|
|
1051
|
|
1052 /* Return the previous frame in the frame list before FRAME.
|
|
1053 FRAMETYPE and CONSOLE control which frames and devices
|
|
1054 are considered; see `next-frame'. */
|
|
1055
|
|
1056 Lisp_Object
|
|
1057 prev_frame (Lisp_Object frame, Lisp_Object frametype, Lisp_Object console)
|
|
1058 {
|
|
1059 Lisp_Object devcons, concons;
|
|
1060 Lisp_Object prev;
|
|
1061
|
|
1062 /* If this frame is dead, it won't be in frame_list, and we'll loop
|
|
1063 forever. Forestall that. */
|
|
1064 CHECK_LIVE_FRAME (frame);
|
|
1065
|
|
1066 prev = Qnil;
|
|
1067 DEVICE_LOOP_NO_BREAK (devcons, concons)
|
|
1068 {
|
|
1069 Lisp_Object device = XCAR (devcons);
|
|
1070 Lisp_Object frmcons;
|
|
1071
|
|
1072 if (!device_matches_console_spec (frame, device, console))
|
|
1073 continue;
|
|
1074
|
|
1075 DEVICE_FRAME_LOOP (frmcons, XDEVICE (device))
|
|
1076 {
|
|
1077 Lisp_Object f = XCAR (frmcons);
|
173
|
1078
|
0
|
1079 if (EQ (frame, f) && !NILP (prev))
|
|
1080 return prev;
|
173
|
1081
|
0
|
1082 /* Decide whether this frame is eligible to be returned,
|
|
1083 according to frametype. */
|
|
1084
|
155
|
1085 if (frame_matches_frametype (f, frametype))
|
0
|
1086 prev = f;
|
|
1087
|
|
1088 }
|
|
1089 }
|
|
1090
|
|
1091 /* We've scanned the entire list. */
|
|
1092 if (NILP (prev))
|
|
1093 /* We went through the whole frame list without finding a single
|
|
1094 acceptable frame. Return the original frame. */
|
|
1095 return frame;
|
|
1096 else
|
|
1097 /* There were no acceptable frames in the list before FRAME; otherwise,
|
|
1098 we would have returned directly from the loop. Since PREV is the last
|
|
1099 acceptable frame in the list, return it. */
|
|
1100 return prev;
|
|
1101 }
|
|
1102
|
20
|
1103 DEFUN ("next-frame", Fnext_frame, 0, 3, 0, /*
|
0
|
1104 Return the next frame of the right type in the frame list after FRAME.
|
|
1105 FRAMETYPE controls which frames are eligible to be returned; all
|
|
1106 others will be skipped. Note that if there is only one eligible
|
|
1107 frame, then `next-frame' called repeatedly will always return
|
|
1108 the same frame, and if there is no eligible frame, then FRAME is
|
|
1109 returned.
|
|
1110
|
|
1111 Possible values for FRAMETYPE are
|
|
1112
|
|
1113 'visible Consider only frames that are visible.
|
|
1114 'iconic Consider only frames that are iconic.
|
|
1115 'invisible Consider only frames that are invisible
|
|
1116 (this is different from iconic).
|
|
1117 'visible-iconic Consider frames that are visible or iconic.
|
|
1118 'invisible-iconic Consider frames that are invisible or iconic.
|
|
1119 'nomini Consider all frames except minibuffer-only ones.
|
|
1120 'visible-nomini Like `visible' but omits minibuffer-only frames.
|
|
1121 'iconic-nomini Like `iconic' but omits minibuffer-only frames.
|
|
1122 'invisible-nomini Like `invisible' but omits minibuffer-only frames.
|
|
1123 'visible-iconic-nomini Like `visible-iconic' but omits minibuffer-only
|
|
1124 frames.
|
|
1125 'invisible-iconic-nomini Like `invisible-iconic' but omits minibuffer-only
|
|
1126 frames.
|
|
1127 any other value Consider all frames.
|
|
1128
|
|
1129 If FRAMETYPE is omitted, 'nomini is used. A FRAMETYPE of 0 (a number)
|
|
1130 is treated like 'iconic, for backwards compatibility.
|
|
1131
|
|
1132 If FRAMETYPE is a window, include only its own frame and any frame now
|
|
1133 using that window as the minibuffer.
|
|
1134
|
|
1135 Optional third argument CONSOLE controls which consoles or devices the
|
|
1136 returned frame may be on. If CONSOLE is a console, return frames only
|
|
1137 on that console. If CONSOLE is a device, return frames only on that
|
|
1138 device. If CONSOLE is a console type, return frames only on consoles
|
|
1139 of that type. If CONSOLE is 'window-system, return any frames on any
|
|
1140 window-system consoles. If CONSOLE is nil or omitted, return frames only
|
|
1141 on the FRAME's console. Otherwise, all frames are considered.
|
20
|
1142 */
|
|
1143 (frame, frametype, console))
|
0
|
1144 {
|
|
1145 XSETFRAME (frame, decode_frame (frame));
|
|
1146
|
173
|
1147 return next_frame (frame, frametype, console);
|
0
|
1148 }
|
|
1149
|
20
|
1150 DEFUN ("previous-frame", Fprevious_frame, 0, 3, 0, /*
|
0
|
1151 Return the next frame of the right type in the frame list after FRAME.
|
|
1152 FRAMETYPE controls which frames are eligible to be returned; all
|
|
1153 others will be skipped. Note that if there is only one eligible
|
|
1154 frame, then `previous-frame' called repeatedly will always return
|
|
1155 the same frame, and if there is no eligible frame, then FRAME is
|
|
1156 returned.
|
|
1157
|
|
1158 See `next-frame' for an explanation of the FRAMETYPE and CONSOLE
|
|
1159 arguments.
|
20
|
1160 */
|
|
1161 (frame, frametype, console))
|
0
|
1162 {
|
|
1163 XSETFRAME (frame, decode_frame (frame));
|
|
1164
|
173
|
1165 return prev_frame (frame, frametype, console);
|
0
|
1166 }
|
|
1167
|
|
1168 /* Return any frame for which PREDICATE is non-zero, or return Qnil
|
|
1169 if there aren't any. */
|
|
1170
|
|
1171 Lisp_Object
|
|
1172 find_some_frame (int (*predicate) (Lisp_Object, void *),
|
|
1173 void *closure)
|
|
1174 {
|
|
1175 Lisp_Object framecons, devcons, concons;
|
|
1176
|
|
1177 FRAME_LOOP_NO_BREAK (framecons, devcons, concons)
|
|
1178 {
|
|
1179 Lisp_Object frame = XCAR (framecons);
|
|
1180
|
|
1181 if ((predicate) (frame, closure))
|
|
1182 return frame;
|
|
1183 }
|
|
1184
|
|
1185 return Qnil;
|
|
1186 }
|
|
1187
|
|
1188
|
|
1189
|
272
|
1190 /* extern void free_line_insertion_deletion_costs (struct frame *f); */
|
0
|
1191
|
|
1192 /* Return 1 if it is ok to delete frame F;
|
|
1193 0 if all frames aside from F are invisible.
|
|
1194 (Exception: if F is a stream frame, it's OK to delete if
|
|
1195 any other frames exist.) */
|
|
1196
|
|
1197 static int
|
|
1198 other_visible_frames_internal (struct frame *f, int called_from_delete_device)
|
|
1199 {
|
16
|
1200 Lisp_Object frame;
|
0
|
1201
|
|
1202 XSETFRAME (frame, f);
|
|
1203 if (FRAME_STREAM_P (f))
|
|
1204 return !EQ (frame, next_frame_internal (frame, Qt, Qt,
|
|
1205 called_from_delete_device));
|
|
1206 return !EQ (frame, next_frame_internal (frame, Qvisible_iconic_nomini, Qt,
|
|
1207 called_from_delete_device));
|
|
1208 }
|
|
1209
|
|
1210 int
|
|
1211 other_visible_frames (struct frame *f)
|
|
1212 {
|
|
1213 return other_visible_frames_internal (f, 0);
|
|
1214 }
|
|
1215
|
|
1216 /* Delete frame F.
|
|
1217
|
|
1218 If FORCE is non-zero, allow deletion of the only frame.
|
|
1219
|
|
1220 If CALLED_FROM_DELETE_DEVICE is non-zero, then, if
|
|
1221 deleting the last frame on a device, just delete it,
|
|
1222 instead of calling `delete-device'.
|
|
1223
|
|
1224 If FROM_IO_ERROR is non-zero, then the frame is gone due
|
|
1225 to an I/O error. This affects what happens if we exit
|
|
1226 (we do an emergency exit instead of `save-buffers-kill-emacs'.)
|
|
1227 */
|
|
1228
|
|
1229 void
|
|
1230 delete_frame_internal (struct frame *f, int force,
|
|
1231 int called_from_delete_device,
|
|
1232 int from_io_error)
|
|
1233 {
|
|
1234 /* This function can GC */
|
|
1235 int minibuffer_selected;
|
|
1236 struct device *d;
|
|
1237 struct console *con;
|
16
|
1238 Lisp_Object frame;
|
0
|
1239 Lisp_Object device;
|
|
1240 Lisp_Object console;
|
|
1241 struct gcpro gcpro1;
|
|
1242
|
|
1243 /* OK to delete an already deleted frame. */
|
|
1244 if (! FRAME_LIVE_P (f))
|
|
1245 return;
|
|
1246
|
|
1247 XSETFRAME (frame, f);
|
|
1248 GCPRO1 (frame);
|
|
1249
|
|
1250 device = FRAME_DEVICE (f);
|
|
1251 d = XDEVICE (device);
|
|
1252 console = DEVICE_CONSOLE (d);
|
|
1253 con = XCONSOLE (console);
|
|
1254
|
|
1255 if (!called_from_delete_device)
|
|
1256 {
|
|
1257 /* If we're deleting the only non-minibuffer frame on the
|
|
1258 device, delete the device. */
|
|
1259 if (EQ (frame, next_frame (frame, Qnomini, FRAME_DEVICE (f))))
|
|
1260 {
|
|
1261 delete_device_internal (d, force, 0, from_io_error);
|
|
1262 UNGCPRO;
|
|
1263 return;
|
|
1264 }
|
|
1265 }
|
|
1266
|
|
1267 /* In FSF, delete-frame will not normally allow you to delete the
|
|
1268 last visible frame. This was too annoying, so we changed it to the
|
|
1269 only frame. However, this would let people shoot themselves by
|
|
1270 deleting all frames which were either visible or iconified and thus
|
|
1271 losing any way of communicating with the still running XEmacs process.
|
|
1272 So we put it back. */
|
146
|
1273 if (!force && !allow_deletion_of_last_visible_frame &&
|
0
|
1274 !other_visible_frames_internal (f, called_from_delete_device))
|
|
1275 error ("Attempt to delete the sole visible or iconified frame");
|
|
1276
|
|
1277 /* Does this frame have a minibuffer, and is it the surrogate
|
|
1278 minibuffer for any other frame? */
|
|
1279 if (FRAME_HAS_MINIBUF_P (f))
|
|
1280 {
|
|
1281 Lisp_Object frmcons, devcons, concons;
|
|
1282
|
|
1283 FRAME_LOOP_NO_BREAK (frmcons, devcons, concons)
|
|
1284 {
|
|
1285 Lisp_Object this = XCAR (frmcons);
|
|
1286
|
|
1287 if (! EQ (this, frame)
|
|
1288 && EQ (frame, (WINDOW_FRAME
|
|
1289 (XWINDOW
|
|
1290 (FRAME_MINIBUF_WINDOW (XFRAME (this)))))))
|
|
1291 {
|
|
1292 /* We've found another frame whose minibuffer is on
|
|
1293 this frame. */
|
|
1294 signal_simple_error
|
|
1295 ("Attempt to delete a surrogate minibuffer frame", frame);
|
|
1296 }
|
|
1297 }
|
|
1298 }
|
|
1299
|
96
|
1300 /* Test for popup frames hanging around. */
|
|
1301 /* Deletion of a parent frame with popups is deadly. */
|
|
1302 {
|
|
1303 Lisp_Object frmcons, devcons, concons;
|
|
1304
|
|
1305 FRAME_LOOP_NO_BREAK (frmcons, devcons, concons)
|
|
1306 {
|
|
1307 Lisp_Object this = XCAR (frmcons);
|
|
1308
|
|
1309
|
272
|
1310 if (! EQ (this, frame))
|
96
|
1311 {
|
272
|
1312 struct device *devcons_d = XDEVICE (XCAR (devcons));
|
|
1313 if (EQ (frame, DEVMETH_OR_GIVEN (devcons_d, get_frame_parent,
|
|
1314 (XFRAME (this)),
|
|
1315 Qnil)))
|
|
1316 /* We've found a popup frame whose parent is this frame. */
|
|
1317 signal_simple_error
|
|
1318 ("Attempt to delete a frame with live popups", frame);
|
96
|
1319 }
|
|
1320 }
|
|
1321 }
|
|
1322
|
16
|
1323 /* Before here, we haven't made any dangerous changes (just checked for
|
|
1324 error conditions). Now run the delete-frame-hook. Remember that
|
|
1325 user code there could do any number of dangerous things, including
|
|
1326 signalling an error. */
|
|
1327
|
|
1328 va_run_hook_with_args (Qdelete_frame_hook, 1, frame);
|
|
1329
|
|
1330 if (!FRAME_LIVE_P (f)) /* Make sure the delete-frame-hook didn't */
|
|
1331 { /* go ahead and delete anything. */
|
|
1332 UNGCPRO;
|
|
1333 return;
|
|
1334 }
|
|
1335
|
|
1336 /* Call the delete-device-hook and delete-console-hook now if
|
|
1337 appropriate, before we do any dangerous things -- they too could
|
|
1338 signal an error. */
|
|
1339 if (XINT (Flength (DEVICE_FRAME_LIST (d))) == 1)
|
|
1340 {
|
|
1341 va_run_hook_with_args (Qdelete_device_hook, 1, device);
|
|
1342 if (!FRAME_LIVE_P (f)) /* Make sure the delete-device-hook didn't */
|
20
|
1343 { /* go ahead and delete anything. */
|
16
|
1344 UNGCPRO;
|
|
1345 return;
|
|
1346 }
|
|
1347
|
|
1348 if (XINT (Flength (CONSOLE_DEVICE_LIST (con))) == 1)
|
|
1349 {
|
|
1350 va_run_hook_with_args (Qdelete_console_hook, 1, console);
|
|
1351 if (!FRAME_LIVE_P (f)) /* Make sure the delete-console-hook didn't */
|
|
1352 { /* go ahead and delete anything. */
|
|
1353 UNGCPRO;
|
|
1354 return;
|
|
1355 }
|
|
1356 }
|
|
1357 }
|
|
1358
|
0
|
1359 minibuffer_selected = EQ (minibuf_window, Fselected_window (Qnil));
|
|
1360
|
2
|
1361 /* If we were focused on this frame, then we're not any more.
|
0
|
1362 Assume that we lost the focus; that way, the call to
|
|
1363 Fselect_frame() below won't end up making us explicitly
|
|
1364 focus on another frame, which is generally undesirable in
|
|
1365 a point-to-type world. If our mouse ends up sitting over
|
|
1366 another frame, we will receive a FocusIn event and end up
|
|
1367 making that frame the selected frame.
|
|
1368
|
|
1369 #### This may not be an ideal solution in a click-to-type
|
|
1370 world (in that case, we might want to explicitly choose
|
|
1371 another frame to have the focus, rather than relying on
|
|
1372 the WM, which might focus on a frame in a different app
|
|
1373 or focus on nothing at all). But there's no easy way
|
|
1374 to detect which focus model we're running on, and the
|
|
1375 alternative is more heinous. */
|
|
1376
|
|
1377 if (EQ (frame, DEVICE_FRAME_WITH_FOCUS_REAL (d)))
|
|
1378 DEVICE_FRAME_WITH_FOCUS_REAL (d) = Qnil;
|
|
1379 if (EQ (frame, DEVICE_FRAME_WITH_FOCUS_FOR_HOOKS (d)))
|
|
1380 DEVICE_FRAME_WITH_FOCUS_FOR_HOOKS (d) = Qnil;
|
|
1381 if (EQ (frame, DEVICE_FRAME_THAT_OUGHT_TO_HAVE_FOCUS (d)))
|
|
1382 DEVICE_FRAME_THAT_OUGHT_TO_HAVE_FOCUS (d) = Qnil;
|
|
1383
|
16
|
1384 /* Don't allow the deleted frame to remain selected.
|
0
|
1385 Note that in the former scheme of things, this would
|
|
1386 have caused us to regain the focus. This no longer
|
|
1387 applies (see above); I think the new behavior is more
|
|
1388 logical. If someone disagrees, it can always be
|
16
|
1389 changed (or a new user variable can be introduced, ugh.) */
|
0
|
1390 if (EQ (frame, DEVICE_SELECTED_FRAME (d)))
|
|
1391 {
|
|
1392 Lisp_Object next;
|
|
1393
|
|
1394 /* If this is a popup frame, select its parent if possible.
|
|
1395 Otherwise, find another visible frame; if none, just take any frame.
|
|
1396 First try the same device, then the same console. */
|
|
1397
|
|
1398 next = DEVMETH_OR_GIVEN (d, get_frame_parent, (f), Qnil);
|
|
1399 if (NILP (next) || EQ (next, frame) || ! FRAME_LIVE_P (XFRAME (next)))
|
|
1400 next = next_frame_internal (frame, Qvisible, device,
|
|
1401 called_from_delete_device);
|
|
1402 if (NILP (next) || EQ (next, frame))
|
|
1403 next = next_frame_internal (frame, Qvisible, console,
|
|
1404 called_from_delete_device);
|
|
1405 if (NILP (next) || EQ (next, frame))
|
|
1406 next = next_frame_internal (frame, Qvisible, Qt,
|
|
1407 called_from_delete_device);
|
|
1408 if (NILP (next) || EQ (next, frame))
|
|
1409 next = next_frame_internal (frame, Qt, device,
|
|
1410 called_from_delete_device);
|
|
1411 if (NILP (next) || EQ (next, frame))
|
|
1412 next = next_frame_internal (frame, Qt, console,
|
|
1413 called_from_delete_device);
|
|
1414 if (NILP (next) || EQ (next, frame))
|
|
1415 next = next_frame_internal (frame, Qt, Qt, called_from_delete_device);
|
165
|
1416
|
|
1417 /* if we haven't found another frame at this point
|
|
1418 then there aren't any. */
|
0
|
1419 if (NILP (next) || EQ (next, frame))
|
|
1420 ;
|
|
1421 else
|
165
|
1422 {
|
|
1423 int did_select = 0;
|
|
1424 /* if this is the global selected frame, select another one. */
|
|
1425 if (EQ (frame, Fselected_frame (Qnil)))
|
|
1426 {
|
|
1427 Fselect_frame (next);
|
|
1428 did_select = 1;
|
|
1429 }
|
|
1430 /*
|
|
1431 * If the new frame we just selected is on a different
|
173
|
1432 * device then we still need to change DEVICE_SELECTED_FRAME(d)
|
165
|
1433 * to a live frame, if there are any left on this device.
|
|
1434 */
|
|
1435 if (!EQ (device, FRAME_DEVICE(XFRAME(next))))
|
|
1436 {
|
|
1437 Lisp_Object next_f =
|
|
1438 next_frame_internal (frame, Qt, device,
|
|
1439 called_from_delete_device);
|
|
1440 if (NILP (next_f) || EQ (next_f, frame))
|
|
1441 ;
|
|
1442 else
|
|
1443 set_device_selected_frame (d, next_f);
|
|
1444 }
|
|
1445 else if (! did_select)
|
|
1446 set_device_selected_frame (d, next);
|
|
1447
|
|
1448 }
|
0
|
1449 }
|
|
1450
|
|
1451 /* Don't allow minibuf_window to remain on a deleted frame. */
|
|
1452 if (EQ (f->minibuffer_window, minibuf_window))
|
|
1453 {
|
|
1454 struct frame *sel_frame = selected_frame ();
|
|
1455 Fset_window_buffer (sel_frame->minibuffer_window,
|
|
1456 XWINDOW (minibuf_window)->buffer);
|
|
1457 minibuf_window = sel_frame->minibuffer_window;
|
|
1458
|
|
1459 /* If the dying minibuffer window was selected,
|
|
1460 select the new one. */
|
|
1461 if (minibuffer_selected)
|
|
1462 Fselect_window (minibuf_window);
|
|
1463 }
|
|
1464
|
|
1465 /* After this point, no errors must be allowed to occur. */
|
|
1466
|
|
1467 #ifdef HAVE_MENUBARS
|
|
1468 free_frame_menubars (f);
|
|
1469 #endif
|
|
1470 #ifdef HAVE_SCROLLBARS
|
|
1471 free_frame_scrollbars (f);
|
|
1472 #endif
|
|
1473 #ifdef HAVE_TOOLBARS
|
|
1474 free_frame_toolbars (f);
|
|
1475 #endif
|
|
1476
|
|
1477 /* This must be done before the window and window_mirror structures
|
|
1478 are freed. The scrollbar information is attached to them. */
|
|
1479 MAYBE_FRAMEMETH (f, delete_frame, (f));
|
|
1480
|
|
1481 /* Mark all the windows that used to be on FRAME as deleted, and then
|
|
1482 remove the reference to them. */
|
|
1483 delete_all_subwindows (XWINDOW (f->root_window));
|
|
1484 f->root_window = Qnil;
|
|
1485
|
|
1486 /* Remove the frame now from the list. This way, any events generated
|
16
|
1487 on this frame by the maneuvers below will disperse themselves. */
|
|
1488
|
|
1489 /* This used to be Fdelq(), but that will cause a seg fault if the
|
|
1490 QUIT checker happens to get invoked, because the frame list is in
|
|
1491 an inconsistent state. */
|
|
1492 d->frame_list = delq_no_quit (frame, d->frame_list);
|
|
1493 RESET_CHANGED_SET_FLAGS;
|
0
|
1494
|
|
1495 f->dead = 1;
|
|
1496 f->visible = 0;
|
|
1497
|
|
1498 free_window_mirror (f->root_mirror);
|
|
1499 /* free_line_insertion_deletion_costs (f); */
|
|
1500
|
|
1501 /* If we've deleted the last non-minibuf frame, then try to find
|
|
1502 another one. */
|
|
1503 if (EQ (frame, CONSOLE_LAST_NONMINIBUF_FRAME (con)))
|
|
1504 {
|
2
|
1505 Lisp_Object frmcons, devcons;
|
173
|
1506
|
0
|
1507 set_console_last_nonminibuf_frame (con, Qnil);
|
173
|
1508
|
0
|
1509 CONSOLE_FRAME_LOOP_NO_BREAK (frmcons, devcons, con)
|
|
1510 {
|
|
1511 Lisp_Object ecran = XCAR (frmcons);
|
|
1512 if (!FRAME_MINIBUF_ONLY_P (XFRAME (ecran)))
|
|
1513 {
|
|
1514 set_console_last_nonminibuf_frame (con, ecran);
|
|
1515 goto double_break_1;
|
|
1516 }
|
|
1517 }
|
|
1518 }
|
|
1519 double_break_1:
|
|
1520
|
280
|
1521 #if 0
|
|
1522 /* The following test is degenerate FALSE */
|
|
1523 if (called_from_delete_device < 0)
|
0
|
1524 /* then we're being called from delete-console, and we shouldn't
|
|
1525 try to find another default-minibuffer frame for the console.
|
|
1526 */
|
|
1527 con->default_minibuffer_frame = Qnil;
|
280
|
1528 #endif
|
0
|
1529
|
|
1530 /* If we've deleted this console's default_minibuffer_frame, try to
|
|
1531 find another one. Prefer minibuffer-only frames, but also notice
|
|
1532 frames with other windows. */
|
|
1533 if (EQ (frame, con->default_minibuffer_frame))
|
|
1534 {
|
|
1535 Lisp_Object frmcons, devcons;
|
|
1536 /* The last frame we saw with a minibuffer, minibuffer-only or not. */
|
|
1537 Lisp_Object frame_with_minibuf;
|
16
|
1538 /* Some frame we found on the same console, or nil if there are none. */
|
0
|
1539 Lisp_Object frame_on_same_console;
|
|
1540
|
|
1541 frame_on_same_console = Qnil;
|
|
1542 frame_with_minibuf = Qnil;
|
|
1543
|
|
1544 set_console_last_nonminibuf_frame (con, Qnil);
|
|
1545
|
|
1546 CONSOLE_FRAME_LOOP_NO_BREAK (frmcons, devcons, con)
|
|
1547 {
|
|
1548 Lisp_Object this;
|
|
1549 struct frame *f1;
|
|
1550
|
|
1551 this = XCAR (frmcons);
|
|
1552 f1 = XFRAME (this);
|
|
1553
|
|
1554 /* Consider only frames on the same console
|
|
1555 and only those with minibuffers. */
|
|
1556 if (FRAME_HAS_MINIBUF_P (f1))
|
|
1557 {
|
|
1558 frame_with_minibuf = this;
|
|
1559 if (FRAME_MINIBUF_ONLY_P (f1))
|
|
1560 goto double_break_2;
|
|
1561 }
|
|
1562
|
|
1563 frame_on_same_console = this;
|
|
1564 }
|
|
1565 double_break_2:
|
|
1566
|
|
1567 if (!NILP (frame_on_same_console))
|
|
1568 {
|
|
1569 /* We know that there must be some frame with a minibuffer out
|
|
1570 there. If this were not true, all of the frames present
|
16
|
1571 would have to be minibuffer-less, which implies that at some
|
0
|
1572 point their minibuffer frames must have been deleted, but
|
|
1573 that is prohibited at the top; you can't delete surrogate
|
|
1574 minibuffer frames. */
|
|
1575 if (NILP (frame_with_minibuf))
|
|
1576 abort ();
|
|
1577
|
|
1578 con->default_minibuffer_frame = frame_with_minibuf;
|
|
1579 }
|
|
1580 else
|
|
1581 /* No frames left on this console--say no minibuffer either. */
|
|
1582 con->default_minibuffer_frame = Qnil;
|
|
1583 }
|
|
1584
|
|
1585 nuke_all_frame_slots (f); /* nobody should be accessing the device
|
|
1586 or anything else any more, and making
|
16
|
1587 them Qnil allows for better GC'ing
|
0
|
1588 in case a pointer to the dead frame
|
16
|
1589 continues to hang around. */
|
0
|
1590 f->framemeths = dead_console_methods;
|
|
1591 UNGCPRO;
|
|
1592 }
|
|
1593
|
|
1594 void
|
|
1595 io_error_delete_frame (Lisp_Object frame)
|
|
1596 {
|
|
1597 delete_frame_internal (XFRAME (frame), 1, 0, 1);
|
|
1598 }
|
|
1599
|
20
|
1600 DEFUN ("delete-frame", Fdelete_frame, 0, 2, "", /*
|
0
|
1601 Delete FRAME, permanently eliminating it from use.
|
|
1602 If omitted, FRAME defaults to the selected frame.
|
|
1603 A frame may not be deleted if its minibuffer is used by other frames.
|
|
1604 Normally, you cannot delete the last non-minibuffer-only frame (you must
|
|
1605 use `save-buffers-kill-emacs' or `kill-emacs'). However, if optional
|
|
1606 second argument FORCE is non-nil, you can delete the last frame. (This
|
|
1607 will automatically call `save-buffers-kill-emacs'.)
|
20
|
1608 */
|
|
1609 (frame, force))
|
0
|
1610 {
|
|
1611 /* This function can GC */
|
|
1612 struct frame *f;
|
|
1613
|
|
1614 if (NILP (frame))
|
|
1615 {
|
|
1616 f = selected_frame ();
|
|
1617 XSETFRAME (frame, f);
|
|
1618 }
|
|
1619 else
|
|
1620 {
|
|
1621 CHECK_FRAME (frame);
|
|
1622 f = XFRAME (frame);
|
|
1623 }
|
|
1624
|
|
1625 delete_frame_internal (f, !NILP (force), 0, 0);
|
|
1626 return Qnil;
|
|
1627 }
|
|
1628
|
|
1629
|
|
1630 /* Return mouse position in character cell units. */
|
|
1631
|
272
|
1632 static int
|
|
1633 mouse_pixel_position_1 (struct device *d, Lisp_Object *frame,
|
|
1634 int *x, int *y)
|
|
1635 {
|
|
1636 switch (DEVMETH_OR_GIVEN (d, get_mouse_position, (d, frame, x, y), -1))
|
|
1637 {
|
|
1638 case 1:
|
|
1639 return 1;
|
|
1640
|
|
1641 case 0:
|
|
1642 *frame = Qnil;
|
|
1643 break;
|
|
1644
|
|
1645 case -1:
|
|
1646 *frame = DEVICE_SELECTED_FRAME (d);
|
|
1647 break;
|
|
1648
|
|
1649 default:
|
|
1650 abort (); /* method is incorrectly written */
|
|
1651 }
|
|
1652
|
|
1653 return 0;
|
|
1654 }
|
|
1655
|
|
1656 DEFUN ("mouse-pixel-position", Fmouse_pixel_position, 0, 1, 0, /*
|
|
1657 Return a list (WINDOW X . Y) giving the current mouse window and position.
|
|
1658 The position is given in pixel units, where (0, 0) is the
|
|
1659 upper-left corner.
|
|
1660
|
|
1661 DEVICE specifies the device on which to read the mouse position, and
|
|
1662 defaults to the selected device. If the device is a mouseless terminal
|
|
1663 or Emacs hasn't been programmed to read its mouse position, it returns
|
|
1664 the device's selected window for WINDOW and nil for X and Y.
|
|
1665 */
|
|
1666 (device))
|
|
1667 {
|
|
1668 struct device *d = decode_device (device);
|
|
1669 Lisp_Object frame;
|
|
1670 Lisp_Object window;
|
|
1671 Lisp_Object x = Qnil;
|
|
1672 Lisp_Object y = Qnil;
|
|
1673 int intx, inty;
|
|
1674
|
|
1675 if (mouse_pixel_position_1 (d, &frame, &intx, &inty))
|
|
1676 {
|
|
1677 struct window *w =
|
|
1678 find_window_by_pixel_pos (intx, inty, XFRAME (frame)->root_window);
|
|
1679 if (!w)
|
|
1680 window = Qnil;
|
|
1681 else
|
|
1682 {
|
|
1683 XSETWINDOW (window, w);
|
|
1684
|
|
1685 /* Adjust the position to be relative to the window. */
|
|
1686 intx -= w->pixel_left;
|
|
1687 inty -= w->pixel_top;
|
|
1688 XSETINT (x, intx);
|
|
1689 XSETINT (y, inty);
|
|
1690 }
|
|
1691 }
|
|
1692 else
|
|
1693 {
|
|
1694 if (FRAMEP (frame))
|
|
1695 window = FRAME_SELECTED_WINDOW (XFRAME (frame));
|
|
1696 else
|
|
1697 window = Qnil;
|
|
1698 }
|
|
1699
|
|
1700 return Fcons (window, Fcons (x, y));
|
|
1701 }
|
|
1702
|
20
|
1703 DEFUN ("mouse-position", Fmouse_position, 0, 1, 0, /*
|
0
|
1704 Return a list (WINDOW X . Y) giving the current mouse window and position.
|
|
1705 The position is given in character cells, where (0, 0) is the
|
|
1706 upper-left corner of the window.
|
|
1707
|
|
1708 DEVICE specifies the device on which to read the mouse position, and
|
|
1709 defaults to the selected device. If the device is a mouseless terminal
|
|
1710 or Emacs hasn't been programmed to read its mouse position, it returns
|
|
1711 the device's selected window for WINDOW and nil for X and Y.
|
20
|
1712 */
|
|
1713 (device))
|
0
|
1714 {
|
|
1715 Lisp_Object val = Fmouse_pixel_position (device);
|
|
1716 int x, y, obj_x, obj_y;
|
|
1717 struct window *w;
|
|
1718 struct frame *f;
|
|
1719 Bufpos bufpos, closest;
|
|
1720 Charcount modeline_closest;
|
|
1721 Lisp_Object obj1, obj2;
|
|
1722
|
|
1723 if (NILP (XCAR (val)) || NILP (XCAR (XCDR (val))))
|
|
1724 return val;
|
|
1725 w = XWINDOW (XCAR (val));
|
|
1726 x = XINT (XCAR (XCDR (val)));
|
|
1727 y = XINT (XCDR (XCDR (val)));
|
|
1728 f = XFRAME (w->frame);
|
|
1729
|
2
|
1730 if (x >= 0 && y >= 0)
|
0
|
1731 {
|
2
|
1732 if (pixel_to_glyph_translation (f, x, y, &x, &y, &obj_x, &obj_y, &w,
|
|
1733 &bufpos, &closest, &modeline_closest,
|
|
1734 &obj1, &obj2)
|
|
1735 != OVER_NOTHING)
|
|
1736 {
|
|
1737 XCAR (XCDR (val)) = make_int (x);
|
|
1738 XCDR (XCDR (val)) = make_int (y);
|
|
1739 }
|
0
|
1740 }
|
|
1741 else
|
|
1742 {
|
|
1743 XCAR (XCDR (val)) = Qnil;
|
|
1744 XCDR (XCDR (val)) = Qnil;
|
|
1745 }
|
|
1746
|
|
1747 return val;
|
|
1748 }
|
|
1749
|
20
|
1750 DEFUN ("mouse-position-as-motion-event", Fmouse_position_as_motion_event, 0, 1, 0, /*
|
0
|
1751 Return the current mouse position as a motion event.
|
|
1752 This allows you to call the standard event functions such as
|
|
1753 `event-over-toolbar-p' to determine where the mouse is.
|
|
1754
|
|
1755 DEVICE specifies the device on which to read the mouse position, and
|
|
1756 defaults to the selected device. If the mouse position can't be determined
|
272
|
1757 \(e.g. DEVICE is a TTY device), nil is returned instead of an event.
|
20
|
1758 */
|
|
1759 (device))
|
0
|
1760 {
|
|
1761 struct device *d = decode_device (device);
|
|
1762 Lisp_Object frame;
|
|
1763 int intx, inty;
|
|
1764
|
|
1765 if (mouse_pixel_position_1 (d, &frame, &intx, &inty))
|
|
1766 {
|
189
|
1767 Lisp_Object event = Fmake_event (Qnil, Qnil);
|
0
|
1768 XEVENT (event)->event_type = pointer_motion_event;
|
|
1769 XEVENT (event)->channel = frame;
|
|
1770 XEVENT (event)->event.motion.x = intx;
|
|
1771 XEVENT (event)->event.motion.y = inty;
|
|
1772 return event;
|
|
1773 }
|
|
1774 else
|
|
1775 return Qnil;
|
|
1776 }
|
|
1777
|
20
|
1778 DEFUN ("set-mouse-position", Fset_mouse_position, 3, 3, 0, /*
|
0
|
1779 Move the mouse pointer to the center of character cell (X,Y) in WINDOW.
|
|
1780 Note, this is a no-op for an X frame that is not visible.
|
|
1781 If you have just created a frame, you must wait for it to become visible
|
|
1782 before calling this function on it, like this.
|
|
1783 (while (not (frame-visible-p frame)) (sleep-for .5))
|
|
1784 Note also: Warping the mouse is contrary to the ICCCM, so be very sure
|
|
1785 that the behavior won't end up being obnoxious!
|
20
|
1786 */
|
|
1787 (window, x, y))
|
0
|
1788 {
|
|
1789 struct window *w;
|
|
1790 int pix_x, pix_y;
|
|
1791
|
|
1792 CHECK_WINDOW (window);
|
|
1793 CHECK_INT (x);
|
|
1794 CHECK_INT (y);
|
|
1795
|
|
1796 /* Warping the mouse will cause EnterNotify and Focus events under X. */
|
|
1797 w = XWINDOW (window);
|
|
1798 glyph_to_pixel_translation (w, XINT (x), XINT (y), &pix_x, &pix_y);
|
|
1799
|
|
1800 MAYBE_FRAMEMETH (XFRAME (w->frame), set_mouse_position, (w, pix_x, pix_y));
|
|
1801
|
|
1802 return Qnil;
|
|
1803 }
|
|
1804
|
20
|
1805 DEFUN ("set-mouse-pixel-position", Fset_mouse_pixel_position, 3, 3, 0, /*
|
0
|
1806 Move the mouse pointer to pixel position (X,Y) in WINDOW.
|
|
1807 Note, this is a no-op for an X frame that is not visible.
|
|
1808 If you have just created a frame, you must wait for it to become visible
|
|
1809 before calling this function on it, like this.
|
|
1810 (while (not (frame-visible-p frame)) (sleep-for .5))
|
20
|
1811 */
|
|
1812 (window, x, y))
|
0
|
1813 {
|
|
1814 struct window *w;
|
|
1815
|
|
1816 CHECK_WINDOW (window);
|
|
1817 CHECK_INT (x);
|
|
1818 CHECK_INT (y);
|
|
1819
|
|
1820 /* Warping the mouse will cause EnterNotify and Focus events under X. */
|
|
1821 w = XWINDOW (window);
|
|
1822 FRAMEMETH (XFRAME (w->frame), set_mouse_position, (w, XINT (x), XINT (y)));
|
|
1823
|
|
1824 return Qnil;
|
|
1825 }
|
|
1826
|
20
|
1827 DEFUN ("make-frame-visible", Fmake_frame_visible, 0, 1, 0, /*
|
0
|
1828 Make the frame FRAME visible (assuming it is an X-window).
|
|
1829 If omitted, FRAME defaults to the currently selected frame.
|
|
1830 Also raises the frame so that nothing obscures it.
|
20
|
1831 */
|
|
1832 (frame))
|
0
|
1833 {
|
|
1834 struct frame *f = decode_frame (frame);
|
|
1835
|
|
1836 MAYBE_FRAMEMETH (f, make_frame_visible, (f));
|
|
1837 return frame;
|
|
1838 }
|
|
1839
|
20
|
1840 DEFUN ("make-frame-invisible", Fmake_frame_invisible, 0, 2, 0, /*
|
0
|
1841 Unconditionally removes frame from the display (assuming it is an X-window).
|
|
1842 If omitted, FRAME defaults to the currently selected frame.
|
|
1843 If what you want to do is iconify the frame (if the window manager uses
|
|
1844 icons) then you should call `iconify-frame' instead.
|
|
1845 Normally you may not make FRAME invisible if all other frames are invisible
|
|
1846 and uniconified, but if the second optional argument FORCE is non-nil,
|
|
1847 you may do so.
|
20
|
1848 */
|
|
1849 (frame, force))
|
0
|
1850 {
|
|
1851 struct frame *f, *sel_frame;
|
|
1852 struct device *d;
|
|
1853
|
|
1854 f = decode_frame (frame);
|
|
1855 d = XDEVICE (FRAME_DEVICE (f));
|
|
1856 sel_frame = XFRAME (DEVICE_SELECTED_FRAME (d));
|
|
1857
|
|
1858 if (NILP (force) && !other_visible_frames (f))
|
|
1859 error ("Attempt to make invisible the sole visible or iconified frame");
|
|
1860
|
|
1861 /* Don't allow minibuf_window to remain on a deleted frame. */
|
|
1862 if (EQ (f->minibuffer_window, minibuf_window))
|
|
1863 {
|
|
1864 Fset_window_buffer (sel_frame->minibuffer_window,
|
|
1865 XWINDOW (minibuf_window)->buffer);
|
|
1866 minibuf_window = sel_frame->minibuffer_window;
|
|
1867 }
|
|
1868
|
|
1869 MAYBE_FRAMEMETH (f, make_frame_invisible, (f));
|
|
1870
|
|
1871 return Qnil;
|
|
1872 }
|
|
1873
|
20
|
1874 DEFUN ("iconify-frame", Ficonify_frame, 0, 1, "", /*
|
0
|
1875 Make the frame FRAME into an icon, if the window manager supports icons.
|
|
1876 If omitted, FRAME defaults to the currently selected frame.
|
20
|
1877 */
|
|
1878 (frame))
|
0
|
1879 {
|
|
1880 struct frame *f, *sel_frame;
|
|
1881 struct device *d;
|
|
1882
|
|
1883 f = decode_frame (frame);
|
|
1884 d = XDEVICE (FRAME_DEVICE (f));
|
|
1885 sel_frame = XFRAME (DEVICE_SELECTED_FRAME (d));
|
|
1886
|
|
1887 /* Don't allow minibuf_window to remain on a deleted frame. */
|
|
1888 if (EQ (f->minibuffer_window, minibuf_window))
|
|
1889 {
|
|
1890 Fset_window_buffer (sel_frame->minibuffer_window,
|
|
1891 XWINDOW (minibuf_window)->buffer);
|
|
1892 minibuf_window = sel_frame->minibuffer_window;
|
|
1893 }
|
|
1894
|
|
1895 MAYBE_FRAMEMETH (f, iconify_frame, (f));
|
|
1896
|
|
1897 return Qnil;
|
|
1898 }
|
|
1899
|
20
|
1900 DEFUN ("deiconify-frame", Fdeiconify_frame, 0, 1, 0, /*
|
0
|
1901 Open (de-iconify) the iconified frame FRAME.
|
|
1902 Under X, this is currently the same as `make-frame-visible'.
|
|
1903 If omitted, FRAME defaults to the currently selected frame.
|
|
1904 Also raises the frame so that nothing obscures it.
|
20
|
1905 */
|
|
1906 (frame))
|
0
|
1907 {
|
|
1908 return Fmake_frame_visible (frame);
|
|
1909 }
|
|
1910
|
|
1911 /* FSF returns 'icon for iconized frames. What a crock! */
|
|
1912
|
20
|
1913 DEFUN ("frame-visible-p", Fframe_visible_p, 0, 1, 0, /*
|
185
|
1914 Return non NIL if FRAME is now "visible" (actually in use for display).
|
0
|
1915 A frame that is not visible is not updated, and, if it works through a
|
|
1916 window system, may not show at all.
|
185
|
1917 N.B. Under X "visible" means Mapped. It the window is mapped but not
|
108
|
1918 actually visible on screen then frame_visible returns 'hidden.
|
20
|
1919 */
|
|
1920 (frame))
|
0
|
1921 {
|
|
1922 struct frame *f = decode_frame (frame);
|
173
|
1923 int visible = FRAMEMETH_OR_GIVEN (f, frame_visible_p, (f), f->visible);
|
|
1924 return visible ? ( visible > 0 ? Qt : Qhidden ) : Qnil;
|
0
|
1925 }
|
|
1926
|
20
|
1927 DEFUN ("frame-totally-visible-p", Fframe_totally_visible_p, 0, 1, 0, /*
|
272
|
1928 Return t if frame is not obscured by any other window system windows.
|
0
|
1929 Always returns t for tty frames.
|
20
|
1930 */
|
|
1931 (frame))
|
0
|
1932 {
|
|
1933 struct frame *f = decode_frame (frame);
|
|
1934 return (FRAMEMETH_OR_GIVEN (f, frame_totally_visible_p, (f), f->visible)
|
173
|
1935 ? Qt : Qnil);
|
0
|
1936 }
|
|
1937
|
20
|
1938 DEFUN ("frame-iconified-p", Fframe_iconified_p, 0, 1, 0, /*
|
0
|
1939 Return t if FRAME is iconified.
|
|
1940 Not all window managers use icons; some merely unmap the window, so this
|
|
1941 function is not the inverse of `frame-visible-p'. It is possible for a
|
|
1942 frame to not be visible and not be iconified either. However, if the
|
|
1943 frame is iconified, it will not be visible.
|
20
|
1944 */
|
|
1945 (frame))
|
0
|
1946 {
|
|
1947 struct frame *f = decode_frame (frame);
|
|
1948 if (f->visible)
|
|
1949 return Qnil;
|
|
1950 f->iconified = FRAMEMETH_OR_GIVEN (f, frame_iconified_p, (f), 0);
|
173
|
1951 return f->iconified ? Qt : Qnil;
|
0
|
1952 }
|
|
1953
|
20
|
1954 DEFUN ("visible-frame-list", Fvisible_frame_list, 0, 1, 0, /*
|
185
|
1955 Return a list of all frames now "visible" (being updated).
|
0
|
1956 If DEVICE is specified only frames on that device will be returned.
|
108
|
1957 Note that under virtual window managers not all these frame are necessarily
|
|
1958 really updated.
|
20
|
1959 */
|
|
1960 (device))
|
0
|
1961 {
|
|
1962 Lisp_Object devcons, concons;
|
|
1963 struct frame *f;
|
|
1964 Lisp_Object value;
|
|
1965
|
|
1966 value = Qnil;
|
|
1967
|
|
1968 DEVICE_LOOP_NO_BREAK (devcons, concons)
|
|
1969 {
|
|
1970 assert (DEVICEP (XCAR (devcons)));
|
|
1971
|
|
1972 if (NILP (device) || EQ (device, XCAR (devcons)))
|
|
1973 {
|
|
1974 Lisp_Object frmcons;
|
|
1975
|
|
1976 DEVICE_FRAME_LOOP (frmcons, XDEVICE (XCAR (devcons)))
|
|
1977 {
|
|
1978 Lisp_Object frame = XCAR (frmcons);
|
|
1979 f = XFRAME (frame);
|
108
|
1980 if (FRAME_VISIBLE_P(f))
|
0
|
1981 value = Fcons (frame, value);
|
|
1982 }
|
|
1983 }
|
|
1984 }
|
|
1985
|
|
1986 return value;
|
|
1987 }
|
|
1988
|
|
1989
|
20
|
1990 DEFUN ("raise-frame", Fraise_frame, 0, 1, "", /*
|
0
|
1991 Bring FRAME to the front, so it occludes any frames it overlaps.
|
|
1992 If omitted, FRAME defaults to the currently selected frame.
|
|
1993 If FRAME is invisible, make it visible.
|
|
1994 If Emacs is displaying on an ordinary terminal or some other device which
|
|
1995 doesn't support multiple overlapping frames, this function does nothing.
|
20
|
1996 */
|
|
1997 (frame))
|
0
|
1998 {
|
|
1999 struct frame *f = decode_frame (frame);
|
|
2000
|
|
2001 /* Do like the documentation says. */
|
|
2002 Fmake_frame_visible (frame);
|
|
2003 MAYBE_FRAMEMETH (f, raise_frame, (f));
|
|
2004 return Qnil;
|
|
2005 }
|
|
2006
|
20
|
2007 DEFUN ("lower-frame", Flower_frame, 0, 1, "", /*
|
0
|
2008 Send FRAME to the back, so it is occluded by any frames that overlap it.
|
|
2009 If omitted, FRAME defaults to the currently selected frame.
|
|
2010 If Emacs is displaying on an ordinary terminal or some other device which
|
|
2011 doesn't support multiple overlapping frames, this function does nothing.
|
20
|
2012 */
|
|
2013 (frame))
|
0
|
2014 {
|
|
2015 struct frame *f = decode_frame (frame);
|
|
2016
|
|
2017 MAYBE_FRAMEMETH (f, lower_frame, (f));
|
|
2018 return Qnil;
|
|
2019 }
|
|
2020
|
|
2021 /* Ben thinks there is no need for `redirect-frame-focus' or `frame-focus',
|
|
2022 crockish FSFmacs functions. See summary on focus in event-stream.c. */
|
|
2023
|
|
2024
|
|
2025 /***************************************************************************/
|
|
2026 /* frame properties */
|
|
2027 /***************************************************************************/
|
|
2028
|
|
2029 static void internal_set_frame_size (struct frame *f, int cols, int rows,
|
|
2030 int pretend);
|
|
2031
|
|
2032 static void
|
|
2033 store_minibuf_frame_prop (struct frame *f, Lisp_Object val)
|
|
2034 {
|
|
2035 Lisp_Object frame;
|
|
2036 XSETFRAME (frame, f);
|
|
2037
|
|
2038 if (WINDOWP (val))
|
|
2039 {
|
|
2040 if (! MINI_WINDOW_P (XWINDOW (val)))
|
|
2041 signal_simple_error
|
|
2042 ("Surrogate minibuffer windows must be minibuffer windows",
|
|
2043 val);
|
|
2044
|
|
2045 if (FRAME_HAS_MINIBUF_P (f) || FRAME_MINIBUF_ONLY_P (f))
|
|
2046 signal_simple_error
|
|
2047 ("Can't change the surrogate minibuffer of a frame with its own minibuffer", frame);
|
173
|
2048
|
0
|
2049 /* Install the chosen minibuffer window, with proper buffer. */
|
|
2050 f->minibuffer_window = val;
|
|
2051 }
|
|
2052 else if (EQ (val, Qt))
|
|
2053 {
|
|
2054 if (FRAME_HAS_MINIBUF_P (f) || FRAME_MINIBUF_ONLY_P (f))
|
|
2055 signal_simple_error
|
|
2056 ("Frame already has its own minibuffer", frame);
|
|
2057 else
|
|
2058 {
|
|
2059 setup_normal_frame (f);
|
|
2060 f->mirror_dirty = 1;
|
|
2061
|
|
2062 update_frame_window_mirror (f);
|
|
2063 internal_set_frame_size (f, f->width, f->height, 1);
|
|
2064 }
|
|
2065 }
|
|
2066 }
|
|
2067
|
|
2068 #if 0
|
|
2069
|
|
2070 /* possible code if you want to have symbols such as `default-background'
|
|
2071 map to setting the background of `default', etc. */
|
|
2072
|
|
2073 static int
|
|
2074 dissect_as_face_setting (Lisp_Object sym, Lisp_Object *face_out,
|
|
2075 Lisp_Object *face_prop_out)
|
|
2076 {
|
|
2077 Lisp_Object list = Vbuilt_in_face_specifiers;
|
|
2078 struct Lisp_String *s;
|
|
2079
|
|
2080 if (!SYMBOLP (sym))
|
|
2081 return 0;
|
|
2082
|
|
2083 s = symbol_name (XSYMBOL (sym));
|
|
2084
|
|
2085 while (!NILP (list))
|
|
2086 {
|
|
2087 Lisp_Object prop = Fcar (list);
|
|
2088 struct Lisp_String *prop_name;
|
|
2089
|
|
2090 if (!SYMBOLP (prop))
|
|
2091 continue;
|
|
2092 prop_name = symbol_name (XSYMBOL (prop));
|
|
2093 if (string_length (s) > string_length (prop_name) + 1
|
|
2094 && !memcmp (string_data (prop_name),
|
|
2095 string_data (s) + string_length (s)
|
|
2096 - string_length (prop_name),
|
|
2097 string_length (prop_name))
|
|
2098 && string_data (s)[string_length (s) - string_length (prop_name)
|
|
2099 - 1] == '-')
|
|
2100 {
|
|
2101 Lisp_Object face =
|
|
2102 Ffind_face (make_string (string_data (s),
|
|
2103 string_length (s)
|
|
2104 - string_length (prop_name)
|
|
2105 - 1));
|
|
2106 if (!NILP (face))
|
|
2107 {
|
|
2108 *face_out = face;
|
|
2109 *face_prop_out = prop;
|
|
2110 return 1;
|
|
2111 }
|
|
2112 }
|
|
2113
|
|
2114 list = Fcdr (list);
|
|
2115 }
|
|
2116
|
|
2117 return 0;
|
|
2118 }
|
|
2119
|
|
2120 #endif /* 0 */
|
|
2121
|
|
2122 static Lisp_Object
|
|
2123 get_property_alias (Lisp_Object prop)
|
|
2124 {
|
|
2125 while (1)
|
|
2126 {
|
|
2127 Lisp_Object alias = Qnil;
|
|
2128
|
|
2129 if (SYMBOLP (prop))
|
|
2130 alias = Fget (prop, Qframe_property_alias, Qnil);
|
|
2131 if (NILP (alias))
|
|
2132 break;
|
|
2133 prop = alias;
|
|
2134 QUIT;
|
|
2135 }
|
|
2136
|
|
2137 return prop;
|
|
2138 }
|
|
2139
|
|
2140 /* #### Using this to modify the internal border width has no effect
|
|
2141 because the change isn't propagated to the windows. Are there
|
|
2142 other properties which this claims to handle, but doesn't?
|
|
2143
|
|
2144 But of course. This stuff needs more work, but it's a lot closer
|
|
2145 to sanity now than before with the horrible frame-params stuff. */
|
|
2146
|
20
|
2147 DEFUN ("set-frame-properties", Fset_frame_properties, 2, 2, 0, /*
|
0
|
2148 Change some properties of a frame.
|
|
2149 PLIST is a property list.
|
|
2150 You can also change frame properties individually using `set-frame-property',
|
|
2151 but it may be more efficient to change many properties at once.
|
|
2152
|
|
2153 Frame properties can be retrieved using `frame-property' or `frame-properties'.
|
|
2154
|
|
2155 The following symbols etc. have predefined meanings:
|
|
2156
|
272
|
2157 name Name of the frame. Used with X resources.
|
2
|
2158 Unchangeable after creation.
|
0
|
2159
|
|
2160 height Height of the frame, in lines.
|
|
2161
|
|
2162 width Width of the frame, in characters.
|
|
2163
|
|
2164 minibuffer Gives the minibuffer behavior for this frame. Either
|
|
2165 t (frame has its own minibuffer), `only' (frame is
|
|
2166 a minibuffer-only frame), or a window (frame uses that
|
|
2167 window, which is on another frame, as the minibuffer).
|
|
2168
|
|
2169 unsplittable If non-nil, frame cannot be split by `display-buffer'.
|
|
2170
|
|
2171 current-display-table, menubar-visible-p, left-margin-width,
|
|
2172 right-margin-width, minimum-line-ascent, minimum-line-descent,
|
|
2173 use-left-overflow, use-right-overflow, scrollbar-width, scrollbar-height,
|
|
2174 default-toolbar, top-toolbar, bottom-toolbar, left-toolbar, right-toolbar,
|
|
2175 default-toolbar-height, default-toolbar-width, top-toolbar-height,
|
|
2176 bottom-toolbar-height, left-toolbar-width, right-toolbar-width,
|
|
2177 default-toolbar-visible-p, top-toolbar-visible-p, bottom-toolbar-visible-p,
|
|
2178 left-toolbar-visible-p, right-toolbar-visible-p, toolbar-buttons-captioned-p,
|
215
|
2179 top-toolbar-border-width, bottom-toolbar-border-width,
|
|
2180 left-toolbar-border-width, right-toolbar-border-width,
|
0
|
2181 modeline-shadow-thickness, has-modeline-p
|
|
2182 [Giving the name of any built-in specifier variable is
|
|
2183 equivalent to calling `set-specifier' on the specifier,
|
|
2184 with a locale of FRAME. Giving the name to `frame-property'
|
|
2185 calls `specifier-instance' on the specifier.]
|
|
2186
|
|
2187 text-pointer-glyph, nontext-pointer-glyph, modeline-pointer-glyph,
|
|
2188 selection-pointer-glyph, busy-pointer-glyph, toolbar-pointer-glyph,
|
|
2189 menubar-pointer-glyph, scrollbar-pointer-glyph, gc-pointer-glyph,
|
|
2190 octal-escape-glyph, control-arrow-glyph, invisible-text-glyph,
|
|
2191 hscroll-glyph, truncation-glyph, continuation-glyph
|
|
2192 [Giving the name of any glyph variable is equivalent to
|
|
2193 calling `set-glyph-image' on the glyph, with a locale
|
|
2194 of FRAME. Giving the name to `frame-property' calls
|
|
2195 `glyph-image-instance' on the glyph.]
|
|
2196
|
|
2197 [default foreground], [default background], [default font],
|
|
2198 [modeline foreground], [modeline background], [modeline font],
|
|
2199 etc.
|
|
2200 [Giving a vector of a face and a property is equivalent
|
|
2201 to calling `set-face-property' on the face and property,
|
2
|
2202 with a locale of FRAME. Giving the vector to
|
0
|
2203 `frame-property' calls `face-property-instance' on the
|
|
2204 face and property.]
|
|
2205
|
|
2206 Finally, if a frame property symbol has the property `frame-property-alias'
|
|
2207 on it, then the value will be used in place of that symbol when looking
|
|
2208 up and setting frame property values. This allows you to alias one
|
|
2209 frame property name to another.
|
|
2210
|
209
|
2211 See the variables `default-x-frame-plist', `default-tty-frame-plist'
|
213
|
2212 and `default-mswindows-frame-plist' for a description of the properties
|
209
|
2213 recognized for particular types of frames.
|
20
|
2214 */
|
|
2215 (frame, plist))
|
0
|
2216 {
|
|
2217 struct frame *f = decode_frame (frame);
|
|
2218 Lisp_Object tail;
|
|
2219 Lisp_Object *tailp;
|
|
2220 struct gcpro gcpro1, gcpro2;
|
|
2221
|
|
2222 XSETFRAME (frame, f);
|
|
2223 GCPRO2 (frame, plist);
|
|
2224 Fcheck_valid_plist (plist);
|
|
2225 plist = Fcopy_sequence (plist);
|
|
2226 Fcanonicalize_lax_plist (plist, Qnil);
|
|
2227 for (tail = plist; !NILP (tail); tail = Fcdr (Fcdr (tail)))
|
|
2228 {
|
|
2229 Lisp_Object prop = Fcar (tail);
|
|
2230 Lisp_Object val = Fcar (Fcdr (tail));
|
|
2231
|
|
2232 prop = get_property_alias (prop);
|
|
2233
|
|
2234 #if 0
|
|
2235 /* mly wants this, but it's not reasonable to change the name of a
|
|
2236 frame after it has been created, because the old name was used
|
|
2237 for resource lookup. */
|
|
2238 if (EQ (prop, Qname))
|
|
2239 {
|
|
2240 CHECK_STRING (val);
|
|
2241 f->name = val;
|
|
2242 }
|
|
2243 #endif /* 0 */
|
|
2244 if (EQ (prop, Qminibuffer))
|
|
2245 store_minibuf_frame_prop (f, val);
|
|
2246 if (EQ (prop, Qunsplittable))
|
|
2247 f->no_split = !NILP (val);
|
|
2248 if (EQ (prop, Qbuffer_predicate))
|
|
2249 f->buffer_predicate = val;
|
|
2250 if (SYMBOLP (prop) && EQ (Fbuilt_in_variable_type (prop),
|
|
2251 Qconst_specifier))
|
|
2252 call3 (Qset_specifier, Fsymbol_value (prop), val, frame);
|
|
2253 if (SYMBOLP (prop) && !NILP (Fget (prop, Qconst_glyph_variable, Qnil)))
|
|
2254 call3 (Qset_glyph_image, Fsymbol_value (prop), val, frame);
|
173
|
2255 if (VECTORP (prop) && XVECTOR_LENGTH (prop) == 2)
|
0
|
2256 {
|
173
|
2257 Lisp_Object face_prop = XVECTOR_DATA (prop)[1];
|
0
|
2258 CHECK_SYMBOL (face_prop);
|
|
2259 call4 (Qset_face_property,
|
173
|
2260 Fget_face (XVECTOR_DATA (prop)[0]),
|
0
|
2261 face_prop, val, frame);
|
|
2262 }
|
|
2263 }
|
|
2264
|
|
2265 MAYBE_FRAMEMETH (f, set_frame_properties, (f, plist));
|
|
2266 for (tailp = &plist; !NILP (*tailp);)
|
|
2267 {
|
|
2268 Lisp_Object *next_tailp;
|
|
2269 Lisp_Object next;
|
|
2270 Lisp_Object prop;
|
|
2271
|
|
2272 next = Fcdr (*tailp);
|
|
2273 CHECK_CONS (next);
|
|
2274 next_tailp = &XCDR (next);
|
|
2275 prop = Fcar (*tailp);
|
|
2276
|
|
2277 prop = get_property_alias (prop);
|
|
2278
|
|
2279 if (EQ (prop, Qminibuffer)
|
|
2280 || EQ (prop, Qunsplittable)
|
|
2281 || EQ (prop, Qbuffer_predicate)
|
|
2282 || EQ (prop, Qheight)
|
|
2283 || EQ (prop, Qwidth)
|
|
2284 || (SYMBOLP (prop) && EQ (Fbuilt_in_variable_type (prop),
|
|
2285 Qconst_specifier))
|
|
2286 || (SYMBOLP (prop) && !NILP (Fget (prop, Qconst_glyph_variable,
|
|
2287 Qnil)))
|
173
|
2288 || (VECTORP (prop) && XVECTOR_LENGTH (prop) == 2)
|
0
|
2289 || FRAMEMETH_OR_GIVEN (f, internal_frame_property_p, (f, prop), 0))
|
|
2290 *tailp = *next_tailp;
|
|
2291 tailp = next_tailp;
|
|
2292 }
|
|
2293
|
|
2294 f->plist = nconc2 (plist, f->plist);
|
|
2295 Fcanonicalize_lax_plist (f->plist, Qnil);
|
|
2296 UNGCPRO;
|
|
2297 return Qnil;
|
|
2298 }
|
|
2299
|
20
|
2300 DEFUN ("frame-property", Fframe_property, 2, 3, 0, /*
|
0
|
2301 Return FRAME's value for property PROPERTY.
|
|
2302 See `set-frame-properties' for the built-in property names.
|
20
|
2303 */
|
173
|
2304 (frame, property, default_))
|
0
|
2305 {
|
|
2306 struct frame *f = decode_frame (frame);
|
272
|
2307 Lisp_Object value;
|
0
|
2308
|
|
2309 XSETFRAME (frame, f);
|
|
2310
|
|
2311 property = get_property_alias (property);
|
|
2312
|
272
|
2313 if (EQ (Qname, property)) return f->name;
|
|
2314
|
|
2315 if (EQ (Qheight, property) || EQ (Qwidth, property))
|
269
|
2316 {
|
272
|
2317 if (window_system_pixelated_geometry (frame))
|
|
2318 {
|
|
2319 int width, height;
|
|
2320 pixel_to_real_char_size (f, FRAME_PIXWIDTH (f), FRAME_PIXHEIGHT (f),
|
|
2321 &width, &height);
|
|
2322 return make_int (EQ (Qheight, property) ? height: width);
|
|
2323 }
|
|
2324 else
|
|
2325 return make_int (EQ (Qheight, property) ?
|
|
2326 FRAME_HEIGHT (f) :
|
|
2327 FRAME_WIDTH (f));
|
269
|
2328 }
|
|
2329
|
0
|
2330 /* NOTE: FSF returns Qnil instead of Qt for FRAME_HAS_MINIBUF_P.
|
|
2331 This is over-the-top bogosity, because it's inconsistent with
|
|
2332 the semantics of `minibuffer' when passed to `make-frame'.
|
|
2333 Returning Qt makes things consistent. */
|
272
|
2334 if (EQ (Qminibuffer, property))
|
|
2335 return (FRAME_MINIBUF_ONLY_P (f) ? Qonly :
|
|
2336 FRAME_HAS_MINIBUF_P (f) ? Qt :
|
|
2337 FRAME_MINIBUF_WINDOW (f));
|
|
2338 if (EQ (Qunsplittable, property))
|
|
2339 return FRAME_NO_SPLIT_P (f) ? Qt : Qnil;
|
|
2340 if (EQ (Qbuffer_predicate, property))
|
|
2341 return f->buffer_predicate;
|
|
2342
|
|
2343 if (SYMBOLP (property))
|
0
|
2344 {
|
272
|
2345 if (EQ (Fbuilt_in_variable_type (property), Qconst_specifier))
|
|
2346 return Fspecifier_instance (Fsymbol_value (property),
|
|
2347 frame, default_, Qnil);
|
|
2348 if (!NILP (Fget (property, Qconst_glyph_variable, Qnil)))
|
|
2349 {
|
|
2350 Lisp_Object glyph = Fsymbol_value (property);
|
|
2351 CHECK_GLYPH (glyph);
|
|
2352 return Fspecifier_instance (XGLYPH_IMAGE (glyph),
|
|
2353 frame, default_, Qnil);
|
|
2354 }
|
0
|
2355 }
|
272
|
2356
|
173
|
2357 if (VECTORP (property) && XVECTOR_LENGTH (property) == 2)
|
0
|
2358 {
|
173
|
2359 Lisp_Object face_prop = XVECTOR_DATA (property)[1];
|
0
|
2360 CHECK_SYMBOL (face_prop);
|
|
2361 return call3 (Qface_property_instance,
|
173
|
2362 Fget_face (XVECTOR_DATA (property)[0]),
|
0
|
2363 face_prop, frame);
|
|
2364 }
|
|
2365
|
272
|
2366 if (HAS_FRAMEMETH_P (f, frame_property))
|
|
2367 if (!UNBOUNDP (value = FRAMEMETH (f, frame_property, (f, property))))
|
0
|
2368 return value;
|
|
2369
|
272
|
2370 if (!UNBOUNDP (value = external_plist_get (&f->plist, property, 1, ERROR_ME)))
|
|
2371 return value;
|
|
2372
|
|
2373 return default_;
|
0
|
2374 }
|
|
2375
|
20
|
2376 DEFUN ("frame-properties", Fframe_properties, 0, 1, 0, /*
|
0
|
2377 Return a property list of the properties of FRAME.
|
|
2378 Do not modify this list; use `set-frame-property' instead.
|
20
|
2379 */
|
|
2380 (frame))
|
0
|
2381 {
|
|
2382 struct frame *f = decode_frame (frame);
|
|
2383 Lisp_Object result = Qnil;
|
|
2384 struct gcpro gcpro1;
|
|
2385
|
|
2386 GCPRO1 (result);
|
173
|
2387
|
269
|
2388 XSETFRAME (frame, f);
|
|
2389
|
272
|
2390 /* #### for the moment (since old code uses `frame-parameters'),
|
|
2391 we call `copy-sequence' on f->plist. That allows frame-parameters
|
|
2392 to destructively convert the plist into an alist, which is more
|
|
2393 efficient than doing it non-destructively. At some point we
|
|
2394 should remove the call to copy-sequence. */
|
|
2395 result = Fcopy_sequence (f->plist);
|
|
2396
|
|
2397 /* #### should we be adding all the specifiers and glyphs?
|
|
2398 That would entail having a list of them all. */
|
|
2399 if (HAS_FRAMEMETH_P (f, frame_properties))
|
|
2400 result = nconc2 (FRAMEMETH (f, frame_properties, (f)), result);
|
|
2401
|
|
2402 if (!NILP (f->buffer_predicate))
|
|
2403 result = cons3 (Qbuffer_predicate, f->buffer_predicate, result);
|
|
2404
|
|
2405 if (FRAME_NO_SPLIT_P (f))
|
|
2406 result = cons3 (Qunsplittable, Qt, result);
|
|
2407
|
|
2408 /* NOTE: FSF returns Qnil instead of Qt for FRAME_HAS_MINIBUF_P.
|
0
|
2409 This is over-the-top bogosity, because it's inconsistent with
|
|
2410 the semantics of `minibuffer' when passed to `make-frame'.
|
|
2411 Returning Qt makes things consistent. */
|
272
|
2412 result = cons3 (Qminibuffer,
|
|
2413 (FRAME_MINIBUF_ONLY_P (f) ? Qonly :
|
|
2414 FRAME_HAS_MINIBUF_P (f) ? Qt :
|
|
2415 FRAME_MINIBUF_WINDOW (f)),
|
|
2416 result);
|
0
|
2417 {
|
272
|
2418 int width, height;
|
|
2419
|
|
2420 if (window_system_pixelated_geometry (frame))
|
|
2421 {
|
|
2422 pixel_to_real_char_size (f, FRAME_PIXWIDTH (f), FRAME_PIXHEIGHT (f),
|
|
2423 &width, &height);
|
|
2424 }
|
|
2425 else
|
|
2426 {
|
|
2427 height = FRAME_HEIGHT (f);
|
|
2428 width = FRAME_WIDTH (f);
|
|
2429 }
|
|
2430 result = cons3 (Qwidth , make_int (width), result);
|
|
2431 result = cons3 (Qheight, make_int (height), result);
|
0
|
2432 }
|
272
|
2433
|
|
2434 result = cons3 (Qname, f->name, result);
|
|
2435
|
|
2436 UNGCPRO;
|
|
2437 return result;
|
0
|
2438 }
|
|
2439
|
|
2440
|
20
|
2441 DEFUN ("frame-pixel-height", Fframe_pixel_height, 0, 1, 0, /*
|
0
|
2442 Return the height in pixels of FRAME.
|
20
|
2443 */
|
|
2444 (frame))
|
0
|
2445 {
|
272
|
2446 return make_int (decode_frame (frame)->pixheight);
|
0
|
2447 }
|
|
2448
|
20
|
2449 DEFUN ("frame-pixel-width", Fframe_pixel_width, 0, 1, 0, /*
|
0
|
2450 Return the width in pixels of FRAME.
|
20
|
2451 */
|
|
2452 (frame))
|
0
|
2453 {
|
272
|
2454 return make_int (decode_frame (frame)->pixwidth);
|
0
|
2455 }
|
|
2456
|
20
|
2457 DEFUN ("frame-name", Fframe_name, 0, 1, 0, /*
|
0
|
2458 Return the name of FRAME (defaulting to the selected frame).
|
|
2459 This is not the same as the `title' of the frame.
|
20
|
2460 */
|
|
2461 (frame))
|
0
|
2462 {
|
173
|
2463 return decode_frame (frame)->name;
|
0
|
2464 }
|
|
2465
|
20
|
2466 DEFUN ("frame-modified-tick", Fframe_modified_tick, 0, 1, 0, /*
|
0
|
2467 Return FRAME's tick counter, incremented for each change to the frame.
|
|
2468 Each frame has a tick counter which is incremented each time the frame
|
|
2469 is resized, a window is resized, added, or deleted, a face is changed,
|
|
2470 `set-window-buffer' or `select-window' is called on a window in the
|
|
2471 frame, the window-start of a window in the frame has changed, or
|
|
2472 anything else interesting has happened. It wraps around occasionally.
|
|
2473 No argument or nil as argument means use selected frame as FRAME.
|
20
|
2474 */
|
|
2475 (frame))
|
0
|
2476 {
|
|
2477 return make_int (decode_frame (frame)->modiff);
|
|
2478 }
|
|
2479
|
|
2480 static void
|
|
2481 internal_set_frame_size (struct frame *f, int cols, int rows, int pretend)
|
|
2482 {
|
|
2483 if (pretend || !HAS_FRAMEMETH_P (f, set_frame_size))
|
|
2484 change_frame_size (f, rows, cols, 0);
|
|
2485 else
|
|
2486 FRAMEMETH (f, set_frame_size, (f, cols, rows));
|
|
2487 }
|
|
2488
|
20
|
2489 DEFUN ("set-frame-height", Fset_frame_height, 2, 3, 0, /*
|
0
|
2490 Specify that the frame FRAME has LINES lines.
|
|
2491 Optional third arg non-nil means that redisplay should use LINES lines
|
|
2492 but that the idea of the actual height of the frame should not be changed.
|
20
|
2493 */
|
|
2494 (frame, rows, pretend))
|
0
|
2495 {
|
|
2496 struct frame *f = decode_frame (frame);
|
269
|
2497 int height, width;
|
0
|
2498 XSETFRAME (frame, f);
|
|
2499 CHECK_INT (rows);
|
173
|
2500
|
269
|
2501 if (window_system_pixelated_geometry (frame))
|
|
2502 {
|
|
2503 char_to_real_pixel_size (f, 0, XINT (rows), 0, &height);
|
|
2504 width = FRAME_PIXWIDTH (f);
|
|
2505 }
|
|
2506 else
|
|
2507 {
|
|
2508 height = XINT (rows);
|
|
2509 width = FRAME_WIDTH (f);
|
|
2510 }
|
|
2511
|
|
2512 internal_set_frame_size (f, width, height, !NILP (pretend));
|
0
|
2513 return frame;
|
|
2514 }
|
|
2515
|
20
|
2516 DEFUN ("set-frame-width", Fset_frame_width, 2, 3, 0, /*
|
0
|
2517 Specify that the frame FRAME has COLS columns.
|
|
2518 Optional third arg non-nil means that redisplay should use COLS columns
|
|
2519 but that the idea of the actual width of the frame should not be changed.
|
20
|
2520 */
|
|
2521 (frame, cols, pretend))
|
0
|
2522 {
|
|
2523 struct frame *f = decode_frame (frame);
|
269
|
2524 int width, height;
|
0
|
2525 XSETFRAME (frame, f);
|
|
2526 CHECK_INT (cols);
|
|
2527
|
269
|
2528 if (window_system_pixelated_geometry (frame))
|
|
2529 {
|
|
2530 char_to_real_pixel_size (f, XINT (cols), 0, &width, 0);
|
|
2531 height = FRAME_PIXHEIGHT (f);
|
|
2532 }
|
|
2533 else
|
|
2534 {
|
|
2535 width = XINT (cols);
|
|
2536 height = FRAME_HEIGHT (f);
|
|
2537 }
|
|
2538
|
|
2539 internal_set_frame_size (f, width, height, !NILP (pretend));
|
0
|
2540 return frame;
|
|
2541 }
|
|
2542
|
20
|
2543 DEFUN ("set-frame-size", Fset_frame_size, 3, 4, 0, /*
|
272
|
2544 Set the size of FRAME to COLS by ROWS.
|
0
|
2545 Optional fourth arg non-nil means that redisplay should use COLS by ROWS
|
|
2546 but that the idea of the actual size of the frame should not be changed.
|
20
|
2547 */
|
|
2548 (frame, cols, rows, pretend))
|
0
|
2549 {
|
|
2550 struct frame *f = decode_frame (frame);
|
269
|
2551 int height, width;
|
0
|
2552 XSETFRAME (frame, f);
|
|
2553 CHECK_INT (cols);
|
|
2554 CHECK_INT (rows);
|
|
2555
|
269
|
2556 if (window_system_pixelated_geometry (frame))
|
|
2557 char_to_real_pixel_size (f, XINT (cols), XINT (rows), &width, &height);
|
|
2558 else
|
|
2559 {
|
|
2560 height = XINT (rows);
|
|
2561 width = XINT (cols);
|
|
2562 }
|
|
2563
|
|
2564 internal_set_frame_size (f, width, height, !NILP (pretend));
|
0
|
2565 return frame;
|
|
2566 }
|
|
2567
|
20
|
2568 DEFUN ("set-frame-position", Fset_frame_position, 3, 3, 0, /*
|
272
|
2569 Set position of FRAME in pixels to XOFFSET by YOFFSET.
|
0
|
2570 This is actually the position of the upper left corner of the frame.
|
|
2571 Negative values for XOFFSET or YOFFSET are interpreted relative to
|
|
2572 the rightmost or bottommost possible position (that stays within the screen).
|
20
|
2573 */
|
|
2574 (frame, xoffset, yoffset))
|
0
|
2575 {
|
|
2576 struct frame *f = decode_frame (frame);
|
|
2577 CHECK_INT (xoffset);
|
|
2578 CHECK_INT (yoffset);
|
|
2579
|
|
2580 MAYBE_FRAMEMETH (f, set_frame_position, (f, XINT (xoffset), XINT (yoffset)));
|
|
2581
|
|
2582 return Qt;
|
|
2583 }
|
|
2584
|
|
2585
|
|
2586
|
|
2587 /* Frame size conversion functions moved here from EmacsFrame.c
|
|
2588 because they're generic and really don't belong in that file.
|
|
2589 Function get_default_char_pixel_size() removed because it's
|
|
2590 exactly the same as default_face_height_and_width(). */
|
|
2591 static void
|
|
2592 frame_conversion_internal (struct frame *f, int pixel_to_char,
|
|
2593 int *pixel_width, int *pixel_height,
|
269
|
2594 int *char_width, int *char_height,
|
|
2595 int real_face)
|
0
|
2596 {
|
|
2597 int cpw;
|
|
2598 int cph;
|
|
2599 int egw;
|
|
2600 int obw, obh, bdr;
|
|
2601 Lisp_Object frame, window;
|
|
2602
|
|
2603 XSETFRAME (frame, f);
|
269
|
2604 if (real_face)
|
|
2605 default_face_height_and_width (frame, &cph, &cpw);
|
|
2606 else
|
|
2607 default_face_height_and_width_1 (frame, &cph, &cpw);
|
|
2608
|
0
|
2609 window = FRAME_SELECTED_WINDOW (f);
|
|
2610
|
|
2611 egw = max (glyph_width (Vcontinuation_glyph, Vdefault_face, 0, window),
|
|
2612 glyph_width (Vtruncation_glyph, Vdefault_face, 0, window));
|
|
2613 egw = max (egw, cpw);
|
|
2614 bdr = 2 * f->internal_border_width;
|
|
2615 obw = FRAME_SCROLLBAR_WIDTH (f) + FRAME_THEORETICAL_LEFT_TOOLBAR_WIDTH (f) +
|
215
|
2616 FRAME_THEORETICAL_RIGHT_TOOLBAR_WIDTH (f) +
|
|
2617 2 * FRAME_THEORETICAL_LEFT_TOOLBAR_BORDER_WIDTH (f) +
|
|
2618 2 * FRAME_THEORETICAL_RIGHT_TOOLBAR_BORDER_WIDTH (f);
|
0
|
2619 obh = FRAME_SCROLLBAR_HEIGHT (f) + FRAME_THEORETICAL_TOP_TOOLBAR_HEIGHT (f) +
|
215
|
2620 FRAME_THEORETICAL_BOTTOM_TOOLBAR_HEIGHT (f) +
|
|
2621 2 * FRAME_THEORETICAL_TOP_TOOLBAR_BORDER_WIDTH (f) +
|
|
2622 2 * FRAME_THEORETICAL_BOTTOM_TOOLBAR_BORDER_WIDTH (f);
|
0
|
2623
|
|
2624 if (pixel_to_char)
|
|
2625 {
|
269
|
2626 if (char_width)
|
|
2627 *char_width = 1 + ((*pixel_width - egw) - bdr - obw) / cpw;
|
|
2628 if (char_height)
|
|
2629 *char_height = (*pixel_height - bdr - obh) / cph;
|
0
|
2630 }
|
|
2631 else
|
|
2632 {
|
269
|
2633 if (pixel_width)
|
|
2634 *pixel_width = (*char_width - 1) * cpw + egw + bdr + obw;
|
|
2635 if (pixel_height)
|
|
2636 *pixel_height = *char_height * cph + bdr + obh;
|
0
|
2637 }
|
|
2638 }
|
173
|
2639
|
0
|
2640 /* This takes the size in pixels of the text area, and returns the number
|
|
2641 of characters that will fit there, taking into account the internal
|
|
2642 border width, and the pixel width of the line terminator glyphs (which
|
|
2643 always count as one "character" wide, even if they are not the same size
|
|
2644 as the default character size of the default font). The frame scrollbar
|
|
2645 width and left and right toolbar widths are also subtracted out of the
|
|
2646 available width. The frame scrollbar height and top and bottom toolbar
|
|
2647 heights are subtracted out of the available height.
|
|
2648
|
|
2649 Therefore the result is not necessarily a multiple of anything in
|
|
2650 particular. */
|
|
2651 void
|
|
2652 pixel_to_char_size (struct frame *f, int pixel_width, int pixel_height,
|
|
2653 int *char_width, int *char_height)
|
|
2654 {
|
|
2655 frame_conversion_internal (f, 1, &pixel_width, &pixel_height, char_width,
|
269
|
2656 char_height, 0);
|
0
|
2657 }
|
|
2658
|
|
2659 /* Given a character size, this returns the minimum number of pixels
|
|
2660 necessary to display that many characters, taking into account the
|
|
2661 internal border width, scrollbar height and width, toolbar heights and
|
|
2662 widths and the size of the line terminator glyphs (assuming the line
|
|
2663 terminators take up exactly one character position).
|
|
2664
|
|
2665 Therefore the result is not necessarily a multiple of anything in
|
|
2666 particular. */
|
|
2667 void
|
|
2668 char_to_pixel_size (struct frame *f, int char_width, int char_height,
|
|
2669 int *pixel_width, int *pixel_height)
|
|
2670 {
|
|
2671 frame_conversion_internal (f, 0, pixel_width, pixel_height, &char_width,
|
269
|
2672 &char_height, 0);
|
0
|
2673 }
|
|
2674
|
|
2675 /* Given a pixel size, rounds DOWN to the smallest size in pixels necessary
|
|
2676 to display the same number of characters as are displayable now.
|
|
2677 */
|
|
2678 void
|
|
2679 round_size_to_char (struct frame *f, int in_width, int in_height,
|
|
2680 int *out_width, int *out_height)
|
|
2681 {
|
|
2682 int char_width;
|
|
2683 int char_height;
|
|
2684 pixel_to_char_size (f, in_width, in_height, &char_width, &char_height);
|
|
2685 char_to_pixel_size (f, char_width, char_height, out_width, out_height);
|
|
2686 }
|
|
2687
|
269
|
2688 /* Versions of the above which always account for real font metrics.
|
|
2689 */
|
|
2690 void
|
|
2691 pixel_to_real_char_size (struct frame *f, int pixel_width, int pixel_height,
|
|
2692 int *char_width, int *char_height)
|
|
2693 {
|
|
2694 frame_conversion_internal (f, 1, &pixel_width, &pixel_height, char_width,
|
|
2695 char_height, 1);
|
|
2696 }
|
|
2697
|
|
2698 void
|
|
2699 char_to_real_pixel_size (struct frame *f, int char_width, int char_height,
|
|
2700 int *pixel_width, int *pixel_height)
|
|
2701 {
|
|
2702 frame_conversion_internal (f, 0, pixel_width, pixel_height, &char_width,
|
|
2703 &char_height, 1);
|
|
2704 }
|
|
2705
|
|
2706 void
|
|
2707 round_size_to_real_char (struct frame *f, int in_width, int in_height,
|
|
2708 int *out_width, int *out_height)
|
|
2709 {
|
|
2710 int char_width;
|
|
2711 int char_height;
|
|
2712 pixel_to_real_char_size (f, in_width, in_height, &char_width, &char_height);
|
|
2713 char_to_real_pixel_size (f, char_width, char_height, out_width, out_height);
|
|
2714 }
|
|
2715
|
0
|
2716 /* Change the frame height and/or width. Values may be given as zero to
|
|
2717 indicate no change is to take place. */
|
|
2718 static void
|
|
2719 change_frame_size_1 (struct frame *f, int newheight, int newwidth)
|
|
2720 {
|
|
2721 Lisp_Object frame;
|
|
2722 int new_pixheight, new_pixwidth;
|
269
|
2723 int font_height, real_font_height, font_width;
|
0
|
2724
|
|
2725 /* #### Chuck -- shouldn't we be checking to see if the frame
|
|
2726 is being "changed" to its existing size, and do nothing if so? */
|
209
|
2727 /* No, because it would hose toolbar updates. The toolbar
|
|
2728 update code relies on this function to cause window `top' and
|
|
2729 `left' coordinates to be recomputed even though no frame size
|
|
2730 change occurs. --kyle */
|
0
|
2731 if (in_display)
|
|
2732 abort ();
|
|
2733
|
|
2734 XSETFRAME (frame, f);
|
149
|
2735
|
269
|
2736 default_face_height_and_width (frame, &real_font_height, 0);
|
|
2737 default_face_height_and_width_1 (frame, &font_height, &font_width);
|
0
|
2738
|
|
2739 /* This size-change overrides any pending one for this frame. */
|
|
2740 FRAME_NEW_HEIGHT (f) = 0;
|
|
2741 FRAME_NEW_WIDTH (f) = 0;
|
|
2742
|
|
2743 new_pixheight = newheight * font_height;
|
|
2744 new_pixwidth = (newwidth - 1) * font_width;
|
|
2745
|
|
2746 /* #### dependency on FRAME_WIN_P should be removed. */
|
|
2747 if (FRAME_WIN_P (f))
|
|
2748 {
|
|
2749 new_pixheight += FRAME_SCROLLBAR_HEIGHT (f);
|
|
2750 new_pixwidth += FRAME_SCROLLBAR_WIDTH (f);
|
|
2751 }
|
|
2752
|
|
2753 /* when frame_conversion_internal() calculated the number of rows/cols
|
280
|
2754 in the frame, the theoretical toolbar sizes were subtracted out.
|
|
2755 The caluclations below adjust for real toolbar height/width in
|
|
2756 frame, which may be different from frame spec, taking the above
|
|
2757 fact into account */
|
|
2758 new_pixheight +=
|
|
2759 + FRAME_THEORETICAL_TOP_TOOLBAR_HEIGHT (f)
|
|
2760 + 2 * FRAME_THEORETICAL_TOP_TOOLBAR_BORDER_WIDTH (f)
|
|
2761 - FRAME_REAL_TOP_TOOLBAR_HEIGHT (f)
|
|
2762 - 2 * FRAME_REAL_TOP_TOOLBAR_BORDER_WIDTH (f);
|
|
2763
|
|
2764 new_pixheight +=
|
|
2765 + FRAME_THEORETICAL_BOTTOM_TOOLBAR_HEIGHT (f)
|
|
2766 + 2 * FRAME_THEORETICAL_BOTTOM_TOOLBAR_BORDER_WIDTH (f)
|
|
2767 - FRAME_REAL_BOTTOM_TOOLBAR_HEIGHT (f)
|
|
2768 - 2 * FRAME_REAL_BOTTOM_TOOLBAR_BORDER_WIDTH (f);
|
|
2769
|
|
2770 new_pixwidth +=
|
|
2771 + FRAME_THEORETICAL_LEFT_TOOLBAR_WIDTH (f)
|
|
2772 + 2 * FRAME_THEORETICAL_LEFT_TOOLBAR_BORDER_WIDTH (f)
|
|
2773 - FRAME_REAL_LEFT_TOOLBAR_WIDTH (f)
|
|
2774 - 2 * FRAME_REAL_LEFT_TOOLBAR_BORDER_WIDTH (f);
|
|
2775
|
|
2776 new_pixwidth +=
|
|
2777 + FRAME_THEORETICAL_RIGHT_TOOLBAR_WIDTH (f)
|
|
2778 + 2 * FRAME_THEORETICAL_RIGHT_TOOLBAR_BORDER_WIDTH (f)
|
|
2779 - FRAME_REAL_RIGHT_TOOLBAR_WIDTH (f)
|
|
2780 - 2 * FRAME_REAL_RIGHT_TOOLBAR_BORDER_WIDTH (f);
|
|
2781
|
0
|
2782 /* Adjust the width for the end glyph which may be a different width
|
|
2783 than the default character width. */
|
|
2784 {
|
|
2785 int adjustment, trunc_width, cont_width;
|
|
2786
|
|
2787 trunc_width = glyph_width (Vtruncation_glyph, Vdefault_face, 0,
|
|
2788 FRAME_SELECTED_WINDOW (f));
|
|
2789 cont_width = glyph_width (Vcontinuation_glyph, Vdefault_face, 0,
|
|
2790 FRAME_SELECTED_WINDOW (f));
|
|
2791 adjustment = max (trunc_width, cont_width);
|
|
2792 adjustment = max (adjustment, font_width);
|
|
2793
|
|
2794 new_pixwidth += adjustment;
|
|
2795 }
|
|
2796
|
|
2797 /* If we don't have valid values, exit. */
|
|
2798 if (!new_pixheight && !new_pixwidth)
|
|
2799 return;
|
|
2800
|
|
2801 if (new_pixheight)
|
|
2802 {
|
|
2803 XWINDOW (FRAME_ROOT_WINDOW (f))->pixel_top = FRAME_TOP_BORDER_END (f);
|
|
2804
|
|
2805 if (FRAME_HAS_MINIBUF_P (f)
|
|
2806 && ! FRAME_MINIBUF_ONLY_P (f))
|
|
2807 /* Frame has both root and minibuffer. */
|
|
2808 {
|
153
|
2809 /*
|
|
2810 * Leave the minibuffer height the same if the frame has
|
|
2811 * been initialized, and the minibuffer height is tall
|
|
2812 * enough to display at least one line of text in the default
|
|
2813 * font, and the old minibuffer height is a multiple of the
|
|
2814 * default font height. This should cause the minibuffer
|
|
2815 * height to be recomputed on font changes but not for
|
|
2816 * other frame size changes, which seems reasonable.
|
|
2817 */
|
|
2818 int old_minibuf_height =
|
|
2819 XWINDOW(FRAME_MINIBUF_WINDOW(f))->pixel_height;
|
|
2820 int minibuf_height =
|
269
|
2821 f->init_finished && (old_minibuf_height % real_font_height) == 0 ?
|
|
2822 max(old_minibuf_height, real_font_height) :
|
|
2823 real_font_height;
|
0
|
2824 set_window_pixheight (FRAME_ROOT_WINDOW (f),
|
|
2825 /* - font_height for minibuffer */
|
153
|
2826 new_pixheight - minibuf_height, 0);
|
0
|
2827
|
|
2828 XWINDOW (FRAME_MINIBUF_WINDOW (f))->pixel_top =
|
153
|
2829 new_pixheight - minibuf_height + FRAME_TOP_BORDER_END (f);
|
173
|
2830
|
153
|
2831 set_window_pixheight (FRAME_MINIBUF_WINDOW (f), minibuf_height, 0);
|
0
|
2832 }
|
|
2833 else
|
|
2834 /* Frame has just one top-level window. */
|
|
2835 set_window_pixheight (FRAME_ROOT_WINDOW (f), new_pixheight, 0);
|
|
2836
|
|
2837 FRAME_HEIGHT (f) = newheight;
|
|
2838 if (FRAME_TTY_P (f))
|
|
2839 f->pixheight = newheight;
|
|
2840 }
|
|
2841
|
|
2842 if (new_pixwidth)
|
|
2843 {
|
|
2844 XWINDOW (FRAME_ROOT_WINDOW (f))->pixel_left = FRAME_LEFT_BORDER_END (f);
|
|
2845 set_window_pixwidth (FRAME_ROOT_WINDOW (f), new_pixwidth, 0);
|
|
2846
|
|
2847 if (FRAME_HAS_MINIBUF_P (f))
|
|
2848 {
|
|
2849 XWINDOW (FRAME_MINIBUF_WINDOW (f))->pixel_left =
|
|
2850 FRAME_LEFT_BORDER_END (f);
|
|
2851 set_window_pixwidth (FRAME_MINIBUF_WINDOW (f), new_pixwidth, 0);
|
|
2852 }
|
|
2853
|
|
2854 FRAME_WIDTH (f) = newwidth;
|
|
2855 if (FRAME_TTY_P (f))
|
|
2856 f->pixwidth = newwidth;
|
|
2857 }
|
|
2858
|
|
2859 MARK_FRAME_TOOLBARS_CHANGED (f);
|
|
2860 MARK_FRAME_CHANGED (f);
|
217
|
2861 f->echo_area_garbaged = 1;
|
0
|
2862 }
|
|
2863
|
|
2864 void
|
|
2865 change_frame_size (struct frame *f, int newheight, int newwidth, int delay)
|
|
2866 {
|
|
2867 /* sometimes we get passed a size that's too small (esp. when a
|
|
2868 client widget gets resized, since we have no control over this).
|
|
2869 So deal. */
|
|
2870 check_frame_size (f, &newheight, &newwidth);
|
|
2871
|
|
2872 if (delay || in_display || gc_in_progress)
|
|
2873 {
|
|
2874 MARK_FRAME_SIZE_CHANGED (f);
|
|
2875 f->new_width = newwidth;
|
|
2876 f->new_height = newheight;
|
|
2877 return;
|
|
2878 }
|
|
2879
|
|
2880 f->size_change_pending = 0;
|
|
2881 /* For TTY frames, it's like one, like all ...
|
|
2882 Can't have two TTY frames of different sizes on the same device. */
|
|
2883 if (FRAME_TTY_P (f))
|
|
2884 {
|
|
2885 Lisp_Object frmcons;
|
|
2886
|
|
2887 DEVICE_FRAME_LOOP (frmcons, XDEVICE (FRAME_DEVICE (f)))
|
|
2888 change_frame_size_1 (XFRAME (XCAR (frmcons)), newheight, newwidth);
|
|
2889 }
|
|
2890 else
|
|
2891 change_frame_size_1 (f, newheight, newwidth);
|
|
2892 }
|
|
2893
|
|
2894
|
|
2895 void
|
|
2896 update_frame_title (struct frame *f)
|
|
2897 {
|
|
2898 struct window *w = XWINDOW (FRAME_SELECTED_WINDOW (f));
|
|
2899 Lisp_Object title_format;
|
|
2900 Lisp_Object icon_format;
|
2
|
2901 Bufbyte *title;
|
0
|
2902
|
|
2903 /* We don't change the title for the minibuffer unless the frame
|
|
2904 only has a minibuffer. */
|
|
2905 if (MINI_WINDOW_P (w) && !FRAME_MINIBUF_ONLY_P (f))
|
|
2906 return;
|
|
2907
|
|
2908 /* And we don't want dead buffers to blow up on us. */
|
2
|
2909 if (!BUFFER_LIVE_P (XBUFFER (w->buffer)))
|
0
|
2910 return;
|
|
2911
|
2
|
2912 title = NULL;
|
|
2913 title_format = symbol_value_in_buffer (Qframe_title_format, w->buffer);
|
|
2914 icon_format = symbol_value_in_buffer (Qframe_icon_title_format, w->buffer);
|
|
2915
|
|
2916 if (HAS_FRAMEMETH_P (f, set_title_from_bufbyte))
|
0
|
2917 {
|
2
|
2918 title = generate_formatted_string (w, title_format, Qnil,
|
|
2919 DEFAULT_INDEX, CURRENT_DISP);
|
|
2920 FRAMEMETH (f, set_title_from_bufbyte, (f, title));
|
|
2921 }
|
|
2922
|
|
2923 if (HAS_FRAMEMETH_P (f, set_icon_name_from_bufbyte))
|
|
2924 {
|
|
2925 if (!EQ (icon_format, title_format) || !title)
|
0
|
2926 {
|
2
|
2927 if (title)
|
|
2928 xfree (title);
|
|
2929
|
|
2930 title = generate_formatted_string (w, icon_format, Qnil,
|
|
2931 DEFAULT_INDEX, CURRENT_DISP);
|
0
|
2932 }
|
2
|
2933 FRAMEMETH (f, set_icon_name_from_bufbyte, (f, title));
|
0
|
2934 }
|
|
2935
|
2
|
2936 if (title)
|
|
2937 xfree (title);
|
0
|
2938 }
|
|
2939
|
|
2940
|
20
|
2941 DEFUN ("set-frame-pointer", Fset_frame_pointer, 2, 2, 0, /*
|
0
|
2942 Set the mouse pointer of FRAME to the given pointer image instance.
|
|
2943 You should not call this function directly. Instead, set one of
|
|
2944 the variables `text-pointer-glyph', `nontext-pointer-glyph',
|
|
2945 `modeline-pointer-glyph', `selection-pointer-glyph',
|
|
2946 `busy-pointer-glyph', or `toolbar-pointer-glyph'.
|
20
|
2947 */
|
|
2948 (frame, image_instance))
|
0
|
2949 {
|
|
2950 struct frame *f = decode_frame (frame);
|
|
2951 CHECK_POINTER_IMAGE_INSTANCE (image_instance);
|
|
2952 if (!EQ (f->pointer, image_instance))
|
|
2953 {
|
|
2954 f->pointer = image_instance;
|
|
2955 MAYBE_FRAMEMETH (f, set_frame_pointer, (f));
|
|
2956 }
|
|
2957 return Qnil;
|
|
2958 }
|
|
2959
|
|
2960
|
|
2961 void
|
|
2962 update_frame_icon (struct frame *f)
|
|
2963 {
|
|
2964 if (f->icon_changed || f->windows_changed)
|
|
2965 {
|
272
|
2966 Lisp_Object frame;
|
0
|
2967 Lisp_Object new_icon;
|
|
2968
|
|
2969 XSETFRAME (frame, f);
|
|
2970 new_icon = glyph_image_instance (Vframe_icon_glyph, frame,
|
|
2971 ERROR_ME_WARN, 0);
|
|
2972 if (!EQ (new_icon, f->icon))
|
|
2973 {
|
|
2974 f->icon = new_icon;
|
|
2975 MAYBE_FRAMEMETH (f, set_frame_icon, (f));
|
|
2976 }
|
|
2977 }
|
|
2978
|
|
2979 f->icon_changed = 0;
|
|
2980 }
|
|
2981
|
|
2982 static void
|
|
2983 icon_glyph_changed (Lisp_Object glyph, Lisp_Object property,
|
|
2984 Lisp_Object locale)
|
|
2985 {
|
|
2986 MARK_ICON_CHANGED;
|
|
2987 }
|
|
2988
|
|
2989
|
|
2990 void
|
|
2991 syms_of_frame (void)
|
|
2992 {
|
|
2993 defsymbol (&Qdelete_frame_hook, "delete-frame-hook");
|
|
2994 defsymbol (&Qselect_frame_hook, "select-frame-hook");
|
|
2995 defsymbol (&Qdeselect_frame_hook, "deselect-frame-hook");
|
|
2996 defsymbol (&Qcreate_frame_hook, "create-frame-hook");
|
197
|
2997 defsymbol (&Qcustom_initialize_frame, "custom-initialize-frame");
|
0
|
2998 defsymbol (&Qmouse_enter_frame_hook, "mouse-enter-frame-hook");
|
|
2999 defsymbol (&Qmouse_leave_frame_hook, "mouse-leave-frame-hook");
|
|
3000 defsymbol (&Qmap_frame_hook, "map-frame-hook");
|
|
3001 defsymbol (&Qunmap_frame_hook, "unmap-frame-hook");
|
249
|
3002 #if defined (HAVE_CDE) || defined (HAVE_OFFIX_DND) || defined(HAVE_MS_WINDOWS)
|
0
|
3003 defsymbol (&Qdrag_and_drop_functions, "drag-and-drop-functions");
|
|
3004 #endif
|
|
3005
|
|
3006 defsymbol (&Qframep, "framep");
|
|
3007 defsymbol (&Qframe_live_p, "frame-live-p");
|
|
3008 defsymbol (&Qframe_x_p, "frame-x-p");
|
|
3009 defsymbol (&Qframe_tty_p, "frame-tty-p");
|
|
3010 defsymbol (&Qdelete_frame, "delete-frame");
|
|
3011 defsymbol (&Qsynchronize_minibuffers, "synchronize-minibuffers");
|
|
3012 defsymbol (&Qbuffer_predicate, "buffer-predicate");
|
|
3013 defsymbol (&Qframe_being_created, "frame-being-created");
|
|
3014 defsymbol (&Qmake_initial_minibuffer_frame, "make-initial-minibuffer-frame");
|
|
3015
|
2
|
3016 defsymbol (&Qframe_title_format, "frame-title-format");
|
|
3017 defsymbol (&Qframe_icon_title_format, "frame-icon-title-format");
|
|
3018
|
108
|
3019 defsymbol (&Qhidden, "hidden");
|
0
|
3020 defsymbol (&Qvisible, "visible");
|
|
3021 defsymbol (&Qiconic, "iconic");
|
|
3022 defsymbol (&Qinvisible, "invisible");
|
|
3023 defsymbol (&Qvisible_iconic, "visible-iconic");
|
|
3024 defsymbol (&Qinvisible_iconic, "invisible-iconic");
|
|
3025 defsymbol (&Qnomini, "nomini");
|
|
3026 defsymbol (&Qvisible_nomini, "visible-nomini");
|
|
3027 defsymbol (&Qiconic_nomini, "iconic-nomini");
|
|
3028 defsymbol (&Qinvisible_nomini, "invisible-nomini");
|
|
3029 defsymbol (&Qvisible_iconic_nomini, "visible-iconic-nomini");
|
|
3030 defsymbol (&Qinvisible_iconic_nomini, "invisible-iconic-nomini");
|
|
3031
|
|
3032 defsymbol (&Qminibuffer, "minibuffer");
|
|
3033 defsymbol (&Qunsplittable, "unsplittable");
|
|
3034 defsymbol (&Qinternal_border_width, "internal-border-width");
|
|
3035 defsymbol (&Qtop_toolbar_shadow_color, "top-toolbar-shadow-color");
|
|
3036 defsymbol (&Qbottom_toolbar_shadow_color, "bottom-toolbar-shadow-color");
|
|
3037 defsymbol (&Qbackground_toolbar_color, "background-toolbar-color");
|
|
3038 defsymbol (&Qtop_toolbar_shadow_pixmap, "top-toolbar-shadow-pixmap");
|
|
3039 defsymbol (&Qbottom_toolbar_shadow_pixmap, "bottom-toolbar-shadow-pixmap");
|
|
3040 defsymbol (&Qtoolbar_shadow_thickness, "toolbar-shadow-thickness");
|
|
3041 defsymbol (&Qscrollbar_placement, "scrollbar-placement");
|
|
3042 defsymbol (&Qinter_line_space, "inter-line-space");
|
|
3043 /* Qiconic already in this function. */
|
|
3044 defsymbol (&Qvisual_bell, "visual-bell");
|
|
3045 defsymbol (&Qbell_volume, "bell-volume");
|
|
3046 defsymbol (&Qpointer_background, "pointer-background");
|
|
3047 defsymbol (&Qpointer_color, "pointer-color");
|
|
3048 defsymbol (&Qtext_pointer, "text-pointer");
|
|
3049 defsymbol (&Qspace_pointer, "space-pointer");
|
|
3050 defsymbol (&Qmodeline_pointer, "modeline-pointer");
|
|
3051 defsymbol (&Qgc_pointer, "gc-pointer");
|
|
3052 defsymbol (&Qinitially_unmapped, "initially-unmapped");
|
|
3053 defsymbol (&Quse_backing_store, "use-backing-store");
|
|
3054 defsymbol (&Qborder_color, "border-color");
|
|
3055 defsymbol (&Qborder_width, "border-width");
|
|
3056 /* Qwidth, Qheight, Qleft, Qtop in general.c */
|
|
3057 defsymbol (&Qset_specifier, "set-specifier");
|
|
3058 defsymbol (&Qset_glyph_image, "set-glyph-image");
|
|
3059 defsymbol (&Qset_face_property, "set-face-property");
|
|
3060 defsymbol (&Qface_property_instance, "face-property-instance");
|
|
3061 defsymbol (&Qframe_property_alias, "frame-property-alias");
|
|
3062
|
20
|
3063 DEFSUBR (Fmake_frame);
|
|
3064 DEFSUBR (Fframep);
|
|
3065 DEFSUBR (Fframe_live_p);
|
0
|
3066 #if 0 /* FSFmacs */
|
20
|
3067 DEFSUBR (Fignore_event);
|
0
|
3068 #endif
|
20
|
3069 DEFSUBR (Fselect_frame);
|
|
3070 DEFSUBR (Fselected_frame);
|
|
3071 DEFSUBR (Factive_minibuffer_window);
|
|
3072 DEFSUBR (Flast_nonminibuf_frame);
|
|
3073 DEFSUBR (Fframe_root_window);
|
|
3074 DEFSUBR (Fframe_selected_window);
|
|
3075 DEFSUBR (Fset_frame_selected_window);
|
|
3076 DEFSUBR (Fframe_device);
|
|
3077 DEFSUBR (Fnext_frame);
|
|
3078 DEFSUBR (Fprevious_frame);
|
|
3079 DEFSUBR (Fdelete_frame);
|
|
3080 DEFSUBR (Fmouse_position);
|
|
3081 DEFSUBR (Fmouse_pixel_position);
|
|
3082 DEFSUBR (Fmouse_position_as_motion_event);
|
|
3083 DEFSUBR (Fset_mouse_position);
|
|
3084 DEFSUBR (Fset_mouse_pixel_position);
|
|
3085 DEFSUBR (Fmake_frame_visible);
|
|
3086 DEFSUBR (Fmake_frame_invisible);
|
|
3087 DEFSUBR (Ficonify_frame);
|
|
3088 DEFSUBR (Fdeiconify_frame);
|
|
3089 DEFSUBR (Fframe_visible_p);
|
|
3090 DEFSUBR (Fframe_totally_visible_p);
|
|
3091 DEFSUBR (Fframe_iconified_p);
|
|
3092 DEFSUBR (Fvisible_frame_list);
|
|
3093 DEFSUBR (Fraise_frame);
|
|
3094 DEFSUBR (Flower_frame);
|
|
3095 DEFSUBR (Fframe_property);
|
|
3096 DEFSUBR (Fframe_properties);
|
|
3097 DEFSUBR (Fset_frame_properties);
|
|
3098 DEFSUBR (Fframe_pixel_height);
|
|
3099 DEFSUBR (Fframe_pixel_width);
|
|
3100 DEFSUBR (Fframe_name);
|
|
3101 DEFSUBR (Fframe_modified_tick);
|
|
3102 DEFSUBR (Fset_frame_height);
|
|
3103 DEFSUBR (Fset_frame_width);
|
|
3104 DEFSUBR (Fset_frame_size);
|
|
3105 DEFSUBR (Fset_frame_position);
|
|
3106 DEFSUBR (Fset_frame_pointer);
|
0
|
3107 }
|
|
3108
|
|
3109 void
|
|
3110 vars_of_frame (void)
|
|
3111 {
|
|
3112 /* */
|
|
3113 Vframe_being_created = Qnil;
|
|
3114 staticpro (&Vframe_being_created);
|
|
3115
|
20
|
3116 #ifdef HAVE_CDE
|
149
|
3117 Fprovide (intern ("cde"));
|
20
|
3118 #endif
|
|
3119
|
183
|
3120 #ifdef HAVE_OFFIX_DND
|
|
3121 Fprovide (intern ("offix"));
|
|
3122 #endif
|
|
3123
|
0
|
3124 #if 0 /* FSFmacs stupidity */
|
|
3125 xxDEFVAR_LISP ("emacs-iconified", &Vemacs_iconified /*
|
|
3126 Non-nil if all of emacs is iconified and frame updates are not needed.
|
|
3127 */ );
|
|
3128 Vemacs_iconified = Qnil;
|
|
3129 #endif
|
|
3130
|
|
3131 DEFVAR_LISP ("select-frame-hook", &Vselect_frame_hook /*
|
|
3132 Function or functions to run just after a new frame is given the focus.
|
|
3133 Note that calling `select-frame' does not necessarily set the focus:
|
|
3134 The actual window-system focus will not be changed until the next time
|
|
3135 that XEmacs is waiting for an event, and even then, the window manager
|
|
3136 may refuse the focus-change request.
|
|
3137 */ );
|
|
3138 Vselect_frame_hook = Qnil;
|
|
3139
|
|
3140 DEFVAR_LISP ("deselect-frame-hook", &Vdeselect_frame_hook /*
|
|
3141 Function or functions to run just before a frame loses the focus.
|
|
3142 See `select-frame-hook'.
|
|
3143 */ );
|
|
3144 Vdeselect_frame_hook = Qnil;
|
|
3145
|
|
3146 DEFVAR_LISP ("delete-frame-hook", &Vdelete_frame_hook /*
|
|
3147 Function or functions to call when a frame is deleted.
|
16
|
3148 One argument, the about-to-be-deleted frame.
|
0
|
3149 */ );
|
|
3150 Vdelete_frame_hook = Qnil;
|
|
3151
|
|
3152 DEFVAR_LISP ("create-frame-hook", &Vcreate_frame_hook /*
|
|
3153 Function or functions to call when a frame is created.
|
|
3154 One argument, the newly-created frame.
|
|
3155 */ );
|
|
3156 Vcreate_frame_hook = Qnil;
|
|
3157
|
|
3158 DEFVAR_LISP ("mouse-enter-frame-hook", &Vmouse_enter_frame_hook /*
|
16
|
3159 Function or functions to call when the mouse enters a frame.
|
0
|
3160 One argument, the frame.
|
16
|
3161 Be careful not to make assumptions about the window manager's focus model.
|
0
|
3162 In most cases, the `deselect-frame-hook' is more appropriate.
|
|
3163 */ );
|
|
3164 Vmouse_enter_frame_hook = Qnil;
|
|
3165
|
|
3166 DEFVAR_LISP ("mouse-leave-frame-hook", &Vmouse_leave_frame_hook /*
|
16
|
3167 Function or functions to call when the mouse leaves a frame.
|
0
|
3168 One argument, the frame.
|
16
|
3169 Be careful not to make assumptions about the window manager's focus model.
|
0
|
3170 In most cases, the `select-frame-hook' is more appropriate.
|
|
3171 */ );
|
|
3172 Vmouse_leave_frame_hook = Qnil;
|
|
3173
|
|
3174 DEFVAR_LISP ("map-frame-hook", &Vmap_frame_hook /*
|
16
|
3175 Function or functions to call when a frame is mapped.
|
0
|
3176 One argument, the frame.
|
|
3177 */ );
|
|
3178 Vmap_frame_hook = Qnil;
|
|
3179
|
|
3180 DEFVAR_LISP ("unmap-frame-hook", &Vunmap_frame_hook /*
|
16
|
3181 Function or functions to call when a frame is unmapped.
|
0
|
3182 One argument, the frame.
|
|
3183 */ );
|
|
3184 Vunmap_frame_hook = Qnil;
|
|
3185
|
142
|
3186 DEFVAR_BOOL ("allow-deletion-of-last-visible-frame",
|
146
|
3187 &allow_deletion_of_last_visible_frame /*
|
0
|
3188 *Non-nil means to assume the force option to delete-frame.
|
|
3189 */ );
|
146
|
3190 allow_deletion_of_last_visible_frame = 0;
|
0
|
3191
|
249
|
3192 #if defined (HAVE_CDE) || defined (HAVE_OFFIX_DND) || defined(HAVE_MS_WINDOWS)
|
0
|
3193 DEFVAR_LISP ("drag-and-drop-functions", &Vdrag_and_drop_functions /*
|
|
3194 Function or functions to run when an object is dropped on a frame.
|
2
|
3195 Each function is called with either two or three args. If called with
|
|
3196 two args, the args are a frame and a pathname. If with three, the
|
16
|
3197 args are a frame, a pathname (which will be either a string or nil)
|
2
|
3198 and the textual representation of the dragged object.
|
0
|
3199 */ );
|
|
3200 Vdrag_and_drop_functions = Qnil;
|
249
|
3201 #endif /* HAVE_CDE || HAVE_OFFIX_DND || HAVE_MS_WINDOWS */
|
0
|
3202
|
|
3203 DEFVAR_LISP ("mouse-motion-handler", &Vmouse_motion_handler /*
|
|
3204 Handler for motion events. One arg, the event.
|
|
3205 For most applications, you should use `mode-motion-hook' instead of this.
|
|
3206 */ );
|
|
3207 Vmouse_motion_handler = Qnil;
|
|
3208
|
|
3209 DEFVAR_LISP ("synchronize-minibuffers",&Vsynchronize_minibuffers /*
|
|
3210 Set to t if all minibuffer windows are to be synchronized.
|
|
3211 This will cause echo area messages to appear in the minibuffers of all
|
|
3212 visible frames.
|
|
3213 */ );
|
|
3214 Vsynchronize_minibuffers = Qnil;
|
|
3215
|
|
3216 DEFVAR_LISP ("frame-title-format", &Vframe_title_format /*
|
|
3217 Controls the title of the X window corresponding to the selected frame.
|
|
3218 This is the same format as `modeline-format' with the exception that
|
|
3219 %- is ignored.
|
|
3220 */ );
|
|
3221 Vframe_title_format = Fpurecopy (build_string ("%S: %b"));
|
|
3222
|
|
3223 DEFVAR_LISP ("frame-icon-title-format", &Vframe_icon_title_format /*
|
|
3224 Controls the title of the icon corresponding to the selected frame.
|
16
|
3225 See also the variable `frame-title-format'.
|
0
|
3226 */ );
|
|
3227 Vframe_icon_title_format = Fpurecopy (build_string ("%b"));
|
|
3228
|
|
3229 DEFVAR_LISP ("default-frame-name", &Vdefault_frame_name /*
|
|
3230 The default name to assign to newly-created frames.
|
|
3231 This can be overridden by arguments to `make-frame'.
|
|
3232 This must be a string.
|
|
3233 */ );
|
272
|
3234 #ifndef INFODOCK
|
0
|
3235 Vdefault_frame_name = Fpurecopy (build_string ("emacs"));
|
272
|
3236 #else
|
|
3237 Vdefault_frame_name = Fpurecopy (build_string ("InfoDock"));
|
|
3238 #endif
|
0
|
3239
|
|
3240 DEFVAR_LISP ("default-frame-plist", &Vdefault_frame_plist /*
|
|
3241 Plist of default values for frame creation, other than the first one.
|
|
3242 These may be set in your init file, like this:
|
|
3243
|
|
3244 \(setq default-frame-plist '(width 80 height 55))
|
|
3245
|
|
3246 The properties may be in alist format for backward compatibility
|
|
3247 but you should not rely on this behavior.
|
|
3248
|
|
3249 These override values given in window system configuration data,
|
|
3250 including X Windows' defaults database.
|
|
3251
|
|
3252 Since the first X frame is created before loading your .emacs file,
|
|
3253 you must use the X resource database for that.
|
|
3254
|
|
3255 For values specific to the first Emacs frame, see `initial-frame-plist'.
|
|
3256 For values specific to the separate minibuffer frame, see
|
|
3257 `minibuffer-frame-plist'.
|
|
3258
|
|
3259 See also the variables `default-x-frame-plist' and
|
|
3260 `default-tty-frame-plist', which are like `default-frame-plist'
|
|
3261 except that they apply only to X or tty frames, respectively
|
197
|
3262 \(whereas `default-frame-plist' applies to all types of frames).
|
0
|
3263 */ );
|
|
3264 Vdefault_frame_plist = Qnil;
|
|
3265
|
|
3266 DEFVAR_LISP ("frame-icon-glyph", &Vframe_icon_glyph /*
|
|
3267 Icon glyph used to iconify a frame.
|
|
3268 */ );
|
|
3269 }
|
|
3270
|
|
3271 void
|
|
3272 complex_vars_of_frame (void)
|
|
3273 {
|
|
3274 Vframe_icon_glyph = allocate_glyph (GLYPH_ICON, icon_glyph_changed);
|
|
3275 }
|