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