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