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