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