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