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;
|
|
56 Lisp_Object 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
|
30
|
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
|
22
|
465 #if 0
|
0
|
466 DEVICE_FRAME_LIST (d) = nconc2 (DEVICE_FRAME_LIST (d), Fcons (frame, Qnil));
|
22
|
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))
|
16
|
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. */
|
|
1259 if (!force && NILP (Vallow_deletion_of_last_visible_frame) &&
|
|
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 }
|
20
|
1285 /* Test for popup frames hanging around. */
|
|
1286 /* Deletion of a parent frame with popups is deadly. */
|
|
1287 {
|
|
1288 Lisp_Object frmcons, devcons, concons;
|
|
1289
|
|
1290 FRAME_LOOP_NO_BREAK (frmcons, devcons, concons)
|
|
1291 {
|
|
1292 Lisp_Object this = XCAR (frmcons);
|
|
1293
|
|
1294
|
|
1295 if (! EQ (this, frame)
|
|
1296 && EQ (frame, DEVMETH_OR_GIVEN(XDEVICE(XCAR(devcons)),
|
|
1297 get_frame_parent,
|
|
1298 (XFRAME(this)),
|
|
1299 Qnil)))
|
|
1300 {
|
|
1301 /* We've found another frame whose minibuffer is on
|
|
1302 this frame. */
|
|
1303 signal_simple_error
|
|
1304 ("Attempt to delete a frame with live popups", frame);
|
|
1305 }
|
|
1306 }
|
|
1307 }
|
0
|
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);
|
20
|
1385
|
0
|
1386 if (NILP (next) || EQ (next, frame) || ! FRAME_LIVE_P (XFRAME (next)))
|
|
1387 next = next_frame_internal (frame, Qvisible, device,
|
|
1388 called_from_delete_device);
|
|
1389 if (NILP (next) || EQ (next, frame))
|
|
1390 next = next_frame_internal (frame, Qvisible, console,
|
|
1391 called_from_delete_device);
|
|
1392 if (NILP (next) || EQ (next, frame))
|
|
1393 next = next_frame_internal (frame, Qvisible, Qt,
|
|
1394 called_from_delete_device);
|
|
1395 if (NILP (next) || EQ (next, frame))
|
|
1396 next = next_frame_internal (frame, Qt, device,
|
|
1397 called_from_delete_device);
|
|
1398 if (NILP (next) || EQ (next, frame))
|
|
1399 next = next_frame_internal (frame, Qt, console,
|
|
1400 called_from_delete_device);
|
|
1401 if (NILP (next) || EQ (next, frame))
|
|
1402 next = next_frame_internal (frame, Qt, Qt, called_from_delete_device);
|
48
|
1403
|
|
1404 /* if we haven't found another frame at this point
|
|
1405 then there aren't any. */
|
0
|
1406 if (NILP (next) || EQ (next, frame))
|
|
1407 ;
|
|
1408 else
|
48
|
1409 {
|
|
1410 int did_select = 0;
|
|
1411 /* if this is the global selected frame, select another one. */
|
|
1412 if (EQ (frame, Fselected_frame (Qnil)))
|
|
1413 {
|
|
1414 Fselect_frame (next);
|
|
1415 did_select = 1;
|
|
1416 }
|
|
1417 /*
|
|
1418 * If the new frame we just selected is on a different
|
|
1419 * device then we still need to change DEVICE_SELECTED_FRAME(d)
|
|
1420 * to a live frame, if there are any left on this device.
|
|
1421 */
|
|
1422 if (!EQ (device, FRAME_DEVICE(XFRAME(next))))
|
|
1423 {
|
|
1424 Lisp_Object next_f =
|
|
1425 next_frame_internal (frame, Qt, device,
|
|
1426 called_from_delete_device);
|
|
1427 if (NILP (next_f) || EQ (next_f, frame))
|
|
1428 ;
|
|
1429 else
|
|
1430 set_device_selected_frame (d, next_f);
|
|
1431 }
|
|
1432 else if (! did_select)
|
|
1433 set_device_selected_frame (d, next);
|
|
1434
|
|
1435 }
|
0
|
1436 }
|
|
1437
|
|
1438 /* Don't allow minibuf_window to remain on a deleted frame. */
|
|
1439 if (EQ (f->minibuffer_window, minibuf_window))
|
|
1440 {
|
|
1441 struct frame *sel_frame = selected_frame ();
|
|
1442 Fset_window_buffer (sel_frame->minibuffer_window,
|
|
1443 XWINDOW (minibuf_window)->buffer);
|
|
1444 minibuf_window = sel_frame->minibuffer_window;
|
|
1445
|
|
1446 /* If the dying minibuffer window was selected,
|
|
1447 select the new one. */
|
|
1448 if (minibuffer_selected)
|
|
1449 Fselect_window (minibuf_window);
|
|
1450 }
|
|
1451
|
|
1452 /* After this point, no errors must be allowed to occur. */
|
|
1453
|
|
1454 #ifdef HAVE_MENUBARS
|
|
1455 free_frame_menubars (f);
|
|
1456 #endif
|
|
1457 #ifdef HAVE_SCROLLBARS
|
|
1458 free_frame_scrollbars (f);
|
|
1459 #endif
|
|
1460 #ifdef HAVE_TOOLBARS
|
|
1461 free_frame_toolbars (f);
|
|
1462 #endif
|
|
1463
|
|
1464 /* This must be done before the window and window_mirror structures
|
|
1465 are freed. The scrollbar information is attached to them. */
|
|
1466 MAYBE_FRAMEMETH (f, delete_frame, (f));
|
|
1467
|
|
1468 /* Mark all the windows that used to be on FRAME as deleted, and then
|
|
1469 remove the reference to them. */
|
|
1470 delete_all_subwindows (XWINDOW (f->root_window));
|
|
1471 f->root_window = Qnil;
|
|
1472
|
|
1473 /* Remove the frame now from the list. This way, any events generated
|
16
|
1474 on this frame by the maneuvers below will disperse themselves. */
|
|
1475
|
|
1476 /* This used to be Fdelq(), but that will cause a seg fault if the
|
|
1477 QUIT checker happens to get invoked, because the frame list is in
|
|
1478 an inconsistent state. */
|
|
1479 d->frame_list = delq_no_quit (frame, d->frame_list);
|
|
1480 RESET_CHANGED_SET_FLAGS;
|
0
|
1481
|
|
1482 f->dead = 1;
|
|
1483 f->visible = 0;
|
|
1484
|
|
1485 free_window_mirror (f->root_mirror);
|
|
1486 /* free_line_insertion_deletion_costs (f); */
|
|
1487
|
|
1488 /* If we've deleted the last non-minibuf frame, then try to find
|
|
1489 another one. */
|
|
1490 if (EQ (frame, CONSOLE_LAST_NONMINIBUF_FRAME (con)))
|
|
1491 {
|
2
|
1492 Lisp_Object frmcons, devcons;
|
0
|
1493
|
|
1494 set_console_last_nonminibuf_frame (con, Qnil);
|
|
1495
|
|
1496 CONSOLE_FRAME_LOOP_NO_BREAK (frmcons, devcons, con)
|
|
1497 {
|
|
1498 Lisp_Object ecran = XCAR (frmcons);
|
|
1499 if (!FRAME_MINIBUF_ONLY_P (XFRAME (ecran)))
|
|
1500 {
|
|
1501 set_console_last_nonminibuf_frame (con, ecran);
|
|
1502 goto double_break_1;
|
|
1503 }
|
|
1504 }
|
|
1505 }
|
|
1506 double_break_1:
|
|
1507
|
|
1508 if (called_from_delete_device < 0)
|
|
1509 /* then we're being called from delete-console, and we shouldn't
|
|
1510 try to find another default-minibuffer frame for the console.
|
|
1511 */
|
|
1512 con->default_minibuffer_frame = Qnil;
|
|
1513
|
|
1514 /* If we've deleted this console's default_minibuffer_frame, try to
|
|
1515 find another one. Prefer minibuffer-only frames, but also notice
|
|
1516 frames with other windows. */
|
|
1517 if (EQ (frame, con->default_minibuffer_frame))
|
|
1518 {
|
|
1519 Lisp_Object frmcons, devcons;
|
|
1520 /* The last frame we saw with a minibuffer, minibuffer-only or not. */
|
|
1521 Lisp_Object frame_with_minibuf;
|
16
|
1522 /* Some frame we found on the same console, or nil if there are none. */
|
0
|
1523 Lisp_Object frame_on_same_console;
|
|
1524
|
|
1525 frame_on_same_console = Qnil;
|
|
1526 frame_with_minibuf = Qnil;
|
|
1527
|
|
1528 set_console_last_nonminibuf_frame (con, Qnil);
|
|
1529
|
|
1530 CONSOLE_FRAME_LOOP_NO_BREAK (frmcons, devcons, con)
|
|
1531 {
|
|
1532 Lisp_Object this;
|
|
1533 struct frame *f1;
|
|
1534
|
|
1535 this = XCAR (frmcons);
|
|
1536 f1 = XFRAME (this);
|
|
1537
|
|
1538 /* Consider only frames on the same console
|
|
1539 and only those with minibuffers. */
|
|
1540 if (FRAME_HAS_MINIBUF_P (f1))
|
|
1541 {
|
|
1542 frame_with_minibuf = this;
|
|
1543 if (FRAME_MINIBUF_ONLY_P (f1))
|
|
1544 goto double_break_2;
|
|
1545 }
|
|
1546
|
|
1547 frame_on_same_console = this;
|
|
1548 }
|
|
1549 double_break_2:
|
|
1550
|
|
1551 if (!NILP (frame_on_same_console))
|
|
1552 {
|
|
1553 /* We know that there must be some frame with a minibuffer out
|
|
1554 there. If this were not true, all of the frames present
|
16
|
1555 would have to be minibuffer-less, which implies that at some
|
0
|
1556 point their minibuffer frames must have been deleted, but
|
|
1557 that is prohibited at the top; you can't delete surrogate
|
|
1558 minibuffer frames. */
|
|
1559 if (NILP (frame_with_minibuf))
|
|
1560 abort ();
|
|
1561
|
|
1562 con->default_minibuffer_frame = frame_with_minibuf;
|
|
1563 }
|
|
1564 else
|
|
1565 /* No frames left on this console--say no minibuffer either. */
|
|
1566 con->default_minibuffer_frame = Qnil;
|
|
1567 }
|
|
1568
|
|
1569 nuke_all_frame_slots (f); /* nobody should be accessing the device
|
|
1570 or anything else any more, and making
|
16
|
1571 them Qnil allows for better GC'ing
|
0
|
1572 in case a pointer to the dead frame
|
16
|
1573 continues to hang around. */
|
0
|
1574 f->framemeths = dead_console_methods;
|
|
1575 UNGCPRO;
|
|
1576 }
|
|
1577
|
|
1578 void
|
|
1579 io_error_delete_frame (Lisp_Object frame)
|
|
1580 {
|
|
1581 delete_frame_internal (XFRAME (frame), 1, 0, 1);
|
|
1582 }
|
|
1583
|
20
|
1584 DEFUN ("delete-frame", Fdelete_frame, 0, 2, "", /*
|
0
|
1585 Delete FRAME, permanently eliminating it from use.
|
|
1586 If omitted, FRAME defaults to the selected frame.
|
|
1587 A frame may not be deleted if its minibuffer is used by other frames.
|
|
1588 Normally, you cannot delete the last non-minibuffer-only frame (you must
|
|
1589 use `save-buffers-kill-emacs' or `kill-emacs'). However, if optional
|
|
1590 second argument FORCE is non-nil, you can delete the last frame. (This
|
|
1591 will automatically call `save-buffers-kill-emacs'.)
|
20
|
1592 */
|
|
1593 (frame, force))
|
0
|
1594 {
|
|
1595 /* This function can GC */
|
|
1596 struct frame *f;
|
|
1597
|
|
1598 if (NILP (frame))
|
|
1599 {
|
|
1600 f = selected_frame ();
|
|
1601 XSETFRAME (frame, f);
|
|
1602 }
|
|
1603 else
|
|
1604 {
|
|
1605 CHECK_FRAME (frame);
|
|
1606 f = XFRAME (frame);
|
|
1607 }
|
|
1608
|
|
1609 delete_frame_internal (f, !NILP (force), 0, 0);
|
|
1610 return Qnil;
|
|
1611 }
|
|
1612
|
|
1613
|
|
1614 /* Return mouse position in character cell units. */
|
|
1615
|
20
|
1616 DEFUN ("mouse-position", Fmouse_position, 0, 1, 0, /*
|
0
|
1617 Return a list (WINDOW X . Y) giving the current mouse window and position.
|
|
1618 The position is given in character cells, where (0, 0) is the
|
|
1619 upper-left corner of the window.
|
|
1620
|
|
1621 DEVICE specifies the device on which to read the mouse position, and
|
|
1622 defaults to the selected device. If the device is a mouseless terminal
|
|
1623 or Emacs hasn't been programmed to read its mouse position, it returns
|
|
1624 the device's selected window for WINDOW and nil for X and Y.
|
20
|
1625 */
|
|
1626 (device))
|
0
|
1627 {
|
|
1628 Lisp_Object val = Fmouse_pixel_position (device);
|
|
1629 int x, y, obj_x, obj_y;
|
|
1630 struct window *w;
|
|
1631 struct frame *f;
|
|
1632 Bufpos bufpos, closest;
|
|
1633 Charcount modeline_closest;
|
|
1634 Lisp_Object obj1, obj2;
|
|
1635
|
|
1636 if (NILP (XCAR (val)) || NILP (XCAR (XCDR (val))))
|
|
1637 return val;
|
|
1638 w = XWINDOW (XCAR (val));
|
|
1639 x = XINT (XCAR (XCDR (val)));
|
|
1640 y = XINT (XCDR (XCDR (val)));
|
|
1641 f = XFRAME (w->frame);
|
|
1642
|
2
|
1643 if (x >= 0 && y >= 0)
|
0
|
1644 {
|
2
|
1645 if (pixel_to_glyph_translation (f, x, y, &x, &y, &obj_x, &obj_y, &w,
|
|
1646 &bufpos, &closest, &modeline_closest,
|
|
1647 &obj1, &obj2)
|
|
1648 != OVER_NOTHING)
|
|
1649 {
|
|
1650 XCAR (XCDR (val)) = make_int (x);
|
|
1651 XCDR (XCDR (val)) = make_int (y);
|
|
1652 }
|
0
|
1653 }
|
|
1654 else
|
|
1655 {
|
|
1656 XCAR (XCDR (val)) = Qnil;
|
|
1657 XCDR (XCDR (val)) = Qnil;
|
|
1658 }
|
|
1659
|
|
1660 return val;
|
|
1661 }
|
|
1662
|
|
1663 static int
|
|
1664 mouse_pixel_position_1 (struct device *d, Lisp_Object *frame,
|
|
1665 int *x, int *y)
|
|
1666 {
|
|
1667 switch (DEVMETH_OR_GIVEN (d, get_mouse_position, (d, frame, x, y), -1))
|
|
1668 {
|
|
1669 case 1:
|
|
1670 return 1;
|
|
1671
|
|
1672 case 0:
|
|
1673 *frame = Qnil;
|
|
1674 break;
|
|
1675
|
|
1676 case -1:
|
|
1677 *frame = DEVICE_SELECTED_FRAME (d);
|
|
1678 break;
|
|
1679
|
|
1680 default:
|
16
|
1681 abort (); /* method is incorrectly written */
|
0
|
1682 }
|
|
1683
|
|
1684 return 0;
|
|
1685 }
|
|
1686
|
20
|
1687 DEFUN ("mouse-pixel-position", Fmouse_pixel_position, 0, 1, 0, /*
|
0
|
1688 Return a list (WINDOW X . Y) giving the current mouse window and position.
|
|
1689 The position is given in pixel units, where (0, 0) is the
|
|
1690 upper-left corner.
|
|
1691
|
|
1692 DEVICE specifies the device on which to read the mouse position, and
|
|
1693 defaults to the selected device. If the device is a mouseless terminal
|
|
1694 or Emacs hasn't been programmed to read its mouse position, it returns
|
|
1695 the device's selected window for WINDOW and nil for X and Y.
|
20
|
1696 */
|
|
1697 (device))
|
0
|
1698 {
|
|
1699 struct device *d = decode_device (device);
|
|
1700 Lisp_Object frame;
|
|
1701 Lisp_Object window;
|
|
1702 Lisp_Object x, y;
|
|
1703 int intx, inty;
|
|
1704
|
|
1705 x = y = Qnil;
|
|
1706
|
|
1707 if (mouse_pixel_position_1 (d, &frame, &intx, &inty))
|
|
1708 {
|
16
|
1709 struct window *w =
|
|
1710 find_window_by_pixel_pos (intx, inty, XFRAME (frame)->root_window);
|
0
|
1711 if (!w)
|
|
1712 window = Qnil;
|
|
1713 else
|
|
1714 {
|
|
1715 XSETWINDOW (window, w);
|
|
1716
|
|
1717 /* Adjust the position to be relative to the window. */
|
|
1718 intx -= w->pixel_left;
|
|
1719 inty -= w->pixel_top;
|
|
1720 XSETINT (x, intx);
|
|
1721 XSETINT (y, inty);
|
|
1722 }
|
|
1723 }
|
|
1724 else
|
|
1725 {
|
|
1726 if (FRAMEP (frame))
|
|
1727 window = FRAME_SELECTED_WINDOW (XFRAME (frame));
|
|
1728 else
|
|
1729 window = Qnil;
|
|
1730 }
|
|
1731
|
|
1732 return Fcons (window, Fcons (x, y));
|
|
1733 }
|
|
1734
|
20
|
1735 DEFUN ("mouse-position-as-motion-event", Fmouse_position_as_motion_event, 0, 1, 0, /*
|
0
|
1736 Return the current mouse position as a motion event.
|
|
1737 This allows you to call the standard event functions such as
|
|
1738 `event-over-toolbar-p' to determine where the mouse is.
|
|
1739
|
|
1740 DEVICE specifies the device on which to read the mouse position, and
|
|
1741 defaults to the selected device. If the mouse position can't be determined
|
|
1742 (e.g. DEVICE is a TTY device), nil is returned instead of an event.
|
20
|
1743 */
|
|
1744 (device))
|
0
|
1745 {
|
|
1746 struct device *d = decode_device (device);
|
|
1747 Lisp_Object frame;
|
|
1748 int intx, inty;
|
|
1749
|
|
1750 if (mouse_pixel_position_1 (d, &frame, &intx, &inty))
|
|
1751 {
|
|
1752 Lisp_Object event = Fmake_event ();
|
|
1753 XEVENT (event)->event_type = pointer_motion_event;
|
|
1754 XEVENT (event)->channel = frame;
|
|
1755 XEVENT (event)->event.motion.x = intx;
|
|
1756 XEVENT (event)->event.motion.y = inty;
|
|
1757 return event;
|
|
1758 }
|
|
1759 else
|
|
1760 return Qnil;
|
|
1761 }
|
|
1762
|
20
|
1763 DEFUN ("set-mouse-position", Fset_mouse_position, 3, 3, 0, /*
|
0
|
1764 Move the mouse pointer to the center of character cell (X,Y) in WINDOW.
|
|
1765 Note, this is a no-op for an X frame that is not visible.
|
|
1766 If you have just created a frame, you must wait for it to become visible
|
|
1767 before calling this function on it, like this.
|
|
1768 (while (not (frame-visible-p frame)) (sleep-for .5))
|
|
1769 Note also: Warping the mouse is contrary to the ICCCM, so be very sure
|
|
1770 that the behavior won't end up being obnoxious!
|
20
|
1771 */
|
|
1772 (window, x, y))
|
0
|
1773 {
|
|
1774 struct window *w;
|
|
1775 int pix_x, pix_y;
|
|
1776
|
|
1777 CHECK_WINDOW (window);
|
|
1778 CHECK_INT (x);
|
|
1779 CHECK_INT (y);
|
|
1780
|
|
1781 /* Warping the mouse will cause EnterNotify and Focus events under X. */
|
|
1782 w = XWINDOW (window);
|
|
1783 glyph_to_pixel_translation (w, XINT (x), XINT (y), &pix_x, &pix_y);
|
|
1784
|
|
1785 MAYBE_FRAMEMETH (XFRAME (w->frame), set_mouse_position, (w, pix_x, pix_y));
|
|
1786
|
|
1787 return Qnil;
|
|
1788 }
|
|
1789
|
20
|
1790 DEFUN ("set-mouse-pixel-position", Fset_mouse_pixel_position, 3, 3, 0, /*
|
0
|
1791 Move the mouse pointer to pixel position (X,Y) in WINDOW.
|
|
1792 Note, this is a no-op for an X frame that is not visible.
|
|
1793 If you have just created a frame, you must wait for it to become visible
|
|
1794 before calling this function on it, like this.
|
|
1795 (while (not (frame-visible-p frame)) (sleep-for .5))
|
20
|
1796 */
|
|
1797 (window, x, y))
|
0
|
1798 {
|
|
1799 struct window *w;
|
|
1800
|
|
1801 CHECK_WINDOW (window);
|
|
1802 CHECK_INT (x);
|
|
1803 CHECK_INT (y);
|
|
1804
|
|
1805 /* Warping the mouse will cause EnterNotify and Focus events under X. */
|
|
1806 w = XWINDOW (window);
|
|
1807 FRAMEMETH (XFRAME (w->frame), set_mouse_position, (w, XINT (x), XINT (y)));
|
|
1808
|
|
1809 return Qnil;
|
|
1810 }
|
|
1811
|
20
|
1812 DEFUN ("make-frame-visible", Fmake_frame_visible, 0, 1, 0, /*
|
0
|
1813 Make the frame FRAME visible (assuming it is an X-window).
|
|
1814 If omitted, FRAME defaults to the currently selected frame.
|
|
1815 Also raises the frame so that nothing obscures it.
|
20
|
1816 */
|
|
1817 (frame))
|
0
|
1818 {
|
|
1819 struct frame *f = decode_frame (frame);
|
|
1820
|
|
1821 MAYBE_FRAMEMETH (f, make_frame_visible, (f));
|
|
1822 return frame;
|
|
1823 }
|
|
1824
|
20
|
1825 DEFUN ("make-frame-invisible", Fmake_frame_invisible, 0, 2, 0, /*
|
0
|
1826 Unconditionally removes frame from the display (assuming it is an X-window).
|
|
1827 If omitted, FRAME defaults to the currently selected frame.
|
|
1828 If what you want to do is iconify the frame (if the window manager uses
|
|
1829 icons) then you should call `iconify-frame' instead.
|
|
1830 Normally you may not make FRAME invisible if all other frames are invisible
|
|
1831 and uniconified, but if the second optional argument FORCE is non-nil,
|
|
1832 you may do so.
|
20
|
1833 */
|
|
1834 (frame, force))
|
0
|
1835 {
|
|
1836 struct frame *f, *sel_frame;
|
|
1837 struct device *d;
|
|
1838
|
|
1839 f = decode_frame (frame);
|
|
1840 d = XDEVICE (FRAME_DEVICE (f));
|
|
1841 sel_frame = XFRAME (DEVICE_SELECTED_FRAME (d));
|
|
1842
|
|
1843 if (NILP (force) && !other_visible_frames (f))
|
|
1844 error ("Attempt to make invisible the sole visible or iconified frame");
|
|
1845
|
|
1846 /* Don't allow minibuf_window to remain on a deleted frame. */
|
|
1847 if (EQ (f->minibuffer_window, minibuf_window))
|
|
1848 {
|
|
1849 Fset_window_buffer (sel_frame->minibuffer_window,
|
|
1850 XWINDOW (minibuf_window)->buffer);
|
|
1851 minibuf_window = sel_frame->minibuffer_window;
|
|
1852 }
|
|
1853
|
|
1854 MAYBE_FRAMEMETH (f, make_frame_invisible, (f));
|
|
1855
|
|
1856 return Qnil;
|
|
1857 }
|
|
1858
|
20
|
1859 DEFUN ("iconify-frame", Ficonify_frame, 0, 1, "", /*
|
0
|
1860 Make the frame FRAME into an icon, if the window manager supports icons.
|
|
1861 If omitted, FRAME defaults to the currently selected frame.
|
20
|
1862 */
|
|
1863 (frame))
|
0
|
1864 {
|
|
1865 struct frame *f, *sel_frame;
|
|
1866 struct device *d;
|
|
1867
|
|
1868 f = decode_frame (frame);
|
|
1869 d = XDEVICE (FRAME_DEVICE (f));
|
|
1870 sel_frame = XFRAME (DEVICE_SELECTED_FRAME (d));
|
|
1871
|
|
1872 /* Don't allow minibuf_window to remain on a deleted frame. */
|
|
1873 if (EQ (f->minibuffer_window, minibuf_window))
|
|
1874 {
|
|
1875 Fset_window_buffer (sel_frame->minibuffer_window,
|
|
1876 XWINDOW (minibuf_window)->buffer);
|
|
1877 minibuf_window = sel_frame->minibuffer_window;
|
|
1878 }
|
|
1879
|
|
1880 MAYBE_FRAMEMETH (f, iconify_frame, (f));
|
|
1881
|
|
1882 return Qnil;
|
|
1883 }
|
|
1884
|
20
|
1885 DEFUN ("deiconify-frame", Fdeiconify_frame, 0, 1, 0, /*
|
0
|
1886 Open (de-iconify) the iconified frame FRAME.
|
|
1887 Under X, this is currently the same as `make-frame-visible'.
|
|
1888 If omitted, FRAME defaults to the currently selected frame.
|
|
1889 Also raises the frame so that nothing obscures it.
|
20
|
1890 */
|
|
1891 (frame))
|
0
|
1892 {
|
|
1893 return Fmake_frame_visible (frame);
|
|
1894 }
|
|
1895
|
|
1896 /* FSF returns 'icon for iconized frames. What a crock! */
|
|
1897
|
20
|
1898 DEFUN ("frame-visible-p", Fframe_visible_p, 0, 1, 0, /*
|
30
|
1899 Return non NIL if FRAME is now \"visible\" (actually in use for display).
|
0
|
1900 A frame that is not visible is not updated, and, if it works through a
|
|
1901 window system, may not show at all.
|
30
|
1902 N.B. Under X \"visible\" means Mapped. It the window is mapped but not
|
|
1903 actually visible on screen then frame_visible returns 'hidden.
|
20
|
1904 */
|
|
1905 (frame))
|
0
|
1906 {
|
30
|
1907 int visible;
|
|
1908
|
0
|
1909 struct frame *f = decode_frame (frame);
|
30
|
1910 visible = FRAMEMETH_OR_GIVEN (f, frame_visible_p, (f), f->visible);
|
|
1911 return ( visible ? ( visible > 0 ? Qt : Qhidden )
|
|
1912 : Qnil);
|
0
|
1913 }
|
|
1914
|
20
|
1915 DEFUN ("frame-totally-visible-p", Fframe_totally_visible_p, 0, 1, 0, /*
|
0
|
1916 Return T if frame is not obscured by any other X windows, NIL otherwise.
|
|
1917 Always returns t for tty frames.
|
20
|
1918 */
|
|
1919 (frame))
|
0
|
1920 {
|
|
1921 struct frame *f = decode_frame (frame);
|
|
1922 return (FRAMEMETH_OR_GIVEN (f, frame_totally_visible_p, (f), f->visible)
|
|
1923 ? Qt : Qnil);
|
|
1924 }
|
|
1925
|
20
|
1926 DEFUN ("frame-iconified-p", Fframe_iconified_p, 0, 1, 0, /*
|
0
|
1927 Return t if FRAME is iconified.
|
|
1928 Not all window managers use icons; some merely unmap the window, so this
|
|
1929 function is not the inverse of `frame-visible-p'. It is possible for a
|
|
1930 frame to not be visible and not be iconified either. However, if the
|
|
1931 frame is iconified, it will not be visible.
|
20
|
1932 */
|
|
1933 (frame))
|
0
|
1934 {
|
|
1935 struct frame *f = decode_frame (frame);
|
|
1936 if (f->visible)
|
|
1937 return Qnil;
|
|
1938 f->iconified = FRAMEMETH_OR_GIVEN (f, frame_iconified_p, (f), 0);
|
|
1939 return (f->iconified ? Qt : Qnil);
|
|
1940 }
|
|
1941
|
20
|
1942 DEFUN ("visible-frame-list", Fvisible_frame_list, 0, 1, 0, /*
|
0
|
1943 Return a list of all frames now \"visible\" (being updated).
|
|
1944 If DEVICE is specified only frames on that device will be returned.
|
30
|
1945 Note that under virtual window managers not all these frame are necessarily
|
|
1946 really updated.
|
20
|
1947 */
|
|
1948 (device))
|
0
|
1949 {
|
|
1950 Lisp_Object devcons, concons;
|
|
1951 struct frame *f;
|
|
1952 Lisp_Object value;
|
|
1953
|
|
1954 value = Qnil;
|
|
1955
|
|
1956 DEVICE_LOOP_NO_BREAK (devcons, concons)
|
|
1957 {
|
|
1958 assert (DEVICEP (XCAR (devcons)));
|
|
1959
|
|
1960 if (NILP (device) || EQ (device, XCAR (devcons)))
|
|
1961 {
|
|
1962 Lisp_Object frmcons;
|
|
1963
|
|
1964 DEVICE_FRAME_LOOP (frmcons, XDEVICE (XCAR (devcons)))
|
|
1965 {
|
|
1966 Lisp_Object frame = XCAR (frmcons);
|
|
1967 f = XFRAME (frame);
|
30
|
1968 if (FRAME_VISIBLE_P(f))
|
0
|
1969 value = Fcons (frame, value);
|
|
1970 }
|
|
1971 }
|
|
1972 }
|
|
1973
|
|
1974 return value;
|
|
1975 }
|
|
1976
|
|
1977
|
20
|
1978 DEFUN ("raise-frame", Fraise_frame, 0, 1, "", /*
|
0
|
1979 Bring FRAME to the front, so it occludes any frames it overlaps.
|
|
1980 If omitted, FRAME defaults to the currently selected frame.
|
|
1981 If FRAME is invisible, make it visible.
|
|
1982 If Emacs is displaying on an ordinary terminal or some other device which
|
|
1983 doesn't support multiple overlapping frames, this function does nothing.
|
20
|
1984 */
|
|
1985 (frame))
|
0
|
1986 {
|
|
1987 struct frame *f = decode_frame (frame);
|
|
1988
|
|
1989 /* Do like the documentation says. */
|
|
1990 Fmake_frame_visible (frame);
|
|
1991 MAYBE_FRAMEMETH (f, raise_frame, (f));
|
|
1992 return Qnil;
|
|
1993 }
|
|
1994
|
20
|
1995 DEFUN ("lower-frame", Flower_frame, 0, 1, "", /*
|
0
|
1996 Send FRAME to the back, so it is occluded by any frames that overlap it.
|
|
1997 If omitted, FRAME defaults to the currently selected frame.
|
|
1998 If Emacs is displaying on an ordinary terminal or some other device which
|
|
1999 doesn't support multiple overlapping frames, this function does nothing.
|
20
|
2000 */
|
|
2001 (frame))
|
0
|
2002 {
|
|
2003 struct frame *f = decode_frame (frame);
|
|
2004
|
|
2005 MAYBE_FRAMEMETH (f, lower_frame, (f));
|
|
2006 return Qnil;
|
|
2007 }
|
|
2008
|
|
2009 /* Ben thinks there is no need for `redirect-frame-focus' or `frame-focus',
|
|
2010 crockish FSFmacs functions. See summary on focus in event-stream.c. */
|
|
2011
|
|
2012
|
|
2013 /***************************************************************************/
|
|
2014 /* frame properties */
|
|
2015 /***************************************************************************/
|
|
2016
|
|
2017 static void internal_set_frame_size (struct frame *f, int cols, int rows,
|
|
2018 int pretend);
|
|
2019
|
|
2020 static void
|
|
2021 store_minibuf_frame_prop (struct frame *f, Lisp_Object val)
|
|
2022 {
|
|
2023 Lisp_Object frame;
|
|
2024 XSETFRAME (frame, f);
|
|
2025
|
|
2026 if (WINDOWP (val))
|
|
2027 {
|
|
2028 if (! MINI_WINDOW_P (XWINDOW (val)))
|
|
2029 signal_simple_error
|
|
2030 ("Surrogate minibuffer windows must be minibuffer windows",
|
|
2031 val);
|
|
2032
|
|
2033 if (FRAME_HAS_MINIBUF_P (f) || FRAME_MINIBUF_ONLY_P (f))
|
|
2034 signal_simple_error
|
|
2035 ("Can't change the surrogate minibuffer of a frame with its own minibuffer", frame);
|
|
2036
|
|
2037 /* Install the chosen minibuffer window, with proper buffer. */
|
|
2038 f->minibuffer_window = val;
|
|
2039 }
|
|
2040 else if (EQ (val, Qt))
|
|
2041 {
|
|
2042 if (FRAME_HAS_MINIBUF_P (f) || FRAME_MINIBUF_ONLY_P (f))
|
|
2043 signal_simple_error
|
|
2044 ("Frame already has its own minibuffer", frame);
|
|
2045 else
|
|
2046 {
|
|
2047 setup_normal_frame (f);
|
|
2048 f->mirror_dirty = 1;
|
|
2049
|
|
2050 update_frame_window_mirror (f);
|
|
2051 internal_set_frame_size (f, f->width, f->height, 1);
|
|
2052 }
|
|
2053 }
|
|
2054 }
|
|
2055
|
|
2056 #if 0
|
|
2057
|
|
2058 /* possible code if you want to have symbols such as `default-background'
|
|
2059 map to setting the background of `default', etc. */
|
|
2060
|
|
2061 static int
|
|
2062 dissect_as_face_setting (Lisp_Object sym, Lisp_Object *face_out,
|
|
2063 Lisp_Object *face_prop_out)
|
|
2064 {
|
|
2065 Lisp_Object list = Vbuilt_in_face_specifiers;
|
|
2066 struct Lisp_String *s;
|
|
2067
|
|
2068 if (!SYMBOLP (sym))
|
|
2069 return 0;
|
|
2070
|
|
2071 s = symbol_name (XSYMBOL (sym));
|
|
2072
|
|
2073 while (!NILP (list))
|
|
2074 {
|
|
2075 Lisp_Object prop = Fcar (list);
|
|
2076 struct Lisp_String *prop_name;
|
|
2077
|
|
2078 if (!SYMBOLP (prop))
|
|
2079 continue;
|
|
2080 prop_name = symbol_name (XSYMBOL (prop));
|
|
2081 if (string_length (s) > string_length (prop_name) + 1
|
|
2082 && !memcmp (string_data (prop_name),
|
|
2083 string_data (s) + string_length (s)
|
|
2084 - string_length (prop_name),
|
|
2085 string_length (prop_name))
|
|
2086 && string_data (s)[string_length (s) - string_length (prop_name)
|
|
2087 - 1] == '-')
|
|
2088 {
|
|
2089 Lisp_Object face =
|
|
2090 Ffind_face (make_string (string_data (s),
|
|
2091 string_length (s)
|
|
2092 - string_length (prop_name)
|
|
2093 - 1));
|
|
2094 if (!NILP (face))
|
|
2095 {
|
|
2096 *face_out = face;
|
|
2097 *face_prop_out = prop;
|
|
2098 return 1;
|
|
2099 }
|
|
2100 }
|
|
2101
|
|
2102 list = Fcdr (list);
|
|
2103 }
|
|
2104
|
|
2105 return 0;
|
|
2106 }
|
|
2107
|
|
2108 #endif /* 0 */
|
|
2109
|
|
2110 static Lisp_Object
|
|
2111 get_property_alias (Lisp_Object prop)
|
|
2112 {
|
|
2113 while (1)
|
|
2114 {
|
|
2115 Lisp_Object alias = Qnil;
|
|
2116
|
|
2117 if (SYMBOLP (prop))
|
|
2118 alias = Fget (prop, Qframe_property_alias, Qnil);
|
|
2119 if (NILP (alias))
|
|
2120 break;
|
|
2121 prop = alias;
|
|
2122 QUIT;
|
|
2123 }
|
|
2124
|
|
2125 return prop;
|
|
2126 }
|
|
2127
|
|
2128 /* #### Using this to modify the internal border width has no effect
|
|
2129 because the change isn't propagated to the windows. Are there
|
|
2130 other properties which this claims to handle, but doesn't?
|
|
2131
|
|
2132 But of course. This stuff needs more work, but it's a lot closer
|
|
2133 to sanity now than before with the horrible frame-params stuff. */
|
|
2134
|
20
|
2135 DEFUN ("set-frame-properties", Fset_frame_properties, 2, 2, 0, /*
|
0
|
2136 Change some properties of a frame.
|
|
2137 PLIST is a property list.
|
|
2138 You can also change frame properties individually using `set-frame-property',
|
|
2139 but it may be more efficient to change many properties at once.
|
|
2140
|
|
2141 Frame properties can be retrieved using `frame-property' or `frame-properties'.
|
|
2142
|
|
2143 The following symbols etc. have predefined meanings:
|
|
2144
|
2
|
2145 name Name of the frame, used with X resources.
|
|
2146 Unchangeable after creation.
|
0
|
2147
|
|
2148 height Height of the frame, in lines.
|
|
2149
|
|
2150 width Width of the frame, in characters.
|
|
2151
|
|
2152 minibuffer Gives the minibuffer behavior for this frame. Either
|
|
2153 t (frame has its own minibuffer), `only' (frame is
|
|
2154 a minibuffer-only frame), or a window (frame uses that
|
|
2155 window, which is on another frame, as the minibuffer).
|
|
2156
|
|
2157 unsplittable If non-nil, frame cannot be split by `display-buffer'.
|
|
2158
|
|
2159 current-display-table, menubar-visible-p, left-margin-width,
|
|
2160 right-margin-width, minimum-line-ascent, minimum-line-descent,
|
|
2161 use-left-overflow, use-right-overflow, scrollbar-width, scrollbar-height,
|
|
2162 default-toolbar, top-toolbar, bottom-toolbar, left-toolbar, right-toolbar,
|
|
2163 default-toolbar-height, default-toolbar-width, top-toolbar-height,
|
|
2164 bottom-toolbar-height, left-toolbar-width, right-toolbar-width,
|
|
2165 default-toolbar-visible-p, top-toolbar-visible-p, bottom-toolbar-visible-p,
|
|
2166 left-toolbar-visible-p, right-toolbar-visible-p, toolbar-buttons-captioned-p,
|
|
2167 modeline-shadow-thickness, has-modeline-p
|
|
2168 [Giving the name of any built-in specifier variable is
|
|
2169 equivalent to calling `set-specifier' on the specifier,
|
|
2170 with a locale of FRAME. Giving the name to `frame-property'
|
|
2171 calls `specifier-instance' on the specifier.]
|
|
2172
|
|
2173 text-pointer-glyph, nontext-pointer-glyph, modeline-pointer-glyph,
|
|
2174 selection-pointer-glyph, busy-pointer-glyph, toolbar-pointer-glyph,
|
|
2175 menubar-pointer-glyph, scrollbar-pointer-glyph, gc-pointer-glyph,
|
|
2176 octal-escape-glyph, control-arrow-glyph, invisible-text-glyph,
|
|
2177 hscroll-glyph, truncation-glyph, continuation-glyph
|
|
2178 [Giving the name of any glyph variable is equivalent to
|
|
2179 calling `set-glyph-image' on the glyph, with a locale
|
|
2180 of FRAME. Giving the name to `frame-property' calls
|
|
2181 `glyph-image-instance' on the glyph.]
|
|
2182
|
|
2183 [default foreground], [default background], [default font],
|
|
2184 [modeline foreground], [modeline background], [modeline font],
|
|
2185 etc.
|
|
2186 [Giving a vector of a face and a property is equivalent
|
|
2187 to calling `set-face-property' on the face and property,
|
2
|
2188 with a locale of FRAME. Giving the vector to
|
0
|
2189 `frame-property' calls `face-property-instance' on the
|
|
2190 face and property.]
|
|
2191
|
|
2192 Finally, if a frame property symbol has the property `frame-property-alias'
|
|
2193 on it, then the value will be used in place of that symbol when looking
|
|
2194 up and setting frame property values. This allows you to alias one
|
|
2195 frame property name to another.
|
|
2196
|
|
2197 See the variables `default-x-frame-plist' and `default-tty-frame-plist'
|
|
2198 for a description of the properties recognized for particular types of
|
|
2199 frames.
|
20
|
2200 */
|
|
2201 (frame, plist))
|
0
|
2202 {
|
|
2203 struct frame *f = decode_frame (frame);
|
|
2204 Lisp_Object tail;
|
|
2205 Lisp_Object *tailp;
|
|
2206 struct gcpro gcpro1, gcpro2;
|
|
2207
|
|
2208 XSETFRAME (frame, f);
|
|
2209 GCPRO2 (frame, plist);
|
|
2210 Fcheck_valid_plist (plist);
|
|
2211 plist = Fcopy_sequence (plist);
|
|
2212 Fcanonicalize_lax_plist (plist, Qnil);
|
|
2213 for (tail = plist; !NILP (tail); tail = Fcdr (Fcdr (tail)))
|
|
2214 {
|
|
2215 Lisp_Object prop = Fcar (tail);
|
|
2216 Lisp_Object val = Fcar (Fcdr (tail));
|
|
2217
|
|
2218 prop = get_property_alias (prop);
|
|
2219
|
|
2220 #if 0
|
|
2221 /* mly wants this, but it's not reasonable to change the name of a
|
|
2222 frame after it has been created, because the old name was used
|
|
2223 for resource lookup. */
|
|
2224 if (EQ (prop, Qname))
|
|
2225 {
|
|
2226 CHECK_STRING (val);
|
|
2227 f->name = val;
|
|
2228 }
|
|
2229 #endif /* 0 */
|
|
2230 if (EQ (prop, Qminibuffer))
|
|
2231 store_minibuf_frame_prop (f, val);
|
|
2232 if (EQ (prop, Qunsplittable))
|
|
2233 f->no_split = !NILP (val);
|
|
2234 if (EQ (prop, Qbuffer_predicate))
|
|
2235 f->buffer_predicate = val;
|
|
2236 if (SYMBOLP (prop) && EQ (Fbuilt_in_variable_type (prop),
|
|
2237 Qconst_specifier))
|
|
2238 call3 (Qset_specifier, Fsymbol_value (prop), val, frame);
|
|
2239 if (SYMBOLP (prop) && !NILP (Fget (prop, Qconst_glyph_variable, Qnil)))
|
|
2240 call3 (Qset_glyph_image, Fsymbol_value (prop), val, frame);
|
|
2241 if (VECTORP (prop) && vector_length (XVECTOR (prop)) == 2)
|
|
2242 {
|
|
2243 Lisp_Object face_prop = vector_data (XVECTOR (prop))[1];
|
|
2244 CHECK_SYMBOL (face_prop);
|
|
2245 call4 (Qset_face_property,
|
|
2246 Fget_face (vector_data (XVECTOR (prop))[0]),
|
|
2247 face_prop, val, frame);
|
|
2248 }
|
|
2249 }
|
|
2250
|
|
2251 MAYBE_FRAMEMETH (f, set_frame_properties, (f, plist));
|
|
2252 for (tailp = &plist; !NILP (*tailp);)
|
|
2253 {
|
|
2254 Lisp_Object *next_tailp;
|
|
2255 Lisp_Object next;
|
|
2256 Lisp_Object prop;
|
|
2257
|
|
2258 next = Fcdr (*tailp);
|
|
2259 CHECK_CONS (next);
|
|
2260 next_tailp = &XCDR (next);
|
|
2261 prop = Fcar (*tailp);
|
|
2262
|
|
2263 prop = get_property_alias (prop);
|
|
2264
|
|
2265 if (EQ (prop, Qminibuffer)
|
|
2266 || EQ (prop, Qunsplittable)
|
|
2267 || EQ (prop, Qbuffer_predicate)
|
|
2268 || EQ (prop, Qheight)
|
|
2269 || EQ (prop, Qwidth)
|
|
2270 || (SYMBOLP (prop) && EQ (Fbuilt_in_variable_type (prop),
|
|
2271 Qconst_specifier))
|
|
2272 || (SYMBOLP (prop) && !NILP (Fget (prop, Qconst_glyph_variable,
|
|
2273 Qnil)))
|
|
2274 || (VECTORP (prop) && vector_length (XVECTOR (prop)) == 2)
|
|
2275 || FRAMEMETH_OR_GIVEN (f, internal_frame_property_p, (f, prop), 0))
|
|
2276 *tailp = *next_tailp;
|
|
2277 tailp = next_tailp;
|
|
2278 }
|
|
2279
|
|
2280 f->plist = nconc2 (plist, f->plist);
|
|
2281 Fcanonicalize_lax_plist (f->plist, Qnil);
|
|
2282 UNGCPRO;
|
|
2283 return Qnil;
|
|
2284 }
|
|
2285
|
20
|
2286 DEFUN ("frame-property", Fframe_property, 2, 3, 0, /*
|
0
|
2287 Return FRAME's value for property PROPERTY.
|
|
2288 See `set-frame-properties' for the built-in property names.
|
20
|
2289 */
|
|
2290 (frame, property, defalt))
|
0
|
2291 {
|
|
2292 struct frame *f = decode_frame (frame);
|
|
2293
|
|
2294 XSETFRAME (frame, f);
|
|
2295
|
|
2296 property = get_property_alias (property);
|
|
2297
|
2
|
2298 #define FROB(propprop, value) \
|
|
2299 do { \
|
|
2300 if (EQ (property, propprop)) \
|
|
2301 return (value); \
|
0
|
2302 } while (0)
|
|
2303
|
|
2304 FROB (Qname, f->name);
|
|
2305 FROB (Qheight, make_int (FRAME_HEIGHT (f)));
|
2
|
2306 FROB (Qwidth, make_int (FRAME_WIDTH (f)));
|
0
|
2307 /* NOTE: FSF returns Qnil instead of Qt for FRAME_HAS_MINIBUF_P.
|
|
2308 This is over-the-top bogosity, because it's inconsistent with
|
|
2309 the semantics of `minibuffer' when passed to `make-frame'.
|
|
2310 Returning Qt makes things consistent. */
|
2
|
2311 FROB (Qminibuffer, (FRAME_HAS_MINIBUF_P (f) ? Qt :
|
|
2312 FRAME_MINIBUF_ONLY_P (f) ? Qonly :
|
|
2313 FRAME_MINIBUF_WINDOW (f)));
|
0
|
2314 FROB (Qunsplittable, FRAME_NO_SPLIT_P (f) ? Qt : Qnil);
|
|
2315 FROB (Qbuffer_predicate, f->buffer_predicate);
|
|
2316
|
|
2317 #undef FROB
|
|
2318
|
|
2319 if (SYMBOLP (property) && EQ (Fbuilt_in_variable_type (property),
|
|
2320 Qconst_specifier))
|
|
2321 return Fspecifier_instance (Fsymbol_value (property), frame, defalt, Qnil);
|
|
2322 if (SYMBOLP (property) && !NILP (Fget (property, Qconst_glyph_variable,
|
|
2323 Qnil)))
|
|
2324 {
|
|
2325 Lisp_Object glyph = Fsymbol_value (property);
|
|
2326 CHECK_GLYPH (glyph);
|
|
2327 return Fspecifier_instance (XGLYPH_IMAGE (glyph), frame, defalt, Qnil);
|
|
2328 }
|
|
2329 if (VECTORP (property) && vector_length (XVECTOR (property)) == 2)
|
|
2330 {
|
|
2331 Lisp_Object face_prop = vector_data (XVECTOR (property))[1];
|
|
2332 CHECK_SYMBOL (face_prop);
|
|
2333 return call3 (Qface_property_instance,
|
|
2334 Fget_face (vector_data (XVECTOR (property))[0]),
|
|
2335 face_prop, frame);
|
|
2336 }
|
|
2337
|
|
2338 {
|
|
2339 Lisp_Object value;
|
|
2340
|
|
2341 value = FRAMEMETH_OR_GIVEN (f, frame_property, (f, property), Qunbound);
|
|
2342 if (!UNBOUNDP (value))
|
|
2343 return value;
|
|
2344
|
|
2345 value = external_plist_get (&f->plist, property, 1, ERROR_ME);
|
|
2346 if (!UNBOUNDP (value))
|
|
2347 return value;
|
|
2348 return defalt;
|
|
2349 }
|
|
2350 }
|
|
2351
|
20
|
2352 DEFUN ("frame-properties", Fframe_properties, 0, 1, 0, /*
|
0
|
2353 Return a property list of the properties of FRAME.
|
|
2354 Do not modify this list; use `set-frame-property' instead.
|
20
|
2355 */
|
|
2356 (frame))
|
0
|
2357 {
|
|
2358 struct frame *f = decode_frame (frame);
|
|
2359 Lisp_Object result = Qnil;
|
|
2360 struct gcpro gcpro1;
|
|
2361
|
|
2362 GCPRO1 (result);
|
|
2363
|
2
|
2364 #define FROB(propprop, value) \
|
|
2365 do { \
|
|
2366 Lisp_Object temtem = (value); \
|
|
2367 if (!NILP (temtem)) \
|
|
2368 /* backwards order; we reverse it below */ \
|
|
2369 result = Fcons (temtem, Fcons (propprop, result)); \
|
0
|
2370 } while (0)
|
|
2371
|
|
2372 FROB (Qname, f->name);
|
|
2373 FROB (Qheight, make_int (FRAME_HEIGHT (f)));
|
2
|
2374 FROB (Qwidth, make_int (FRAME_WIDTH (f)));
|
0
|
2375 /* NOTE: FSF returns Qnil instead of Qt for FRAME_HAS_MINIBUF_P.
|
|
2376 This is over-the-top bogosity, because it's inconsistent with
|
|
2377 the semantics of `minibuffer' when passed to `make-frame'.
|
|
2378 Returning Qt makes things consistent. */
|
2
|
2379 FROB (Qminibuffer, (FRAME_HAS_MINIBUF_P (f) ? Qt :
|
|
2380 FRAME_MINIBUF_ONLY_P (f) ? Qonly :
|
|
2381 FRAME_MINIBUF_WINDOW (f)));
|
0
|
2382 FROB (Qunsplittable, FRAME_NO_SPLIT_P (f) ? Qt : Qnil);
|
|
2383 FROB (Qbuffer_predicate, f->buffer_predicate);
|
|
2384
|
|
2385 #undef FROB
|
|
2386
|
|
2387 /* #### should we be adding all the specifiers and glyphs?
|
|
2388 That would entail having a list of them all. */
|
|
2389 {
|
|
2390 Lisp_Object value;
|
|
2391
|
|
2392 value = FRAMEMETH_OR_GIVEN (f, frame_properties, (f), Qnil);
|
|
2393 result = nconc2 (value, result);
|
|
2394 /* #### for the moment (since old code uses `frame-parameters'),
|
|
2395 we call `copy-sequence' on f->plist. That allows frame-parameters
|
|
2396 to destructively convert the plist into an alist, which is more
|
|
2397 efficient than doing it non-destructively. At some point we
|
|
2398 should remove the call to copy-sequence. */
|
|
2399 result = nconc2 (Fnreverse (result), Fcopy_sequence (f->plist));
|
|
2400 RETURN_UNGCPRO (result);
|
|
2401 }
|
|
2402 }
|
|
2403
|
|
2404
|
20
|
2405 DEFUN ("frame-pixel-height", Fframe_pixel_height, 0, 1, 0, /*
|
0
|
2406 Return the height in pixels of FRAME.
|
20
|
2407 */
|
|
2408 (frame))
|
0
|
2409 {
|
|
2410 struct frame *f = decode_frame (frame);
|
|
2411 return (make_int (f->pixheight));
|
|
2412 }
|
|
2413
|
20
|
2414 DEFUN ("frame-pixel-width", Fframe_pixel_width, 0, 1, 0, /*
|
0
|
2415 Return the width in pixels of FRAME.
|
20
|
2416 */
|
|
2417 (frame))
|
0
|
2418 {
|
|
2419 struct frame *f = decode_frame (frame);
|
|
2420 return (make_int (f->pixwidth));
|
|
2421 }
|
|
2422
|
20
|
2423 DEFUN ("frame-name", Fframe_name, 0, 1, 0, /*
|
0
|
2424 Return the name of FRAME (defaulting to the selected frame).
|
|
2425 This is not the same as the `title' of the frame.
|
20
|
2426 */
|
|
2427 (frame))
|
0
|
2428 {
|
|
2429 return (decode_frame (frame)->name);
|
|
2430 }
|
|
2431
|
20
|
2432 DEFUN ("frame-modified-tick", Fframe_modified_tick, 0, 1, 0, /*
|
0
|
2433 Return FRAME's tick counter, incremented for each change to the frame.
|
|
2434 Each frame has a tick counter which is incremented each time the frame
|
|
2435 is resized, a window is resized, added, or deleted, a face is changed,
|
|
2436 `set-window-buffer' or `select-window' is called on a window in the
|
|
2437 frame, the window-start of a window in the frame has changed, or
|
|
2438 anything else interesting has happened. It wraps around occasionally.
|
|
2439 No argument or nil as argument means use selected frame as FRAME.
|
20
|
2440 */
|
|
2441 (frame))
|
0
|
2442 {
|
|
2443 return make_int (decode_frame (frame)->modiff);
|
|
2444 }
|
|
2445
|
|
2446 static void
|
|
2447 internal_set_frame_size (struct frame *f, int cols, int rows, int pretend)
|
|
2448 {
|
|
2449 if (pretend || !HAS_FRAMEMETH_P (f, set_frame_size))
|
|
2450 change_frame_size (f, rows, cols, 0);
|
|
2451 else
|
|
2452 FRAMEMETH (f, set_frame_size, (f, cols, rows));
|
|
2453 }
|
|
2454
|
20
|
2455 DEFUN ("set-frame-height", Fset_frame_height, 2, 3, 0, /*
|
0
|
2456 Specify that the frame FRAME has LINES lines.
|
|
2457 Optional third arg non-nil means that redisplay should use LINES lines
|
|
2458 but that the idea of the actual height of the frame should not be changed.
|
20
|
2459 */
|
|
2460 (frame, rows, pretend))
|
0
|
2461 {
|
|
2462 struct frame *f = decode_frame (frame);
|
|
2463 XSETFRAME (frame, f);
|
|
2464 CHECK_INT (rows);
|
|
2465
|
|
2466 internal_set_frame_size (f, FRAME_WIDTH (f), XINT (rows),
|
|
2467 !NILP (pretend));
|
|
2468 return frame;
|
|
2469 }
|
|
2470
|
20
|
2471 DEFUN ("set-frame-width", Fset_frame_width, 2, 3, 0, /*
|
0
|
2472 Specify that the frame FRAME has COLS columns.
|
|
2473 Optional third arg non-nil means that redisplay should use COLS columns
|
|
2474 but that the idea of the actual width of the frame should not be changed.
|
20
|
2475 */
|
|
2476 (frame, cols, pretend))
|
0
|
2477 {
|
|
2478 struct frame *f = decode_frame (frame);
|
|
2479 XSETFRAME (frame, f);
|
|
2480 CHECK_INT (cols);
|
|
2481
|
|
2482 internal_set_frame_size (f, XINT (cols), FRAME_HEIGHT (f),
|
|
2483 !NILP (pretend));
|
|
2484 return frame;
|
|
2485 }
|
|
2486
|
20
|
2487 DEFUN ("set-frame-size", Fset_frame_size, 3, 4, 0, /*
|
0
|
2488 Sets size of FRAME to COLS by ROWS.
|
|
2489 Optional fourth arg non-nil means that redisplay should use COLS by ROWS
|
|
2490 but that the idea of the actual size of the frame should not be changed.
|
20
|
2491 */
|
|
2492 (frame, cols, rows, pretend))
|
0
|
2493 {
|
|
2494 struct frame *f = decode_frame (frame);
|
|
2495 XSETFRAME (frame, f);
|
|
2496 CHECK_INT (cols);
|
|
2497 CHECK_INT (rows);
|
|
2498
|
|
2499 internal_set_frame_size (f, XINT (cols), XINT (rows), !NILP (pretend));
|
|
2500 return frame;
|
|
2501 }
|
|
2502
|
20
|
2503 DEFUN ("set-frame-position", Fset_frame_position, 3, 3, 0, /*
|
0
|
2504 Sets position of FRAME in pixels to XOFFSET by YOFFSET.
|
|
2505 This is actually the position of the upper left corner of the frame.
|
|
2506 Negative values for XOFFSET or YOFFSET are interpreted relative to
|
|
2507 the rightmost or bottommost possible position (that stays within the screen).
|
20
|
2508 */
|
|
2509 (frame, xoffset, yoffset))
|
0
|
2510 {
|
|
2511 struct frame *f = decode_frame (frame);
|
|
2512 CHECK_INT (xoffset);
|
|
2513 CHECK_INT (yoffset);
|
|
2514
|
|
2515 MAYBE_FRAMEMETH (f, set_frame_position, (f, XINT (xoffset), XINT (yoffset)));
|
|
2516
|
|
2517 return Qt;
|
|
2518 }
|
|
2519
|
|
2520
|
|
2521
|
|
2522 /* Frame size conversion functions moved here from EmacsFrame.c
|
|
2523 because they're generic and really don't belong in that file.
|
|
2524 Function get_default_char_pixel_size() removed because it's
|
|
2525 exactly the same as default_face_height_and_width(). */
|
|
2526 static void
|
|
2527 frame_conversion_internal (struct frame *f, int pixel_to_char,
|
|
2528 int *pixel_width, int *pixel_height,
|
|
2529 int *char_width, int *char_height)
|
|
2530 {
|
|
2531 int cpw;
|
|
2532 int cph;
|
|
2533 int egw;
|
|
2534 int obw, obh, bdr;
|
|
2535 Lisp_Object frame, window;
|
|
2536
|
|
2537 XSETFRAME (frame, f);
|
|
2538 default_face_height_and_width (frame, &cph, &cpw);
|
|
2539 window = FRAME_SELECTED_WINDOW (f);
|
|
2540
|
|
2541 egw = max (glyph_width (Vcontinuation_glyph, Vdefault_face, 0, window),
|
|
2542 glyph_width (Vtruncation_glyph, Vdefault_face, 0, window));
|
|
2543 egw = max (egw, cpw);
|
|
2544 bdr = 2 * f->internal_border_width;
|
|
2545 obw = FRAME_SCROLLBAR_WIDTH (f) + FRAME_THEORETICAL_LEFT_TOOLBAR_WIDTH (f) +
|
|
2546 FRAME_THEORETICAL_RIGHT_TOOLBAR_WIDTH (f);
|
|
2547 obh = FRAME_SCROLLBAR_HEIGHT (f) + FRAME_THEORETICAL_TOP_TOOLBAR_HEIGHT (f) +
|
|
2548 FRAME_THEORETICAL_BOTTOM_TOOLBAR_HEIGHT (f);
|
|
2549
|
|
2550 if (pixel_to_char)
|
|
2551 {
|
|
2552 *char_width = 1 + ((*pixel_width - egw) - bdr - obw) / cpw;
|
|
2553 *char_height = (*pixel_height - bdr - obh) / cph;
|
|
2554 }
|
|
2555 else
|
|
2556 {
|
|
2557 *pixel_width = (*char_width - 1) * cpw + egw + bdr + obw;
|
|
2558 *pixel_height = *char_height * cph + bdr + obh;
|
|
2559 }
|
|
2560 }
|
|
2561
|
|
2562 /* This takes the size in pixels of the text area, and returns the number
|
|
2563 of characters that will fit there, taking into account the internal
|
|
2564 border width, and the pixel width of the line terminator glyphs (which
|
|
2565 always count as one "character" wide, even if they are not the same size
|
|
2566 as the default character size of the default font). The frame scrollbar
|
|
2567 width and left and right toolbar widths are also subtracted out of the
|
|
2568 available width. The frame scrollbar height and top and bottom toolbar
|
|
2569 heights are subtracted out of the available height.
|
|
2570
|
|
2571 Therefore the result is not necessarily a multiple of anything in
|
|
2572 particular. */
|
|
2573 void
|
|
2574 pixel_to_char_size (struct frame *f, int pixel_width, int pixel_height,
|
|
2575 int *char_width, int *char_height)
|
|
2576 {
|
|
2577 frame_conversion_internal (f, 1, &pixel_width, &pixel_height, char_width,
|
|
2578 char_height);
|
|
2579 }
|
|
2580
|
|
2581 /* Given a character size, this returns the minimum number of pixels
|
|
2582 necessary to display that many characters, taking into account the
|
|
2583 internal border width, scrollbar height and width, toolbar heights and
|
|
2584 widths and the size of the line terminator glyphs (assuming the line
|
|
2585 terminators take up exactly one character position).
|
|
2586
|
|
2587 Therefore the result is not necessarily a multiple of anything in
|
|
2588 particular. */
|
|
2589 void
|
|
2590 char_to_pixel_size (struct frame *f, int char_width, int char_height,
|
|
2591 int *pixel_width, int *pixel_height)
|
|
2592 {
|
|
2593 frame_conversion_internal (f, 0, pixel_width, pixel_height, &char_width,
|
|
2594 &char_height);
|
|
2595 }
|
|
2596
|
|
2597 /* Given a pixel size, rounds DOWN to the smallest size in pixels necessary
|
|
2598 to display the same number of characters as are displayable now.
|
|
2599 */
|
|
2600 void
|
|
2601 round_size_to_char (struct frame *f, int in_width, int in_height,
|
|
2602 int *out_width, int *out_height)
|
|
2603 {
|
|
2604 int char_width;
|
|
2605 int char_height;
|
|
2606 pixel_to_char_size (f, in_width, in_height, &char_width, &char_height);
|
|
2607 char_to_pixel_size (f, char_width, char_height, out_width, out_height);
|
|
2608 }
|
|
2609
|
|
2610 /* Change the frame height and/or width. Values may be given as zero to
|
|
2611 indicate no change is to take place. */
|
|
2612 static void
|
|
2613 change_frame_size_1 (struct frame *f, int newheight, int newwidth)
|
|
2614 {
|
|
2615 Lisp_Object frame;
|
|
2616 int new_pixheight, new_pixwidth;
|
|
2617 int font_height, font_width;
|
|
2618
|
|
2619 /* #### Chuck -- shouldn't we be checking to see if the frame
|
|
2620 is being "changed" to its existing size, and do nothing if so? */
|
|
2621 if (in_display)
|
|
2622 abort ();
|
|
2623
|
|
2624 XSETFRAME (frame, f);
|
|
2625 default_face_height_and_width (frame, &font_height, &font_width);
|
|
2626
|
|
2627 /* This size-change overrides any pending one for this frame. */
|
|
2628 FRAME_NEW_HEIGHT (f) = 0;
|
|
2629 FRAME_NEW_WIDTH (f) = 0;
|
|
2630
|
|
2631 new_pixheight = newheight * font_height;
|
|
2632 new_pixwidth = (newwidth - 1) * font_width;
|
|
2633
|
|
2634 /* #### dependency on FRAME_WIN_P should be removed. */
|
|
2635 if (FRAME_WIN_P (f))
|
|
2636 {
|
|
2637 new_pixheight += FRAME_SCROLLBAR_HEIGHT (f);
|
|
2638 new_pixwidth += FRAME_SCROLLBAR_WIDTH (f);
|
|
2639 }
|
|
2640
|
|
2641 /* when frame_conversion_internal() calculated the number of rows/cols
|
|
2642 in the frame, the toolbar sizes were subtracted out. However,
|
|
2643 if the corresponding toolbar is not actually visible in the
|
|
2644 selected window, then the extra space needs to be filled in
|
|
2645 with rows/cols. */
|
|
2646 if (!FRAME_REAL_TOP_TOOLBAR_VISIBLE (f))
|
|
2647 new_pixheight += FRAME_THEORETICAL_TOP_TOOLBAR_HEIGHT (f);
|
|
2648 if (!FRAME_REAL_BOTTOM_TOOLBAR_VISIBLE (f))
|
|
2649 new_pixheight += FRAME_THEORETICAL_BOTTOM_TOOLBAR_HEIGHT (f);
|
|
2650 if (!FRAME_REAL_LEFT_TOOLBAR_VISIBLE (f))
|
|
2651 new_pixwidth += FRAME_THEORETICAL_LEFT_TOOLBAR_WIDTH (f);
|
|
2652 if (!FRAME_REAL_RIGHT_TOOLBAR_VISIBLE (f))
|
|
2653 new_pixwidth += FRAME_THEORETICAL_RIGHT_TOOLBAR_WIDTH (f);
|
|
2654
|
|
2655 /* Adjust the width for the end glyph which may be a different width
|
|
2656 than the default character width. */
|
|
2657 {
|
|
2658 int adjustment, trunc_width, cont_width;
|
|
2659
|
|
2660 trunc_width = glyph_width (Vtruncation_glyph, Vdefault_face, 0,
|
|
2661 FRAME_SELECTED_WINDOW (f));
|
|
2662 cont_width = glyph_width (Vcontinuation_glyph, Vdefault_face, 0,
|
|
2663 FRAME_SELECTED_WINDOW (f));
|
|
2664 adjustment = max (trunc_width, cont_width);
|
|
2665 adjustment = max (adjustment, font_width);
|
|
2666
|
|
2667 new_pixwidth += adjustment;
|
|
2668 }
|
|
2669
|
|
2670 /* If we don't have valid values, exit. */
|
|
2671 if (!new_pixheight && !new_pixwidth)
|
|
2672 return;
|
|
2673
|
|
2674 if (new_pixheight)
|
|
2675 {
|
|
2676 XWINDOW (FRAME_ROOT_WINDOW (f))->pixel_top = FRAME_TOP_BORDER_END (f);
|
|
2677
|
|
2678 if (FRAME_HAS_MINIBUF_P (f)
|
|
2679 && ! FRAME_MINIBUF_ONLY_P (f))
|
|
2680 /* Frame has both root and minibuffer. */
|
|
2681 {
|
|
2682 set_window_pixheight (FRAME_ROOT_WINDOW (f),
|
|
2683 /* - font_height for minibuffer */
|
|
2684 new_pixheight - font_height, 0);
|
|
2685
|
|
2686 XWINDOW (FRAME_MINIBUF_WINDOW (f))->pixel_top =
|
|
2687 new_pixheight - font_height + FRAME_TOP_BORDER_END (f);
|
|
2688
|
|
2689 set_window_pixheight (FRAME_MINIBUF_WINDOW (f), font_height, 0);
|
|
2690 }
|
|
2691 else
|
|
2692 /* Frame has just one top-level window. */
|
|
2693 set_window_pixheight (FRAME_ROOT_WINDOW (f), new_pixheight, 0);
|
|
2694
|
|
2695 FRAME_HEIGHT (f) = newheight;
|
|
2696 if (FRAME_TTY_P (f))
|
|
2697 f->pixheight = newheight;
|
|
2698 }
|
|
2699
|
|
2700 if (new_pixwidth)
|
|
2701 {
|
|
2702 XWINDOW (FRAME_ROOT_WINDOW (f))->pixel_left = FRAME_LEFT_BORDER_END (f);
|
|
2703 set_window_pixwidth (FRAME_ROOT_WINDOW (f), new_pixwidth, 0);
|
|
2704
|
|
2705 if (FRAME_HAS_MINIBUF_P (f))
|
|
2706 {
|
|
2707 XWINDOW (FRAME_MINIBUF_WINDOW (f))->pixel_left =
|
|
2708 FRAME_LEFT_BORDER_END (f);
|
|
2709 set_window_pixwidth (FRAME_MINIBUF_WINDOW (f), new_pixwidth, 0);
|
|
2710 }
|
|
2711
|
|
2712 FRAME_WIDTH (f) = newwidth;
|
|
2713 if (FRAME_TTY_P (f))
|
|
2714 f->pixwidth = newwidth;
|
|
2715 }
|
|
2716
|
|
2717 MARK_FRAME_TOOLBARS_CHANGED (f);
|
|
2718 MARK_FRAME_CHANGED (f);
|
|
2719 }
|
|
2720
|
|
2721 void
|
|
2722 change_frame_size (struct frame *f, int newheight, int newwidth, int delay)
|
|
2723 {
|
|
2724 /* sometimes we get passed a size that's too small (esp. when a
|
|
2725 client widget gets resized, since we have no control over this).
|
|
2726 So deal. */
|
|
2727 check_frame_size (f, &newheight, &newwidth);
|
|
2728
|
|
2729 if (delay || in_display || gc_in_progress)
|
|
2730 {
|
|
2731 MARK_FRAME_SIZE_CHANGED (f);
|
|
2732 f->new_width = newwidth;
|
|
2733 f->new_height = newheight;
|
|
2734 return;
|
|
2735 }
|
|
2736
|
|
2737 f->size_change_pending = 0;
|
|
2738 /* For TTY frames, it's like one, like all ...
|
|
2739 Can't have two TTY frames of different sizes on the same device. */
|
|
2740 if (FRAME_TTY_P (f))
|
|
2741 {
|
|
2742 Lisp_Object frmcons;
|
|
2743
|
|
2744 DEVICE_FRAME_LOOP (frmcons, XDEVICE (FRAME_DEVICE (f)))
|
|
2745 change_frame_size_1 (XFRAME (XCAR (frmcons)), newheight, newwidth);
|
|
2746 }
|
|
2747 else
|
|
2748 change_frame_size_1 (f, newheight, newwidth);
|
|
2749 }
|
|
2750
|
|
2751
|
|
2752 void
|
|
2753 update_frame_title (struct frame *f)
|
|
2754 {
|
|
2755 struct window *w = XWINDOW (FRAME_SELECTED_WINDOW (f));
|
|
2756 Lisp_Object title_format;
|
|
2757 Lisp_Object icon_format;
|
2
|
2758 Bufbyte *title;
|
0
|
2759
|
|
2760 /* We don't change the title for the minibuffer unless the frame
|
|
2761 only has a minibuffer. */
|
|
2762 if (MINI_WINDOW_P (w) && !FRAME_MINIBUF_ONLY_P (f))
|
|
2763 return;
|
|
2764
|
|
2765 /* And we don't want dead buffers to blow up on us. */
|
2
|
2766 if (!BUFFER_LIVE_P (XBUFFER (w->buffer)))
|
0
|
2767 return;
|
|
2768
|
2
|
2769 title = NULL;
|
|
2770 title_format = symbol_value_in_buffer (Qframe_title_format, w->buffer);
|
|
2771 icon_format = symbol_value_in_buffer (Qframe_icon_title_format, w->buffer);
|
|
2772
|
|
2773 if (HAS_FRAMEMETH_P (f, set_title_from_bufbyte))
|
0
|
2774 {
|
2
|
2775 title = generate_formatted_string (w, title_format, Qnil,
|
|
2776 DEFAULT_INDEX, CURRENT_DISP);
|
|
2777 FRAMEMETH (f, set_title_from_bufbyte, (f, title));
|
|
2778 }
|
|
2779
|
|
2780 if (HAS_FRAMEMETH_P (f, set_icon_name_from_bufbyte))
|
|
2781 {
|
|
2782 if (!EQ (icon_format, title_format) || !title)
|
0
|
2783 {
|
2
|
2784 if (title)
|
|
2785 xfree (title);
|
|
2786
|
|
2787 title = generate_formatted_string (w, icon_format, Qnil,
|
|
2788 DEFAULT_INDEX, CURRENT_DISP);
|
0
|
2789 }
|
2
|
2790 FRAMEMETH (f, set_icon_name_from_bufbyte, (f, title));
|
0
|
2791 }
|
|
2792
|
2
|
2793 if (title)
|
|
2794 xfree (title);
|
0
|
2795 }
|
|
2796
|
|
2797
|
20
|
2798 DEFUN ("set-frame-pointer", Fset_frame_pointer, 2, 2, 0, /*
|
0
|
2799 Set the mouse pointer of FRAME to the given pointer image instance.
|
|
2800 You should not call this function directly. Instead, set one of
|
|
2801 the variables `text-pointer-glyph', `nontext-pointer-glyph',
|
|
2802 `modeline-pointer-glyph', `selection-pointer-glyph',
|
|
2803 `busy-pointer-glyph', or `toolbar-pointer-glyph'.
|
20
|
2804 */
|
|
2805 (frame, image_instance))
|
0
|
2806 {
|
|
2807 struct frame *f = decode_frame (frame);
|
|
2808 CHECK_POINTER_IMAGE_INSTANCE (image_instance);
|
|
2809 if (!EQ (f->pointer, image_instance))
|
|
2810 {
|
|
2811 f->pointer = image_instance;
|
|
2812 MAYBE_FRAMEMETH (f, set_frame_pointer, (f));
|
|
2813 }
|
|
2814 return Qnil;
|
|
2815 }
|
|
2816
|
|
2817
|
|
2818 void
|
|
2819 update_frame_icon (struct frame *f)
|
|
2820 {
|
|
2821 if (f->icon_changed || f->windows_changed)
|
|
2822 {
|
|
2823 Lisp_Object frame = Qnil;
|
|
2824 Lisp_Object new_icon;
|
|
2825
|
|
2826 XSETFRAME (frame, f);
|
|
2827 new_icon = glyph_image_instance (Vframe_icon_glyph, frame,
|
|
2828 ERROR_ME_WARN, 0);
|
|
2829 if (!EQ (new_icon, f->icon))
|
|
2830 {
|
|
2831 f->icon = new_icon;
|
|
2832 MAYBE_FRAMEMETH (f, set_frame_icon, (f));
|
|
2833 }
|
|
2834 }
|
|
2835
|
|
2836 f->icon_changed = 0;
|
|
2837 }
|
|
2838
|
|
2839 static void
|
|
2840 icon_glyph_changed (Lisp_Object glyph, Lisp_Object property,
|
|
2841 Lisp_Object locale)
|
|
2842 {
|
|
2843 MARK_ICON_CHANGED;
|
|
2844 }
|
|
2845
|
|
2846
|
|
2847 void
|
|
2848 syms_of_frame (void)
|
|
2849 {
|
|
2850 defsymbol (&Qdelete_frame_hook, "delete-frame-hook");
|
|
2851 defsymbol (&Qselect_frame_hook, "select-frame-hook");
|
|
2852 defsymbol (&Qdeselect_frame_hook, "deselect-frame-hook");
|
|
2853 defsymbol (&Qcreate_frame_hook, "create-frame-hook");
|
|
2854 defsymbol (&Qmouse_enter_frame_hook, "mouse-enter-frame-hook");
|
|
2855 defsymbol (&Qmouse_leave_frame_hook, "mouse-leave-frame-hook");
|
|
2856 defsymbol (&Qmap_frame_hook, "map-frame-hook");
|
|
2857 defsymbol (&Qunmap_frame_hook, "unmap-frame-hook");
|
2
|
2858 #if defined (HAVE_CDE) || defined (HAVE_OFFIX_DND)
|
0
|
2859 defsymbol (&Qdrag_and_drop_functions, "drag-and-drop-functions");
|
|
2860 #endif
|
|
2861
|
|
2862 defsymbol (&Qframep, "framep");
|
|
2863 defsymbol (&Qframe_live_p, "frame-live-p");
|
|
2864 defsymbol (&Qframe_x_p, "frame-x-p");
|
|
2865 defsymbol (&Qframe_tty_p, "frame-tty-p");
|
|
2866 defsymbol (&Qdelete_frame, "delete-frame");
|
|
2867 defsymbol (&Qsynchronize_minibuffers, "synchronize-minibuffers");
|
|
2868 defsymbol (&Qbuffer_predicate, "buffer-predicate");
|
|
2869 defsymbol (&Qframe_being_created, "frame-being-created");
|
|
2870 defsymbol (&Qmake_initial_minibuffer_frame, "make-initial-minibuffer-frame");
|
|
2871
|
2
|
2872 defsymbol (&Qframe_title_format, "frame-title-format");
|
|
2873 defsymbol (&Qframe_icon_title_format, "frame-icon-title-format");
|
|
2874
|
30
|
2875 defsymbol (&Qhidden, "hidden");
|
0
|
2876 defsymbol (&Qvisible, "visible");
|
|
2877 defsymbol (&Qiconic, "iconic");
|
|
2878 defsymbol (&Qinvisible, "invisible");
|
|
2879 defsymbol (&Qvisible_iconic, "visible-iconic");
|
|
2880 defsymbol (&Qinvisible_iconic, "invisible-iconic");
|
|
2881 defsymbol (&Qnomini, "nomini");
|
|
2882 defsymbol (&Qvisible_nomini, "visible-nomini");
|
|
2883 defsymbol (&Qiconic_nomini, "iconic-nomini");
|
|
2884 defsymbol (&Qinvisible_nomini, "invisible-nomini");
|
|
2885 defsymbol (&Qvisible_iconic_nomini, "visible-iconic-nomini");
|
|
2886 defsymbol (&Qinvisible_iconic_nomini, "invisible-iconic-nomini");
|
|
2887
|
|
2888 defsymbol (&Qminibuffer, "minibuffer");
|
|
2889 defsymbol (&Qunsplittable, "unsplittable");
|
|
2890 defsymbol (&Qinternal_border_width, "internal-border-width");
|
|
2891 defsymbol (&Qtop_toolbar_shadow_color, "top-toolbar-shadow-color");
|
|
2892 defsymbol (&Qbottom_toolbar_shadow_color, "bottom-toolbar-shadow-color");
|
|
2893 defsymbol (&Qbackground_toolbar_color, "background-toolbar-color");
|
|
2894 defsymbol (&Qtop_toolbar_shadow_pixmap, "top-toolbar-shadow-pixmap");
|
|
2895 defsymbol (&Qbottom_toolbar_shadow_pixmap, "bottom-toolbar-shadow-pixmap");
|
|
2896 defsymbol (&Qtoolbar_shadow_thickness, "toolbar-shadow-thickness");
|
|
2897 defsymbol (&Qscrollbar_placement, "scrollbar-placement");
|
|
2898 defsymbol (&Qinter_line_space, "inter-line-space");
|
|
2899 /* Qiconic already in this function. */
|
|
2900 defsymbol (&Qvisual_bell, "visual-bell");
|
|
2901 defsymbol (&Qbell_volume, "bell-volume");
|
|
2902 defsymbol (&Qpointer_background, "pointer-background");
|
|
2903 defsymbol (&Qpointer_color, "pointer-color");
|
|
2904 defsymbol (&Qtext_pointer, "text-pointer");
|
|
2905 defsymbol (&Qspace_pointer, "space-pointer");
|
|
2906 defsymbol (&Qmodeline_pointer, "modeline-pointer");
|
|
2907 defsymbol (&Qgc_pointer, "gc-pointer");
|
|
2908 defsymbol (&Qinitially_unmapped, "initially-unmapped");
|
|
2909 defsymbol (&Quse_backing_store, "use-backing-store");
|
|
2910 defsymbol (&Qborder_color, "border-color");
|
|
2911 defsymbol (&Qborder_width, "border-width");
|
|
2912 /* Qwidth, Qheight, Qleft, Qtop in general.c */
|
|
2913 defsymbol (&Qset_specifier, "set-specifier");
|
|
2914 defsymbol (&Qset_glyph_image, "set-glyph-image");
|
|
2915 defsymbol (&Qset_face_property, "set-face-property");
|
|
2916 defsymbol (&Qface_property_instance, "face-property-instance");
|
|
2917 defsymbol (&Qframe_property_alias, "frame-property-alias");
|
|
2918
|
20
|
2919 DEFSUBR (Fmake_frame);
|
|
2920 DEFSUBR (Fframep);
|
|
2921 DEFSUBR (Fframe_live_p);
|
0
|
2922 #if 0 /* FSFmacs */
|
20
|
2923 DEFSUBR (Fignore_event);
|
0
|
2924 #endif
|
20
|
2925 DEFSUBR (Fselect_frame);
|
|
2926 DEFSUBR (Fselected_frame);
|
|
2927 DEFSUBR (Factive_minibuffer_window);
|
|
2928 DEFSUBR (Flast_nonminibuf_frame);
|
|
2929 DEFSUBR (Fframe_root_window);
|
|
2930 DEFSUBR (Fframe_selected_window);
|
|
2931 DEFSUBR (Fset_frame_selected_window);
|
|
2932 DEFSUBR (Fframe_device);
|
|
2933 DEFSUBR (Fnext_frame);
|
|
2934 DEFSUBR (Fprevious_frame);
|
|
2935 DEFSUBR (Fdelete_frame);
|
|
2936 DEFSUBR (Fmouse_position);
|
|
2937 DEFSUBR (Fmouse_pixel_position);
|
|
2938 DEFSUBR (Fmouse_position_as_motion_event);
|
|
2939 DEFSUBR (Fset_mouse_position);
|
|
2940 DEFSUBR (Fset_mouse_pixel_position);
|
|
2941 DEFSUBR (Fmake_frame_visible);
|
|
2942 DEFSUBR (Fmake_frame_invisible);
|
|
2943 DEFSUBR (Ficonify_frame);
|
|
2944 DEFSUBR (Fdeiconify_frame);
|
|
2945 DEFSUBR (Fframe_visible_p);
|
|
2946 DEFSUBR (Fframe_totally_visible_p);
|
|
2947 DEFSUBR (Fframe_iconified_p);
|
|
2948 DEFSUBR (Fvisible_frame_list);
|
|
2949 DEFSUBR (Fraise_frame);
|
|
2950 DEFSUBR (Flower_frame);
|
|
2951 DEFSUBR (Fframe_property);
|
|
2952 DEFSUBR (Fframe_properties);
|
|
2953 DEFSUBR (Fset_frame_properties);
|
|
2954 DEFSUBR (Fframe_pixel_height);
|
|
2955 DEFSUBR (Fframe_pixel_width);
|
|
2956 DEFSUBR (Fframe_name);
|
|
2957 DEFSUBR (Fframe_modified_tick);
|
|
2958 DEFSUBR (Fset_frame_height);
|
|
2959 DEFSUBR (Fset_frame_width);
|
|
2960 DEFSUBR (Fset_frame_size);
|
|
2961 DEFSUBR (Fset_frame_position);
|
|
2962 DEFSUBR (Fset_frame_pointer);
|
0
|
2963 }
|
|
2964
|
|
2965 void
|
|
2966 vars_of_frame (void)
|
|
2967 {
|
|
2968 /* */
|
|
2969 Vframe_being_created = Qnil;
|
|
2970 staticpro (&Vframe_being_created);
|
|
2971
|
20
|
2972 #ifdef HAVE_CDE
|
|
2973 Vfeatures = Fcons (intern ("cde"), Vfeatures);
|
|
2974 #endif
|
|
2975
|
0
|
2976 #if 0 /* FSFmacs stupidity */
|
|
2977 xxDEFVAR_LISP ("emacs-iconified", &Vemacs_iconified /*
|
|
2978 Non-nil if all of emacs is iconified and frame updates are not needed.
|
|
2979 */ );
|
|
2980 Vemacs_iconified = Qnil;
|
|
2981 #endif
|
|
2982
|
|
2983 DEFVAR_LISP ("select-frame-hook", &Vselect_frame_hook /*
|
|
2984 Function or functions to run just after a new frame is given the focus.
|
|
2985 Note that calling `select-frame' does not necessarily set the focus:
|
|
2986 The actual window-system focus will not be changed until the next time
|
|
2987 that XEmacs is waiting for an event, and even then, the window manager
|
|
2988 may refuse the focus-change request.
|
|
2989 */ );
|
|
2990 Vselect_frame_hook = Qnil;
|
|
2991
|
|
2992 DEFVAR_LISP ("deselect-frame-hook", &Vdeselect_frame_hook /*
|
|
2993 Function or functions to run just before a frame loses the focus.
|
|
2994 See `select-frame-hook'.
|
|
2995 */ );
|
|
2996 Vdeselect_frame_hook = Qnil;
|
|
2997
|
|
2998 DEFVAR_LISP ("delete-frame-hook", &Vdelete_frame_hook /*
|
|
2999 Function or functions to call when a frame is deleted.
|
16
|
3000 One argument, the about-to-be-deleted frame.
|
0
|
3001 */ );
|
|
3002 Vdelete_frame_hook = Qnil;
|
|
3003
|
|
3004 DEFVAR_LISP ("create-frame-hook", &Vcreate_frame_hook /*
|
|
3005 Function or functions to call when a frame is created.
|
|
3006 One argument, the newly-created frame.
|
|
3007 */ );
|
|
3008 Vcreate_frame_hook = Qnil;
|
|
3009
|
|
3010 DEFVAR_LISP ("mouse-enter-frame-hook", &Vmouse_enter_frame_hook /*
|
16
|
3011 Function or functions to call when the mouse enters a frame.
|
0
|
3012 One argument, the frame.
|
16
|
3013 Be careful not to make assumptions about the window manager's focus model.
|
0
|
3014 In most cases, the `deselect-frame-hook' is more appropriate.
|
|
3015 */ );
|
|
3016 Vmouse_enter_frame_hook = Qnil;
|
|
3017
|
|
3018 DEFVAR_LISP ("mouse-leave-frame-hook", &Vmouse_leave_frame_hook /*
|
16
|
3019 Function or functions to call when the mouse leaves a frame.
|
0
|
3020 One argument, the frame.
|
16
|
3021 Be careful not to make assumptions about the window manager's focus model.
|
0
|
3022 In most cases, the `select-frame-hook' is more appropriate.
|
|
3023 */ );
|
|
3024 Vmouse_leave_frame_hook = Qnil;
|
|
3025
|
|
3026 DEFVAR_LISP ("map-frame-hook", &Vmap_frame_hook /*
|
16
|
3027 Function or functions to call when a frame is mapped.
|
0
|
3028 One argument, the frame.
|
|
3029 */ );
|
|
3030 Vmap_frame_hook = Qnil;
|
|
3031
|
|
3032 DEFVAR_LISP ("unmap-frame-hook", &Vunmap_frame_hook /*
|
16
|
3033 Function or functions to call when a frame is unmapped.
|
0
|
3034 One argument, the frame.
|
|
3035 */ );
|
|
3036 Vunmap_frame_hook = Qnil;
|
|
3037
|
|
3038 DEFVAR_LISP ("allow-deletion-of-last-visible-frame",
|
|
3039 &Vallow_deletion_of_last_visible_frame /*
|
|
3040 *Non-nil means to assume the force option to delete-frame.
|
|
3041 */ );
|
|
3042 Vallow_deletion_of_last_visible_frame = Qnil;
|
|
3043
|
2
|
3044 #if defined (HAVE_CDE) || defined (HAVE_OFFIX_DND)
|
0
|
3045 DEFVAR_LISP ("drag-and-drop-functions", &Vdrag_and_drop_functions /*
|
|
3046 Function or functions to run when an object is dropped on a frame.
|
2
|
3047 Each function is called with either two or three args. If called with
|
|
3048 two args, the args are a frame and a pathname. If with three, the
|
16
|
3049 args are a frame, a pathname (which will be either a string or nil)
|
2
|
3050 and the textual representation of the dragged object.
|
0
|
3051 */ );
|
|
3052 Vdrag_and_drop_functions = Qnil;
|
16
|
3053 #endif /* HAVE_CDE */
|
0
|
3054
|
|
3055 DEFVAR_LISP ("mouse-motion-handler", &Vmouse_motion_handler /*
|
|
3056 Handler for motion events. One arg, the event.
|
|
3057 For most applications, you should use `mode-motion-hook' instead of this.
|
|
3058 */ );
|
|
3059 Vmouse_motion_handler = Qnil;
|
|
3060
|
|
3061 DEFVAR_LISP ("synchronize-minibuffers",&Vsynchronize_minibuffers /*
|
|
3062 Set to t if all minibuffer windows are to be synchronized.
|
|
3063 This will cause echo area messages to appear in the minibuffers of all
|
|
3064 visible frames.
|
|
3065 */ );
|
|
3066 Vsynchronize_minibuffers = Qnil;
|
|
3067
|
|
3068 DEFVAR_LISP ("frame-title-format", &Vframe_title_format /*
|
|
3069 Controls the title of the X window corresponding to the selected frame.
|
|
3070 This is the same format as `modeline-format' with the exception that
|
|
3071 %- is ignored.
|
|
3072 */ );
|
|
3073 Vframe_title_format = Fpurecopy (build_string ("%S: %b"));
|
|
3074
|
|
3075 DEFVAR_LISP ("frame-icon-title-format", &Vframe_icon_title_format /*
|
|
3076 Controls the title of the icon corresponding to the selected frame.
|
16
|
3077 See also the variable `frame-title-format'.
|
0
|
3078 */ );
|
|
3079 Vframe_icon_title_format = Fpurecopy (build_string ("%b"));
|
|
3080
|
|
3081 DEFVAR_LISP ("default-frame-name", &Vdefault_frame_name /*
|
|
3082 The default name to assign to newly-created frames.
|
|
3083 This can be overridden by arguments to `make-frame'.
|
|
3084 This must be a string.
|
|
3085 */ );
|
|
3086 Vdefault_frame_name = Fpurecopy (build_string ("emacs"));
|
|
3087
|
|
3088 DEFVAR_LISP ("default-frame-plist", &Vdefault_frame_plist /*
|
|
3089 Plist of default values for frame creation, other than the first one.
|
|
3090 These may be set in your init file, like this:
|
|
3091
|
|
3092 \(setq default-frame-plist '(width 80 height 55))
|
|
3093
|
|
3094 The properties may be in alist format for backward compatibility
|
|
3095 but you should not rely on this behavior.
|
|
3096
|
|
3097 These override values given in window system configuration data,
|
|
3098 including X Windows' defaults database.
|
|
3099
|
|
3100 Since the first X frame is created before loading your .emacs file,
|
|
3101 you must use the X resource database for that.
|
|
3102
|
|
3103 For values specific to the first Emacs frame, see `initial-frame-plist'.
|
|
3104 For values specific to the separate minibuffer frame, see
|
|
3105 `minibuffer-frame-plist'.
|
|
3106
|
|
3107 See also the variables `default-x-frame-plist' and
|
|
3108 `default-tty-frame-plist', which are like `default-frame-plist'
|
|
3109 except that they apply only to X or tty frames, respectively
|
|
3110 (whereas `default-frame-plist' applies to all types of frames).
|
|
3111 */ );
|
|
3112 Vdefault_frame_plist = Qnil;
|
|
3113
|
|
3114 DEFVAR_LISP ("frame-icon-glyph", &Vframe_icon_glyph /*
|
|
3115 Icon glyph used to iconify a frame.
|
|
3116 */ );
|
|
3117 }
|
|
3118
|
|
3119 void
|
|
3120 complex_vars_of_frame (void)
|
|
3121 {
|
|
3122 Vframe_icon_glyph = allocate_glyph (GLYPH_ICON, icon_glyph_changed);
|
|
3123 }
|