annotate src/frame.c @ 668:91da4ecd9da0

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