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