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