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