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