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