annotate src/frame.c @ 1252:a0845169de0a

[xemacs-hg @ 2003-02-03 17:46:54 by james] Fix module building on FreeBSD (and probably other non-GNU make systems).
author james
date Mon, 03 Feb 2003 17:46:58 +0000
parents e22b0213b713
children 671b65f2b075
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 /* Generic frame functions.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2 Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
3 Copyright (C) 1995, 1996, 2002 Ben Wing.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4 Copyright (C) 1995 Sun Microsystems, Inc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6 This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 under the terms of the GNU General Public License as published by the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10 Free Software Foundation; either version 2, or (at your option) any
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11 later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 XEmacs is distributed in the hope that it will be useful, but WITHOUT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16 for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 along with XEmacs; see the file COPYING. If not, write to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21 Boston, MA 02111-1307, USA. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23 /* Synched up with: FSF 19.30. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25 /* This file has been Mule-ized. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27 #include <config.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28 #include "lisp.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30 #include "buffer.h" /* for Vbuffer_alist */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31 #include "console.h"
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
32 #include "device-impl.h"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33 #include "events.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34 #include "extents.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35 #include "faces.h"
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
36 #include "frame-impl.h"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37 #include "glyphs.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 #include "gutter.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 #include "menubar.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 #include "redisplay.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 #include "scrollbar.h"
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
42 #include "toolbar.h"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 #include "window.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 Lisp_Object Vselect_frame_hook, Qselect_frame_hook;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 Lisp_Object Vdeselect_frame_hook, Qdeselect_frame_hook;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 Lisp_Object Vcreate_frame_hook, Qcreate_frame_hook;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 Lisp_Object Vdelete_frame_hook, Qdelete_frame_hook;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 Lisp_Object Vmouse_enter_frame_hook, Qmouse_enter_frame_hook;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50 Lisp_Object Vmouse_leave_frame_hook, Qmouse_leave_frame_hook;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 Lisp_Object Vmap_frame_hook, Qmap_frame_hook;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52 Lisp_Object Vunmap_frame_hook, Qunmap_frame_hook;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53 int allow_deletion_of_last_visible_frame;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54 Lisp_Object Vadjust_frame_function;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 Lisp_Object Vmouse_motion_handler;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 Lisp_Object Vsynchronize_minibuffers;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 Lisp_Object Qsynchronize_minibuffers;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58 Lisp_Object Qbuffer_predicate;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59 Lisp_Object Qmake_initial_minibuffer_frame;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60 Lisp_Object Qcustom_initialize_frame;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 /* We declare all these frame properties here even though many of them
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63 are currently only used in frame-x.c, because we should generalize
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64 them. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 Lisp_Object Qminibuffer;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 Lisp_Object Qunsplittable;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 Lisp_Object Qinternal_border_width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 Lisp_Object Qtop_toolbar_shadow_color;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 Lisp_Object Qbottom_toolbar_shadow_color;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 Lisp_Object Qbackground_toolbar_color;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 Lisp_Object Qtop_toolbar_shadow_pixmap;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73 Lisp_Object Qbottom_toolbar_shadow_pixmap;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 Lisp_Object Qtoolbar_shadow_thickness;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75 Lisp_Object Qscrollbar_placement;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76 Lisp_Object Qinter_line_space;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 Lisp_Object Qvisual_bell;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78 Lisp_Object Qbell_volume;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79 Lisp_Object Qpointer_background;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80 Lisp_Object Qpointer_color;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 Lisp_Object Qtext_pointer;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82 Lisp_Object Qspace_pointer;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 Lisp_Object Qmodeline_pointer;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84 Lisp_Object Qgc_pointer;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 Lisp_Object Qinitially_unmapped;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 Lisp_Object Quse_backing_store;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87 Lisp_Object Qborder_color;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 Lisp_Object Qborder_width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 Lisp_Object Qframep, Qframe_live_p;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91 Lisp_Object Qdelete_frame;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93 Lisp_Object Qframe_title_format, Vframe_title_format;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 Lisp_Object Qframe_icon_title_format, Vframe_icon_title_format;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 Lisp_Object Vdefault_frame_name;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 Lisp_Object Vdefault_frame_plist;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 Lisp_Object Vframe_icon_glyph;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 Lisp_Object Qhidden;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 Lisp_Object Qvisible, Qiconic, Qinvisible, Qvisible_iconic, Qinvisible_iconic;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 Lisp_Object Qnomini, Qvisible_nomini, Qiconic_nomini, Qinvisible_nomini;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 Lisp_Object Qvisible_iconic_nomini, Qinvisible_iconic_nomini;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
107 Lisp_Object Qset_specifier, Qset_face_property;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 Lisp_Object Qface_property_instance;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 Lisp_Object Qframe_property_alias;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112 /* If this is non-nil, it is the frame that make-frame is currently
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113 creating. We can't set the current frame to this in case the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114 debugger goes off because it would try and display to it. However,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115 there are some places which need to reference it which have no
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116 other way of getting it if it isn't the selected frame. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117 Lisp_Object Vframe_being_created;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118 Lisp_Object Qframe_being_created;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120 static void store_minibuf_frame_prop (struct frame *f, Lisp_Object val);
1125
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
121
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
122 typedef enum {
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
123 DISPLAYABLE_PIXEL_TO_CHAR,
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
124 TOTAL_PIXEL_TO_CHAR,
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
125 CHAR_TO_TOTAL_PIXEL,
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
126 CHAR_TO_DISPLAYABLE_PIXEL,
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
127 } pixel_to_char_mode_t;
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
128
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
129 static void frame_conversion_internal (struct frame *f,
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
130 pixel_to_char_mode_t pixel_to_char,
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
131 int *pixel_width, int *pixel_height,
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
132 int *char_width, int *char_height,
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
133 int real_face);
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
134 static struct display_line title_string_display_line;
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
135 /* Used by generate_title_string. Global because they get used so much that
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
136 the dynamic allocation time adds up. */
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 863
diff changeset
137 static Ichar_dynarr *title_string_ichar_dynarr;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
138
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
140
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
141 extern const struct sized_memory_description gtk_frame_data_description;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
142 extern const struct sized_memory_description mswindows_frame_data_description;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
143 extern const struct sized_memory_description x_frame_data_description;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
144
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
145 static const struct memory_description frame_data_description_1 []= {
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
146 #ifdef HAVE_GTK
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
147 { XD_STRUCT_PTR, gtk_console, 1, &gtk_frame_data_description},
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
148 #endif
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
149 #ifdef HAVE_MS_WINDOWS
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
150 { XD_STRUCT_PTR, mswindows_console, 1, &mswindows_frame_data_description},
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
151 #endif
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
152 #ifdef HAVE_X_WINDOWS
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
153 { XD_STRUCT_PTR, x_console, 1, &x_frame_data_description},
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
154 #endif
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
155 { XD_END }
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
156 };
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
157
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
158 static const struct sized_memory_description frame_data_description = {
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
159 sizeof (void *), frame_data_description_1
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
160 };
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
161
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
162 extern const struct sized_memory_description expose_ignore_description;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
163
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
164 static const struct memory_description expose_ignore_description_1 [] = {
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
165 { XD_STRUCT_PTR, offsetof (struct expose_ignore, next),
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
166 1, &expose_ignore_description },
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
167 { XD_END }
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
168 };
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
169
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
170 const struct sized_memory_description expose_ignore_description = {
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
171 sizeof (struct expose_ignore),
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
172 expose_ignore_description_1
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
173 };
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
174
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
175 static const struct memory_description display_line_dynarr_pointer_description_1 []= {
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
176 { XD_STRUCT_PTR, 0, 1, &display_line_dynarr_description},
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
177 { XD_END }
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
178 };
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
179
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
180 static const struct sized_memory_description display_line_dynarr_pointer_description = {
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
181 sizeof (display_line_dynarr *), display_line_dynarr_pointer_description_1
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
182 };
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
183
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
184 static const struct memory_description frame_description [] = {
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
185 { XD_INT, offsetof (struct frame, frametype) },
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
186 #define MARKED_SLOT(x) { XD_LISP_OBJECT, offsetof (struct frame, x) },
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
187 #define MARKED_SLOT_ARRAY(slot, size) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
188 { XD_LISP_OBJECT_ARRAY, offsetof (struct frame, slot), size },
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
189 #include "frameslots.h"
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
190
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
191 { XD_STRUCT_PTR, offsetof (struct frame, subwindow_exposures),
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
192 1, &expose_ignore_description },
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
193 { XD_STRUCT_PTR, offsetof (struct frame, subwindow_exposures_tail),
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
194 1, &expose_ignore_description },
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
195
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
196 #ifdef HAVE_SCROLLBARS
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
197 { XD_LISP_OBJECT, offsetof (struct frame, sb_vcache) },
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
198 { XD_LISP_OBJECT, offsetof (struct frame, sb_hcache) },
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
199 #endif /* HAVE_SCROLLBARS */
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
200
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
201 { XD_STRUCT_ARRAY, offsetof (struct frame, current_display_lines),
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
202 4, &display_line_dynarr_pointer_description },
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
203 { XD_STRUCT_ARRAY, offsetof (struct frame, desired_display_lines),
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
204 4, &display_line_dynarr_pointer_description },
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
205
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
206 { XD_STRUCT_PTR, offsetof (struct frame, framemeths), 1,
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
207 &console_methods_description },
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
208 { XD_UNION, offsetof (struct frame, frame_data),
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
209 XD_INDIRECT (0, 0), &frame_data_description },
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
210 { XD_END }
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
211 };
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
212
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
213 static Lisp_Object
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
214 mark_frame (Lisp_Object obj)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
215 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
216 struct frame *f = XFRAME (obj);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
217
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
218 #define MARKED_SLOT(x) mark_object (f->x);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
219 #include "frameslots.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
220
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
221 if (FRAME_LIVE_P (f)) /* device is nil for a dead frame */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
222 MAYBE_FRAMEMETH (f, mark_frame, (f));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
223
617
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 563
diff changeset
224 #ifdef HAVE_SCROLLBARS
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 563
diff changeset
225 if (f->sb_vcache)
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 563
diff changeset
226 mark_object (wrap_scrollbar_instance (f->sb_vcache));
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 563
diff changeset
227 if (f->sb_hcache)
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 563
diff changeset
228 mark_object (wrap_scrollbar_instance (f->sb_hcache));
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 563
diff changeset
229 #endif
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 563
diff changeset
230
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 563
diff changeset
231 mark_gutters (f);
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 563
diff changeset
232
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
233 return Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
234 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
235
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
236 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
237 print_frame (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
238 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
239 struct frame *frm = XFRAME (obj);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
240
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
241 if (print_readably)
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
242 printing_unreadable_object ("#<frame %s 0x%x>",
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
243 XSTRING_DATA (frm->name), frm->header.uid);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
244
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
245 write_fmt_string (printcharfun, "#<%s-frame ", !FRAME_LIVE_P (frm) ? "dead" :
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
246 FRAME_TYPE_NAME (frm));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
247 print_internal (frm->name, printcharfun, 1);
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
248 write_fmt_string (printcharfun, " 0x%x>", frm->header.uid);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
249 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
250
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
251 DEFINE_LRECORD_IMPLEMENTATION ("frame", frame,
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
252 0, /*dumpable-flag*/
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
253 mark_frame, print_frame, 0, 0, 0,
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
254 frame_description,
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
255 struct frame);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
256
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
257 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
258 nuke_all_frame_slots (struct frame *f)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
259 {
617
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 563
diff changeset
260 zero_lcrecord (f);
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 563
diff changeset
261
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
262 #define MARKED_SLOT(x) f->x = Qnil;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
263 #include "frameslots.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
264 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
265
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
266 /* Allocate a new frame object and set all its fields to reasonable
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
267 values. The root window is created but the minibuffer will be done
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
268 later. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
269
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
270 static struct frame *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
271 allocate_frame_core (Lisp_Object device)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
272 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
273 /* This function can GC */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
274 Lisp_Object frame;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
275 Lisp_Object root_window;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
276 struct frame *f = alloc_lcrecord_type (struct frame, &lrecord_frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
277
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
278 nuke_all_frame_slots (f);
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
279 frame = wrap_frame (f);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
280
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
281 f->device = device;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
282 f->framemeths = XDEVICE (device)->devmeths;
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
283 f->frametype = get_console_variant (XDEVICE_TYPE (device));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
284 f->buffer_alist = Fcopy_sequence (Vbuffer_alist);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
285
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
286 root_window = allocate_window ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
287 XWINDOW (root_window)->frame = frame;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
288
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
289 /* 10 is arbitrary,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
290 Just so that there is "something there."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
291 Correct size will be set up later with change_frame_size. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
292
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
293 f->width = 10;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
294 f->height = 10;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
295
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
296 XWINDOW (root_window)->pixel_width = 10;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
297 XWINDOW (root_window)->pixel_height = 9;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
298
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
299 f->root_window = root_window;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
300 f->selected_window = root_window;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
301 f->last_nonminibuf_window = root_window;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
302
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
303 /* cache of subwindows visible on frame */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
304 f->subwindow_instance_cache = make_weak_list (WEAK_LIST_SIMPLE);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
305
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
306 /* associated exposure ignore list */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
307 f->subwindow_exposures = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
308 f->subwindow_exposures_tail = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
309
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
310 FRAME_SET_PAGENUMBER (f, 1);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
311
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
312 note_object_created (root_window);
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
313
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
314 /* Choose a buffer for the frame's root window. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
315 XWINDOW (root_window)->buffer = Qt;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
316 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
317 Lisp_Object buf;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
318
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
319 buf = Fcurrent_buffer ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
320 /* If buf is a 'hidden' buffer (i.e. one whose name starts with
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
321 a space), try to find another one. */
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 863
diff changeset
322 if (string_ichar (Fbuffer_name (buf), 0) == ' ')
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
323 buf = Fother_buffer (buf, Qnil, Qnil);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
324 Fset_window_buffer (root_window, buf, Qnil);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
325 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
326
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
327 return f;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
328 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
329
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
330 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
331 setup_normal_frame (struct frame *f)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
332 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
333 Lisp_Object mini_window;
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
334 Lisp_Object frame = wrap_frame (f);
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
335
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
336
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
337 mini_window = allocate_window ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
338 XWINDOW (f->root_window)->next = mini_window;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
339 XWINDOW (mini_window)->prev = f->root_window;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
340 XWINDOW (mini_window)->mini_p = Qt;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
341 XWINDOW (mini_window)->frame = frame;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
342 f->minibuffer_window = mini_window;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
343 f->has_minibuffer = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
344
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
345 note_object_created (mini_window);
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
346
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
347 XWINDOW (mini_window)->buffer = Qt;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
348 Fset_window_buffer (mini_window, Vminibuffer_zero, Qt);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
349 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
350
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
351 /* Make a frame using a separate minibuffer window on another frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
352 MINI_WINDOW is the minibuffer window to use. nil means use the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
353 default-minibuffer-frame. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
354
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
355 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
356 setup_frame_without_minibuffer (struct frame *f, Lisp_Object mini_window)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
357 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
358 /* This function can GC */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
359 Lisp_Object device = f->device;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
360
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
361 if (!NILP (mini_window))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
362 CHECK_LIVE_WINDOW (mini_window);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
363
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
364 if (!NILP (mini_window)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
365 && !EQ (DEVICE_CONSOLE (XDEVICE (device)),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
366 FRAME_CONSOLE (XFRAME (XWINDOW (mini_window)->frame))))
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
367 invalid_argument ("frame and minibuffer must be on the same console", Qunbound);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
368
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
369 /* Do not create a default minibuffer frame on printer devices. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
370 if (NILP (mini_window)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
371 && DEVICE_DISPLAY_P (XDEVICE (FRAME_DEVICE (f))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
372 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
373 struct console *con = XCONSOLE (FRAME_CONSOLE (f));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
374 /* Use default-minibuffer-frame if possible. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
375 if (!FRAMEP (con->default_minibuffer_frame)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
376 || ! FRAME_LIVE_P (XFRAME (con->default_minibuffer_frame)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
377 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
378 /* If there's no minibuffer frame to use, create one. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
379 con->default_minibuffer_frame
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
380 = call1 (Qmake_initial_minibuffer_frame, device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
381 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
382 mini_window = XFRAME (con->default_minibuffer_frame)->minibuffer_window;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
383 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
384
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
385 /* Install the chosen minibuffer window, with proper buffer. */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
386 if (!NILP (mini_window))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
387 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
388 store_minibuf_frame_prop (f, mini_window);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
389 Fset_window_buffer (mini_window, Vminibuffer_zero, Qt);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
390 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
391 else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
392 f->minibuffer_window = Qnil;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
393 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
394
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
395 /* Make a frame containing only a minibuffer window. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
396
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
397 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
398 setup_minibuffer_frame (struct frame *f)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
399 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
400 /* This function can GC */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
401 /* First make a frame containing just a root window, no minibuffer. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
402 Lisp_Object mini_window;
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
403 Lisp_Object frame = wrap_frame (f);
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
404
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
405
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
406 f->no_split = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
407 f->has_minibuffer = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
408
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
409 /* Now label the root window as also being the minibuffer.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
410 Avoid infinite looping on the window chain by marking next pointer
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
411 as nil. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
412
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
413 mini_window = f->minibuffer_window = f->root_window;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
414 XWINDOW (mini_window)->mini_p = Qt;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
415 XWINDOW (mini_window)->next = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
416 XWINDOW (mini_window)->prev = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
417 XWINDOW (mini_window)->frame = frame;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
418
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
419 /* Put the proper buffer in that window. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
420
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
421 Fset_window_buffer (mini_window, Vminibuffer_zero, Qt);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
422 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
423
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
424 static Lisp_Object
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
425 make_sure_its_a_fresh_plist (Lisp_Object foolist)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
426 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
427 if (CONSP (Fcar (foolist)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
428 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
429 /* looks like an alist to me. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
430 foolist = Fcopy_alist (foolist);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
431 foolist = Fdestructive_alist_to_plist (foolist);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
432 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
433 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
434 foolist = Fcopy_sequence (foolist);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
435
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
436 return foolist;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
437 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
438
558
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 546
diff changeset
439 static Lisp_Object
546
666d73d6ac56 [xemacs-hg @ 2001-05-20 01:17:07 by ben]
ben
parents: 545
diff changeset
440 restore_frame_list_to_its_unbesmirched_state (Lisp_Object kawnz)
666d73d6ac56 [xemacs-hg @ 2001-05-20 01:17:07 by ben]
ben
parents: 545
diff changeset
441 {
666d73d6ac56 [xemacs-hg @ 2001-05-20 01:17:07 by ben]
ben
parents: 545
diff changeset
442 Lisp_Object lissed = XCDR (kawnz);
666d73d6ac56 [xemacs-hg @ 2001-05-20 01:17:07 by ben]
ben
parents: 545
diff changeset
443 if (!EQ (lissed, Qunbound))
666d73d6ac56 [xemacs-hg @ 2001-05-20 01:17:07 by ben]
ben
parents: 545
diff changeset
444 DEVICE_FRAME_LIST (XDEVICE (XCAR (kawnz))) = lissed;
666d73d6ac56 [xemacs-hg @ 2001-05-20 01:17:07 by ben]
ben
parents: 545
diff changeset
445 return Qnil;
666d73d6ac56 [xemacs-hg @ 2001-05-20 01:17:07 by ben]
ben
parents: 545
diff changeset
446 }
666d73d6ac56 [xemacs-hg @ 2001-05-20 01:17:07 by ben]
ben
parents: 545
diff changeset
447
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
448 DEFUN ("make-frame", Fmake_frame, 0, 2, "", /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
449 Create and return a new frame, displaying the current buffer.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
450 Runs the functions listed in `create-frame-hook' after frame creation.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
451
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
452 Optional argument PROPS is a property list (a list of alternating
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
453 keyword-value specifications) of properties for the new frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
454 \(An alist is accepted for backward compatibility but should not
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
455 be passed in.)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
456
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
457 See `set-frame-properties', `default-x-frame-plist', and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
458 `default-tty-frame-plist' for the specially-recognized properties.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
459 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
460 (props, device))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
461 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
462 struct frame *f;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
463 struct device *d;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
464 Lisp_Object frame = Qnil, name = Qnil, minibuf;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
465 struct gcpro gcpro1, gcpro2, gcpro3;
546
666d73d6ac56 [xemacs-hg @ 2001-05-20 01:17:07 by ben]
ben
parents: 545
diff changeset
466 int speccount = specpdl_depth (), speccount2;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
467 int first_frame_on_device = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
468 int first_frame_on_console = 0;
546
666d73d6ac56 [xemacs-hg @ 2001-05-20 01:17:07 by ben]
ben
parents: 545
diff changeset
469 Lisp_Object besmirched_cons = Qnil;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
470 int frame_name_is_defaulted = 1;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
471
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
472 d = decode_device (device);
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
473 device = wrap_device (d);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
474
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
475 /* PROPS and NAME may be freshly-created, so make sure to GCPRO. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
476 GCPRO3 (frame, props, name);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
477
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
478 props = make_sure_its_a_fresh_plist (props);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
479 if (DEVICE_SPECIFIC_FRAME_PROPS (d))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
480 /* Put the device-specific props before the more general ones so
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
481 that they override them. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
482 props = nconc2 (props,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
483 make_sure_its_a_fresh_plist
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
484 (*DEVICE_SPECIFIC_FRAME_PROPS (d)));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
485 props = nconc2 (props, make_sure_its_a_fresh_plist (Vdefault_frame_plist));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
486 Fcanonicalize_lax_plist (props, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
487
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
488 name = Flax_plist_get (props, Qname, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
489 if (!NILP (name))
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
490 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
491 CHECK_STRING (name);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
492 frame_name_is_defaulted = 0;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
493 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
494 else if (STRINGP (Vdefault_frame_name))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
495 name = Vdefault_frame_name;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
496 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
497 name = build_string ("emacs");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
498
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 863
diff changeset
499 if (!NILP (Fstring_match (make_string ((const Ibyte *) "\\.", 2), name,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
500 Qnil, Qnil)))
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
501 syntax_error (". not allowed in frame names", name);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
502
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
503 f = allocate_frame_core (device);
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
504 frame = wrap_frame (f);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
505
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
506 specbind (Qframe_being_created, name);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
507 f->name = name;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
508
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
509 FRAMEMETH (f, init_frame_1, (f, props, frame_name_is_defaulted));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
510
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
511 minibuf = Flax_plist_get (props, Qminibuffer, Qunbound);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
512 if (UNBOUNDP (minibuf))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
513 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
514 /* If minibuf is unspecified, then look for a minibuffer X resource. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
515 /* #### Not implemented any more. We need to fix things up so
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
516 that we search out all X resources and append them to the end of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
517 props, above. This is the only way in general to assure
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
518 coherent behavior for all frame properties/resources/etc. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
519 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
520 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
521 props = Flax_plist_remprop (props, Qminibuffer);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
522
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
523 if (EQ (minibuf, Qnone) || NILP (minibuf))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
524 setup_frame_without_minibuffer (f, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
525 else if (EQ (minibuf, Qonly))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
526 setup_minibuffer_frame (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
527 else if (WINDOWP (minibuf))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
528 setup_frame_without_minibuffer (f, minibuf);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
529 else if (EQ (minibuf, Qt) || UNBOUNDP (minibuf))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
530 setup_normal_frame (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
531 else
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
532 invalid_argument ("Invalid value for `minibuffer'", minibuf);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
533
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
534 update_frame_window_mirror (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
535
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
536 if (initialized && !DEVICE_STREAM_P (d))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
537 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
538 if (!NILP (f->minibuffer_window))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
539 reset_face_cachels (XWINDOW (f->minibuffer_window));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
540 reset_face_cachels (XWINDOW (f->root_window));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
541 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
542
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
543 /* If no frames on this device formerly existed, say this is the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
544 first frame. It kind of assumes that frameless devices don't
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
545 exist, but it shouldn't be too harmful. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
546 if (NILP (DEVICE_FRAME_LIST (d)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
547 first_frame_on_device = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
548
546
666d73d6ac56 [xemacs-hg @ 2001-05-20 01:17:07 by ben]
ben
parents: 545
diff changeset
549 /* It's possible for one of the init methods below to signal an error;
666d73d6ac56 [xemacs-hg @ 2001-05-20 01:17:07 by ben]
ben
parents: 545
diff changeset
550 in that case, let's make sure the device isn't besmirched by
666d73d6ac56 [xemacs-hg @ 2001-05-20 01:17:07 by ben]
ben
parents: 545
diff changeset
551 having a half-initialized frame attached to it */
666d73d6ac56 [xemacs-hg @ 2001-05-20 01:17:07 by ben]
ben
parents: 545
diff changeset
552 speccount2 = specpdl_depth ();
666d73d6ac56 [xemacs-hg @ 2001-05-20 01:17:07 by ben]
ben
parents: 545
diff changeset
553 record_unwind_protect (restore_frame_list_to_its_unbesmirched_state,
666d73d6ac56 [xemacs-hg @ 2001-05-20 01:17:07 by ben]
ben
parents: 545
diff changeset
554 besmirched_cons =
666d73d6ac56 [xemacs-hg @ 2001-05-20 01:17:07 by ben]
ben
parents: 545
diff changeset
555 Fcons (device, DEVICE_FRAME_LIST (d)));
666d73d6ac56 [xemacs-hg @ 2001-05-20 01:17:07 by ben]
ben
parents: 545
diff changeset
556
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
557 /* This *must* go before the init_*() methods. Those functions
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
558 call Lisp code, and if any of them causes a warning to be displayed
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
559 and the *Warnings* buffer to be created, it won't get added to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
560 the frame-specific version of the buffer-alist unless the frame
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
561 is accessible from the device. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
562
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
563 #if 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
564 DEVICE_FRAME_LIST (d) = nconc2 (DEVICE_FRAME_LIST (d), Fcons (frame, Qnil));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
565 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
566 DEVICE_FRAME_LIST (d) = Fcons (frame, DEVICE_FRAME_LIST (d));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
567 RESET_CHANGED_SET_FLAGS;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
568
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
569 note_object_created (frame);
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
570
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
571 /* Now make sure that the initial cached values are set correctly.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
572 Do this after the init_frame method is called because that may
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
573 do things (e.g. create widgets) that are necessary for the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
574 specifier value-changed methods to work OK. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
575 recompute_all_cached_specifiers_in_frame (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
576
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
577 if (!DEVICE_STREAM_P (d))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
578 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
579 init_frame_faces (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
580
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
581 #ifdef HAVE_SCROLLBARS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
582 /* Finish up resourcing the scrollbars. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
583 init_frame_scrollbars (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
584 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
585
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
586 #ifdef HAVE_TOOLBARS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
587 /* Create the initial toolbars. We have to do this after the frame
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
588 methods are called because it may potentially call some things itself
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
589 which depend on the normal frame methods having initialized
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
590 things. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
591 init_frame_toolbars (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
592 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
593 reset_face_cachels (XWINDOW (FRAME_SELECTED_WINDOW (f)));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
594 reset_glyph_cachels (XWINDOW (FRAME_SELECTED_WINDOW (f)));
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
595
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
596 change_frame_size (f, f->height, f->width, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
597 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
598
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
599 MAYBE_FRAMEMETH (f, init_frame_2, (f, props));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
600 Fset_frame_properties (frame, props);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
601 MAYBE_FRAMEMETH (f, init_frame_3, (f));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
602
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
603 /* Hallelujah, praise the lord. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
604 f->init_finished = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
605
546
666d73d6ac56 [xemacs-hg @ 2001-05-20 01:17:07 by ben]
ben
parents: 545
diff changeset
606 XCDR (besmirched_cons) = Qunbound;
666d73d6ac56 [xemacs-hg @ 2001-05-20 01:17:07 by ben]
ben
parents: 545
diff changeset
607
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
608 unbind_to (speccount2);
546
666d73d6ac56 [xemacs-hg @ 2001-05-20 01:17:07 by ben]
ben
parents: 545
diff changeset
609
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
610 /* If this is the first frame on the device, make it the selected one. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
611 if (first_frame_on_device && NILP (DEVICE_SELECTED_FRAME (d)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
612 set_device_selected_frame (d, frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
613
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
614 /* If at startup or if the current console is a stream console
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
615 (usually also at startup), make this console the selected one
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
616 so that messages show up on it. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
617 if (NILP (Fselected_console ()) ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
618 CONSOLE_STREAM_P (XCONSOLE (Fselected_console ())))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
619 Fselect_console (DEVICE_CONSOLE (d));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
620
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
621 first_frame_on_console =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
622 (first_frame_on_device &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
623 XINT (Flength (CONSOLE_DEVICE_LIST (XCONSOLE (DEVICE_CONSOLE (d)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
624 == 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
625
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
626 /* #### all this calling of frame methods at various odd times
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
627 is somewhat of a mess. It's necessary to do it this way due
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
628 to strange console-type-specific things that need to be done. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
629 MAYBE_FRAMEMETH (f, after_init_frame, (f, first_frame_on_device,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
630 first_frame_on_console));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
631
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
632 if (!DEVICE_STREAM_P (d))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
633 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
634 /* Now initialise the gutters. This won't change the frame size,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
635 but is needed as input to the layout that change_frame_size
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
636 will eventually do. Unfortunately gutter sizing code relies
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
637 on the frame in question being visible so we can't do this
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
638 earlier. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
639 init_frame_gutters (f);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
640
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
641 change_frame_size (f, f->height, f->width, 0);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
642 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
643
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
644 if (first_frame_on_device)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
645 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
646 if (first_frame_on_console)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
647 va_run_hook_with_args (Qcreate_console_hook, 1, DEVICE_CONSOLE (d));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
648 va_run_hook_with_args (Qcreate_device_hook, 1, device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
649 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
650 va_run_hook_with_args (Qcreate_frame_hook, 1, frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
651
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
652 /* Initialize custom-specific stuff. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
653 if (!UNBOUNDP (symbol_function (XSYMBOL (Qcustom_initialize_frame))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
654 call1 (Qcustom_initialize_frame, frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
655
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
656 UNGCPRO;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
657 unbind_to (speccount);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
658
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
659 return frame;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
660 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
661
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
662
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
663 /* this function should be used in most cases when a Lisp function is passed
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
664 a FRAME argument. Use this unless you don't accept nil == current frame
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
665 (in which case, do a CHECK_LIVE_FRAME() and then an XFRAME()) or you
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
666 allow dead frames. Note that very few functions should accept dead
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
667 frames. It could be argued that functions should just do nothing when
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
668 given a dead frame, but the presence of a dead frame usually indicates
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
669 an oversight in the Lisp code that could potentially lead to strange
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
670 results and so it is better to catch the error early.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
671
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
672 If you only accept X frames, use decode_x_frame(), which does what this
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
673 function does but also makes sure the frame is an X frame. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
674
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
675 struct frame *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
676 decode_frame (Lisp_Object frame)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
677 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
678 if (NILP (frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
679 return selected_frame ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
680
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
681 CHECK_LIVE_FRAME (frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
682 return XFRAME (frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
683 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
684
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
685 struct frame *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
686 decode_frame_or_selected (Lisp_Object cdf)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
687 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
688 if (CONSOLEP (cdf))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
689 cdf = CONSOLE_SELECTED_DEVICE (decode_console (cdf));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
690 if (DEVICEP (cdf))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
691 cdf = DEVICE_SELECTED_FRAME (decode_device (cdf));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
692 return decode_frame (cdf);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
693 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
694
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
695 Lisp_Object
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
696 frame_device (struct frame *f)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
697 {
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
698 return FRAME_DEVICE (f);
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
699 }
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
700
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
701 int
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
702 frame_live_p (struct frame *f)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
703 {
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
704 return FRAME_LIVE_P (f);
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
705 }
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
706
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
707
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
708 #ifdef ERROR_CHECK_TRAPPING_PROBLEMS
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
709
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
710 static Lisp_Object
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
711 commit_ritual_suicide (Lisp_Object ceci_nest_pas_une_pipe)
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
712 {
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
713 assert (!in_display);
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
714 return Qnil;
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
715 }
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
716
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
717 #endif
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
718
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
719 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
720 * window size changes are held up during critical regions. Afterwards,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
721 * we want to deal with any delayed changes.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
722 */
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
723 int
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
724 enter_redisplay_critical_section (void)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
725 {
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
726 int depth = specpdl_depth ();
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
727
1123
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 934
diff changeset
728 /* NOTE NOTE NOTE: Inside the redisplay critical section, every place
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 934
diff changeset
729 that could QUIT or call Lisp code needs to be wrapped, since GC
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 934
diff changeset
730 or a non-local exit will be fatal. The way to do this is with
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 934
diff changeset
731 call_trapping_problems(..., INHIBIT_GC), or the like. */
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 934
diff changeset
732
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
733 #ifdef ERROR_CHECK_TRAPPING_PROBLEMS
1123
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 934
diff changeset
734 /* Force every call to QUIT to check for in_displayness. This will
37bdd24225ef [xemacs-hg @ 2002-11-27 07:15:02 by ben]
ben
parents: 934
diff changeset
735 verify proper wrapping, as in the previous comment, aborting if not. */
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
736 something_happened++;
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
737 record_unwind_protect (commit_ritual_suicide, Qnil);
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
738 #endif
1161
8e95979f01c6 [xemacs-hg @ 2002-12-16 02:32:47 by ben]
ben
parents: 1125
diff changeset
739 begin_gc_forbidden ();
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
740 in_display = 1;
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
741
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
742 return depth;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
743 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
744
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
745 void
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
746 exit_redisplay_critical_section (int depth)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
747 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
748 Lisp_Object frmcons, devcons, concons;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
749
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
750 in_display = 0;
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
751
1161
8e95979f01c6 [xemacs-hg @ 2002-12-16 02:32:47 by ben]
ben
parents: 1125
diff changeset
752 unbind_to (depth);
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
753 #ifdef ERROR_CHECK_TRAPPING_PROBLEMS
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
754 something_happened--;
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
755 #endif
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
756
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
757 /* we used to have a function to do this for only one frame, and
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
758 it was typical to call it at the end of a critical section
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
759 (which occurs once per frame); but what then happens if multiple
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
760 frames have frame changes held up?
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
761
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
762 this means we are O(N^2) over frames. i seriously doubt it matters.
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
763 --ben */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
764 FRAME_LOOP_NO_BREAK (frmcons, devcons, concons)
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
765 {
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
766 struct frame *f = XFRAME (XCAR (frmcons));
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
767 if (f->size_change_pending)
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
768 change_frame_size (f, f->new_height, f->new_width, 0);
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
769 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
770 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
771
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
772 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
773 invalidate_vertical_divider_cache_in_frame (struct frame *f)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
774 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
775 /* Invalidate cached value of needs_vertical_divider_p in
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
776 every and all windows */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
777 map_windows (f, invalidate_vertical_divider_cache_in_window, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
778 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
779
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
780 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
781 * Frame size may change due to changes in scrollbars, toolbars,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
782 * default font etc. These changes are applied early in redisplay
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
783 * frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
784 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
785 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
786 adjust_frame_size (struct frame *f)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
787 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
788 int keep_char_size = 0;
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
789 Lisp_Object frame = wrap_frame (f);
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
790
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
791
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
792 if (!f->size_slipped)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
793 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
794
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
795 /* Don't adjust tty frames. #### May break when TTY have menubars.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
796 Then, write an Vadjust_frame_function which will return t for TTY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
797 frames. Another solution is frame_size_fixed_p method for TTYs,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
798 which always returned yes it's fixed.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
799 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
800 if (!FRAME_WIN_P (f))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
801 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
802 CLEAR_FRAME_SIZE_SLIPPED (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
803 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
804 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
805
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
806 /* frame_size_fixed_p tells that frame size cannot currently
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
807 be changed change due to external conditions */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
808 if (!FRAMEMETH_OR_GIVEN (f, frame_size_fixed_p, (f), 0))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
809 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
810 if (NILP (Vadjust_frame_function))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
811 keep_char_size = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
812 else if (EQ (Vadjust_frame_function, Qt))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
813 keep_char_size = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
814 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
815 keep_char_size =
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
816 NILP (call1_trapping_problems ("Error in adjust-frame-function",
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
817 Vadjust_frame_function, frame,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
818 0));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
819
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
820 if (keep_char_size)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
821 Fset_frame_size (frame, make_int (FRAME_CHARWIDTH(f)),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
822 make_int (FRAME_CHARHEIGHT(f)), Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
823 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
824
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
825 if (!keep_char_size)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
826 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
827 int height, width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
828 pixel_to_char_size (f, FRAME_PIXWIDTH(f), FRAME_PIXHEIGHT(f),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
829 &width, &height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
830 change_frame_size (f, height, width, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
831 CLEAR_FRAME_SIZE_SLIPPED (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
832 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
833 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
834
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
835 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
836 * This is a "specifier changed in frame" handler for various specifiers
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
837 * changing which causes frame size adjustment
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
838 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
839 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
840 frame_size_slipped (Lisp_Object specifier, struct frame *f,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
841 Lisp_Object oldval)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
842 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
843 MARK_FRAME_SIZE_SLIPPED(f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
844 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
845
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
846 DEFUN ("framep", Fframep, 1, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
847 Return non-nil if OBJECT is a frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
848 Also see `frame-live-p'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
849 Note that FSF Emacs kludgily returns a value indicating what type of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
850 frame this is. Use the cleaner function `frame-type' for that.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
851 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
852 (object))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
853 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
854 return FRAMEP (object) ? Qt : Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
855 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
856
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
857 DEFUN ("frame-live-p", Fframe_live_p, 1, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
858 Return non-nil if OBJECT is a frame which has not been deleted.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
859 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
860 (object))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
861 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
862 return FRAMEP (object) && FRAME_LIVE_P (XFRAME (object)) ? Qt : Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
863 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
864
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
865
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
866 DEFUN ("focus-frame", Ffocus_frame, 1, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
867 Select FRAME and give it the window system focus.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
868 This function is not affected by the value of `focus-follows-mouse'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
869 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
870 (frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
871 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
872 CHECK_LIVE_FRAME (frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
873
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
874 MAYBE_DEVMETH (XDEVICE (FRAME_DEVICE (XFRAME (frame))), focus_on_frame,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
875 (XFRAME (frame)));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
876 /* FRAME will be selected by the time we receive the next event.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
877 However, it is better to select it explicitly now, in case the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
878 Lisp code depends on frame being selected. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
879 Fselect_frame (frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
880 return Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
881 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
882
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
883 /* Called from Fselect_window() */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
884 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
885 select_frame_1 (Lisp_Object frame)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
886 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
887 struct frame *f = XFRAME (frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
888 Lisp_Object old_selected_frame = Fselected_frame (Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
889
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
890 if (EQ (frame, old_selected_frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
891 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
892
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
893 /* now select the frame's device */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
894 set_device_selected_frame (XDEVICE (FRAME_DEVICE (f)), frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
895 select_device_1 (FRAME_DEVICE (f));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
896
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
897 update_frame_window_mirror (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
898 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
899
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
900 DEFUN ("select-frame", Fselect_frame, 1, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
901 Select the frame FRAME.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
902 Subsequent editing commands apply to its selected window.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
903 The selection of FRAME lasts until the next time the user does
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
904 something to select a different frame, or until the next time this
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
905 function is called.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
906
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
907 Note that this does not actually cause the window-system focus to be
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
908 set to this frame, or the `select-frame-hook' or `deselect-frame-hook'
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
909 to be run, until the next time that XEmacs is waiting for an event.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
910
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
911 Also note that when focus-follows-mouse is non-nil, the frame
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
912 selection is temporary and is reverted when the current command
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
913 terminates, much like the buffer selected by `set-buffer'. In order
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
914 to effect a permanent focus change, use `focus-frame'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
915 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
916 (frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
917 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
918 CHECK_LIVE_FRAME (frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
919
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
920 /* select the frame's selected window. This will call
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
921 selected_frame_1(). */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
922 Fselect_window (FRAME_SELECTED_WINDOW (XFRAME (frame)), Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
923
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
924 /* Nothing should be depending on the return value of this function.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
925 But, of course, there is stuff out there which is. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
926 return frame;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
927 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
928
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
929 /* use this to retrieve the currently selected frame. You should use
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
930 this in preference to Fselected_frame (Qnil) unless you are prepared
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
931 to handle the possibility of there being no selected frame (this
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
932 happens at some points during startup). */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
933
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
934 struct frame *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
935 selected_frame (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
936 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
937 Lisp_Object device = Fselected_device (Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
938 Lisp_Object frame = DEVICE_SELECTED_FRAME (XDEVICE (device));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
939 if (NILP (frame))
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
940 gui_error ("No frames exist on device", device);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
941 return XFRAME (frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
942 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
943
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
944 /* use this instead of XFRAME (DEVICE_SELECTED_FRAME (d)) to catch
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
945 the possibility of there being no frames on the device (just created).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
946 There is no point doing this inside of redisplay because errors
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
947 cause an abort(), indicating a flaw in the logic, and error_check_frame()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
948 will catch this just as well. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
949
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
950 struct frame *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
951 device_selected_frame (struct device *d)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
952 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
953 Lisp_Object frame = DEVICE_SELECTED_FRAME (d);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
954 if (NILP (frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
955 {
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
956 Lisp_Object device = wrap_device (d);
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
957
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
958 gui_error ("No frames exist on device", device);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
959 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
960 return XFRAME (frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
961 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
962
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
963 #if 0 /* FSFmacs */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
964
826
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 800
diff changeset
965 DEFUN ("handle-switch-frame", Fhandle_switch_frame, 1, 2, "e", /*
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
966 Handle a switch-frame event EVENT.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
967 Switch-frame events are usually bound to this function.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
968 A switch-frame event tells Emacs that the window manager has requested
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
969 that the user's events be directed to the frame mentioned in the event.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
970 This function selects the selected window of the frame of EVENT.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
971
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
972 If EVENT is frame object, handle it as if it were a switch-frame event
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
973 to that frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
974 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
975 (frame, no_enter))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
976 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
977 /* Preserve prefix arg that the command loop just cleared. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
978 XCONSOLE (Vselected_console)->prefix_arg = Vcurrent_prefix_arg;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
979 #if 0 /* unclean! */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
980 run_hook (Qmouse_leave_buffer_hook);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
981 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
982 return do_switch_frame (frame, no_enter, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
983 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
984
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
985 /* A load of garbage. */
826
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 800
diff changeset
986 DEFUN ("ignore-event", Fignore_event, 0, 0, "", /*
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
987 Do nothing, but preserve any prefix argument already specified.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
988 This is a suitable binding for iconify-frame and make-frame-visible.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
989 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
990 ())
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
991 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
992 struct console *c = XCONSOLE (Vselected_console);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
993
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
994 c->prefix_arg = Vcurrent_prefix_arg;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
995 return Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
996 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
997
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
998 #endif /* 0 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
999
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1000 DEFUN ("selected-frame", Fselected_frame, 0, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1001 Return the frame that is now selected on device DEVICE.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1002 If DEVICE is not specified, the selected device will be used.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1003 If no frames exist on the device, nil is returned.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1004 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1005 (device))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1006 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1007 if (NILP (device) && NILP (Fselected_device (Qnil)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1008 return Qnil; /* happens early in temacs */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1009 return DEVICE_SELECTED_FRAME (decode_device (device));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1010 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1011
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1012 Lisp_Object
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1013 frame_first_window (struct frame *f)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1014 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1015 Lisp_Object w = f->root_window;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1016
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1017 while (1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1018 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1019 if (! NILP (XWINDOW (w)->hchild))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1020 w = XWINDOW (w)->hchild;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1021 else if (! NILP (XWINDOW (w)->vchild))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1022 w = XWINDOW (w)->vchild;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1023 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1024 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1025 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1026
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1027 return w;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1028 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1029
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1030 DEFUN ("active-minibuffer-window", Factive_minibuffer_window, 0, 0, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1031 Return the currently active minibuffer window, or nil if none.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1032 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1033 ())
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1034 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1035 return minibuf_level ? minibuf_window : Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1036 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1037
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1038 DEFUN ("last-nonminibuf-frame", Flast_nonminibuf_frame, 0, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1039 Return the most-recently-selected non-minibuffer-only frame on CONSOLE.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1040 This will always be the same as (selected-frame device) unless the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1041 selected frame is a minibuffer-only frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1042 CONSOLE defaults to the selected console if omitted.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1043 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1044 (console))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1045 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1046 Lisp_Object result;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1047
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
1048 console = wrap_console (decode_console (console));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1049 /* Just in case the machinations in delete_frame_internal() resulted
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1050 in the last-nonminibuf-frame getting out of sync, make sure and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1051 return the selected frame if it's acceptable. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1052 result = Fselected_frame (CONSOLE_SELECTED_DEVICE (XCONSOLE (console)));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1053 if (!NILP (result) && !FRAME_MINIBUF_ONLY_P (XFRAME (result)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1054 return result;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1055 return CONSOLE_LAST_NONMINIBUF_FRAME (XCONSOLE (console));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1056 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1057
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1058 DEFUN ("frame-root-window", Fframe_root_window, 0, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1059 Return the root-window of FRAME.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1060 If omitted, FRAME defaults to the currently selected frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1061 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1062 (frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1063 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1064 struct frame *f = decode_frame (frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1065 return FRAME_ROOT_WINDOW (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1066 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1067
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1068 DEFUN ("frame-selected-window", Fframe_selected_window, 0, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1069 Return the selected window of frame object FRAME.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1070 If omitted, FRAME defaults to the currently selected frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1071 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1072 (frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1073 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1074 struct frame *f = decode_frame (frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1075 return FRAME_SELECTED_WINDOW (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1076 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1077
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1078 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1079 set_frame_selected_window (struct frame *f, Lisp_Object window)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1080 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1081 assert (XFRAME (WINDOW_FRAME (XWINDOW (window))) == f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1082 f->selected_window = window;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1083 if (!MINI_WINDOW_P (XWINDOW (window)) || FRAME_MINIBUF_ONLY_P (f))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1084 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1085 if (!EQ (f->last_nonminibuf_window, window))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1086 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1087 #ifdef HAVE_TOOLBARS
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1088 MARK_TOOLBAR_CHANGED;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1089 #endif
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1090 MARK_GUTTER_CHANGED;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1091 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1092 f->last_nonminibuf_window = window;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1093 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1094 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1095
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1096 DEFUN ("set-frame-selected-window", Fset_frame_selected_window, 2, 2, 0, /*
460
223736d75acb Import from CVS: tag r21-2-45
cvs
parents: 450
diff changeset
1097 Set the selected window of FRAME to WINDOW.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1098 If FRAME is nil, the selected frame is used.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1099 If FRAME is the selected frame, this makes WINDOW the selected window.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1100 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1101 (frame, window))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1102 {
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
1103 frame = wrap_frame (decode_frame (frame));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1104 CHECK_LIVE_WINDOW (window);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1105
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1106 if (! EQ (frame, WINDOW_FRAME (XWINDOW (window))))
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
1107 invalid_argument ("In `set-frame-selected-window', WINDOW is not on FRAME", Qunbound);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1108
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1109 if (XFRAME (frame) == selected_frame ())
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1110 return Fselect_window (window, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1111
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1112 set_frame_selected_window (XFRAME (frame), window);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1113 return window;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1114 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1115
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1116
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1117 DEFUN ("frame-device", Fframe_device, 0, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1118 Return the device that FRAME is on.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1119 If omitted, FRAME defaults to the currently selected frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1120 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1121 (frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1122 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1123 return FRAME_DEVICE (decode_frame (frame));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1124 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1125
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1126 int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1127 is_surrogate_for_selected_frame (struct frame *f)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1128 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1129 struct device *d = XDEVICE (f->device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1130 struct frame *dsf = device_selected_frame (d);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1131
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1132 /* Can't be a surrogate for ourselves. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1133 if (f == dsf)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1134 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1135
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1136 if (!FRAME_HAS_MINIBUF_P (dsf) &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1137 f == XFRAME (WINDOW_FRAME (XWINDOW (FRAME_MINIBUF_WINDOW (dsf)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1138 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1139 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1140 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1141 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1142
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1143 static int
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1144 frame_matches_frame_spec (Lisp_Object frame, Lisp_Object type)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1145 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1146 struct frame *f = XFRAME (frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1147
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1148 if (WINDOWP (type))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1149 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1150 CHECK_LIVE_WINDOW (type);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1151
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1152 if (EQ (FRAME_MINIBUF_WINDOW (f), type)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1153 /* Check that F either is, or has forwarded
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1154 its focus to, TYPE's frame. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1155 && (EQ (WINDOW_FRAME (XWINDOW (type)), frame)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1156 || EQ (WINDOW_FRAME (XWINDOW (type)),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1157 FRAME_FOCUS_FRAME (f))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1158 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1159 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1160 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1161 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1162
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1163 #if 0 /* FSFmacs */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1164 if (EQ (type, Qvisible) || EQ (type, Qiconic) || EQ (type, Qvisible_iconic)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1165 || EQ (type, Qvisible_nomini) || EQ (type, Qiconic_nomini)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1166 || EQ (type, Qvisible_iconic_nomini))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1167 FRAME_SAMPLE_VISIBILITY (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1168 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1169
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1170 if (NILP (type))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1171 type = Qnomini;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1172 if (ZEROP (type))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1173 type = Qvisible_iconic;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1174
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1175 if (EQ (type, Qvisible))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1176 return FRAME_VISIBLE_P (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1177 if (EQ (type, Qiconic))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1178 return FRAME_ICONIFIED_P (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1179 if (EQ (type, Qinvisible))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1180 return !FRAME_VISIBLE_P (f) && !FRAME_ICONIFIED_P (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1181 if (EQ (type, Qvisible_iconic))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1182 return FRAME_VISIBLE_P (f) || FRAME_ICONIFIED_P (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1183 if (EQ (type, Qinvisible_iconic))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1184 return !FRAME_VISIBLE_P (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1185
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1186 if (EQ (type, Qnomini))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1187 return !FRAME_MINIBUF_ONLY_P (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1188 if (EQ (type, Qvisible_nomini))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1189 return FRAME_VISIBLE_P (f) && !FRAME_MINIBUF_ONLY_P (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1190 if (EQ (type, Qiconic_nomini))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1191 return FRAME_ICONIFIED_P (f) && !FRAME_MINIBUF_ONLY_P (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1192 if (EQ (type, Qinvisible_nomini))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1193 return !FRAME_VISIBLE_P (f) && !FRAME_ICONIFIED_P (f) &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1194 !FRAME_MINIBUF_ONLY_P (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1195 if (EQ (type, Qvisible_iconic_nomini))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1196 return ((FRAME_VISIBLE_P (f) || FRAME_ICONIFIED_P (f))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1197 && !FRAME_MINIBUF_ONLY_P (f));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1198 if (EQ (type, Qinvisible_iconic_nomini))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1199 return !FRAME_VISIBLE_P (f) && !FRAME_MINIBUF_ONLY_P (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1200
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1201 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1202 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1203
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1204 int
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1205 device_matches_device_spec (Lisp_Object device, Lisp_Object device_spec)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1206 {
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1207 if (EQ (device_spec, Qwindow_system))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1208 return DEVICE_WIN_P (XDEVICE (device));
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1209 if (DEVICEP (device_spec))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1210 return EQ (device, device_spec);
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1211 if (CONSOLEP (device_spec))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1212 return EQ (DEVICE_CONSOLE (XDEVICE (device)), device_spec);
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1213 if (valid_console_type_p (device_spec))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1214 return EQ (DEVICE_TYPE (XDEVICE (device)), device_spec);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1215 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1216 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1217
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1218 /* Return the next frame in the frame list after FRAME.
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1219 WHICH-FRAMES and WHICH-DEVICES control which frames and devices
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1220 are considered; see `next-frame'. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1221
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1222 Lisp_Object
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1223 next_frame (Lisp_Object frame, Lisp_Object which_frames, Lisp_Object which_devices)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1224 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1225 Lisp_Object first = Qnil;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1226 Lisp_Object devcons, concons;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1227 int passed = 0;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1228
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1229 CHECK_LIVE_FRAME (frame);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1230
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1231 DEVICE_LOOP_NO_BREAK (devcons, concons)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1232 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1233 Lisp_Object device = XCAR (devcons);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1234 Lisp_Object frmcons;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1235
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1236 if (!device_matches_device_spec (device, which_devices))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1237 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1238 if (EQ (device, FRAME_DEVICE (XFRAME (frame))))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1239 passed = 1;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1240 continue;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1241 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1242
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1243 DEVICE_FRAME_LOOP (frmcons, XDEVICE (device))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1244 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1245 Lisp_Object f = XCAR (frmcons);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1246
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1247 if (passed)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1248 {
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1249 if (frame_matches_frame_spec (f, which_frames))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1250 return f;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1251 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1252 else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1253 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1254 if (EQ (frame, f))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1255 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1256 passed = 1;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1257 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1258 else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1259 {
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1260 if (NILP (first) && frame_matches_frame_spec (f, which_frames))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1261 first = f;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1262 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1263 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1264 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1265 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1266
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1267 if (NILP (first))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1268 /* We went through the whole frame list without finding a single
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1269 acceptable frame. Return the original frame. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1270 return frame;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1271 else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1272 /* There were no acceptable frames in the list after FRAME; otherwise,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1273 we would have returned directly from the loop. Since FIRST is the last
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1274 acceptable frame in the list, return it. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1275 return first;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1276 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1277
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1278 /* Return the previous frame in the frame list before FRAME.
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1279 WHICH-FRAMES and WHICH-DEVICES control which frames and devices
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1280 are considered; see `next-frame'. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1281
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1282 Lisp_Object
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1283 previous_frame (Lisp_Object frame, Lisp_Object which_frames, Lisp_Object which_devices)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1284 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1285 Lisp_Object devcons, concons;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1286 Lisp_Object last = Qnil;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1287
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1288 CHECK_LIVE_FRAME (frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1289
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1290 DEVICE_LOOP_NO_BREAK (devcons, concons)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1291 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1292 Lisp_Object device = XCAR (devcons);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1293 Lisp_Object frmcons;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1294
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1295 if (!device_matches_device_spec (device, which_devices))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1296 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1297 if (EQ (device, FRAME_DEVICE (XFRAME (frame)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1298 && !NILP (last))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1299 return last;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1300 continue;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1301 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1302
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1303 DEVICE_FRAME_LOOP (frmcons, XDEVICE (device))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1304 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1305 Lisp_Object f = XCAR (frmcons);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1306
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1307 if (EQ (frame, f))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1308 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1309 if (!NILP (last))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1310 return last;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1311 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1312 else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1313 {
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1314 if (frame_matches_frame_spec (f, which_frames))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1315 last = f;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1316 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1317 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1318 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1319
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1320 if (NILP (last))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1321 /* We went through the whole frame list without finding a single
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1322 acceptable frame. Return the original frame. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1323 return frame;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1324 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1325 /* There were no acceptable frames in the list before FRAME; otherwise,
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1326 we would have returned directly from the loop. Since LAST is the last
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1327 acceptable frame in the list, return it. */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1328 return last;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1329 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1330
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1331 DEFUN ("next-frame", Fnext_frame, 0, 3, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1332 Return the next frame of the right type in the frame list after FRAME.
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1333 WHICH-FRAMES controls which frames are eligible to be returned; all
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1334 others will be skipped. Note that if there is only one eligible
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1335 frame, then `next-frame' called repeatedly will always return
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1336 the same frame, and if there is no eligible frame, then FRAME is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1337 returned.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1338
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1339 Possible values for WHICH-FRAMES are
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1340
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1341 'visible Consider only frames that are visible.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1342 'iconic Consider only frames that are iconic.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1343 'invisible Consider only frames that are invisible
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1344 (this is different from iconic).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1345 'visible-iconic Consider frames that are visible or iconic.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1346 'invisible-iconic Consider frames that are invisible or iconic.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1347 'nomini Consider all frames except minibuffer-only ones.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1348 'visible-nomini Like `visible' but omits minibuffer-only frames.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1349 'iconic-nomini Like `iconic' but omits minibuffer-only frames.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1350 'invisible-nomini Like `invisible' but omits minibuffer-only frames.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1351 'visible-iconic-nomini Like `visible-iconic' but omits minibuffer-only
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1352 frames.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1353 'invisible-iconic-nomini Like `invisible-iconic' but omits minibuffer-only
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1354 frames.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1355 any other value Consider all frames.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1356
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1357 If WHICH-FRAMES is omitted, 'nomini is used. A value for WHICH-FRAMES
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1358 of 0 (a number) is treated like 'iconic, for backwards compatibility.
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1359
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1360 If WHICH-FRAMES is a window, include only its own frame and any frame
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1361 now using that window as the minibuffer.
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1362
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1363 The optional third argument WHICH-DEVICES further clarifies on which
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1364 devices to search for frames as specified by WHICH-FRAMES.
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1365 If nil or omitted, search all devices on FRAME's console.
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1366 If a device, only search that device.
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1367 If a console, search all devices on that console.
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1368 If a device type, search all devices of that type.
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1369 If `window-system', search all window-system devices.
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1370 Any other non-nil value means search all devices.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1371 */
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1372 (frame, which_frames, which_devices))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1373 {
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
1374 frame = wrap_frame (decode_frame (frame));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1375
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1376 return next_frame (frame, which_frames, which_devices);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1377 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1378
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1379 DEFUN ("previous-frame", Fprevious_frame, 0, 3, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1380 Return the next frame of the right type in the frame list after FRAME.
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1381 WHICH-FRAMES controls which frames are eligible to be returned; all
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1382 others will be skipped. Note that if there is only one eligible
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1383 frame, then `previous-frame' called repeatedly will always return
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1384 the same frame, and if there is no eligible frame, then FRAME is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1385 returned.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1386
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1387 See `next-frame' for an explanation of the WHICH-FRAMES and WHICH-DEVICES
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1388 arguments.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1389 */
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1390 (frame, which_frames, which_devices))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1391 {
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
1392 frame = wrap_frame (decode_frame (frame));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1393
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1394 return previous_frame (frame, which_frames, which_devices);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1395 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1396
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1397 /* Return any frame for which PREDICATE is non-zero, or return Qnil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1398 if there aren't any. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1399
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1400 Lisp_Object
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1401 find_some_frame (int (*predicate) (Lisp_Object, void *),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1402 void *closure)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1403 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1404 Lisp_Object framecons, devcons, concons;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1405
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1406 FRAME_LOOP_NO_BREAK (framecons, devcons, concons)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1407 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1408 Lisp_Object frame = XCAR (framecons);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1409
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1410 if ((predicate) (frame, closure))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1411 return frame;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1412 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1413
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1414 return Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1415 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1416
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1417
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1418
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1419 /* extern void free_line_insertion_deletion_costs (struct frame *f); */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1420
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1421 /* Return 1 if it is ok to delete frame F;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1422 0 if all frames aside from F are invisible.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1423 (Exception: if F is a stream frame, it's OK to delete if
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1424 any other frames exist.) */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1425
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1426 int
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1427 other_visible_frames (struct frame *f)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1428 {
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
1429 Lisp_Object frame = wrap_frame (f);
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
1430
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1431 if (FRAME_STREAM_P (f))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1432 return !EQ (frame, next_frame (frame, Qt, Qt));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1433 return !EQ (frame, next_frame (frame, Qvisible_iconic_nomini, Qt));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1434 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1435
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1436 /* Delete frame F.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1437
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1438 If FORCE is non-zero, allow deletion of the only frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1439
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1440 If CALLED_FROM_DELETE_DEVICE is non-zero, then, if
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1441 deleting the last frame on a device, just delete it,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1442 instead of calling `delete-device'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1443
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1444 If FROM_IO_ERROR is non-zero, then the frame is gone due
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1445 to an I/O error. This affects what happens if we exit
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1446 (we do an emergency exit instead of `save-buffers-kill-emacs'.)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1447 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1448
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1449 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1450 delete_frame_internal (struct frame *f, int force,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1451 int called_from_delete_device,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1452 int from_io_error)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1453 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1454 /* This function can GC */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1455 int minibuffer_selected;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1456 struct device *d;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1457 struct console *con;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1458 Lisp_Object frame;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1459 Lisp_Object device;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1460 Lisp_Object console;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1461 struct gcpro gcpro1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1462
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1463 /* OK to delete an already deleted frame. */
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1464 if (!FRAME_LIVE_P (f))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1465 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1466
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
1467 frame = wrap_frame (f);
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1468
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1469 if (!force)
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1470 check_allowed_operation (OPERATION_DELETE_OBJECT, frame, Qnil);
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1471
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1472 GCPRO1 (frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1473
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1474 device = FRAME_DEVICE (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1475 d = XDEVICE (device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1476 console = DEVICE_CONSOLE (d);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1477 con = XCONSOLE (console);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1478
545
9a775fb11bb7 [xemacs-hg @ 2001-05-18 04:39:39 by kkm]
kkm
parents: 460
diff changeset
1479 if (!called_from_delete_device
9a775fb11bb7 [xemacs-hg @ 2001-05-18 04:39:39 by kkm]
kkm
parents: 460
diff changeset
1480 && !DEVICE_IMPL_FLAG (d, XDEVIMPF_FRAMELESS_OK))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1481 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1482 /* If we're deleting the only non-minibuffer frame on the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1483 device, delete the device. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1484 if (EQ (frame, next_frame (frame, Qnomini, FRAME_DEVICE (f))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1485 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1486 delete_device_internal (d, force, 0, from_io_error);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1487 UNGCPRO;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1488 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1489 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1490 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1491
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1492 /* In FSF, delete-frame will not normally allow you to delete the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1493 last visible frame. This was too annoying, so we changed it to the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1494 only frame. However, this would let people shoot themselves by
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1495 deleting all frames which were either visible or iconified and thus
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1496 losing any way of communicating with the still running XEmacs process.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1497 So we put it back. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1498 if (!force && !allow_deletion_of_last_visible_frame &&
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1499 !other_visible_frames (f))
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
1500 invalid_operation ("Attempt to delete the sole visible or iconified frame", Qunbound);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1501
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1502 /* Does this frame have a minibuffer, and is it the surrogate
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1503 minibuffer for any other frame? */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1504 if (FRAME_HAS_MINIBUF_P (f))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1505 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1506 Lisp_Object frmcons, devcons, concons;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1507
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1508 FRAME_LOOP_NO_BREAK (frmcons, devcons, concons)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1509 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1510 Lisp_Object this = XCAR (frmcons);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1511
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1512 if (! EQ (this, frame)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1513 && EQ (frame, (WINDOW_FRAME
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1514 (XWINDOW
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1515 (FRAME_MINIBUF_WINDOW (XFRAME (this)))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1516 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1517 /* We've found another frame whose minibuffer is on
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1518 this frame. */
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
1519 gui_error
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1520 ("Attempt to delete a surrogate minibuffer frame", frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1521 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1522 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1523 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1524
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1525 /* Test for popup frames hanging around. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1526 /* Deletion of a parent frame with popups is deadly. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1527 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1528 Lisp_Object frmcons, devcons, concons;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1529
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1530 FRAME_LOOP_NO_BREAK (frmcons, devcons, concons)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1531 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1532 Lisp_Object this = XCAR (frmcons);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1533
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1534
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1535 if (! EQ (this, frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1536 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1537 struct device *devcons_d = XDEVICE (XCAR (devcons));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1538 if (EQ (frame, DEVMETH_OR_GIVEN (devcons_d, get_frame_parent,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1539 (XFRAME (this)),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1540 Qnil)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1541 /* We've found a popup frame whose parent is this frame. */
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
1542 gui_error
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1543 ("Attempt to delete a frame with live popups", frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1544 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1545 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1546 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1547
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1548 /* Before here, we haven't made any dangerous changes (just checked for
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1549 error conditions). Now run the delete-frame-hook. Remember that
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1550 user code there could do any number of dangerous things, including
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1551 signalling an error. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1552
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1553 va_run_hook_with_args (Qdelete_frame_hook, 1, frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1554
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1555 if (!FRAME_LIVE_P (f)) /* Make sure the delete-frame-hook didn't */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1556 { /* go ahead and delete anything. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1557 UNGCPRO;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1558 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1559 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1560
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1561 /* Call the delete-device-hook and delete-console-hook now if
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1562 appropriate, before we do any dangerous things -- they too could
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1563 signal an error. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1564 if (XINT (Flength (DEVICE_FRAME_LIST (d))) == 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1565 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1566 va_run_hook_with_args (Qdelete_device_hook, 1, device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1567 if (!FRAME_LIVE_P (f)) /* Make sure the delete-device-hook didn't */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1568 { /* go ahead and delete anything. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1569 UNGCPRO;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1570 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1571 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1572
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1573 if (XINT (Flength (CONSOLE_DEVICE_LIST (con))) == 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1574 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1575 va_run_hook_with_args (Qdelete_console_hook, 1, console);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1576 if (!FRAME_LIVE_P (f)) /* Make sure the delete-console-hook didn't */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1577 { /* go ahead and delete anything. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1578 UNGCPRO;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1579 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1580 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1581 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1582 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1583
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1584 minibuffer_selected = EQ (minibuf_window, Fselected_window (Qnil));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1585
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1586 /* If we were focused on this frame, then we're not any more.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1587 Assume that we lost the focus; that way, the call to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1588 Fselect_frame() below won't end up making us explicitly
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1589 focus on another frame, which is generally undesirable in
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1590 a point-to-type world. If our mouse ends up sitting over
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1591 another frame, we will receive a FocusIn event and end up
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1592 making that frame the selected frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1593
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1594 #### This may not be an ideal solution in a click-to-type
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1595 world (in that case, we might want to explicitly choose
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1596 another frame to have the focus, rather than relying on
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1597 the WM, which might focus on a frame in a different app
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1598 or focus on nothing at all). But there's no easy way
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1599 to detect which focus model we're running on, and the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1600 alternative is more heinous. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1601
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1602 if (EQ (frame, DEVICE_FRAME_WITH_FOCUS_REAL (d)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1603 DEVICE_FRAME_WITH_FOCUS_REAL (d) = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1604 if (EQ (frame, DEVICE_FRAME_WITH_FOCUS_FOR_HOOKS (d)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1605 DEVICE_FRAME_WITH_FOCUS_FOR_HOOKS (d) = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1606 if (EQ (frame, DEVICE_FRAME_THAT_OUGHT_TO_HAVE_FOCUS (d)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1607 DEVICE_FRAME_THAT_OUGHT_TO_HAVE_FOCUS (d) = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1608
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1609 /* Don't allow the deleted frame to remain selected.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1610 Note that in the former scheme of things, this would
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1611 have caused us to regain the focus. This no longer
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1612 applies (see above); I think the new behavior is more
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1613 logical. If someone disagrees, it can always be
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1614 changed (or a new user variable can be introduced, ugh.) */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1615 if (EQ (frame, DEVICE_SELECTED_FRAME (d)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1616 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1617 Lisp_Object next;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1618
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1619 /* If this is a popup frame, select its parent if possible.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1620 Otherwise, find another visible frame; if none, just take any frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1621 First try the same device, then the same console. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1622
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1623 next = DEVMETH_OR_GIVEN (d, get_frame_parent, (f), Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1624 if (NILP (next) || EQ (next, frame) || ! FRAME_LIVE_P (XFRAME (next)))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1625 next = next_frame (frame, Qvisible, device);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1626 if (NILP (next) || EQ (next, frame))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1627 next = next_frame (frame, Qvisible, console);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1628 if (NILP (next) || EQ (next, frame))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1629 next = next_frame (frame, Qvisible, Qt);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1630 if (NILP (next) || EQ (next, frame))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1631 next = next_frame (frame, Qt, device);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1632 if (NILP (next) || EQ (next, frame))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1633 next = next_frame (frame, Qt, console);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1634 if (NILP (next) || EQ (next, frame))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1635 next = next_frame (frame, Qt, Qt);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1636
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1637 /* if we haven't found another frame at this point
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1638 then there aren't any. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1639 if (NILP (next) || EQ (next, frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1640 ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1641 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1642 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1643 int did_select = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1644 /* if this is the global selected frame, select another one. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1645 if (EQ (frame, Fselected_frame (Qnil)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1646 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1647 Fselect_frame (next);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1648 did_select = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1649 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1650 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1651 * If the new frame we just selected is on a different
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1652 * device then we still need to change DEVICE_SELECTED_FRAME(d)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1653 * to a live frame, if there are any left on this device.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1654 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1655 if (!EQ (device, FRAME_DEVICE(XFRAME(next))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1656 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1657 Lisp_Object next_f = next_frame (frame, Qt, device);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1658 if (NILP (next_f) || EQ (next_f, frame))
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1659 set_device_selected_frame (d, Qnil);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1660 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1661 set_device_selected_frame (d, next_f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1662 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1663 else if (! did_select)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1664 set_device_selected_frame (d, next);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1665
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1666 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1667 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1668
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1669 /* Don't allow minibuf_window to remain on a deleted frame. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1670 if (EQ (f->minibuffer_window, minibuf_window))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1671 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1672 struct frame *sel_frame = selected_frame ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1673 Fset_window_buffer (sel_frame->minibuffer_window,
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1674 XWINDOW (minibuf_window)->buffer, Qt);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1675 minibuf_window = sel_frame->minibuffer_window;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1676
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1677 /* If the dying minibuffer window was selected,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1678 select the new one. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1679 if (minibuffer_selected)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1680 Fselect_window (minibuf_window, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1681 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1682
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1683 /* After this point, no errors must be allowed to occur. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1684
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1685 #ifdef HAVE_MENUBARS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1686 free_frame_menubars (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1687 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1688 #ifdef HAVE_SCROLLBARS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1689 free_frame_scrollbars (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1690 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1691 #ifdef HAVE_TOOLBARS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1692 free_frame_toolbars (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1693 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1694 free_frame_gutters (f);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1695 /* Unfortunately deleting the frame will also delete the parent of
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1696 all of the subwindow instances current on the frame. I think this
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1697 can lead to bad things when trying to finalize the
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1698 instances. Thus we loop over all instance caches calling the
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1699 finalize method for each instance. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1700 free_frame_subwindow_instances (f);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1701
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1702 /* This must be done before the window and window_mirror structures
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1703 are freed. The scrollbar information is attached to them. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1704 MAYBE_FRAMEMETH (f, delete_frame, (f));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1705
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1706 /* Mark all the windows that used to be on FRAME as deleted, and then
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1707 remove the reference to them. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1708 delete_all_subwindows (XWINDOW (f->root_window));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1709 f->root_window = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1710
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1711 /* clear out the cached glyph information */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1712 f->subwindow_instance_cache = Qnil;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1713
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1714 /* Remove the frame now from the list. This way, any events generated
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1715 on this frame by the maneuvers below will disperse themselves. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1716
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1717 /* This used to be Fdelq(), but that will cause a seg fault if the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1718 QUIT checker happens to get invoked, because the frame list is in
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1719 an inconsistent state. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1720 d->frame_list = delq_no_quit (frame, d->frame_list);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1721 RESET_CHANGED_SET_FLAGS;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1722
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1723 f->visible = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1724
617
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 563
diff changeset
1725 free_window_mirror (XWINDOW_MIRROR (f->root_mirror));
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1726
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1727 /* free_line_insertion_deletion_costs (f); */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1728
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1729 /* If we've deleted the last non-minibuf frame, then try to find
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1730 another one. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1731 if (EQ (frame, CONSOLE_LAST_NONMINIBUF_FRAME (con)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1732 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1733 Lisp_Object frmcons, devcons;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1734
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1735 set_console_last_nonminibuf_frame (con, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1736
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1737 CONSOLE_FRAME_LOOP_NO_BREAK (frmcons, devcons, con)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1738 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1739 Lisp_Object ecran = XCAR (frmcons);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1740 if (!FRAME_MINIBUF_ONLY_P (XFRAME (ecran)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1741 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1742 set_console_last_nonminibuf_frame (con, ecran);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1743 goto double_break_1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1744 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1745 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1746 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1747 double_break_1:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1748
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1749 #if 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1750 /* The following test is degenerate FALSE */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1751 if (called_from_delete_device < 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1752 /* then we're being called from delete-console, and we shouldn't
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1753 try to find another default-minibuffer frame for the console.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1754 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1755 con->default_minibuffer_frame = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1756 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1757
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1758 /* If we've deleted this console's default_minibuffer_frame, try to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1759 find another one. Prefer minibuffer-only frames, but also notice
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1760 frames with other windows. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1761 if (EQ (frame, con->default_minibuffer_frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1762 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1763 Lisp_Object frmcons, devcons;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1764 /* The last frame we saw with a minibuffer, minibuffer-only or not. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1765 Lisp_Object frame_with_minibuf;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1766 /* Some frame we found on the same console, or nil if there are none. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1767 Lisp_Object frame_on_same_console;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1768
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1769 frame_on_same_console = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1770 frame_with_minibuf = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1771
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1772 set_console_last_nonminibuf_frame (con, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1773
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1774 CONSOLE_FRAME_LOOP_NO_BREAK (frmcons, devcons, con)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1775 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1776 Lisp_Object this;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1777 struct frame *f1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1778
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1779 this = XCAR (frmcons);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1780 f1 = XFRAME (this);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1781
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1782 /* Consider only frames on the same console
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1783 and only those with minibuffers. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1784 if (FRAME_HAS_MINIBUF_P (f1))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1785 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1786 frame_with_minibuf = this;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1787 if (FRAME_MINIBUF_ONLY_P (f1))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1788 goto double_break_2;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1789 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1790
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1791 frame_on_same_console = this;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1792 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1793 double_break_2:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1794
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1795 if (!NILP (frame_on_same_console))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1796 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1797 /* We know that there must be some frame with a minibuffer out
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1798 there. If this were not true, all of the frames present
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1799 would have to be minibuffer-less, which implies that at some
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1800 point their minibuffer frames must have been deleted, but
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1801 that is prohibited at the top; you can't delete surrogate
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1802 minibuffer frames. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1803 if (NILP (frame_with_minibuf))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1804 abort ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1805
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1806 con->default_minibuffer_frame = frame_with_minibuf;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1807 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1808 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1809 /* No frames left on this console--say no minibuffer either. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1810 con->default_minibuffer_frame = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1811 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1812
617
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 563
diff changeset
1813 /* Nobody should be accessing anything in this object any more, and
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 563
diff changeset
1814 making all Lisp_Objects Qnil allows for better GC'ing in case a
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 563
diff changeset
1815 pointer to the dead frame continues to hang around. Zero all
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 563
diff changeset
1816 other structs in case someone tries to access something through
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 563
diff changeset
1817 them. */
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 563
diff changeset
1818
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 563
diff changeset
1819 nuke_all_frame_slots (f);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1820 f->framemeths = dead_console_methods;
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
1821 f->frametype = dead_console;
617
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 563
diff changeset
1822
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1823 note_object_deleted (frame);
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1824
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1825 UNGCPRO;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1826 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1827
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1828 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1829 io_error_delete_frame (Lisp_Object frame)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1830 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1831 delete_frame_internal (XFRAME (frame), 1, 0, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1832 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1833
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1834 DEFUN ("delete-frame", Fdelete_frame, 0, 2, "", /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1835 Delete FRAME, permanently eliminating it from use.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1836 If omitted, FRAME defaults to the selected frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1837 A frame may not be deleted if its minibuffer is used by other frames.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1838 Normally, you cannot delete the last non-minibuffer-only frame (you must
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1839 use `save-buffers-kill-emacs' or `kill-emacs'). However, if optional
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1840 second argument FORCE is non-nil, you can delete the last frame. (This
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1841 will automatically call `save-buffers-kill-emacs'.)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1842 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1843 (frame, force))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1844 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1845 /* This function can GC */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1846 struct frame *f;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1847
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1848 if (NILP (frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1849 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1850 f = selected_frame ();
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
1851 frame = wrap_frame (f);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1852 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1853 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1854 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1855 CHECK_FRAME (frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1856 f = XFRAME (frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1857 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1858
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1859 delete_frame_internal (f, !NILP (force), 0, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1860 return Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1861 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1862
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1863
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1864 /* Return mouse position in character cell units. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1865
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1866 static int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1867 mouse_pixel_position_1 (struct device *d, Lisp_Object *frame,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1868 int *x, int *y)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1869 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1870 switch (DEVMETH_OR_GIVEN (d, get_mouse_position, (d, frame, x, y), -1))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1871 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1872 case 1:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1873 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1874
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1875 case 0:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1876 *frame = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1877 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1878
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1879 case -1:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1880 *frame = DEVICE_SELECTED_FRAME (d);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1881 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1882
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1883 default:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1884 abort (); /* method is incorrectly written */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1885 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1886
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1887 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1888 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1889
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1890 DEFUN ("mouse-pixel-position", Fmouse_pixel_position, 0, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1891 Return a list (WINDOW X . Y) giving the current mouse window and position.
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1892 The position is given in pixel units, where (0, 0) is the upper-left corner
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1893 of the window.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1894
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1895 When the cursor is not over a window, the return value is a list (nil nil).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1896
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1897 DEVICE specifies the device on which to read the mouse position, and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1898 defaults to the selected device. If the device is a mouseless terminal
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1899 or XEmacs hasn't been programmed to read its mouse position, it returns
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1900 the device's selected window for WINDOW and nil for X and Y.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1901 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1902 (device))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1903 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1904 struct device *d = decode_device (device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1905 Lisp_Object frame;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1906 Lisp_Object window = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1907 Lisp_Object x = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1908 Lisp_Object y = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1909 int intx, inty;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1910
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1911 if (mouse_pixel_position_1 (d, &frame, &intx, &inty) > 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1912 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1913 struct window *w =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1914 find_window_by_pixel_pos (intx, inty, XFRAME (frame)->root_window);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1915 if (w)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1916 {
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
1917 window = wrap_window (w);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1918
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1919 /* Adjust the position to be relative to the window. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1920 intx -= w->pixel_left;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1921 inty -= w->pixel_top;
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
1922 x = make_int (intx);
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
1923 y = make_int (inty);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1924 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1925 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1926 else if (FRAMEP (frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1927 window = FRAME_SELECTED_WINDOW (XFRAME (frame));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1928
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1929 return Fcons (window, Fcons (x, y));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1930 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1931
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1932 DEFUN ("mouse-position", Fmouse_position, 0, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1933 Return a list (WINDOW X . Y) giving the current mouse window and position.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1934 The position is of a character under cursor, where (0, 0) is the upper-left
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1935 corner of the window.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1936
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1937 When the cursor is not over a character, or not over a window, the return
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1938 value is a list (nil nil).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1939
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1940 DEVICE specifies the device on which to read the mouse position, and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1941 defaults to the selected device. If the device is a mouseless terminal
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1942 or Emacs hasn't been programmed to read its mouse position, it returns
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1943 the device's selected window for WINDOW and nil for X and Y.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1944 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1945 (device))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1946 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1947 struct device *d = decode_device (device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1948 struct window *w;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1949 Lisp_Object frame, window = Qnil, lisp_x = Qnil, lisp_y = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1950 int x, y, obj_x, obj_y;
665
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 617
diff changeset
1951 Charbpos charbpos, closest;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1952 Charcount modeline_closest;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1953 Lisp_Object obj1, obj2;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1954
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1955 if (mouse_pixel_position_1 (d, &frame, &x, &y) > 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1956 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1957 int res = pixel_to_glyph_translation (XFRAME (frame), x, y, &x, &y,
665
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 617
diff changeset
1958 &obj_x, &obj_y, &w, &charbpos,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1959 &closest, &modeline_closest,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1960 &obj1, &obj2);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1961 if (res == OVER_TEXT)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1962 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1963 lisp_x = make_int (x);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1964 lisp_y = make_int (y);
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
1965 window = wrap_window (w);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1966 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1967 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1968 else if (FRAMEP (frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1969 window = FRAME_SELECTED_WINDOW (XFRAME (frame));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1970
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1971 return Fcons (window, Fcons (lisp_x, lisp_y));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1972 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1973
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1974 DEFUN ("mouse-position-as-motion-event", Fmouse_position_as_motion_event, 0, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1975 Return the current mouse position as a motion event.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1976 This allows you to call the standard event functions such as
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1977 `event-over-toolbar-p' to determine where the mouse is.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1978
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1979 DEVICE specifies the device on which to read the mouse position, and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1980 defaults to the selected device. If the mouse position can't be determined
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1981 \(e.g. DEVICE is a TTY device), nil is returned instead of an event.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1982 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1983 (device))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1984 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1985 struct device *d = decode_device (device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1986 Lisp_Object frame;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1987 int intx, inty;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1988
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1989 if (mouse_pixel_position_1 (d, &frame, &intx, &inty))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1990 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1991 Lisp_Object event = Fmake_event (Qnil, Qnil);
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1992 XSET_EVENT_TYPE (event, pointer_motion_event);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 872
diff changeset
1993 XSET_EVENT_CHANNEL (event, frame);
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
1994 XSET_EVENT_MOTION_X (event, intx);
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 1161
diff changeset
1995 XSET_EVENT_MOTION_Y (event, inty);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1996 return event;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1997 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1998 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1999 return Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2000 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2001
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2002 DEFUN ("set-mouse-position", Fset_mouse_position, 3, 3, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2003 Move the mouse pointer to the center of character cell (X,Y) in WINDOW.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2004 Note, this is a no-op for an X frame that is not visible.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2005 If you have just created a frame, you must wait for it to become visible
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2006 before calling this function on it, like this.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2007 (while (not (frame-visible-p frame)) (sleep-for .5))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2008 Note also: Warping the mouse is contrary to the ICCCM, so be very sure
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2009 that the behavior won't end up being obnoxious!
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2010 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2011 (window, x, y))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2012 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2013 struct window *w;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2014 int pix_x, pix_y;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2015
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2016 CHECK_LIVE_WINDOW (window);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2017 CHECK_INT (x);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2018 CHECK_INT (y);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2019
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2020 /* Warping the mouse will cause EnterNotify and Focus events under X. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2021 w = XWINDOW (window);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2022 glyph_to_pixel_translation (w, XINT (x), XINT (y), &pix_x, &pix_y);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2023
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2024 MAYBE_FRAMEMETH (XFRAME (w->frame), set_mouse_position, (w, pix_x, pix_y));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2025
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2026 return Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2027 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2028
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2029 DEFUN ("set-mouse-pixel-position", Fset_mouse_pixel_position, 3, 3, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2030 Move the mouse pointer to pixel position (X,Y) in WINDOW.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2031 Note, this is a no-op for an X frame that is not visible.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2032 If you have just created a frame, you must wait for it to become visible
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2033 before calling this function on it, like this.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2034 (while (not (frame-visible-p frame)) (sleep-for .5))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2035 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2036 (window, x, y))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2037 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2038 struct window *w;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2039
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2040 CHECK_LIVE_WINDOW (window);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2041 CHECK_INT (x);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2042 CHECK_INT (y);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2043
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2044 /* Warping the mouse will cause EnterNotify and Focus events under X. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2045 w = XWINDOW (window);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2046 FRAMEMETH (XFRAME (w->frame), set_mouse_position, (w, XINT (x), XINT (y)));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2047
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2048 return Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2049 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2050
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2051 DEFUN ("make-frame-visible", Fmake_frame_visible, 0, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2052 Make the frame FRAME visible (assuming it is an X-window).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2053 If omitted, FRAME defaults to the currently selected frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2054 Also raises the frame so that nothing obscures it.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2055 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2056 (frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2057 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2058 struct frame *f = decode_frame (frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2059
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2060 MAYBE_FRAMEMETH (f, make_frame_visible, (f));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2061 return frame;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2062 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2063
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2064 DEFUN ("make-frame-invisible", Fmake_frame_invisible, 0, 2, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2065 Unconditionally removes frame from the display (assuming it is an X-window).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2066 If omitted, FRAME defaults to the currently selected frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2067 If what you want to do is iconify the frame (if the window manager uses
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2068 icons) then you should call `iconify-frame' instead.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2069 Normally you may not make FRAME invisible if all other frames are invisible
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2070 and uniconified, but if the second optional argument FORCE is non-nil,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2071 you may do so.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2072 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2073 (frame, force))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2074 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2075 struct frame *f, *sel_frame;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2076 struct device *d;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2077
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2078 f = decode_frame (frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2079 d = XDEVICE (FRAME_DEVICE (f));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2080 sel_frame = XFRAME (DEVICE_SELECTED_FRAME (d));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2081
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2082 if (NILP (force) && !other_visible_frames (f))
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
2083 invalid_operation ("Attempt to make invisible the sole visible or iconified frame", Qunbound);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2084
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2085 /* Don't allow minibuf_window to remain on a deleted frame. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2086 if (EQ (f->minibuffer_window, minibuf_window))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2087 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2088 Fset_window_buffer (sel_frame->minibuffer_window,
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
2089 XWINDOW (minibuf_window)->buffer, Qt);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2090 minibuf_window = sel_frame->minibuffer_window;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2091 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2092
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2093 MAYBE_FRAMEMETH (f, make_frame_invisible, (f));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2094
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2095 return Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2096 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2097
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2098 DEFUN ("iconify-frame", Ficonify_frame, 0, 1, "", /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2099 Make the frame FRAME into an icon, if the window manager supports icons.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2100 If omitted, FRAME defaults to the currently selected frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2101 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2102 (frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2103 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2104 struct frame *f, *sel_frame;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2105 struct device *d;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2106
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2107 f = decode_frame (frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2108 d = XDEVICE (FRAME_DEVICE (f));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2109 sel_frame = XFRAME (DEVICE_SELECTED_FRAME (d));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2110
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2111 /* Don't allow minibuf_window to remain on a deleted frame. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2112 if (EQ (f->minibuffer_window, minibuf_window))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2113 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2114 Fset_window_buffer (sel_frame->minibuffer_window,
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
2115 XWINDOW (minibuf_window)->buffer, Qt);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2116 minibuf_window = sel_frame->minibuffer_window;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2117 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2118
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2119 MAYBE_FRAMEMETH (f, iconify_frame, (f));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2120
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2121 return Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2122 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2123
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2124 DEFUN ("deiconify-frame", Fdeiconify_frame, 0, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2125 Open (de-iconify) the iconified frame FRAME.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2126 Under X, this is currently the same as `make-frame-visible'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2127 If omitted, FRAME defaults to the currently selected frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2128 Also raises the frame so that nothing obscures it.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2129 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2130 (frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2131 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2132 return Fmake_frame_visible (frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2133 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2134
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2135 /* FSF returns 'icon for iconized frames. What a crock! */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2136
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2137 DEFUN ("frame-visible-p", Fframe_visible_p, 0, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2138 Return non NIL if FRAME is now "visible" (actually in use for display).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2139 A frame that is not visible is not updated, and, if it works through a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2140 window system, may not show at all.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2141 N.B. Under X "visible" means Mapped. It the window is mapped but not
460
223736d75acb Import from CVS: tag r21-2-45
cvs
parents: 450
diff changeset
2142 actually visible on screen then `frame-visible-p' returns 'hidden.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2143 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2144 (frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2145 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2146 struct frame *f = decode_frame (frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2147 int visible = FRAMEMETH_OR_GIVEN (f, frame_visible_p, (f), f->visible);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2148 return visible ? ( visible > 0 ? Qt : Qhidden ) : Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2149 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2150
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2151 DEFUN ("frame-totally-visible-p", Fframe_totally_visible_p, 0, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2152 Return t if frame is not obscured by any other window system windows.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2153 Always returns t for tty frames.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2154 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2155 (frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2156 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2157 struct frame *f = decode_frame (frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2158 return (FRAMEMETH_OR_GIVEN (f, frame_totally_visible_p, (f), f->visible)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2159 ? Qt : Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2160 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2161
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2162 DEFUN ("frame-iconified-p", Fframe_iconified_p, 0, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2163 Return t if FRAME is iconified.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2164 Not all window managers use icons; some merely unmap the window, so this
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2165 function is not the inverse of `frame-visible-p'. It is possible for a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2166 frame to not be visible and not be iconified either. However, if the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2167 frame is iconified, it will not be visible.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2168 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2169 (frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2170 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2171 struct frame *f = decode_frame (frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2172 if (f->visible)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2173 return Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2174 f->iconified = FRAMEMETH_OR_GIVEN (f, frame_iconified_p, (f), 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2175 return f->iconified ? Qt : Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2176 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2177
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2178 DEFUN ("visible-frame-list", Fvisible_frame_list, 0, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2179 Return a list of all frames now "visible" (being updated).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2180 If DEVICE is specified only frames on that device will be returned.
460
223736d75acb Import from CVS: tag r21-2-45
cvs
parents: 450
diff changeset
2181 Note that under virtual window managers not all these frames are
223736d75acb Import from CVS: tag r21-2-45
cvs
parents: 450
diff changeset
2182 necessarily really updated.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2183 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2184 (device))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2185 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2186 Lisp_Object devcons, concons;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2187 struct frame *f;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2188 Lisp_Object value;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2189
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2190 value = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2191
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2192 DEVICE_LOOP_NO_BREAK (devcons, concons)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2193 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2194 assert (DEVICEP (XCAR (devcons)));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2195
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2196 if (NILP (device) || EQ (device, XCAR (devcons)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2197 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2198 Lisp_Object frmcons;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2199
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2200 DEVICE_FRAME_LOOP (frmcons, XDEVICE (XCAR (devcons)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2201 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2202 Lisp_Object frame = XCAR (frmcons);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2203 f = XFRAME (frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2204 if (FRAME_VISIBLE_P(f))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2205 value = Fcons (frame, value);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2206 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2207 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2208 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2209
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2210 return value;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2211 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2212
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2213
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2214 DEFUN ("raise-frame", Fraise_frame, 0, 1, "", /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2215 Bring FRAME to the front, so it occludes any frames it overlaps.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2216 If omitted, FRAME defaults to the currently selected frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2217 If FRAME is invisible, make it visible.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2218 If Emacs is displaying on an ordinary terminal or some other device which
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2219 doesn't support multiple overlapping frames, this function does nothing.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2220 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2221 (frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2222 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2223 struct frame *f = decode_frame (frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2224
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2225 /* Do like the documentation says. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2226 Fmake_frame_visible (frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2227 MAYBE_FRAMEMETH (f, raise_frame, (f));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2228 return Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2229 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2230
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2231 DEFUN ("lower-frame", Flower_frame, 0, 1, "", /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2232 Send FRAME to the back, so it is occluded by any frames that overlap it.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2233 If omitted, FRAME defaults to the currently selected frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2234 If Emacs is displaying on an ordinary terminal or some other device which
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2235 doesn't support multiple overlapping frames, this function does nothing.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2236 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2237 (frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2238 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2239 struct frame *f = decode_frame (frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2240
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2241 MAYBE_FRAMEMETH (f, lower_frame, (f));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2242 return Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2243 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2244
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2245
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2246 DEFUN ("disable-frame", Fdisable_frame, 1, 1, 0, /*
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2247 Disable frame FRAME, so that it cannot have the focus or receive user input.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2248 This is normally used during modal dialog boxes.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2249 WARNING: Be very careful not to wedge XEmacs!
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2250 Use an `unwind-protect' that re-enables the frame to avoid this.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2251 */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2252 (frame))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2253 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2254 struct frame *f = decode_frame (frame);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2255
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2256 f->disabled = 1;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2257 MAYBE_FRAMEMETH (f, disable_frame, (f));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2258 return Qnil;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2259 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2260
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2261 DEFUN ("enable-frame", Fenable_frame, 1, 1, 0, /*
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2262 Enable frame FRAME, so that it can have the focus and receive user input.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2263 Frames are normally enabled, unless explicitly disabled using `disable-frame'.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2264 */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2265 (frame))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2266 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2267 struct frame *f = decode_frame (frame);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2268 f->disabled = 0;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2269 MAYBE_FRAMEMETH (f, enable_frame, (f));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2270 return Qnil;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2271 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2272
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2273 /* Ben thinks there is no need for `redirect-frame-focus' or `frame-focus',
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2274 crockish FSFmacs functions. See summary on focus in event-stream.c. */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2275
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2276 DEFUN ("print-job-page-number", Fprint_job_page_number, 1, 1, 0, /*
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2277 Return current page number for the print job FRAME.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2278 */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2279 (frame))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2280 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2281 CHECK_PRINTER_FRAME (frame);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2282 return make_int (FRAME_PAGENUMBER (XFRAME (frame)));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2283 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2284
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2285 DEFUN ("print-job-eject-page", Fprint_job_eject_page, 1, 1, 0, /*
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2286 Eject page in the print job FRAME.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2287 */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2288 (frame))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2289 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2290 struct frame *f;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2291
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2292 CHECK_PRINTER_FRAME (frame);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2293 f = XFRAME (frame);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2294 FRAMEMETH (f, eject_page, (f));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2295 FRAME_SET_PAGENUMBER (f, 1 + FRAME_PAGENUMBER (f));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2296 f->clear = 1;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2297
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2298 return Qnil;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2299 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2300
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2301
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2302 /***************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2303 /* frame properties */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2304 /***************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2305
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2306 static void internal_set_frame_size (struct frame *f, int cols, int rows,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2307 int pretend);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2308
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2309 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2310 store_minibuf_frame_prop (struct frame *f, Lisp_Object val)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2311 {
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
2312 Lisp_Object frame = wrap_frame (f);
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
2313
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2314
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2315 if (WINDOWP (val))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2316 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2317 if (! MINI_WINDOW_P (XWINDOW (val)))
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
2318 gui_error
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2319 ("Surrogate minibuffer windows must be minibuffer windows",
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2320 val);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2321
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2322 if (FRAME_HAS_MINIBUF_P (f) || FRAME_MINIBUF_ONLY_P (f))
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
2323 gui_error
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2324 ("Can't change the surrogate minibuffer of a frame with its own minibuffer", frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2325
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2326 /* Install the chosen minibuffer window, with proper buffer. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2327 f->minibuffer_window = val;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2328 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2329 else if (EQ (val, Qt))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2330 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2331 if (FRAME_HAS_MINIBUF_P (f) || FRAME_MINIBUF_ONLY_P (f))
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
2332 gui_error
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2333 ("Frame already has its own minibuffer", frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2334 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2335 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2336 setup_normal_frame (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2337 f->mirror_dirty = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2338
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2339 update_frame_window_mirror (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2340 internal_set_frame_size (f, f->width, f->height, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2341 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2342 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2343 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2344
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2345 #if 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2346
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2347 /* possible code if you want to have symbols such as `default-background'
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2348 map to setting the background of `default', etc. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2349
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2350 static int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2351 dissect_as_face_setting (Lisp_Object sym, Lisp_Object *face_out,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2352 Lisp_Object *face_prop_out)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2353 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2354 Lisp_Object list = Vbuilt_in_face_specifiers;
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
2355 Lisp_Object s;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2356
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2357 if (!SYMBOLP (sym))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2358 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2359
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2360 s = symbol_name (XSYMBOL (sym));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2361
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2362 while (!NILP (list))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2363 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2364 Lisp_Object prop = Fcar (list);
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
2365 Lisp_Object prop_name;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2366
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2367 if (!SYMBOLP (prop))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2368 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2369 prop_name = symbol_name (XSYMBOL (prop));
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
2370 if (XSTRING_LENGTH (s) > XSTRING_LENGTH (prop_name) + 1
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
2371 && !memcmp (XSTRING_DATA (prop_name),
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
2372 XSTRING_DATA (s) + XSTRING_LENGTH (s)
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
2373 - XSTRING_LENGTH (prop_name),
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
2374 XSTRING_LENGTH (prop_name))
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
2375 && XSTRING_DATA (s)[XSTRING_LENGTH (s) - XSTRING_LENGTH (prop_name)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2376 - 1] == '-')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2377 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2378 Lisp_Object face =
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
2379 Ffind_face (make_string (XSTRING_DATA (s),
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
2380 XSTRING_LENGTH (s)
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
2381 - XSTRING_LENGTH (prop_name)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2382 - 1));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2383 if (!NILP (face))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2384 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2385 *face_out = face;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2386 *face_prop_out = prop;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2387 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2388 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2389 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2390
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2391 list = Fcdr (list);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2392 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2393
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2394 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2395 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2396
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2397 #endif /* 0 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2398
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2399 static Lisp_Object
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2400 get_property_alias (Lisp_Object prop)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2401 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2402 while (1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2403 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2404 Lisp_Object alias = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2405
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2406 if (SYMBOLP (prop))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2407 alias = Fget (prop, Qframe_property_alias, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2408 if (NILP (alias))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2409 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2410 prop = alias;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2411 QUIT;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2412 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2413
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2414 return prop;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2415 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2416
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2417 /* #### Using this to modify the internal border width has no effect
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2418 because the change isn't propagated to the windows. Are there
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2419 other properties which this claims to handle, but doesn't?
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2420
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2421 But of course. This stuff needs more work, but it's a lot closer
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2422 to sanity now than before with the horrible frame-params stuff. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2423
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2424 DEFUN ("set-frame-properties", Fset_frame_properties, 2, 2, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2425 Change some properties of a frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2426 PLIST is a property list.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2427 You can also change frame properties individually using `set-frame-property',
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2428 but it may be more efficient to change many properties at once.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2429
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2430 Frame properties can be retrieved using `frame-property' or `frame-properties'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2431
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2432 The following symbols etc. have predefined meanings:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2433
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2434 name Name of the frame. Used with X resources.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2435 Unchangeable after creation.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2436
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2437 height Height of the frame, in lines.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2438
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2439 width Width of the frame, in characters.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2440
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2441 minibuffer Gives the minibuffer behavior for this frame. Either
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2442 t (frame has its own minibuffer), `only' (frame is
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2443 a minibuffer-only frame), `none' (frame has no minibuffer)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2444 or a window (frame uses that window, which is on another
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2445 frame, as the minibuffer).
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2446
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2447 unsplittable If non-nil, frame cannot be split by `display-buffer'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2448
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2449 current-display-table, menubar-visible-p, left-margin-width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2450 right-margin-width, minimum-line-ascent, minimum-line-descent,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2451 use-left-overflow, use-right-overflow, scrollbar-width, scrollbar-height,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2452 default-toolbar, top-toolbar, bottom-toolbar, left-toolbar, right-toolbar,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2453 default-toolbar-height, default-toolbar-width, top-toolbar-height,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2454 bottom-toolbar-height, left-toolbar-width, right-toolbar-width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2455 default-toolbar-visible-p, top-toolbar-visible-p, bottom-toolbar-visible-p,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2456 left-toolbar-visible-p, right-toolbar-visible-p, toolbar-buttons-captioned-p,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2457 top-toolbar-border-width, bottom-toolbar-border-width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2458 left-toolbar-border-width, right-toolbar-border-width,
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2459 modeline-shadow-thickness, has-modeline-p,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2460 default-gutter, top-gutter, bottom-gutter, left-gutter, right-gutter,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2461 default-gutter-height, default-gutter-width, top-gutter-height,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2462 bottom-gutter-height, left-gutter-width, right-gutter-width,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2463 default-gutter-visible-p, top-gutter-visible-p, bottom-gutter-visible-p,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2464 left-gutter-visible-p, right-gutter-visible-p, top-gutter-border-width,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2465 bottom-gutter-border-width, left-gutter-border-width, right-gutter-border-width,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2466 [Giving the name of any built-in specifier variable is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2467 equivalent to calling `set-specifier' on the specifier,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2468 with a locale of FRAME. Giving the name to `frame-property'
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2469 calls `specifier-instance' on the specifier.]
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2470
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2471 text-pointer-glyph, nontext-pointer-glyph, modeline-pointer-glyph,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2472 selection-pointer-glyph, busy-pointer-glyph, toolbar-pointer-glyph,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2473 menubar-pointer-glyph, scrollbar-pointer-glyph, gc-pointer-glyph,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2474 octal-escape-glyph, control-arrow-glyph, invisible-text-glyph,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2475 hscroll-glyph, truncation-glyph, continuation-glyph
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2476 [Giving the name of any glyph variable is equivalent to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2477 calling `set-glyph-image' on the glyph, with a locale
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2478 of FRAME. Giving the name to `frame-property' calls
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2479 `glyph-image-instance' on the glyph.]
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2480
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2481 [default foreground], [default background], [default font],
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2482 [modeline foreground], [modeline background], [modeline font],
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2483 etc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2484 [Giving a vector of a face and a property is equivalent
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2485 to calling `set-face-property' on the face and property,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2486 with a locale of FRAME. Giving the vector to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2487 `frame-property' calls `face-property-instance' on the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2488 face and property.]
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2489
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2490 Finally, if a frame property symbol has the property `frame-property-alias'
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2491 on it, then the value will be used in place of that symbol when looking
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2492 up and setting frame property values. This allows you to alias one
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2493 frame property name to another.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2494
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2495 See the variables `default-x-frame-plist', `default-tty-frame-plist'
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2496 and `default-mswindows-frame-plist' for a description of the properties
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2497 recognized for particular types of frames.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2498 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2499 (frame, plist))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2500 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2501 struct frame *f = decode_frame (frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2502 Lisp_Object tail;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2503 Lisp_Object *tailp;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2504 struct gcpro gcpro1, gcpro2;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2505
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
2506 frame = wrap_frame (f);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2507 GCPRO2 (frame, plist);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2508 Fcheck_valid_plist (plist);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2509 plist = Fcopy_sequence (plist);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2510 Fcanonicalize_lax_plist (plist, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2511 for (tail = plist; !NILP (tail); tail = Fcdr (Fcdr (tail)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2512 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2513 Lisp_Object prop = Fcar (tail);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2514 Lisp_Object val = Fcar (Fcdr (tail));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2515
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2516 prop = get_property_alias (prop);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2517
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2518 #if 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2519 /* mly wants this, but it's not reasonable to change the name of a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2520 frame after it has been created, because the old name was used
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2521 for resource lookup. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2522 if (EQ (prop, Qname))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2523 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2524 CHECK_STRING (val);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2525 f->name = val;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2526 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2527 #endif /* 0 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2528 if (EQ (prop, Qminibuffer))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2529 store_minibuf_frame_prop (f, val);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2530 if (EQ (prop, Qunsplittable))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2531 f->no_split = !NILP (val);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2532 if (EQ (prop, Qbuffer_predicate))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2533 f->buffer_predicate = val;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2534 if (SYMBOLP (prop) && EQ (Fbuilt_in_variable_type (prop),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2535 Qconst_specifier))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2536 call3 (Qset_specifier, Fsymbol_value (prop), val, frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2537 if (SYMBOLP (prop) && !NILP (Fget (prop, Qconst_glyph_variable, Qnil)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2538 call3 (Qset_glyph_image, Fsymbol_value (prop), val, frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2539 if (VECTORP (prop) && XVECTOR_LENGTH (prop) == 2)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2540 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2541 Lisp_Object face_prop = XVECTOR_DATA (prop)[1];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2542 CHECK_SYMBOL (face_prop);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2543 call4 (Qset_face_property,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2544 Fget_face (XVECTOR_DATA (prop)[0]),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2545 face_prop, val, frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2546 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2547 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2548
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2549 MAYBE_FRAMEMETH (f, set_frame_properties, (f, plist));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2550 for (tailp = &plist; !NILP (*tailp);)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2551 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2552 Lisp_Object *next_tailp;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2553 Lisp_Object next;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2554 Lisp_Object prop;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2555
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2556 next = Fcdr (*tailp);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2557 CHECK_CONS (next);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2558 next_tailp = &XCDR (next);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2559 prop = Fcar (*tailp);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2560
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2561 prop = get_property_alias (prop);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2562
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2563 if (EQ (prop, Qminibuffer)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2564 || EQ (prop, Qunsplittable)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2565 || EQ (prop, Qbuffer_predicate)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2566 || EQ (prop, Qheight)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2567 || EQ (prop, Qwidth)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2568 || (SYMBOLP (prop) && EQ (Fbuilt_in_variable_type (prop),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2569 Qconst_specifier))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2570 || (SYMBOLP (prop) && !NILP (Fget (prop, Qconst_glyph_variable,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2571 Qnil)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2572 || (VECTORP (prop) && XVECTOR_LENGTH (prop) == 2)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2573 || FRAMEMETH_OR_GIVEN (f, internal_frame_property_p, (f, prop), 0))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2574 *tailp = *next_tailp;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2575 tailp = next_tailp;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2576 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2577
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2578 f->plist = nconc2 (plist, f->plist);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2579 Fcanonicalize_lax_plist (f->plist, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2580 UNGCPRO;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2581 return Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2582 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2583
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2584 DEFUN ("frame-property", Fframe_property, 2, 3, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2585 Return FRAME's value for property PROPERTY.
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2586 Return DEFAULT if there is no such property.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2587 See `set-frame-properties' for the built-in property names.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2588 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2589 (frame, property, default_))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2590 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2591 struct frame *f = decode_frame (frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2592 Lisp_Object value;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2593
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
2594 frame = wrap_frame (f);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2595
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2596 property = get_property_alias (property);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2597
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2598 if (EQ (Qname, property)) return f->name;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2599
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2600 if (EQ (Qheight, property) || EQ (Qwidth, property))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2601 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2602 if (window_system_pixelated_geometry (frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2603 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2604 int width, height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2605 pixel_to_real_char_size (f, FRAME_PIXWIDTH (f), FRAME_PIXHEIGHT (f),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2606 &width, &height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2607 return make_int (EQ (Qheight, property) ? height: width);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2608 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2609 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2610 return make_int (EQ (Qheight, property) ?
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2611 FRAME_HEIGHT (f) :
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2612 FRAME_WIDTH (f));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2613 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2614
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2615 /* NOTE: FSF returns Qnil instead of Qt for FRAME_HAS_MINIBUF_P.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2616 This is over-the-top bogosity, because it's inconsistent with
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2617 the semantics of `minibuffer' when passed to `make-frame'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2618 Returning Qt makes things consistent. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2619 if (EQ (Qminibuffer, property))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2620 return (FRAME_MINIBUF_ONLY_P (f) ? Qonly :
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2621 FRAME_HAS_MINIBUF_P (f) ? Qt :
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2622 FRAME_MINIBUF_WINDOW (f));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2623 if (EQ (Qunsplittable, property))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2624 return FRAME_NO_SPLIT_P (f) ? Qt : Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2625 if (EQ (Qbuffer_predicate, property))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2626 return f->buffer_predicate;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2627
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2628 if (SYMBOLP (property))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2629 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2630 if (EQ (Fbuilt_in_variable_type (property), Qconst_specifier))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2631 return Fspecifier_instance (Fsymbol_value (property),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2632 frame, default_, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2633 if (!NILP (Fget (property, Qconst_glyph_variable, Qnil)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2634 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2635 Lisp_Object glyph = Fsymbol_value (property);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2636 CHECK_GLYPH (glyph);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2637 return Fspecifier_instance (XGLYPH_IMAGE (glyph),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2638 frame, default_, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2639 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2640 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2641
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2642 if (VECTORP (property) && XVECTOR_LENGTH (property) == 2)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2643 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2644 Lisp_Object face_prop = XVECTOR_DATA (property)[1];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2645 CHECK_SYMBOL (face_prop);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2646 return call3 (Qface_property_instance,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2647 Fget_face (XVECTOR_DATA (property)[0]),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2648 face_prop, frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2649 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2650
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2651 if (HAS_FRAMEMETH_P (f, frame_property))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2652 if (!UNBOUNDP (value = FRAMEMETH (f, frame_property, (f, property))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2653 return value;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2654
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2655 if (!UNBOUNDP (value = external_plist_get (&f->plist, property, 1, ERROR_ME)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2656 return value;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2657
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2658 return default_;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2659 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2660
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2661 DEFUN ("frame-properties", Fframe_properties, 0, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2662 Return a property list of the properties of FRAME.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2663 Do not modify this list; use `set-frame-property' instead.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2664 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2665 (frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2666 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2667 struct frame *f = decode_frame (frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2668 Lisp_Object result = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2669 struct gcpro gcpro1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2670
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2671 GCPRO1 (result);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2672
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
2673 frame = wrap_frame (f);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2674
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2675 /* #### for the moment (since old code uses `frame-parameters'),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2676 we call `copy-sequence' on f->plist. That allows frame-parameters
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2677 to destructively convert the plist into an alist, which is more
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2678 efficient than doing it non-destructively. At some point we
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2679 should remove the call to copy-sequence. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2680 result = Fcopy_sequence (f->plist);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2681
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2682 /* #### should we be adding all the specifiers and glyphs?
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2683 That would entail having a list of them all. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2684 if (HAS_FRAMEMETH_P (f, frame_properties))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2685 result = nconc2 (FRAMEMETH (f, frame_properties, (f)), result);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2686
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2687 if (!NILP (f->buffer_predicate))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2688 result = cons3 (Qbuffer_predicate, f->buffer_predicate, result);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2689
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2690 if (FRAME_NO_SPLIT_P (f))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2691 result = cons3 (Qunsplittable, Qt, result);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2692
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2693 /* NOTE: FSF returns Qnil instead of Qt for FRAME_HAS_MINIBUF_P.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2694 This is over-the-top bogosity, because it's inconsistent with
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2695 the semantics of `minibuffer' when passed to `make-frame'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2696 Returning Qt makes things consistent. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2697 result = cons3 (Qminibuffer,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2698 (FRAME_MINIBUF_ONLY_P (f) ? Qonly :
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2699 FRAME_HAS_MINIBUF_P (f) ? Qt :
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2700 FRAME_MINIBUF_WINDOW (f)),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2701 result);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2702 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2703 int width, height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2704
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2705 if (window_system_pixelated_geometry (frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2706 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2707 pixel_to_real_char_size (f, FRAME_PIXWIDTH (f), FRAME_PIXHEIGHT (f),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2708 &width, &height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2709 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2710 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2711 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2712 height = FRAME_HEIGHT (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2713 width = FRAME_WIDTH (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2714 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2715 result = cons3 (Qwidth , make_int (width), result);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2716 result = cons3 (Qheight, make_int (height), result);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2717 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2718
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2719 result = cons3 (Qname, f->name, result);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2720
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2721 UNGCPRO;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2722 return result;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2723 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2724
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2725
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2726 DEFUN ("frame-pixel-height", Fframe_pixel_height, 0, 1, 0, /*
1125
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2727 Return the total height in pixels of FRAME.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2728 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2729 (frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2730 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2731 return make_int (decode_frame (frame)->pixheight);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2732 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2733
1125
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2734 DEFUN ("frame-displayable-pixel-height", Fframe_displayable_pixel_height, 0, 1, 0, /*
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2735 Return the height of the displayable area in pixels of FRAME.
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2736 */
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2737 (frame))
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2738 {
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2739 struct frame *f = decode_frame (frame);
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2740 int height, pheight;
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2741 frame = wrap_frame (f);
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2742
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2743 if (!window_system_pixelated_geometry (frame))
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2744 {
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2745 height = FRAME_HEIGHT (f);
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2746
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2747 frame_conversion_internal (f, CHAR_TO_DISPLAYABLE_PIXEL,
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2748 0, &pheight, 0, &height, 0);
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2749 }
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2750 else
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2751 pheight = FRAME_PIXHEIGHT (f);
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2752
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2753 return make_int (pheight);
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2754 }
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2755
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2756 DEFUN ("frame-pixel-width", Fframe_pixel_width, 0, 1, 0, /*
1125
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2757 Return the total width in pixels of FRAME.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2758 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2759 (frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2760 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2761 return make_int (decode_frame (frame)->pixwidth);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2762 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2763
1125
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2764 DEFUN ("frame-displayable-pixel-width", Fframe_displayable_pixel_width, 0, 1, 0, /*
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2765 Return the width of the displayable area in pixels of FRAME.
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2766 */
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2767 (frame))
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2768 {
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2769 struct frame *f = decode_frame (frame);
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2770 int width, pwidth;
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2771 frame = wrap_frame (f);
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2772
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2773 if (!window_system_pixelated_geometry (frame))
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2774 {
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2775 width = FRAME_WIDTH (f);
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2776
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2777 frame_conversion_internal (f, CHAR_TO_DISPLAYABLE_PIXEL,
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2778 &pwidth, 0, &width, 0, 0);
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2779 }
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2780 else
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2781 pwidth = FRAME_PIXWIDTH (f);
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2782
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2783 return make_int (pwidth);
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2784 }
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2785
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2786 DEFUN ("frame-name", Fframe_name, 0, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2787 Return the name of FRAME (defaulting to the selected frame).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2788 This is not the same as the `title' of the frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2789 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2790 (frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2791 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2792 return decode_frame (frame)->name;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2793 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2794
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2795 DEFUN ("frame-modified-tick", Fframe_modified_tick, 0, 1, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2796 Return FRAME's tick counter, incremented for each change to the frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2797 Each frame has a tick counter which is incremented each time the frame
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2798 is resized, a window is resized, added, or deleted, a face is changed,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2799 `set-window-buffer' or `select-window' is called on a window in the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2800 frame, the window-start of a window in the frame has changed, or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2801 anything else interesting has happened. It wraps around occasionally.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2802 No argument or nil as argument means use selected frame as FRAME.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2803 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2804 (frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2805 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2806 return make_int (decode_frame (frame)->modiff);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2807 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2808
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2809 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2810 internal_set_frame_size (struct frame *f, int cols, int rows, int pretend)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2811 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2812 /* An explicit size change cancels any pending frame size adjustment */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2813 CLEAR_FRAME_SIZE_SLIPPED(f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2814
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2815 if (pretend || !HAS_FRAMEMETH_P (f, set_frame_size))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2816 change_frame_size (f, rows, cols, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2817 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2818 FRAMEMETH (f, set_frame_size, (f, cols, rows));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2819 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2820
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2821 DEFUN ("set-frame-height", Fset_frame_height, 2, 3, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2822 Specify that the frame FRAME has LINES lines.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2823 Optional third arg non-nil means that redisplay should use LINES lines
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2824 but that the idea of the actual height of the frame should not be changed.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2825 */
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2826 (frame, lines, pretend))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2827 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2828 struct frame *f = decode_frame (frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2829 int height, width;
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
2830 frame = wrap_frame (f);
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2831 CHECK_INT (lines);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2832
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2833 if (window_system_pixelated_geometry (frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2834 {
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2835 char_to_real_pixel_size (f, 0, XINT (lines), 0, &height);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2836 width = FRAME_PIXWIDTH (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2837 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2838 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2839 {
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2840 height = XINT (lines);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2841 width = FRAME_WIDTH (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2842 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2843
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2844 internal_set_frame_size (f, width, height, !NILP (pretend));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2845 return frame;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2846 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2847
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2848 DEFUN ("set-frame-pixel-height", Fset_frame_pixel_height, 2, 3, 0, /*
1125
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2849 Specify that the frame FRAME is a total of HEIGHT pixels tall.
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2850 Optional third arg non-nil means that redisplay should be HEIGHT pixels tall
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2851 but that the idea of the actual height of the frame should not be changed.
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2852 */
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2853 (frame, height, pretend))
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2854 {
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2855 struct frame *f = decode_frame (frame);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2856 int pheight, width;
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2857 frame = wrap_frame (f);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2858 CHECK_INT (height);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2859
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2860 if (!window_system_pixelated_geometry (frame))
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2861 {
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2862 int h = XINT (height);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2863 width = FRAME_WIDTH (f);
1125
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2864
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2865 frame_conversion_internal (f, TOTAL_PIXEL_TO_CHAR, 0, &h, 0, &pheight, 0);
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2866 }
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2867 else
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2868 {
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2869 width = FRAME_PIXWIDTH (f);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2870 pheight = XINT (height);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2871 }
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2872
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2873 internal_set_frame_size (f, width, pheight, !NILP (pretend));
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2874 return frame;
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2875 }
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2876
1125
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2877 DEFUN ("set-frame-displayable-pixel-height", Fset_frame_displayable_pixel_height, 2, 3, 0, /*
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2878 Specify that the displayable area of frame FRAME is HEIGHT pixels tall.
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2879 Optional third arg non-nil means that redisplay should be HEIGHT pixels tall
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2880 but that the idea of the actual height of the frame should not be changed.
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2881 */
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2882 (frame, height, pretend))
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2883 {
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2884 struct frame *f = decode_frame (frame);
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2885 int pheight, width;
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2886 frame = wrap_frame (f);
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2887 CHECK_INT (height);
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2888
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2889 if (!window_system_pixelated_geometry (frame))
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2890 {
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2891 int h = XINT (height);
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2892 width = FRAME_WIDTH (f);
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2893 frame_conversion_internal (f, DISPLAYABLE_PIXEL_TO_CHAR, 0, &h, 0, &pheight, 0);
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2894 }
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2895 else
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2896 {
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2897 width = FRAME_PIXWIDTH (f);
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2898 pheight = XINT (height);
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2899 }
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2900
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2901 internal_set_frame_size (f, width, pheight, !NILP (pretend));
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2902 return frame;
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2903 }
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2904
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2905
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2906 DEFUN ("set-frame-width", Fset_frame_width, 2, 3, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2907 Specify that the frame FRAME has COLS columns.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2908 Optional third arg non-nil means that redisplay should use COLS columns
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2909 but that the idea of the actual width of the frame should not be changed.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2910 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2911 (frame, cols, pretend))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2912 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2913 struct frame *f = decode_frame (frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2914 int width, height;
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
2915 frame = wrap_frame (f);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2916 CHECK_INT (cols);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2917
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2918 if (window_system_pixelated_geometry (frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2919 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2920 char_to_real_pixel_size (f, XINT (cols), 0, &width, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2921 height = FRAME_PIXHEIGHT (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2922 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2923 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2924 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2925 width = XINT (cols);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2926 height = FRAME_HEIGHT (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2927 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2928
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2929 internal_set_frame_size (f, width, height, !NILP (pretend));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2930 return frame;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2931 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2932
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2933 DEFUN ("set-frame-pixel-width", Fset_frame_pixel_width, 2, 3, 0, /*
1125
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2934 Specify that the frame FRAME is a total of WIDTH pixels wide.
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2935 Optional third arg non-nil means that redisplay should be WIDTH wide
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2936 but that the idea of the actual height of the frame should not be changed.
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2937 */
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2938 (frame, width, pretend))
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2939 {
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2940 struct frame *f = decode_frame (frame);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2941 int height, pwidth;
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2942 frame = wrap_frame (f);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2943 CHECK_INT (width);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2944
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2945 if (!window_system_pixelated_geometry (frame))
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2946 {
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2947 int w = XINT (width);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2948 height = FRAME_HEIGHT (f);
1125
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2949 frame_conversion_internal (f, TOTAL_PIXEL_TO_CHAR, &w, 0, &pwidth, 0, 0);
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2950 }
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2951 else
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2952 {
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2953 height = FRAME_PIXHEIGHT (f);
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2954 pwidth = XINT (width);
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2955 }
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2956
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2957 internal_set_frame_size (f, pwidth, height, !NILP (pretend));
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2958 return frame;
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2959 }
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2960
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2961 DEFUN ("set-frame-displayable-pixel-width", Fset_frame_displayable_pixel_width, 2, 3, 0, /*
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2962 Specify that the displayable area of frame FRAME is WIDTH pixels wide.
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2963 Optional third arg non-nil means that redisplay should be WIDTH wide
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2964 but that the idea of the actual height of the frame should not be changed.
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2965 */
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2966 (frame, width, pretend))
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2967 {
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2968 struct frame *f = decode_frame (frame);
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2969 int height, pwidth;
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2970 frame = wrap_frame (f);
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2971 CHECK_INT (width);
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2972
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2973 if (!window_system_pixelated_geometry (frame))
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2974 {
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2975 int w = XINT (width);
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2976 height = FRAME_HEIGHT (f);
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
2977 frame_conversion_internal (f, DISPLAYABLE_PIXEL_TO_CHAR, &w, 0, &pwidth, 0, 0);
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2978 }
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2979 else
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2980 {
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2981 height = FRAME_PIXHEIGHT (f);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2982 pwidth = XINT (width);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2983 }
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2984
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2985 internal_set_frame_size (f, pwidth, height, !NILP (pretend));
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2986 return frame;
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2987 }
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2988
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2989 DEFUN ("set-frame-size", Fset_frame_size, 3, 4, 0, /*
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2990 Set the size of FRAME to COLS by ROWS, measured in characters.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2991 Optional fourth arg non-nil means that redisplay should use COLS by ROWS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2992 but that the idea of the actual size of the frame should not be changed.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2993 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2994 (frame, cols, rows, pretend))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2995 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2996 struct frame *f = decode_frame (frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2997 int height, width;
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
2998 frame = wrap_frame (f);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2999 CHECK_INT (cols);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3000 CHECK_INT (rows);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3001
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3002 if (window_system_pixelated_geometry (frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3003 char_to_real_pixel_size (f, XINT (cols), XINT (rows), &width, &height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3004 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3005 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3006 height = XINT (rows);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3007 width = XINT (cols);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3008 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3009
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3010 internal_set_frame_size (f, width, height, !NILP (pretend));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3011 return frame;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3012 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3013
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
3014 DEFUN ("set-frame-pixel-size", Fset_frame_pixel_size, 3, 4, 0, /*
1125
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3015 Set the total size of FRAME to WIDTH by HEIGHT, measured in pixels.
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
3016 Optional fourth arg non-nil means that redisplay should use WIDTH by HEIGHT
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
3017 but that the idea of the actual size of the frame should not be changed.
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
3018 */
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
3019 (frame, width, height, pretend))
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
3020 {
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
3021 struct frame *f = decode_frame (frame);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
3022 int pheight, pwidth;
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
3023 frame = wrap_frame (f);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
3024 CHECK_INT (width);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
3025 CHECK_INT (height);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
3026
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
3027 if (!window_system_pixelated_geometry (frame))
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
3028 {
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
3029 int w = XINT (width);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
3030 int h = XINT (height);
1125
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3031 frame_conversion_internal (f, TOTAL_PIXEL_TO_CHAR, &w, &h, &pwidth, &pheight, 0);
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3032 }
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3033 else
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3034 {
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3035 pheight = XINT (height);
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3036 pwidth = XINT (width);
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3037 }
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3038
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3039 internal_set_frame_size (f, pwidth, pheight, !NILP (pretend));
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3040 return frame;
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3041 }
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3042
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3043 DEFUN ("set-frame-displayable-pixel-size", Fset_frame_displayable_pixel_size, 3, 4, 0, /*
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3044 Set the displayable size of FRAME to WIDTH by HEIGHT, measured in pixels.
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3045 Optional fourth arg non-nil means that redisplay should use WIDTH by HEIGHT
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3046 but that the idea of the actual size of the frame should not be changed.
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3047 */
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3048 (frame, width, height, pretend))
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3049 {
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3050 struct frame *f = decode_frame (frame);
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3051 int pheight, pwidth;
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3052 frame = wrap_frame (f);
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3053 CHECK_INT (width);
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3054 CHECK_INT (height);
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3055
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3056 if (!window_system_pixelated_geometry (frame))
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3057 {
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3058 int w = XINT (width);
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3059 int h = XINT (height);
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3060 frame_conversion_internal (f, DISPLAYABLE_PIXEL_TO_CHAR, &w, &h, &pwidth, &pheight, 0);
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
3061 }
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
3062 else
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
3063 {
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
3064 pheight = XINT (height);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
3065 pwidth = XINT (width);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
3066 }
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
3067
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
3068 internal_set_frame_size (f, pwidth, pheight, !NILP (pretend));
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
3069 return frame;
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
3070 }
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
3071
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3072 DEFUN ("set-frame-position", Fset_frame_position, 3, 3, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3073 Set position of FRAME in pixels to XOFFSET by YOFFSET.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3074 This is actually the position of the upper left corner of the frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3075 Negative values for XOFFSET or YOFFSET are interpreted relative to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3076 the rightmost or bottommost possible position (that stays within the screen).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3077 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3078 (frame, xoffset, yoffset))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3079 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3080 struct frame *f = decode_frame (frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3081 CHECK_INT (xoffset);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3082 CHECK_INT (yoffset);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3083
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3084 MAYBE_FRAMEMETH (f, set_frame_position, (f, XINT (xoffset), XINT (yoffset)));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3085
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3086 return Qt;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3087 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3088
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3089
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3090
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3091 /* Frame size conversion functions moved here from EmacsFrame.c
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3092 because they're generic and really don't belong in that file.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3093 Function get_default_char_pixel_size() removed because it's
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3094 exactly the same as default_face_height_and_width(). */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3095 static void
1125
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3096 frame_conversion_internal (struct frame *f,
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3097 pixel_to_char_mode_t pixel_to_char,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3098 int *pixel_width, int *pixel_height,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3099 int *char_width, int *char_height,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3100 int real_face)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3101 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3102 int cpw;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3103 int cph;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3104 int egw;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3105 int obw, obh, bdr;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3106 Lisp_Object frame, window;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3107
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
3108 frame = wrap_frame (f);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3109 if (real_face)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3110 default_face_height_and_width (frame, &cph, &cpw);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3111 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3112 default_face_height_and_width_1 (frame, &cph, &cpw);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3113
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3114 window = FRAME_SELECTED_WINDOW (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3115
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
3116 egw = max (glyph_width (Vcontinuation_glyph, window),
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
3117 glyph_width (Vtruncation_glyph, window));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3118 egw = max (egw, cpw);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3119 bdr = 2 * f->internal_border_width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3120 obw = FRAME_SCROLLBAR_WIDTH (f) + FRAME_THEORETICAL_LEFT_TOOLBAR_WIDTH (f) +
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3121 FRAME_THEORETICAL_RIGHT_TOOLBAR_WIDTH (f) +
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3122 2 * FRAME_THEORETICAL_LEFT_TOOLBAR_BORDER_WIDTH (f) +
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3123 2 * FRAME_THEORETICAL_RIGHT_TOOLBAR_BORDER_WIDTH (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3124 obh = FRAME_SCROLLBAR_HEIGHT (f) + FRAME_THEORETICAL_TOP_TOOLBAR_HEIGHT (f) +
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3125 FRAME_THEORETICAL_BOTTOM_TOOLBAR_HEIGHT (f) +
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3126 2 * FRAME_THEORETICAL_TOP_TOOLBAR_BORDER_WIDTH (f) +
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3127 2 * FRAME_THEORETICAL_BOTTOM_TOOLBAR_BORDER_WIDTH (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3128
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
3129 /* Convert to chars so that the displayable area is pixel_width x
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
3130 pixel_height.
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
3131
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
3132 #### Consider rounding up to 0.5 characters to avoid adding too
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
3133 much space. */
1125
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3134 switch (pixel_to_char)
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
3135 {
1125
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3136 case DISPLAYABLE_PIXEL_TO_CHAR:
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
3137 if (char_width)
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
3138 *char_width = ROUND_UP (*pixel_width, cpw) / cpw;
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
3139 if (char_height)
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
3140 *char_height = ROUND_UP (*pixel_height, cph) / cph;
1125
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3141 break;
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3142 case TOTAL_PIXEL_TO_CHAR:
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3143 /* Convert to chars so that the total frame size is pixel_width x
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3144 pixel_height. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3145 if (char_width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3146 *char_width = 1 + ((*pixel_width - egw) - bdr - obw) / cpw;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3147 if (char_height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3148 *char_height = (*pixel_height - bdr - obh) / cph;
1125
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3149 break;
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3150 case CHAR_TO_TOTAL_PIXEL:
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3151 if (pixel_width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3152 *pixel_width = (*char_width - 1) * cpw + egw + bdr + obw;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3153 if (pixel_height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3154 *pixel_height = *char_height * cph + bdr + obh;
1125
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3155 break;
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3156 case CHAR_TO_DISPLAYABLE_PIXEL:
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3157 if (pixel_width)
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3158 *pixel_width = *char_width * cpw;
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3159 if (pixel_height)
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3160 *pixel_height = *char_height * cph;
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3161 break;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3162 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3163 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3164
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3165 /* This takes the size in pixels of the text area, and returns the number
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3166 of characters that will fit there, taking into account the internal
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3167 border width, and the pixel width of the line terminator glyphs (which
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3168 always count as one "character" wide, even if they are not the same size
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3169 as the default character size of the default font). The frame scrollbar
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3170 width and left and right toolbar widths are also subtracted out of the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3171 available width. The frame scrollbar height and top and bottom toolbar
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3172 heights are subtracted out of the available height.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3173
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3174 Therefore the result is not necessarily a multiple of anything in
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3175 particular. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3176 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3177 pixel_to_char_size (struct frame *f, int pixel_width, int pixel_height,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3178 int *char_width, int *char_height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3179 {
1125
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3180 frame_conversion_internal (f, TOTAL_PIXEL_TO_CHAR,
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3181 &pixel_width, &pixel_height, char_width,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3182 char_height, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3183 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3184
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3185 /* Given a character size, this returns the minimum number of pixels
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3186 necessary to display that many characters, taking into account the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3187 internal border width, scrollbar height and width, toolbar heights and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3188 widths and the size of the line terminator glyphs (assuming the line
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3189 terminators take up exactly one character position).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3190
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3191 Therefore the result is not necessarily a multiple of anything in
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3192 particular. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3193 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3194 char_to_pixel_size (struct frame *f, int char_width, int char_height,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3195 int *pixel_width, int *pixel_height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3196 {
1125
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3197 frame_conversion_internal (f, CHAR_TO_TOTAL_PIXEL,
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3198 pixel_width, pixel_height, &char_width,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3199 &char_height, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3200 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3201
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3202 /* Given a pixel size, rounds DOWN to the smallest size in pixels necessary
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3203 to display the same number of characters as are displayable now.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3204 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3205 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3206 round_size_to_char (struct frame *f, int in_width, int in_height,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3207 int *out_width, int *out_height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3208 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3209 int char_width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3210 int char_height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3211 pixel_to_char_size (f, in_width, in_height, &char_width, &char_height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3212 char_to_pixel_size (f, char_width, char_height, out_width, out_height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3213 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3214
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3215 /* Versions of the above which always account for real font metrics.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3216 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3217 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3218 pixel_to_real_char_size (struct frame *f, int pixel_width, int pixel_height,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3219 int *char_width, int *char_height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3220 {
1125
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3221 frame_conversion_internal (f, TOTAL_PIXEL_TO_CHAR,
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3222 &pixel_width, &pixel_height, char_width,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3223 char_height, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3224 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3225
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3226 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3227 char_to_real_pixel_size (struct frame *f, int char_width, int char_height,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3228 int *pixel_width, int *pixel_height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3229 {
1125
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3230 frame_conversion_internal (f, CHAR_TO_TOTAL_PIXEL,
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3231 pixel_width, pixel_height, &char_width,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3232 &char_height, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3233 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3234
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3235 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3236 round_size_to_real_char (struct frame *f, int in_width, int in_height,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3237 int *out_width, int *out_height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3238 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3239 int char_width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3240 int char_height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3241 pixel_to_real_char_size (f, in_width, in_height, &char_width, &char_height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3242 char_to_real_pixel_size (f, char_width, char_height, out_width, out_height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3243 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3244
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3245 /* Change the frame height and/or width. Values may be given as zero to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3246 indicate no change is to take place. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3247 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3248 change_frame_size_1 (struct frame *f, int newheight, int newwidth)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3249 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3250 Lisp_Object frame;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3251 int new_pixheight, new_pixwidth;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3252 int font_height, real_font_height, font_width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3253
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3254 /* #### Chuck -- shouldn't we be checking to see if the frame
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3255 is being "changed" to its existing size, and do nothing if so? */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3256 /* No, because it would hose toolbar updates. The toolbar
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3257 update code relies on this function to cause window `top' and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3258 `left' coordinates to be recomputed even though no frame size
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3259 change occurs. --kyle */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3260 if (in_display)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3261 abort ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3262
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
3263 frame = wrap_frame (f);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3264
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3265 default_face_height_and_width (frame, &real_font_height, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3266 default_face_height_and_width_1 (frame, &font_height, &font_width);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3267
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3268 /* This size-change overrides any pending one for this frame. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3269 FRAME_NEW_HEIGHT (f) = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3270 FRAME_NEW_WIDTH (f) = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3271
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3272 new_pixheight = newheight * font_height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3273 new_pixwidth = (newwidth - 1) * font_width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3274
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3275 /* #### dependency on FRAME_WIN_P should be removed. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3276 if (FRAME_WIN_P (f))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3277 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3278 new_pixheight += FRAME_SCROLLBAR_HEIGHT (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3279 new_pixwidth += FRAME_SCROLLBAR_WIDTH (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3280 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3281
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3282 /* when frame_conversion_internal() calculated the number of rows/cols
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3283 in the frame, the theoretical toolbar sizes were subtracted out.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3284 The calculations below adjust for real toolbar height/width in
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3285 frame, which may be different from frame spec, taking the above
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3286 fact into account */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3287 new_pixheight +=
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3288 + FRAME_THEORETICAL_TOP_TOOLBAR_HEIGHT (f)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3289 + 2 * FRAME_THEORETICAL_TOP_TOOLBAR_BORDER_WIDTH (f)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3290 - FRAME_REAL_TOP_TOOLBAR_HEIGHT (f)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3291 - 2 * FRAME_REAL_TOP_TOOLBAR_BORDER_WIDTH (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3292
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3293 new_pixheight +=
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3294 + FRAME_THEORETICAL_BOTTOM_TOOLBAR_HEIGHT (f)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3295 + 2 * FRAME_THEORETICAL_BOTTOM_TOOLBAR_BORDER_WIDTH (f)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3296 - FRAME_REAL_BOTTOM_TOOLBAR_HEIGHT (f)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3297 - 2 * FRAME_REAL_BOTTOM_TOOLBAR_BORDER_WIDTH (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3298
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3299 new_pixwidth +=
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3300 + FRAME_THEORETICAL_LEFT_TOOLBAR_WIDTH (f)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3301 + 2 * FRAME_THEORETICAL_LEFT_TOOLBAR_BORDER_WIDTH (f)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3302 - FRAME_REAL_LEFT_TOOLBAR_WIDTH (f)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3303 - 2 * FRAME_REAL_LEFT_TOOLBAR_BORDER_WIDTH (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3304
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3305 new_pixwidth +=
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3306 + FRAME_THEORETICAL_RIGHT_TOOLBAR_WIDTH (f)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3307 + 2 * FRAME_THEORETICAL_RIGHT_TOOLBAR_BORDER_WIDTH (f)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3308 - FRAME_REAL_RIGHT_TOOLBAR_WIDTH (f)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3309 - 2 * FRAME_REAL_RIGHT_TOOLBAR_BORDER_WIDTH (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3310
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3311 /* Adjust the width for the end glyph which may be a different width
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3312 than the default character width. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3313 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3314 int adjustment, trunc_width, cont_width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3315
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
3316 trunc_width = glyph_width (Vtruncation_glyph,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3317 FRAME_SELECTED_WINDOW (f));
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
3318 cont_width = glyph_width (Vcontinuation_glyph,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3319 FRAME_SELECTED_WINDOW (f));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3320 adjustment = max (trunc_width, cont_width);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3321 adjustment = max (adjustment, font_width);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3322
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3323 new_pixwidth += adjustment;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3324 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3325
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3326 /* If we don't have valid values, exit. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3327 if (!new_pixheight && !new_pixwidth)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3328 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3329
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3330 if (new_pixheight)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3331 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3332 /* Adjust for gutters here so that we always get set
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3333 properly. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3334 new_pixheight -=
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3335 (FRAME_TOP_GUTTER_BOUNDS (f)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3336 + FRAME_BOTTOM_GUTTER_BOUNDS (f));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3337
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3338 XWINDOW (FRAME_ROOT_WINDOW (f))->pixel_top
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3339 = FRAME_TOP_BORDER_END (f) + FRAME_TOP_GUTTER_BOUNDS (f);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3340
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3341 if (FRAME_HAS_MINIBUF_P (f)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3342 && ! FRAME_MINIBUF_ONLY_P (f))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3343 /* Frame has both root and minibuffer. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3344 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3345 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3346 * Leave the minibuffer height the same if the frame has
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3347 * been initialized, and the minibuffer height is tall
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3348 * enough to display at least one line of text in the default
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3349 * font, and the old minibuffer height is a multiple of the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3350 * default font height. This should cause the minibuffer
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3351 * height to be recomputed on font changes but not for
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3352 * other frame size changes, which seems reasonable.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3353 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3354 int old_minibuf_height =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3355 XWINDOW(FRAME_MINIBUF_WINDOW(f))->pixel_height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3356 int minibuf_height =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3357 f->init_finished && (old_minibuf_height % real_font_height) == 0 ?
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3358 max(old_minibuf_height, real_font_height) :
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3359 real_font_height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3360 set_window_pixheight (FRAME_ROOT_WINDOW (f),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3361 /* - font_height for minibuffer */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3362 new_pixheight - minibuf_height, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3363
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3364 XWINDOW (FRAME_MINIBUF_WINDOW (f))->pixel_top =
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3365 FRAME_TOP_BORDER_END (f) +
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3366 FRAME_TOP_GUTTER_BOUNDS (f) +
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3367 FRAME_BOTTOM_GUTTER_BOUNDS (f) +
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3368 new_pixheight - minibuf_height;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3369
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3370 set_window_pixheight (FRAME_MINIBUF_WINDOW (f), minibuf_height, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3371 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3372 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3373 /* Frame has just one top-level window. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3374 set_window_pixheight (FRAME_ROOT_WINDOW (f), new_pixheight, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3375
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3376 FRAME_HEIGHT (f) = newheight;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3377 if (FRAME_TTY_P (f))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3378 f->pixheight = newheight;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3379 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3380
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3381 if (new_pixwidth)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3382 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3383 /* Adjust for gutters here so that we always get set
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3384 properly. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3385 new_pixwidth -=
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3386 (FRAME_LEFT_GUTTER_BOUNDS (f)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3387 + FRAME_RIGHT_GUTTER_BOUNDS (f));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3388
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3389 XWINDOW (FRAME_ROOT_WINDOW (f))->pixel_left =
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3390 FRAME_LEFT_BORDER_END (f) + FRAME_LEFT_GUTTER_BOUNDS (f);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3391 set_window_pixwidth (FRAME_ROOT_WINDOW (f), new_pixwidth, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3392
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3393 if (FRAME_HAS_MINIBUF_P (f))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3394 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3395 XWINDOW (FRAME_MINIBUF_WINDOW (f))->pixel_left =
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3396 FRAME_LEFT_BORDER_END (f) + FRAME_LEFT_GUTTER_BOUNDS (f);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3397 set_window_pixwidth (FRAME_MINIBUF_WINDOW (f), new_pixwidth, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3398 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3399
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3400 FRAME_WIDTH (f) = newwidth;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3401 if (FRAME_TTY_P (f))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3402 f->pixwidth = newwidth;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3403 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3404
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3405 if (window_system_pixelated_geometry (frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3406 pixel_to_real_char_size (f, FRAME_PIXWIDTH (f), FRAME_PIXHEIGHT (f),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3407 &FRAME_CHARWIDTH (f), &FRAME_CHARHEIGHT (f));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3408 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3409 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3410 FRAME_CHARWIDTH (f) = FRAME_WIDTH (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3411 FRAME_CHARHEIGHT (f) = FRAME_HEIGHT (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3412 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3413
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3414 MARK_FRAME_TOOLBARS_CHANGED (f);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3415 MARK_FRAME_GUTTERS_CHANGED (f);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3416 MARK_FRAME_CHANGED (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3417 f->echo_area_garbaged = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3418 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3419
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3420 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3421 change_frame_size (struct frame *f, int newheight, int newwidth, int delay)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3422 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3423 /* sometimes we get passed a size that's too small (esp. when a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3424 client widget gets resized, since we have no control over this).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3425 So deal. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3426 check_frame_size (f, &newheight, &newwidth);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3427
450
98528da0b7fc Import from CVS: tag r21-2-40
cvs
parents: 444
diff changeset
3428 /* Unconditionally mark that the frame has changed size. This is
98528da0b7fc Import from CVS: tag r21-2-40
cvs
parents: 444
diff changeset
3429 because many things need to know after the
98528da0b7fc Import from CVS: tag r21-2-40
cvs
parents: 444
diff changeset
3430 fact. f->size_change_pending will get reset below. The most that
98528da0b7fc Import from CVS: tag r21-2-40
cvs
parents: 444
diff changeset
3431 can happen is that we will cycle through redisplay once more
98528da0b7fc Import from CVS: tag r21-2-40
cvs
parents: 444
diff changeset
3432 --andy. */
98528da0b7fc Import from CVS: tag r21-2-40
cvs
parents: 444
diff changeset
3433 MARK_FRAME_SIZE_CHANGED (f);
98528da0b7fc Import from CVS: tag r21-2-40
cvs
parents: 444
diff changeset
3434
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3435 if (delay || in_display || gc_in_progress)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3436 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3437 f->new_width = newwidth;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3438 f->new_height = newheight;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3439 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3440 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3441
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3442 f->size_change_pending = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3443 /* For TTY frames, it's like one, like all ...
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3444 Can't have two TTY frames of different sizes on the same device. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3445 if (FRAME_TTY_P (f))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3446 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3447 Lisp_Object frmcons;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3448
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3449 DEVICE_FRAME_LOOP (frmcons, XDEVICE (FRAME_DEVICE (f)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3450 change_frame_size_1 (XFRAME (XCAR (frmcons)), newheight, newwidth);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3451 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3452 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3453 change_frame_size_1 (f, newheight, newwidth);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3454 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3455
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3456
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
3457 /* The caller is responsible for freeing the returned string. */
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 863
diff changeset
3458 static Ibyte *
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
3459 generate_title_string (struct window *w, Lisp_Object format_str,
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
3460 face_index findex, int type)
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
3461 {
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
3462 struct display_line *dl;
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
3463 struct display_block *db;
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
3464 int elt = 0;
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
3465
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
3466 dl = &title_string_display_line;
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
3467 db = get_display_block_from_line (dl, TEXT);
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
3468 Dynarr_reset (db->runes);
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
3469
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
3470 generate_formatted_string_db (format_str, Qnil, w, dl, db, findex, 0,
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
3471 -1, type);
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
3472
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 863
diff changeset
3473 Dynarr_reset (title_string_ichar_dynarr);
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
3474 while (elt < Dynarr_length (db->runes))
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
3475 {
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
3476 if (Dynarr_atp (db->runes, elt)->type == RUNE_CHAR)
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 863
diff changeset
3477 Dynarr_add (title_string_ichar_dynarr,
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
3478 Dynarr_atp (db->runes, elt)->object.chr.ch);
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
3479 elt++;
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
3480 }
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
3481
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
3482 return
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 863
diff changeset
3483 convert_ichar_string_into_malloced_string
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 863
diff changeset
3484 (Dynarr_atp (title_string_ichar_dynarr, 0),
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 863
diff changeset
3485 Dynarr_length (title_string_ichar_dynarr), 0);
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
3486 }
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
3487
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3488 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3489 update_frame_title (struct frame *f)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3490 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3491 struct window *w = XWINDOW (FRAME_SELECTED_WINDOW (f));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3492 Lisp_Object title_format;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3493 Lisp_Object icon_format;
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 863
diff changeset
3494 Ibyte *title;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3495
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3496 /* We don't change the title for the minibuffer unless the frame
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3497 only has a minibuffer. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3498 if (MINI_WINDOW_P (w) && !FRAME_MINIBUF_ONLY_P (f))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3499 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3500
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3501 /* And we don't want dead buffers to blow up on us. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3502 if (!BUFFER_LIVE_P (XBUFFER (w->buffer)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3503 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3504
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3505 title = NULL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3506 title_format = symbol_value_in_buffer (Qframe_title_format, w->buffer);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3507 icon_format = symbol_value_in_buffer (Qframe_icon_title_format, w->buffer);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3508
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 863
diff changeset
3509 if (HAS_FRAMEMETH_P (f, set_title_from_ibyte))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3510 {
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
3511 title = generate_title_string (w, title_format,
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
3512 DEFAULT_INDEX, CURRENT_DISP);
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 863
diff changeset
3513 FRAMEMETH (f, set_title_from_ibyte, (f, title));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3514 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3515
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 863
diff changeset
3516 if (HAS_FRAMEMETH_P (f, set_icon_name_from_ibyte))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3517 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3518 if (!EQ (icon_format, title_format) || !title)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3519 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3520 if (title)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3521 xfree (title);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3522
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
3523 title = generate_title_string (w, icon_format,
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
3524 DEFAULT_INDEX, CURRENT_DISP);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3525 }
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 863
diff changeset
3526 FRAMEMETH (f, set_icon_name_from_ibyte, (f, title));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3527 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3528
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3529 if (title)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3530 xfree (title);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3531 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3532
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3533
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3534 DEFUN ("set-frame-pointer", Fset_frame_pointer, 2, 2, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3535 Set the mouse pointer of FRAME to the given pointer image instance.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3536 You should not call this function directly. Instead, set one of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3537 the variables `text-pointer-glyph', `nontext-pointer-glyph',
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3538 `modeline-pointer-glyph', `selection-pointer-glyph',
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3539 `busy-pointer-glyph', or `toolbar-pointer-glyph'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3540 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3541 (frame, image_instance))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3542 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3543 struct frame *f = decode_frame (frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3544 CHECK_POINTER_IMAGE_INSTANCE (image_instance);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3545 if (!EQ (f->pointer, image_instance))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3546 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3547 f->pointer = image_instance;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3548 MAYBE_FRAMEMETH (f, set_frame_pointer, (f));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3549 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3550 return Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3551 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3552
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3553
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3554 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3555 update_frame_icon (struct frame *f)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3556 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3557 if (f->icon_changed || f->windows_changed)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3558 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3559 Lisp_Object frame;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3560 Lisp_Object new_icon;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3561
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
3562 frame = wrap_frame (f);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3563 new_icon = glyph_image_instance (Vframe_icon_glyph, frame,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3564 ERROR_ME_WARN, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3565 if (!EQ (new_icon, f->icon))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3566 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3567 f->icon = new_icon;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3568 MAYBE_FRAMEMETH (f, set_frame_icon, (f));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3569 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3570 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3571
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3572 f->icon_changed = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3573 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3574
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3575 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3576 icon_glyph_changed (Lisp_Object glyph, Lisp_Object property,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3577 Lisp_Object locale)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3578 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3579 MARK_ICON_CHANGED;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3580 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3581
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3582
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
3583 /***************************************************************************/
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
3584 /* */
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
3585 /* initialization */
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
3586 /* */
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
3587 /***************************************************************************/
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
3588
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
3589 void
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
3590 init_frame (void)
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
3591 {
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
3592 #ifndef PDUMP
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
3593 if (!initialized)
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
3594 #endif
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
3595 {
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 863
diff changeset
3596 title_string_ichar_dynarr = Dynarr_new (Ichar);
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
3597 xzero (title_string_display_line);
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
3598 }
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
3599 }
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
3600
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3601 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3602 syms_of_frame (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3603 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3604 INIT_LRECORD_IMPLEMENTATION (frame);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3605
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3606 DEFSYMBOL (Qdelete_frame_hook);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3607 DEFSYMBOL (Qselect_frame_hook);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3608 DEFSYMBOL (Qdeselect_frame_hook);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3609 DEFSYMBOL (Qcreate_frame_hook);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3610 DEFSYMBOL (Qcustom_initialize_frame);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3611 DEFSYMBOL (Qmouse_enter_frame_hook);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3612 DEFSYMBOL (Qmouse_leave_frame_hook);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3613 DEFSYMBOL (Qmap_frame_hook);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3614 DEFSYMBOL (Qunmap_frame_hook);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3615
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3616 DEFSYMBOL (Qframep);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3617 DEFSYMBOL (Qframe_live_p);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3618 DEFSYMBOL (Qdelete_frame);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3619 DEFSYMBOL (Qsynchronize_minibuffers);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3620 DEFSYMBOL (Qbuffer_predicate);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3621 DEFSYMBOL (Qframe_being_created);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3622 DEFSYMBOL (Qmake_initial_minibuffer_frame);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3623
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3624 DEFSYMBOL (Qframe_title_format);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3625 DEFSYMBOL (Qframe_icon_title_format);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3626
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3627 DEFSYMBOL (Qhidden);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3628 DEFSYMBOL (Qvisible);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3629 DEFSYMBOL (Qiconic);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3630 DEFSYMBOL (Qinvisible);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3631 DEFSYMBOL (Qvisible_iconic);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3632 DEFSYMBOL (Qinvisible_iconic);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3633 DEFSYMBOL (Qnomini);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3634 DEFSYMBOL (Qvisible_nomini);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3635 DEFSYMBOL (Qiconic_nomini);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3636 DEFSYMBOL (Qinvisible_nomini);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3637 DEFSYMBOL (Qvisible_iconic_nomini);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3638 DEFSYMBOL (Qinvisible_iconic_nomini);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3639
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3640 DEFSYMBOL (Qminibuffer);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3641 DEFSYMBOL (Qunsplittable);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3642 DEFSYMBOL (Qinternal_border_width);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3643 DEFSYMBOL (Qtop_toolbar_shadow_color);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3644 DEFSYMBOL (Qbottom_toolbar_shadow_color);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3645 DEFSYMBOL (Qbackground_toolbar_color);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3646 DEFSYMBOL (Qtop_toolbar_shadow_pixmap);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3647 DEFSYMBOL (Qbottom_toolbar_shadow_pixmap);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3648 DEFSYMBOL (Qtoolbar_shadow_thickness);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3649 DEFSYMBOL (Qscrollbar_placement);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3650 DEFSYMBOL (Qinter_line_space);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3651 /* Qiconic already in this function. */
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3652 DEFSYMBOL (Qvisual_bell);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3653 DEFSYMBOL (Qbell_volume);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3654 DEFSYMBOL (Qpointer_background);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3655 DEFSYMBOL (Qpointer_color);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3656 DEFSYMBOL (Qtext_pointer);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3657 DEFSYMBOL (Qspace_pointer);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3658 DEFSYMBOL (Qmodeline_pointer);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3659 DEFSYMBOL (Qgc_pointer);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3660 DEFSYMBOL (Qinitially_unmapped);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3661 DEFSYMBOL (Quse_backing_store);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3662 DEFSYMBOL (Qborder_color);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3663 DEFSYMBOL (Qborder_width);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3664 /* Qwidth, Qheight, Qleft, Qtop in general.c */
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3665 DEFSYMBOL (Qset_specifier);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3666 DEFSYMBOL (Qset_face_property);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3667 DEFSYMBOL (Qface_property_instance);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
3668 DEFSYMBOL (Qframe_property_alias);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3669
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3670 DEFSUBR (Fmake_frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3671 DEFSUBR (Fframep);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3672 DEFSUBR (Fframe_live_p);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3673 #if 0 /* FSFmacs */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3674 DEFSUBR (Fignore_event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3675 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3676 DEFSUBR (Ffocus_frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3677 DEFSUBR (Fselect_frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3678 DEFSUBR (Fselected_frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3679 DEFSUBR (Factive_minibuffer_window);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3680 DEFSUBR (Flast_nonminibuf_frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3681 DEFSUBR (Fframe_root_window);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3682 DEFSUBR (Fframe_selected_window);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3683 DEFSUBR (Fset_frame_selected_window);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3684 DEFSUBR (Fframe_device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3685 DEFSUBR (Fnext_frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3686 DEFSUBR (Fprevious_frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3687 DEFSUBR (Fdelete_frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3688 DEFSUBR (Fmouse_position);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3689 DEFSUBR (Fmouse_pixel_position);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3690 DEFSUBR (Fmouse_position_as_motion_event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3691 DEFSUBR (Fset_mouse_position);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3692 DEFSUBR (Fset_mouse_pixel_position);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3693 DEFSUBR (Fmake_frame_visible);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3694 DEFSUBR (Fmake_frame_invisible);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3695 DEFSUBR (Ficonify_frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3696 DEFSUBR (Fdeiconify_frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3697 DEFSUBR (Fframe_visible_p);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3698 DEFSUBR (Fframe_totally_visible_p);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3699 DEFSUBR (Fframe_iconified_p);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3700 DEFSUBR (Fvisible_frame_list);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3701 DEFSUBR (Fraise_frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3702 DEFSUBR (Flower_frame);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3703 DEFSUBR (Fdisable_frame);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3704 DEFSUBR (Fenable_frame);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3705 DEFSUBR (Fframe_property);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3706 DEFSUBR (Fframe_properties);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3707 DEFSUBR (Fset_frame_properties);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3708 DEFSUBR (Fframe_pixel_height);
1125
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3709 DEFSUBR (Fframe_displayable_pixel_height);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3710 DEFSUBR (Fframe_pixel_width);
1125
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3711 DEFSUBR (Fframe_displayable_pixel_width);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3712 DEFSUBR (Fframe_name);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3713 DEFSUBR (Fframe_modified_tick);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3714 DEFSUBR (Fset_frame_height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3715 DEFSUBR (Fset_frame_width);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3716 DEFSUBR (Fset_frame_size);
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
3717 DEFSUBR (Fset_frame_pixel_height);
1125
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3718 DEFSUBR (Fset_frame_displayable_pixel_height);
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
3719 DEFSUBR (Fset_frame_pixel_width);
1125
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3720 DEFSUBR (Fset_frame_displayable_pixel_width);
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
3721 DEFSUBR (Fset_frame_pixel_size);
1125
ecb17ab2f7ab [xemacs-hg @ 2002-11-28 12:30:09 by michaels]
michaels
parents: 1123
diff changeset
3722 DEFSUBR (Fset_frame_displayable_pixel_size);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3723 DEFSUBR (Fset_frame_position);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3724 DEFSUBR (Fset_frame_pointer);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3725 DEFSUBR (Fprint_job_page_number);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3726 DEFSUBR (Fprint_job_eject_page);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3727 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3728
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3729 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3730 vars_of_frame (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3731 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3732 /* */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3733 Vframe_being_created = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3734 staticpro (&Vframe_being_created);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3735
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3736 #ifdef HAVE_CDE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3737 Fprovide (intern ("cde"));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3738 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3739
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3740 #ifdef HAVE_OFFIX_DND
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3741 Fprovide (intern ("offix"));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3742 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3743
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3744 #if 0 /* FSFmacs stupidity */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3745 xxDEFVAR_LISP ("emacs-iconified", &Vemacs_iconified /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3746 Non-nil if all of emacs is iconified and frame updates are not needed.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3747 */ );
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3748 Vemacs_iconified = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3749 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3750
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3751 DEFVAR_LISP ("select-frame-hook", &Vselect_frame_hook /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3752 Function or functions to run just after a new frame is given the focus.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3753 Note that calling `select-frame' does not necessarily set the focus:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3754 The actual window-system focus will not be changed until the next time
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3755 that XEmacs is waiting for an event, and even then, the window manager
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3756 may refuse the focus-change request.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3757 */ );
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3758 Vselect_frame_hook = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3759
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3760 DEFVAR_LISP ("deselect-frame-hook", &Vdeselect_frame_hook /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3761 Function or functions to run just before a frame loses the focus.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3762 See `select-frame-hook'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3763 */ );
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3764 Vdeselect_frame_hook = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3765
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3766 DEFVAR_LISP ("delete-frame-hook", &Vdelete_frame_hook /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3767 Function or functions to call when a frame is deleted.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3768 One argument, the about-to-be-deleted frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3769 */ );
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3770 Vdelete_frame_hook = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3771
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3772 DEFVAR_LISP ("create-frame-hook", &Vcreate_frame_hook /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3773 Function or functions to call when a frame is created.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3774 One argument, the newly-created frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3775 */ );
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3776 Vcreate_frame_hook = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3777
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3778 DEFVAR_LISP ("mouse-enter-frame-hook", &Vmouse_enter_frame_hook /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3779 Function or functions to call when the mouse enters a frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3780 One argument, the frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3781 Be careful not to make assumptions about the window manager's focus model.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3782 In most cases, the `deselect-frame-hook' is more appropriate.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3783 */ );
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3784 Vmouse_enter_frame_hook = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3785
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3786 DEFVAR_LISP ("mouse-leave-frame-hook", &Vmouse_leave_frame_hook /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3787 Function or functions to call when the mouse leaves a frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3788 One argument, the frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3789 Be careful not to make assumptions about the window manager's focus model.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3790 In most cases, the `select-frame-hook' is more appropriate.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3791 */ );
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3792 Vmouse_leave_frame_hook = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3793
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3794 DEFVAR_LISP ("map-frame-hook", &Vmap_frame_hook /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3795 Function or functions to call when a frame is mapped.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3796 One argument, the frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3797 */ );
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3798 Vmap_frame_hook = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3799
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3800 DEFVAR_LISP ("unmap-frame-hook", &Vunmap_frame_hook /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3801 Function or functions to call when a frame is unmapped.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3802 One argument, the frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3803 */ );
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3804 Vunmap_frame_hook = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3805
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3806 DEFVAR_BOOL ("allow-deletion-of-last-visible-frame",
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3807 &allow_deletion_of_last_visible_frame /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3808 *Non-nil means to assume the force option to delete-frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3809 */ );
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3810 allow_deletion_of_last_visible_frame = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3811
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3812 DEFVAR_LISP ("adjust-frame-function", &Vadjust_frame_function /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3813 Function or constant controlling adjustment of frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3814 When scrollbars, toolbars, default font etc. change in frame, the frame
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3815 needs to be adjusted. The adjustment is controlled by this variable.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3816 Legal values are:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3817 nil to keep character frame size unchanged when possible (resize)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3818 t to keep pixel size unchanged (never resize)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3819 function symbol or lambda form. This function must return boolean
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3820 value which is treated as above. Function is passed one parameter,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3821 the frame being adjusted. It function should not modify or delete
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3822 the frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3823 */ );
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3824 Vadjust_frame_function = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3825
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3826 DEFVAR_LISP ("mouse-motion-handler", &Vmouse_motion_handler /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3827 Handler for motion events. One arg, the event.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3828 For most applications, you should use `mode-motion-hook' instead of this.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3829 */ );
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3830 Vmouse_motion_handler = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3831
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3832 DEFVAR_LISP ("synchronize-minibuffers",&Vsynchronize_minibuffers /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3833 Set to t if all minibuffer windows are to be synchronized.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3834 This will cause echo area messages to appear in the minibuffers of all
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3835 visible frames.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3836 */ );
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3837 Vsynchronize_minibuffers = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3838
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3839 DEFVAR_LISP ("frame-title-format", &Vframe_title_format /*
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3840 Controls the title of the window-system window of the selected frame.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3841 This is the same format as `modeline-format' with the exception that
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3842 %- is ignored.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3843 */ );
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3844 /* #### I would change this unilaterally but for the wrath of the Kyles
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3845 of the world. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3846 #ifdef WIN32_NATIVE
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3847 Vframe_title_format = build_string ("%b - XEmacs");
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3848 #else
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3849 Vframe_title_format = build_string ("%S: %b");
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3850 #endif
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3851
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3852 DEFVAR_LISP ("frame-icon-title-format", &Vframe_icon_title_format /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3853 Controls the title of the icon corresponding to the selected frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3854 See also the variable `frame-title-format'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3855 */ );
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3856 Vframe_icon_title_format = build_string ("%b");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3857
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3858 DEFVAR_LISP ("default-frame-name", &Vdefault_frame_name /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3859 The default name to assign to newly-created frames.
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3860 This can be overridden by arguments to `make-frame'. This must be a string.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3861 This is used primarily for picking up X resources, and is *not* the title
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3862 of the frame. (See `frame-title-format'.)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3863 */ );
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3864 #ifndef INFODOCK
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3865 Vdefault_frame_name = build_string ("emacs");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3866 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3867 Vdefault_frame_name = build_string ("InfoDock");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3868 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3869
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3870 DEFVAR_LISP ("default-frame-plist", &Vdefault_frame_plist /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3871 Plist of default values for frame creation, other than the first one.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3872 These may be set in your init file, like this:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3873
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3874 \(setq default-frame-plist '(width 80 height 55))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3875
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3876 The properties may be in alist format for backward compatibility
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3877 but you should not rely on this behavior.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3878
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3879 These override values given in window system configuration data,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3880 including X Windows' defaults database.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3881
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3882 Since the first X frame is created before loading your .emacs file,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3883 you must use the X resource database for that.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3884
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3885 For values specific to the first Emacs frame, see `initial-frame-plist'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3886 For values specific to the separate minibuffer frame, see
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3887 `minibuffer-frame-plist'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3888
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3889 See also the variables `default-x-frame-plist' and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3890 `default-tty-frame-plist', which are like `default-frame-plist'
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3891 except that they apply only to X or tty frames, respectively
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3892 \(whereas `default-frame-plist' applies to all types of frames).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3893 */ );
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3894 Vdefault_frame_plist = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3895
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3896 DEFVAR_LISP ("frame-icon-glyph", &Vframe_icon_glyph /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3897 Icon glyph used to iconify a frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3898 */ );
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3899 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3900
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3901 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3902 complex_vars_of_frame (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3903 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3904 Vframe_icon_glyph = allocate_glyph (GLYPH_ICON, icon_glyph_changed);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3905 }