annotate src/frame.c @ 408:501cfd01ee6d r21-2-34

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