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