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