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