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