Mercurial > hg > xemacs-beta
annotate src/frame.c @ 5363:311f6817efc2
Remove various redundant wrapper lambdas, core lisp.
2011-03-08 Aidan Kehoe <kehoea@parhasard.net>
* package-ui.el (pui-add-required-packages):
* packages.el (packages-handle-package-dumped-lisps):
* bytecomp-runtime.el (byte-compile-with-fboundp):
* bytecomp-runtime.el (globally-declare-fboundp):
* bytecomp-runtime.el
(byte-compile-with-byte-compiler-warnings-suppressed):
* mule/devan-util.el (devanagari-reorder-glyphs-for-composition):
* mule/devan-util.el (devanagari-compose-to-one-glyph):
* mule/japanese.el:
* mule/japanese.el ("Japanese"):
* mule/make-coding-system.el (fixed-width-generate-helper):
* mule/mule-category.el (defined-category-list):
* mule/mule-category.el (undefined-category-designator):
Style change: remove redundant lambdas, things like (mapcar
#'(lambda (pkg) (symbol-name pkg)) ...) => (mapcar #'symbol-name ...).
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Tue, 08 Mar 2011 18:12:48 +0000 |
parents | 94982b8f9485 |
children | 3889ef128488 308d34e9f07d |
rev | line source |
---|---|
428 | 1 /* Generic frame functions. |
2 Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. | |
5043 | 3 Copyright (C) 1995, 1996, 2002, 2003, 2005, 2010 Ben Wing. |
428 | 4 Copyright (C) 1995 Sun Microsystems, Inc. |
5 | |
6 This file is part of XEmacs. | |
7 | |
8 XEmacs is free software; you can redistribute it and/or modify it | |
9 under the terms of the GNU General Public License as published by the | |
10 Free Software Foundation; either version 2, or (at your option) any | |
11 later version. | |
12 | |
13 XEmacs is distributed in the hope that it will be useful, but WITHOUT | |
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
19 along with XEmacs; see the file COPYING. If not, write to | |
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
21 Boston, MA 02111-1307, USA. */ | |
22 | |
23 /* Synched up with: FSF 19.30. */ | |
24 | |
25 /* This file has been Mule-ized. */ | |
26 | |
5043 | 27 /* About window and frame geometry [ben]: |
28 | |
29 Here is an ASCII diagram: | |
30 | |
5046 | 31 +------------------------------------------------------------------------| |
32 | window-manager decoration | | |
33 | +--------------------------------------------------------------------+ | | |
34 | | menubar | | | |
35 | ###################################################################### | | |
36 | # toolbar # | | |
37 | #--------------------------------------------------------------------# | | |
5090 | 38 | # | internal border | # | |
39 | # | +----------------------------------------------------------+ | # | | |
40 | # | | gutter | | # | | |
41 | # | |-********************************************************-| | # | | |
42 |w# | | *@| scrollbar |v* |s* | | #w| | |
43 |i# | | *-+-------------------------|e* |c* | | #i| | |
44 |n# | | *s| |r* |r* | | #n| | |
45 |d# | | *c| |t* |o* | | #d| | |
46 |o# | | *r| |.* text area |l* | | #o| | |
47 |w# |i| *o| | * |l* |i| #w| | |
48 |-# |n| *l| text area |d* |b* |n| #-| | |
49 |m# |t| *l| |i* |a* |t| #m| | |
50 |a# |e| *b| |v* |r* |e| #a| | |
51 |n# t|r| *a| |i*----------------------+-* |r|t #n| | |
52 |a# o|n|g*r| |d* scrollbar |@*g|n|o #a| | |
53 |g# o|a|u*-+-------------------------|e*----------------------+-*u|a|o #g| | |
54 |e# l|l|t* modeline |r* modeline *t|l|l #e| | |
55 |r# b| |t********************************************************t| |b #r| | |
56 | # a|b|e* =..texttexttex....= |s|v* |s*e|b|a # | | |
57 |d# r|o|r*o m=..texttexttextt..=o m|c|e* |c*r|o|r #d| | |
58 |e# |r| *u a=.exttexttextte...=u a|r|r* |r* |r| #e| | |
59 |c# |d| *t r=....texttexttex..=t r|o|t* |o* |d| #c| | |
60 |o# |e| *s g= etc. =s g|l|.* text area |l* |e| #o| | |
61 |r# |r| *i i= =i i|l| * |l* |r| #r| | |
62 |a# | | *d n= =d n|b|d* |b* | | #a| | |
63 |t# | | *e = inner text area =e |a|i* |a* | | #t| | |
5046 | 64 |i# | | * = = |r|v* |r* | | #i| |
65 |o# | | *---===================---+-|i*----------------------+-* | | #o| | |
5090 | 66 |n# | | * scrollbar |@|d* scrollbar |@* | | #n| |
5046 | 67 | # | | *-------------------------+-|e*----------------------+-* | | # | |
68 | # | | * modeline |r* modeline * | | # | | |
5090 | 69 | # | |-********************************************************-| | # | |
70 | # | | gutter | | # | | |
71 | # | |-********************************************************-| | # | | |
72 | # | |@* minibuffer *@| | # | | |
73 | # | +-********************************************************-+ | # | | |
74 | # | internal border | # | | |
5046 | 75 | #--------------------------------------------------------------------# | |
76 | # toolbar # | | |
77 | ###################################################################### | | |
78 | window manager decoration | | |
79 +------------------------------------------------------------------------+ | |
5043 | 80 |
81 # = boundary of client area; * = window boundaries, boundary of paned area | |
5090 | 82 = = boundary of inner text area; . = inside margin area; @ = dead boxes |
5043 | 83 |
84 Note in particular what happens at the corners, where a "corner box" | |
85 occurs. Top and bottom toolbars take precedence over left and right | |
86 toolbars, extending out horizontally into the corner boxes. Gutters | |
87 work the same way. The corner box where the scrollbars meet, however, | |
88 is assigned to neither scrollbar, and is known as the "dead box"; it is | |
5090 | 89 an area that must be cleared specially. There are similar dead boxes at |
90 the bottom-right and bottom-left corners where the minibuffer and | |
91 left/right gutters meet, but there is currently a bug in that these dead | |
92 boxes are not explicitly cleared and may contain junk. | |
5043 | 93 |
94 THE FRAME | |
95 --------- | |
96 | |
97 The "top-level window area" is the entire area of a top-level window (or | |
98 "frame"). The "client area" (a term from MS Windows) is the area of a | |
99 top-level window that XEmacs draws into and manages with redisplay. | |
100 This includes the toolbar, scrollbars, gutters, dividers, text area, | |
101 modeline and minibuffer. It does not include the menubar, title or | |
102 outer borders. The "non-client area" is the area of a top-level window | |
103 outside of the client area and includes the menubar, title and outer | |
104 borders. Internally, all frame coordinates are relative to the client | |
105 area. | |
106 | |
107 | |
108 THE NON-CLIENT AREA | |
109 ------------------- | |
110 | |
111 Under X, the non-client area is split into two parts: | |
112 | |
113 (1) The outer layer is the window-manager decorations: The title and | |
114 borders. These are controlled by the window manager, a separate process | |
115 that controls the desktop, the location of icons, etc. When a process | |
116 tries to create a window, the window manager intercepts this action and | |
117 "reparents" the window, placing another window around it which contains | |
118 the window decorations, including the title bar, outer borders used for | |
119 resizing, etc. The window manager also implements any actions involving | |
120 the decorations, such as the ability to resize a window by dragging its | |
121 borders, move a window by dragging its title bar, etc. If there is no | |
122 window manager or you kill it, windows will have no decorations (and | |
123 will lose them if they previously had any) and you will not be able to | |
124 move or resize them. | |
125 | |
126 (2) Inside of the window-manager decorations is the "shell", which is | |
127 managed by the toolkit and widget libraries your program is linked with. | |
128 The code in *-x.c uses the Xt toolkit and various possible widget | |
129 libraries built on top of Xt, such as Motif, Athena, the "Lucid" | |
130 widgets, etc. Another possibility is GTK (*-gtk.c), which implements | |
131 both the toolkit and widgets. Under Xt, the "shell" window is an | |
132 EmacsShell widget, containing an EmacsManager widget of the same size, | |
133 which in turn contains a menubar widget and an EmacsFrame widget, inside | |
134 of which is the client area. (The division into EmacsShell and | |
135 EmacsManager is due to the complex and screwy geometry-management system | |
136 in Xt [and X more generally]. The EmacsShell handles negotation with | |
137 the window manager; the place of the EmacsManager widget is normally | |
138 assumed by a widget that manages the geometry of its child widgets, but | |
139 the EmacsManager widget just lets the XEmacs redisplay mechanism do the | |
140 positioning.) | |
141 | |
142 Under Windows, the non-client area is managed by the window system. | |
143 There is no division such as under X. Part of the window-system API | |
144 (USER.DLL) of Win32 includes functions to control the menubars, title, | |
145 etc. and implements the move and resize behavior. There *is* an | |
146 equivalent of the window manager, called the "shell", but it manages | |
147 only the desktop, not the windows themselves. The normal shell under | |
148 Windows is EXPLORER.EXE; if you kill this, you will lose the bar | |
149 containing the "Start" menu and tray and such, but the windows | |
150 themselves will not be affected or lose their decorations. | |
151 | |
152 | |
153 THE CLIENT AREA | |
154 --------------- | |
155 | |
156 Inside of the client area is the toolbars, the gutters (where the buffer | |
157 tabs are displayed), the minibuffer, the internal border width, and one | |
158 or more non-overlapping "windows" (this is old Emacs terminology, from | |
159 before the time when frames existed at all; the standard terminology for | |
160 this would be "pane"). Each window can contain a modeline, horizontal | |
161 and/or vertical scrollbars, and (for non-rightmost windows) a vertical | |
162 divider, surrounding a text area. | |
163 | |
164 The dimensions of the toolbars and gutters are determined by the formula | |
165 (THICKNESS + 2 * BORDER-THICKNESS), where "thickness" is a cover term | |
166 for height or width, as appropriate. The height and width come from | |
167 `default-toolbar-height' and `default-toolbar-width' and the specific | |
168 versions of these (`top-toolbar-height', `left-toolbar-width', etc.). | |
169 The border thickness comes from `default-toolbar-border-height' and | |
170 `default-toolbar-border-width', and the specific versions of these. The | |
171 gutter works exactly equivalently. | |
172 | |
173 Note that for any particular toolbar or gutter, it will only be | |
174 displayed if [a] its visibility specifier (`default-toolbar-visible-p' | |
175 etc.) is non-nil; [b] its thickness (`default-toolbar-height' etc.) is | |
176 greater than 0; [c] its contents (`default-toolbar' etc.) are non-nil. | |
177 | |
178 The position-specific toolbars interact with the default specifications | |
179 as follows: If the value for a position-specific specifier is not | |
180 defined in a particular domain (usually a window), and the position of | |
181 that specifier is set as the default position (using | |
182 `default-toolbar-position'), then the value from the corresponding | |
183 default specifier in that domain will be used. The gutters work the | |
184 same. | |
185 | |
186 | |
187 THE PANED AREA | |
188 -------------- | |
189 | |
5090 | 190 The area occupied by the "windows" is called the paned area. Unfortunately, |
191 because of the presence of the gutter *between* the minibuffer and other | |
192 windows, the bottom of the paned area is not well-defined -- does it | |
193 include the minibuffer (in which case it also includes the bottom gutter, | |
194 but none others) or does it not include the minibuffer? (In which case | |
195 not all windows are included.) #### GEOM! It would be cleaner to put the | |
196 bottom gutter *below* the minibuffer instead of above it. | |
197 | |
198 Each window can include a horizontal and/or vertical scrollbar, a | |
199 modeline and a vertical divider to its right, as well as the text area. | |
200 Only non-rightmost windows can include a vertical divider. (The | |
201 minibuffer normally does not include either modeline or scrollbars.) | |
5043 | 202 |
203 Note that, because the toolbars and gutters are controlled by | |
204 specifiers, and specifiers can have window-specific and buffer-specific | |
205 values, the size of the paned area can change depending on which window | |
206 is selected: In other words, if the selected window or buffer changes, | |
207 the entire paned area for the frame may change. | |
208 | |
209 | |
210 TEXT AREAS, FRINGES, MARGINS | |
211 ---------------------------- | |
212 | |
213 The space occupied by a window can be divided into the text area and the | |
214 fringes. The fringes include the modeline, scrollbars and vertical | |
215 divider on the right side (if any); inside of this is the text area, | |
216 where the text actually occurs. Note that a window may or may not | |
217 contain any of the elements that are part of the fringe -- this is | |
218 controlled by specifiers, e.g. `has-modeline-p', | |
219 `horizontal-scrollbar-visible-p', `vertical-scrollbar-visible-p', | |
220 `vertical-divider-always-visible-p', etc. | |
221 | |
222 In addition, it is possible to set margins in the text area using the | |
223 specifiers `left-margin-width' and `right-margin-width'. When this is | |
224 done, only the "inner text area" (the area inside of the margins) will | |
225 be used for normal display of text; the margins will be used for glyphs | |
226 with a layout policy of `outside-margin' (as set on an extent containing | |
227 the glyph by `set-extent-begin-glyph-layout' or | |
228 `set-extent-end-glyph-layout'). However, the calculation of the text | |
229 area size (e.g. in the function `window-text-area-width') includes the | |
230 margins. Which margin is used depends on whether a glyph has been set | |
231 as the begin-glyph or end-glyph of an extent (`set-extent-begin-glyph' | |
232 etc.), using the left and right margins, respectively. | |
233 | |
234 Technically, the margins outside of the inner text area are known as the | |
235 "outside margins". The "inside margins" are in the inner text area and | |
236 constitute the whitespace between the outside margins and the first or | |
237 last non-whitespace character in a line; their width can vary from line | |
238 to line. Glyphs will be placed in the inside margin if their layout | |
239 policy is `inside-margin' or `whitespace', with `whitespace' glyphs on | |
240 the inside and `inside-margin' glyphs on the outside. Inside-margin | |
241 glyphs can spill over into the outside margin if `use-left-overflow' or | |
242 `use-right-overflow', respectively, is non-nil. | |
243 | |
244 See the Lisp Reference manual, under Annotations, for more details. | |
245 | |
246 | |
247 THE DISPLAYABLE AREA | |
248 -------------------- | |
249 | |
250 The "displayable area" is not so much an actual area as a convenient | |
251 fiction. It is the area used to convert between pixel and character | |
252 dimensions for frames. The character dimensions for a frame (e.g. as | |
253 returned by `frame-width' and `frame-height' and set by | |
254 `set-frame-width' and `set-frame-height') are determined from the | |
255 displayable area by dividing by the pixel size of the default font as | |
256 instantiated in the frame. (For proportional fonts, the "average" width | |
257 is used. Under Windows, this is a built-in property of the fonts. | |
258 Under X, this is based on the width of the lowercase 'n', or if this is | |
259 zero then the width of the default character. [We prefer 'n' to the | |
260 specified default character because many X fonts have a default | |
261 character with a zero or otherwise non-representative width.]) | |
262 | |
5090 | 263 The displayable area is essentially the "theoretical" gutter area of the |
264 frame, excluding the rightmost and bottom-most scrollbars. That is, it | |
265 starts from the client (or "total") area and then excludes the | |
266 "theoretical" toolbars and bottom-most/rightmost scrollbars, and the | |
267 internal border width. In this context, "theoretical" means that all | |
268 calculations on based on frame-level values for toolbar and scrollbar | |
269 thicknesses. Because these thicknesses are controlled by specifiers, | |
270 and specifiers can have window-specific and buffer-specific values, | |
271 these calculations may or may not reflect the actual size of the paned | |
272 area or of the scrollbars when any particular window is selected. Note | |
273 also that the "displayable area" may not even be contiguous! In | |
274 particular, the gutters are included, but the bottom-most and rightmost | |
275 scrollbars are excluded even though they are inside of the gutters. | |
276 Furthermore, if the frame-level value of the horizontal scrollbar height | |
277 is non-zero, then the displayable area includes the paned area above and | |
278 below the bottom horizontal scrollbar (i.e. the modeline and minibuffer) | |
279 but not the scrollbar itself. | |
5043 | 280 |
281 As a further twist, the character-dimension calculations are adjusted so | |
282 that the truncation and continuation glyphs (see `truncation-glyph' and | |
283 `continuation-glyph') count as a single character even if they are wider | |
284 than the default font width. (Technically, the character width is | |
285 computed from the displayable-area width by subtracting the maximum of | |
286 the truncation-glyph width, continuation-glyph width and default-font | |
287 width before dividing by the default-font width, and then adding 1 to | |
288 the result.) (The ultimate motivation for this kludge as well as the | |
289 subtraction of the scrollbars, but not the minibuffer or bottom-most | |
290 modeline, is to maintain compatibility with TTY's.) | |
291 | |
292 Despite all these concerns and kludges, however, the "displayable area" | |
293 concept works well in practice and mostly ensures that by default the | |
294 frame will actually fit 79 characters + continuation/truncation glyph. | |
295 | |
296 | |
297 WHICH FUNCTIONS USE WHICH? | |
298 -------------------------- | |
299 | |
300 [1] Top-level window area: | |
301 | |
302 set-frame-position | |
303 `left' and `top' frame properties | |
304 | |
305 [2] Client area: | |
306 | |
307 frame-pixel-*, set-frame-pixel-* | |
308 | |
309 [3] Paned area: | |
310 | |
311 window-pixel-edges | |
312 event-x-pixel, event-y-pixel, event-properties, make-event | |
313 | |
314 [4] Displayable area: | |
315 | |
316 frame-width, frame-height and other all functions specifying frame size | |
317 in characters | |
318 frame-displayable-pixel-* | |
319 | |
320 --ben | |
321 | |
322 */ | |
323 | |
5104
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
324 /* |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
325 About different types of units: |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
326 |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
327 (1) "Total pixels" measure the pixel size of the client area of the |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
328 frame (everything except the menubars and window-manager decorations; |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
329 see comment at top of file). |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
330 |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
331 (2) "Displayable pixels" measure the pixel size of the "displayable area" |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
332 of the frame, a convenient fiction that specifies which portion of |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
333 the frame "counts" for the purposes of determining the size of the |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
334 frame in character cells. Approximately speaking, the difference |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
335 between the client area and displayable area is that toolbars, |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
336 gutters, internal border width and bottom-most/right-most scrollbars |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
337 are inside the client area but outside the displayable area. See |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
338 comment at top of file for more discussion. |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
339 |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
340 (3) "Character-cell units" measure the frame size in "character cells", |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
341 which are fixed rectangles of a size meant to correspond with the |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
342 height and (average) width of the bounding box of a single character |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
343 in the default font. The size of a frame in character cells is |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
344 determined by computing the size in "displayable pixels" and dividing |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
345 by the pixel size of the default font as instantiated in the frame. |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
346 See comment at top of file under "displayable area" for more info. |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
347 |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
348 (4) In window-system "frame units" -- pixels on MS Windows, character |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
349 cells on X and GTK (on TTY's, pixels and character cells are the |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
350 same). Note that on MS Windows the pixels measure the size of the |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
351 displayable area, not the entire client area. |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
352 |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
353 This bogosity exists because MS Windows always reports frame sizes |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
354 in pixels, whereas X-Windows has a scheme whereby character-cell |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
355 sizes and extra sizes (e.g. for toolbars, menubars, etc.) can be |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
356 reported to the window manager, and the window manager displays |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
357 character-cell units when resizing, only allows resizing to integral |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
358 character-cell sizes, and reports back the size in character cells. |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
359 As a result, someone thought it was a good idea to make the |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
360 fundamental units for measuring frame size correspond to what the |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
361 window system "reports" and hence vary between pixels and character |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
362 cells, as described above. |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
363 |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
364 --ben |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
365 */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
366 |
428 | 367 #include <config.h> |
368 #include "lisp.h" | |
369 | |
370 #include "buffer.h" /* for Vbuffer_alist */ | |
371 #include "console.h" | |
872 | 372 #include "device-impl.h" |
428 | 373 #include "events.h" |
374 #include "extents.h" | |
375 #include "faces.h" | |
872 | 376 #include "frame-impl.h" |
428 | 377 #include "glyphs.h" |
378 #include "gutter.h" | |
379 #include "menubar.h" | |
2681 | 380 #include "process.h" /* for egetenv */ |
428 | 381 #include "redisplay.h" |
382 #include "scrollbar.h" | |
800 | 383 #include "toolbar.h" |
428 | 384 #include "window.h" |
385 | |
386 Lisp_Object Vselect_frame_hook, Qselect_frame_hook; | |
387 Lisp_Object Vdeselect_frame_hook, Qdeselect_frame_hook; | |
388 Lisp_Object Vcreate_frame_hook, Qcreate_frame_hook; | |
389 Lisp_Object Vdelete_frame_hook, Qdelete_frame_hook; | |
390 Lisp_Object Vmouse_enter_frame_hook, Qmouse_enter_frame_hook; | |
391 Lisp_Object Vmouse_leave_frame_hook, Qmouse_leave_frame_hook; | |
392 Lisp_Object Vmap_frame_hook, Qmap_frame_hook; | |
393 Lisp_Object Vunmap_frame_hook, Qunmap_frame_hook; | |
394 int allow_deletion_of_last_visible_frame; | |
395 Lisp_Object Vadjust_frame_function; | |
396 Lisp_Object Vmouse_motion_handler; | |
397 Lisp_Object Vsynchronize_minibuffers; | |
398 Lisp_Object Qsynchronize_minibuffers; | |
399 Lisp_Object Qbuffer_predicate; | |
400 Lisp_Object Qmake_initial_minibuffer_frame; | |
401 Lisp_Object Qcustom_initialize_frame; | |
402 | |
403 /* We declare all these frame properties here even though many of them | |
404 are currently only used in frame-x.c, because we should generalize | |
405 them. */ | |
406 | |
407 Lisp_Object Qminibuffer; | |
408 Lisp_Object Qunsplittable; | |
409 Lisp_Object Qinternal_border_width; | |
410 Lisp_Object Qtop_toolbar_shadow_color; | |
411 Lisp_Object Qbottom_toolbar_shadow_color; | |
412 Lisp_Object Qbackground_toolbar_color; | |
413 Lisp_Object Qtop_toolbar_shadow_pixmap; | |
414 Lisp_Object Qbottom_toolbar_shadow_pixmap; | |
415 Lisp_Object Qtoolbar_shadow_thickness; | |
416 Lisp_Object Qscrollbar_placement; | |
417 Lisp_Object Qinter_line_space; | |
418 Lisp_Object Qvisual_bell; | |
419 Lisp_Object Qbell_volume; | |
420 Lisp_Object Qpointer_background; | |
421 Lisp_Object Qpointer_color; | |
422 Lisp_Object Qtext_pointer; | |
423 Lisp_Object Qspace_pointer; | |
424 Lisp_Object Qmodeline_pointer; | |
425 Lisp_Object Qgc_pointer; | |
426 Lisp_Object Qinitially_unmapped; | |
427 Lisp_Object Quse_backing_store; | |
428 Lisp_Object Qborder_color; | |
429 Lisp_Object Qborder_width; | |
430 | |
431 Lisp_Object Qframep, Qframe_live_p; | |
432 Lisp_Object Qdelete_frame; | |
433 | |
434 Lisp_Object Qframe_title_format, Vframe_title_format; | |
435 Lisp_Object Qframe_icon_title_format, Vframe_icon_title_format; | |
436 | |
437 Lisp_Object Vdefault_frame_name; | |
438 Lisp_Object Vdefault_frame_plist; | |
439 | |
440 Lisp_Object Vframe_icon_glyph; | |
441 | |
442 Lisp_Object Qhidden; | |
443 | |
444 Lisp_Object Qvisible, Qiconic, Qinvisible, Qvisible_iconic, Qinvisible_iconic; | |
445 Lisp_Object Qnomini, Qvisible_nomini, Qiconic_nomini, Qinvisible_nomini; | |
446 Lisp_Object Qvisible_iconic_nomini, Qinvisible_iconic_nomini; | |
447 | |
442 | 448 Lisp_Object Qset_specifier, Qset_face_property; |
428 | 449 Lisp_Object Qface_property_instance; |
450 | |
451 Lisp_Object Qframe_property_alias; | |
452 | |
453 /* If this is non-nil, it is the frame that make-frame is currently | |
454 creating. We can't set the current frame to this in case the | |
455 debugger goes off because it would try and display to it. However, | |
456 there are some places which need to reference it which have no | |
457 other way of getting it if it isn't the selected frame. */ | |
458 Lisp_Object Vframe_being_created; | |
459 Lisp_Object Qframe_being_created; | |
460 | |
461 static void store_minibuf_frame_prop (struct frame *f, Lisp_Object val); | |
1125 | 462 |
5043 | 463 typedef enum |
464 { | |
1125 | 465 DISPLAYABLE_PIXEL_TO_CHAR, |
5043 | 466 CHAR_TO_DISPLAYABLE_PIXEL, |
1125 | 467 TOTAL_PIXEL_TO_CHAR, |
468 CHAR_TO_TOTAL_PIXEL, | |
5043 | 469 TOTAL_PIXEL_TO_DISPLAYABLE_PIXEL, |
470 DISPLAYABLE_PIXEL_TO_TOTAL_PIXEL, | |
471 } | |
472 pixel_to_char_mode_t; | |
473 | |
474 enum frame_size_type | |
475 { | |
476 SIZE_TOTAL_PIXEL, | |
477 SIZE_DISPLAYABLE_PIXEL, | |
478 SIZE_CHAR_CELL, | |
479 SIZE_FRAME_UNIT, | |
480 }; | |
1125 | 481 |
482 static void frame_conversion_internal (struct frame *f, | |
5043 | 483 enum frame_size_type source, |
484 int source_width, int source_height, | |
485 enum frame_size_type dest, | |
486 int *dest_width, int *dest_height); | |
487 static void get_frame_char_size (struct frame *f, int *out_width, | |
488 int *out_height); | |
5105
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
489 static void get_frame_new_displayable_pixel_size (struct frame *f, |
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
490 int *out_width, |
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
491 int *out_height); |
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
492 static void get_frame_new_total_pixel_size (struct frame *f, |
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
493 int *out_width, |
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
494 int *out_height); |
5043 | 495 |
438 | 496 static struct display_line title_string_display_line; |
497 /* Used by generate_title_string. Global because they get used so much that | |
498 the dynamic allocation time adds up. */ | |
867 | 499 static Ichar_dynarr *title_string_ichar_dynarr; |
428 | 500 |
501 | |
5104
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
502 /**************************************************************************/ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
503 /* */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
504 /* frame object */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
505 /* */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
506 /**************************************************************************/ |
1204 | 507 |
3092 | 508 #ifndef NEW_GC |
1204 | 509 extern const struct sized_memory_description gtk_frame_data_description; |
510 extern const struct sized_memory_description mswindows_frame_data_description; | |
511 extern const struct sized_memory_description x_frame_data_description; | |
3092 | 512 #endif /* not NEW_GC */ |
1204 | 513 |
514 static const struct memory_description frame_data_description_1 []= { | |
3092 | 515 #ifdef NEW_GC |
516 #ifdef HAVE_GTK | |
517 { XD_LISP_OBJECT, gtk_console }, | |
518 #endif | |
519 #ifdef HAVE_MS_WINDOWS | |
520 { XD_LISP_OBJECT, mswindows_console }, | |
521 #endif | |
522 #ifdef HAVE_X_WINDOWS | |
523 { XD_LISP_OBJECT, x_console }, | |
524 #endif | |
525 #else /* not NEW_GC */ | |
1204 | 526 #ifdef HAVE_GTK |
2551 | 527 { XD_BLOCK_PTR, gtk_console, 1, { >k_frame_data_description} }, |
1204 | 528 #endif |
529 #ifdef HAVE_MS_WINDOWS | |
2551 | 530 { XD_BLOCK_PTR, mswindows_console, 1, { &mswindows_frame_data_description} }, |
1204 | 531 #endif |
532 #ifdef HAVE_X_WINDOWS | |
2551 | 533 { XD_BLOCK_PTR, x_console, 1, { &x_frame_data_description} }, |
1204 | 534 #endif |
3092 | 535 #endif /* not NEW_GC */ |
1204 | 536 { XD_END } |
537 }; | |
538 | |
539 static const struct sized_memory_description frame_data_description = { | |
540 sizeof (void *), frame_data_description_1 | |
541 }; | |
542 | |
3092 | 543 #ifdef NEW_GC |
544 static const struct memory_description expose_ignore_description_1 [] = { | |
545 { XD_LISP_OBJECT, offsetof (struct expose_ignore, next) }, | |
546 { XD_END } | |
547 }; | |
548 | |
5118
e0db3c197671
merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
diff
changeset
|
549 DEFINE_DUMPABLE_INTERNAL_LISP_OBJECT ("expose-ignore", expose_ignore, |
e0db3c197671
merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
diff
changeset
|
550 0, expose_ignore_description_1, |
e0db3c197671
merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
diff
changeset
|
551 struct expose_ignore); |
3092 | 552 #else /* not NEW_GC */ |
1204 | 553 extern const struct sized_memory_description expose_ignore_description; |
554 | |
555 static const struct memory_description expose_ignore_description_1 [] = { | |
2367 | 556 { XD_BLOCK_PTR, offsetof (struct expose_ignore, next), |
2551 | 557 1, { &expose_ignore_description } }, |
1204 | 558 { XD_END } |
559 }; | |
560 | |
561 const struct sized_memory_description expose_ignore_description = { | |
562 sizeof (struct expose_ignore), | |
563 expose_ignore_description_1 | |
564 }; | |
3092 | 565 #endif /* not NEW_GC */ |
1204 | 566 |
567 static const struct memory_description display_line_dynarr_pointer_description_1 []= { | |
2551 | 568 { XD_BLOCK_PTR, 0, 1, { &display_line_dynarr_description} }, |
1204 | 569 { XD_END } |
570 }; | |
571 | |
572 static const struct sized_memory_description display_line_dynarr_pointer_description = { | |
573 sizeof (display_line_dynarr *), display_line_dynarr_pointer_description_1 | |
574 }; | |
575 | |
576 static const struct memory_description frame_description [] = { | |
577 { XD_INT, offsetof (struct frame, frametype) }, | |
578 #define MARKED_SLOT(x) { XD_LISP_OBJECT, offsetof (struct frame, x) }, | |
579 #define MARKED_SLOT_ARRAY(slot, size) \ | |
580 { XD_LISP_OBJECT_ARRAY, offsetof (struct frame, slot), size }, | |
581 #include "frameslots.h" | |
582 | |
3092 | 583 #ifdef NEW_GC |
584 { XD_LISP_OBJECT, offsetof (struct frame, subwindow_exposures) }, | |
585 { XD_LISP_OBJECT, offsetof (struct frame, subwindow_exposures_tail) }, | |
586 #else /* not NEW_GC */ | |
2367 | 587 { XD_BLOCK_PTR, offsetof (struct frame, subwindow_exposures), |
2551 | 588 1, { &expose_ignore_description } }, |
2367 | 589 { XD_BLOCK_PTR, offsetof (struct frame, subwindow_exposures_tail), |
2551 | 590 1, { &expose_ignore_description } }, |
3092 | 591 #endif /* not NEW_GC */ |
1204 | 592 |
593 #ifdef HAVE_SCROLLBARS | |
594 { XD_LISP_OBJECT, offsetof (struct frame, sb_vcache) }, | |
595 { XD_LISP_OBJECT, offsetof (struct frame, sb_hcache) }, | |
596 #endif /* HAVE_SCROLLBARS */ | |
597 | |
2367 | 598 { XD_BLOCK_ARRAY, offsetof (struct frame, current_display_lines), |
2551 | 599 4, { &display_line_dynarr_pointer_description } }, |
2367 | 600 { XD_BLOCK_ARRAY, offsetof (struct frame, desired_display_lines), |
2551 | 601 4, { &display_line_dynarr_pointer_description } }, |
1204 | 602 |
2367 | 603 { XD_BLOCK_PTR, offsetof (struct frame, framemeths), 1, |
2551 | 604 { &console_methods_description } }, |
4207 | 605 { XD_UNION, offsetof (struct frame, frame_data), |
2551 | 606 XD_INDIRECT (0, 0), { &frame_data_description } }, |
1204 | 607 { XD_END } |
608 }; | |
609 | |
428 | 610 static Lisp_Object |
611 mark_frame (Lisp_Object obj) | |
612 { | |
613 struct frame *f = XFRAME (obj); | |
614 | |
1204 | 615 #define MARKED_SLOT(x) mark_object (f->x); |
428 | 616 #include "frameslots.h" |
617 | |
618 if (FRAME_LIVE_P (f)) /* device is nil for a dead frame */ | |
619 MAYBE_FRAMEMETH (f, mark_frame, (f)); | |
620 | |
617 | 621 #ifdef HAVE_SCROLLBARS |
622 if (f->sb_vcache) | |
623 mark_object (wrap_scrollbar_instance (f->sb_vcache)); | |
624 if (f->sb_hcache) | |
625 mark_object (wrap_scrollbar_instance (f->sb_hcache)); | |
626 #endif | |
627 | |
628 mark_gutters (f); | |
629 | |
428 | 630 return Qnil; |
631 } | |
632 | |
633 static void | |
2286 | 634 print_frame (Lisp_Object obj, Lisp_Object printcharfun, |
635 int UNUSED (escapeflag)) | |
428 | 636 { |
637 struct frame *frm = XFRAME (obj); | |
638 | |
639 if (print_readably) | |
5142
f965e31a35f0
reduce lcrecord headers to 2 words, rename printing_unreadable_object
Ben Wing <ben@xemacs.org>
parents:
5130
diff
changeset
|
640 printing_unreadable_lisp_object (obj, XSTRING_DATA (frm->name)); |
428 | 641 |
800 | 642 write_fmt_string (printcharfun, "#<%s-frame ", !FRAME_LIVE_P (frm) ? "dead" : |
643 FRAME_TYPE_NAME (frm)); | |
428 | 644 print_internal (frm->name, printcharfun, 1); |
5209
94982b8f9485
When printing a frame, print its device, making things clearer with gnuserv
Aidan Kehoe <kehoea@parhasard.net>
parents:
5158
diff
changeset
|
645 write_ascstring (printcharfun, " on "); |
94982b8f9485
When printing a frame, print its device, making things clearer with gnuserv
Aidan Kehoe <kehoea@parhasard.net>
parents:
5158
diff
changeset
|
646 print_internal (frm->device, printcharfun, 0); |
5146
88bd4f3ef8e4
make lrecord UID's have a separate UID space for each object, resurrect debug SOE code in extents.c
Ben Wing <ben@xemacs.org>
parents:
5142
diff
changeset
|
647 write_fmt_string (printcharfun, " 0x%x>", LISP_OBJECT_UID (obj)); |
428 | 648 } |
649 | |
5118
e0db3c197671
merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
diff
changeset
|
650 DEFINE_NODUMP_LISP_OBJECT ("frame", frame, |
5124
623d57b7fbe8
separate regular and disksave finalization, print method fixes.
Ben Wing <ben@xemacs.org>
parents:
5120
diff
changeset
|
651 mark_frame, print_frame, 0, 0, 0, |
623d57b7fbe8
separate regular and disksave finalization, print method fixes.
Ben Wing <ben@xemacs.org>
parents:
5120
diff
changeset
|
652 frame_description, |
623d57b7fbe8
separate regular and disksave finalization, print method fixes.
Ben Wing <ben@xemacs.org>
parents:
5120
diff
changeset
|
653 struct frame); |
428 | 654 |
5104
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
655 /**************************************************************************/ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
656 /* */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
657 /* frame creation */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
658 /* */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
659 /**************************************************************************/ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
660 |
428 | 661 static void |
662 nuke_all_frame_slots (struct frame *f) | |
663 { | |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5126
diff
changeset
|
664 zero_nonsized_lisp_object (wrap_frame (f)); |
617 | 665 |
1204 | 666 #define MARKED_SLOT(x) f->x = Qnil; |
428 | 667 #include "frameslots.h" |
668 } | |
669 | |
670 /* Allocate a new frame object and set all its fields to reasonable | |
671 values. The root window is created but the minibuffer will be done | |
672 later. */ | |
673 | |
674 static struct frame * | |
675 allocate_frame_core (Lisp_Object device) | |
676 { | |
677 /* This function can GC */ | |
678 Lisp_Object root_window; | |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5126
diff
changeset
|
679 Lisp_Object frame = ALLOC_NORMAL_LISP_OBJECT (frame); |
5117
3742ea8250b5
Checking in final CVS version of workspace 'ben-lisp-object'
Ben Wing <ben@xemacs.org>
parents:
3025
diff
changeset
|
680 struct frame *f = XFRAME (frame); |
428 | 681 |
682 nuke_all_frame_slots (f); | |
683 | |
684 f->device = device; | |
685 f->framemeths = XDEVICE (device)->devmeths; | |
1204 | 686 f->frametype = get_console_variant (XDEVICE_TYPE (device)); |
428 | 687 f->buffer_alist = Fcopy_sequence (Vbuffer_alist); |
688 | |
689 root_window = allocate_window (); | |
690 XWINDOW (root_window)->frame = frame; | |
691 | |
692 /* 10 is arbitrary, | |
693 Just so that there is "something there." | |
694 Correct size will be set up later with change_frame_size. */ | |
695 | |
696 f->width = 10; | |
697 f->height = 10; | |
698 | |
699 XWINDOW (root_window)->pixel_width = 10; | |
700 XWINDOW (root_window)->pixel_height = 9; | |
701 | |
702 f->root_window = root_window; | |
703 f->selected_window = root_window; | |
704 f->last_nonminibuf_window = root_window; | |
705 | |
706 /* cache of subwindows visible on frame */ | |
442 | 707 f->subwindow_instance_cache = make_weak_list (WEAK_LIST_SIMPLE); |
428 | 708 |
709 /* associated exposure ignore list */ | |
710 f->subwindow_exposures = 0; | |
711 f->subwindow_exposures_tail = 0; | |
712 | |
442 | 713 FRAME_SET_PAGENUMBER (f, 1); |
714 | |
853 | 715 note_object_created (root_window); |
716 | |
428 | 717 /* Choose a buffer for the frame's root window. */ |
718 XWINDOW (root_window)->buffer = Qt; | |
719 { | |
720 Lisp_Object buf; | |
721 | |
722 buf = Fcurrent_buffer (); | |
723 /* If buf is a 'hidden' buffer (i.e. one whose name starts with | |
724 a space), try to find another one. */ | |
867 | 725 if (string_ichar (Fbuffer_name (buf), 0) == ' ') |
428 | 726 buf = Fother_buffer (buf, Qnil, Qnil); |
440 | 727 Fset_window_buffer (root_window, buf, Qnil); |
428 | 728 } |
729 | |
730 return f; | |
731 } | |
732 | |
733 static void | |
734 setup_normal_frame (struct frame *f) | |
735 { | |
736 Lisp_Object mini_window; | |
793 | 737 Lisp_Object frame = wrap_frame (f); |
738 | |
428 | 739 |
740 mini_window = allocate_window (); | |
741 XWINDOW (f->root_window)->next = mini_window; | |
742 XWINDOW (mini_window)->prev = f->root_window; | |
743 XWINDOW (mini_window)->mini_p = Qt; | |
744 XWINDOW (mini_window)->frame = frame; | |
745 f->minibuffer_window = mini_window; | |
746 f->has_minibuffer = 1; | |
747 | |
853 | 748 note_object_created (mini_window); |
749 | |
428 | 750 XWINDOW (mini_window)->buffer = Qt; |
440 | 751 Fset_window_buffer (mini_window, Vminibuffer_zero, Qt); |
428 | 752 } |
753 | |
754 /* Make a frame using a separate minibuffer window on another frame. | |
755 MINI_WINDOW is the minibuffer window to use. nil means use the | |
756 default-minibuffer-frame. */ | |
757 | |
758 static void | |
759 setup_frame_without_minibuffer (struct frame *f, Lisp_Object mini_window) | |
760 { | |
761 /* This function can GC */ | |
762 Lisp_Object device = f->device; | |
763 | |
764 if (!NILP (mini_window)) | |
765 CHECK_LIVE_WINDOW (mini_window); | |
766 | |
767 if (!NILP (mini_window) | |
768 && !EQ (DEVICE_CONSOLE (XDEVICE (device)), | |
769 FRAME_CONSOLE (XFRAME (XWINDOW (mini_window)->frame)))) | |
563 | 770 invalid_argument ("frame and minibuffer must be on the same console", Qunbound); |
428 | 771 |
442 | 772 /* Do not create a default minibuffer frame on printer devices. */ |
773 if (NILP (mini_window) | |
774 && DEVICE_DISPLAY_P (XDEVICE (FRAME_DEVICE (f)))) | |
428 | 775 { |
776 struct console *con = XCONSOLE (FRAME_CONSOLE (f)); | |
777 /* Use default-minibuffer-frame if possible. */ | |
778 if (!FRAMEP (con->default_minibuffer_frame) | |
779 || ! FRAME_LIVE_P (XFRAME (con->default_minibuffer_frame))) | |
780 { | |
781 /* If there's no minibuffer frame to use, create one. */ | |
782 con->default_minibuffer_frame | |
783 = call1 (Qmake_initial_minibuffer_frame, device); | |
784 } | |
785 mini_window = XFRAME (con->default_minibuffer_frame)->minibuffer_window; | |
786 } | |
787 | |
788 /* Install the chosen minibuffer window, with proper buffer. */ | |
442 | 789 if (!NILP (mini_window)) |
790 { | |
791 store_minibuf_frame_prop (f, mini_window); | |
792 Fset_window_buffer (mini_window, Vminibuffer_zero, Qt); | |
793 } | |
794 else | |
795 f->minibuffer_window = Qnil; | |
428 | 796 } |
797 | |
798 /* Make a frame containing only a minibuffer window. */ | |
799 | |
800 static void | |
801 setup_minibuffer_frame (struct frame *f) | |
802 { | |
803 /* This function can GC */ | |
804 /* First make a frame containing just a root window, no minibuffer. */ | |
805 Lisp_Object mini_window; | |
793 | 806 Lisp_Object frame = wrap_frame (f); |
807 | |
428 | 808 |
809 f->no_split = 1; | |
810 f->has_minibuffer = 1; | |
811 | |
812 /* Now label the root window as also being the minibuffer. | |
813 Avoid infinite looping on the window chain by marking next pointer | |
814 as nil. */ | |
815 | |
816 mini_window = f->minibuffer_window = f->root_window; | |
817 XWINDOW (mini_window)->mini_p = Qt; | |
818 XWINDOW (mini_window)->next = Qnil; | |
819 XWINDOW (mini_window)->prev = Qnil; | |
820 XWINDOW (mini_window)->frame = frame; | |
821 | |
822 /* Put the proper buffer in that window. */ | |
823 | |
440 | 824 Fset_window_buffer (mini_window, Vminibuffer_zero, Qt); |
428 | 825 } |
826 | |
827 static Lisp_Object | |
828 make_sure_its_a_fresh_plist (Lisp_Object foolist) | |
829 { | |
830 if (CONSP (Fcar (foolist))) | |
831 { | |
832 /* looks like an alist to me. */ | |
833 foolist = Fcopy_alist (foolist); | |
834 foolist = Fdestructive_alist_to_plist (foolist); | |
835 } | |
836 else | |
837 foolist = Fcopy_sequence (foolist); | |
838 | |
839 return foolist; | |
840 } | |
841 | |
558 | 842 static Lisp_Object |
546 | 843 restore_frame_list_to_its_unbesmirched_state (Lisp_Object kawnz) |
844 { | |
845 Lisp_Object lissed = XCDR (kawnz); | |
846 if (!EQ (lissed, Qunbound)) | |
847 DEVICE_FRAME_LIST (XDEVICE (XCAR (kawnz))) = lissed; | |
848 return Qnil; | |
4207 | 849 } |
546 | 850 |
428 | 851 DEFUN ("make-frame", Fmake_frame, 0, 2, "", /* |
852 Create and return a new frame, displaying the current buffer. | |
853 Runs the functions listed in `create-frame-hook' after frame creation. | |
854 | |
855 Optional argument PROPS is a property list (a list of alternating | |
856 keyword-value specifications) of properties for the new frame. | |
857 \(An alist is accepted for backward compatibility but should not | |
858 be passed in.) | |
859 | |
860 See `set-frame-properties', `default-x-frame-plist', and | |
861 `default-tty-frame-plist' for the specially-recognized properties. | |
862 */ | |
863 (props, device)) | |
864 { | |
865 struct frame *f; | |
866 struct device *d; | |
867 Lisp_Object frame = Qnil, name = Qnil, minibuf; | |
868 struct gcpro gcpro1, gcpro2, gcpro3; | |
546 | 869 int speccount = specpdl_depth (), speccount2; |
428 | 870 int first_frame_on_device = 0; |
871 int first_frame_on_console = 0; | |
546 | 872 Lisp_Object besmirched_cons = Qnil; |
771 | 873 int frame_name_is_defaulted = 1; |
428 | 874 |
875 d = decode_device (device); | |
793 | 876 device = wrap_device (d); |
428 | 877 |
878 /* PROPS and NAME may be freshly-created, so make sure to GCPRO. */ | |
879 GCPRO3 (frame, props, name); | |
880 | |
881 props = make_sure_its_a_fresh_plist (props); | |
882 if (DEVICE_SPECIFIC_FRAME_PROPS (d)) | |
883 /* Put the device-specific props before the more general ones so | |
884 that they override them. */ | |
885 props = nconc2 (props, | |
886 make_sure_its_a_fresh_plist | |
887 (*DEVICE_SPECIFIC_FRAME_PROPS (d))); | |
888 props = nconc2 (props, make_sure_its_a_fresh_plist (Vdefault_frame_plist)); | |
889 Fcanonicalize_lax_plist (props, Qnil); | |
890 | |
891 name = Flax_plist_get (props, Qname, Qnil); | |
892 if (!NILP (name)) | |
771 | 893 { |
894 CHECK_STRING (name); | |
895 frame_name_is_defaulted = 0; | |
896 } | |
2681 | 897 else if (!initialized) |
898 { | |
899 /* We leave Vdefault_frame_name alone here so that it'll remain Qnil | |
900 in the dumped executable, and we can choose it at runtime. */ | |
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4846
diff
changeset
|
901 name = build_ascstring ("XEmacs"); |
2681 | 902 } |
4207 | 903 else if (NILP (Vdefault_frame_name)) |
904 { | |
2681 | 905 if (egetenv ("USE_EMACS_AS_DEFAULT_APPLICATION_CLASS")) |
906 { | |
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4846
diff
changeset
|
907 Vdefault_frame_name = build_ascstring ("emacs"); |
2681 | 908 } |
4207 | 909 else |
2681 | 910 { |
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4846
diff
changeset
|
911 Vdefault_frame_name = build_ascstring ("XEmacs"); |
2681 | 912 } |
913 } | |
914 | |
915 if (NILP(name) && STRINGP(Vdefault_frame_name)) | |
916 { | |
917 name = Vdefault_frame_name; | |
918 } | |
428 | 919 |
867 | 920 if (!NILP (Fstring_match (make_string ((const Ibyte *) "\\.", 2), name, |
428 | 921 Qnil, Qnil))) |
563 | 922 syntax_error (". not allowed in frame names", name); |
428 | 923 |
924 f = allocate_frame_core (device); | |
793 | 925 frame = wrap_frame (f); |
428 | 926 |
927 specbind (Qframe_being_created, name); | |
928 f->name = name; | |
929 | |
771 | 930 FRAMEMETH (f, init_frame_1, (f, props, frame_name_is_defaulted)); |
428 | 931 |
932 minibuf = Flax_plist_get (props, Qminibuffer, Qunbound); | |
933 if (UNBOUNDP (minibuf)) | |
934 { | |
935 /* If minibuf is unspecified, then look for a minibuffer X resource. */ | |
936 /* #### Not implemented any more. We need to fix things up so | |
937 that we search out all X resources and append them to the end of | |
938 props, above. This is the only way in general to assure | |
939 coherent behavior for all frame properties/resources/etc. */ | |
940 } | |
941 else | |
942 props = Flax_plist_remprop (props, Qminibuffer); | |
943 | |
944 if (EQ (minibuf, Qnone) || NILP (minibuf)) | |
945 setup_frame_without_minibuffer (f, Qnil); | |
946 else if (EQ (minibuf, Qonly)) | |
947 setup_minibuffer_frame (f); | |
948 else if (WINDOWP (minibuf)) | |
949 setup_frame_without_minibuffer (f, minibuf); | |
950 else if (EQ (minibuf, Qt) || UNBOUNDP (minibuf)) | |
951 setup_normal_frame (f); | |
952 else | |
563 | 953 invalid_argument ("Invalid value for `minibuffer'", minibuf); |
428 | 954 |
955 update_frame_window_mirror (f); | |
956 | |
4968 | 957 /* #### Do we need to be calling reset_face_cachels here, and then again |
958 down below? */ | |
428 | 959 if (initialized && !DEVICE_STREAM_P (d)) |
960 { | |
961 if (!NILP (f->minibuffer_window)) | |
4207 | 962 reset_face_cachels (XWINDOW (f->minibuffer_window)); |
428 | 963 reset_face_cachels (XWINDOW (f->root_window)); |
964 } | |
965 | |
966 /* If no frames on this device formerly existed, say this is the | |
967 first frame. It kind of assumes that frameless devices don't | |
968 exist, but it shouldn't be too harmful. */ | |
969 if (NILP (DEVICE_FRAME_LIST (d))) | |
970 first_frame_on_device = 1; | |
971 | |
546 | 972 /* It's possible for one of the init methods below to signal an error; |
973 in that case, let's make sure the device isn't besmirched by | |
974 having a half-initialized frame attached to it */ | |
975 speccount2 = specpdl_depth (); | |
976 record_unwind_protect (restore_frame_list_to_its_unbesmirched_state, | |
977 besmirched_cons = | |
978 Fcons (device, DEVICE_FRAME_LIST (d))); | |
979 | |
428 | 980 /* This *must* go before the init_*() methods. Those functions |
981 call Lisp code, and if any of them causes a warning to be displayed | |
982 and the *Warnings* buffer to be created, it won't get added to | |
983 the frame-specific version of the buffer-alist unless the frame | |
984 is accessible from the device. */ | |
985 | |
986 #if 0 | |
987 DEVICE_FRAME_LIST (d) = nconc2 (DEVICE_FRAME_LIST (d), Fcons (frame, Qnil)); | |
988 #endif | |
989 DEVICE_FRAME_LIST (d) = Fcons (frame, DEVICE_FRAME_LIST (d)); | |
990 RESET_CHANGED_SET_FLAGS; | |
991 | |
853 | 992 note_object_created (frame); |
993 | |
428 | 994 /* Now make sure that the initial cached values are set correctly. |
995 Do this after the init_frame method is called because that may | |
996 do things (e.g. create widgets) that are necessary for the | |
997 specifier value-changed methods to work OK. */ | |
998 recompute_all_cached_specifiers_in_frame (f); | |
999 | |
1000 if (!DEVICE_STREAM_P (d)) | |
1001 { | |
1002 init_frame_faces (f); | |
1003 | |
1004 #ifdef HAVE_SCROLLBARS | |
1005 /* Finish up resourcing the scrollbars. */ | |
1006 init_frame_scrollbars (f); | |
1007 #endif | |
1008 | |
1009 #ifdef HAVE_TOOLBARS | |
1010 /* Create the initial toolbars. We have to do this after the frame | |
1011 methods are called because it may potentially call some things itself | |
1012 which depend on the normal frame methods having initialized | |
1013 things. */ | |
1014 init_frame_toolbars (f); | |
1015 #endif | |
4968 | 1016 /* Added this assert recently (2-1-10); seems there should be only |
1017 two windows, root and minibufer. Probably we should just be | |
1018 calling reset_*_cachels on the root window directly instead of the | |
1019 selected window, but I want to make sure they are always the | |
1020 same. --ben */ | |
1021 assert (EQ (FRAME_SELECTED_WINDOW (f), f->root_window)); | |
428 | 1022 reset_face_cachels (XWINDOW (FRAME_SELECTED_WINDOW (f))); |
1023 reset_glyph_cachels (XWINDOW (FRAME_SELECTED_WINDOW (f))); | |
4968 | 1024 if (!NILP (f->minibuffer_window)) |
1025 { | |
1026 reset_face_cachels (XWINDOW (f->minibuffer_window)); | |
1027 reset_glyph_cachels (XWINDOW (f->minibuffer_window)); | |
1028 } | |
442 | 1029 |
5043 | 1030 change_frame_size (f, f->width, f->height, 0); |
428 | 1031 } |
1032 | |
1033 MAYBE_FRAMEMETH (f, init_frame_2, (f, props)); | |
1034 Fset_frame_properties (frame, props); | |
1035 MAYBE_FRAMEMETH (f, init_frame_3, (f)); | |
1036 | |
1037 /* Hallelujah, praise the lord. */ | |
1038 f->init_finished = 1; | |
1039 | |
546 | 1040 XCDR (besmirched_cons) = Qunbound; |
1041 | |
771 | 1042 unbind_to (speccount2); |
546 | 1043 |
428 | 1044 /* If this is the first frame on the device, make it the selected one. */ |
1045 if (first_frame_on_device && NILP (DEVICE_SELECTED_FRAME (d))) | |
1046 set_device_selected_frame (d, frame); | |
1047 | |
1048 /* If at startup or if the current console is a stream console | |
1049 (usually also at startup), make this console the selected one | |
1050 so that messages show up on it. */ | |
1051 if (NILP (Fselected_console ()) || | |
1052 CONSOLE_STREAM_P (XCONSOLE (Fselected_console ()))) | |
1053 Fselect_console (DEVICE_CONSOLE (d)); | |
1054 | |
1055 first_frame_on_console = | |
1056 (first_frame_on_device && | |
1057 XINT (Flength (CONSOLE_DEVICE_LIST (XCONSOLE (DEVICE_CONSOLE (d))))) | |
1058 == 1); | |
1059 | |
1060 /* #### all this calling of frame methods at various odd times | |
1061 is somewhat of a mess. It's necessary to do it this way due | |
1062 to strange console-type-specific things that need to be done. */ | |
1063 MAYBE_FRAMEMETH (f, after_init_frame, (f, first_frame_on_device, | |
1064 first_frame_on_console)); | |
1065 | |
442 | 1066 if (!DEVICE_STREAM_P (d)) |
1067 { | |
1068 /* Now initialise the gutters. This won't change the frame size, | |
4207 | 1069 but is needed as input to the layout that change_frame_size |
1070 will eventually do. Unfortunately gutter sizing code relies | |
1071 on the frame in question being visible so we can't do this | |
1072 earlier. */ | |
442 | 1073 init_frame_gutters (f); |
1074 | |
5043 | 1075 change_frame_size (f, f->width, f->height, 0); |
442 | 1076 } |
1077 | |
428 | 1078 if (first_frame_on_device) |
1079 { | |
1080 if (first_frame_on_console) | |
1081 va_run_hook_with_args (Qcreate_console_hook, 1, DEVICE_CONSOLE (d)); | |
1082 va_run_hook_with_args (Qcreate_device_hook, 1, device); | |
1083 } | |
1084 va_run_hook_with_args (Qcreate_frame_hook, 1, frame); | |
1085 | |
1086 /* Initialize custom-specific stuff. */ | |
1087 if (!UNBOUNDP (symbol_function (XSYMBOL (Qcustom_initialize_frame)))) | |
1088 call1 (Qcustom_initialize_frame, frame); | |
1089 | |
1204 | 1090 UNGCPRO; |
771 | 1091 unbind_to (speccount); |
428 | 1092 |
1093 return frame; | |
1094 } | |
1095 | |
1096 | |
5104
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1097 /**************************************************************************/ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1098 /* */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1099 /* validating a frame argument */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1100 /* */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1101 /**************************************************************************/ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1102 |
428 | 1103 /* this function should be used in most cases when a Lisp function is passed |
1104 a FRAME argument. Use this unless you don't accept nil == current frame | |
1105 (in which case, do a CHECK_LIVE_FRAME() and then an XFRAME()) or you | |
1106 allow dead frames. Note that very few functions should accept dead | |
1107 frames. It could be argued that functions should just do nothing when | |
1108 given a dead frame, but the presence of a dead frame usually indicates | |
1109 an oversight in the Lisp code that could potentially lead to strange | |
1110 results and so it is better to catch the error early. | |
1111 | |
1112 If you only accept X frames, use decode_x_frame(), which does what this | |
1113 function does but also makes sure the frame is an X frame. */ | |
1114 | |
1115 struct frame * | |
1116 decode_frame (Lisp_Object frame) | |
1117 { | |
1118 if (NILP (frame)) | |
1119 return selected_frame (); | |
1120 | |
1121 CHECK_LIVE_FRAME (frame); | |
1122 return XFRAME (frame); | |
1123 } | |
1124 | |
1125 struct frame * | |
1126 decode_frame_or_selected (Lisp_Object cdf) | |
1127 { | |
1128 if (CONSOLEP (cdf)) | |
1129 cdf = CONSOLE_SELECTED_DEVICE (decode_console (cdf)); | |
1130 if (DEVICEP (cdf)) | |
1131 cdf = DEVICE_SELECTED_FRAME (decode_device (cdf)); | |
1132 return decode_frame (cdf); | |
1133 } | |
1134 | |
872 | 1135 int |
1136 frame_live_p (struct frame *f) | |
1137 { | |
1138 return FRAME_LIVE_P (f); | |
1139 } | |
1140 | |
428 | 1141 DEFUN ("framep", Fframep, 1, 1, 0, /* |
1142 Return non-nil if OBJECT is a frame. | |
1143 Also see `frame-live-p'. | |
1144 Note that FSF Emacs kludgily returns a value indicating what type of | |
1145 frame this is. Use the cleaner function `frame-type' for that. | |
1146 */ | |
1147 (object)) | |
1148 { | |
1149 return FRAMEP (object) ? Qt : Qnil; | |
1150 } | |
1151 | |
1152 DEFUN ("frame-live-p", Fframe_live_p, 1, 1, 0, /* | |
1153 Return non-nil if OBJECT is a frame which has not been deleted. | |
1154 */ | |
1155 (object)) | |
1156 { | |
1157 return FRAMEP (object) && FRAME_LIVE_P (XFRAME (object)) ? Qt : Qnil; | |
1158 } | |
1159 | |
1160 | |
5104
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1161 /**************************************************************************/ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1162 /* */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1163 /* frame focus/selection */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1164 /* */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1165 /**************************************************************************/ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1166 |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1167 Lisp_Object |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1168 frame_device (struct frame *f) |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1169 { |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1170 return FRAME_DEVICE (f); |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1171 } |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1172 |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1173 DEFUN ("frame-device", Fframe_device, 0, 1, 0, /* |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1174 Return the device that FRAME is on. |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1175 If omitted, FRAME defaults to the currently selected frame. |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1176 */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1177 (frame)) |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1178 { |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1179 return FRAME_DEVICE (decode_frame (frame)); |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1180 } |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1181 |
428 | 1182 DEFUN ("focus-frame", Ffocus_frame, 1, 1, 0, /* |
1183 Select FRAME and give it the window system focus. | |
1184 This function is not affected by the value of `focus-follows-mouse'. | |
1185 */ | |
1186 (frame)) | |
1187 { | |
1188 CHECK_LIVE_FRAME (frame); | |
1189 | |
1190 MAYBE_DEVMETH (XDEVICE (FRAME_DEVICE (XFRAME (frame))), focus_on_frame, | |
1191 (XFRAME (frame))); | |
1192 /* FRAME will be selected by the time we receive the next event. | |
1193 However, it is better to select it explicitly now, in case the | |
1194 Lisp code depends on frame being selected. */ | |
1195 Fselect_frame (frame); | |
1196 return Qnil; | |
1197 } | |
1198 | |
1199 /* Called from Fselect_window() */ | |
1200 void | |
1201 select_frame_1 (Lisp_Object frame) | |
1202 { | |
1203 struct frame *f = XFRAME (frame); | |
1204 Lisp_Object old_selected_frame = Fselected_frame (Qnil); | |
1205 | |
1206 if (EQ (frame, old_selected_frame)) | |
1207 return; | |
1208 | |
1209 /* now select the frame's device */ | |
1210 set_device_selected_frame (XDEVICE (FRAME_DEVICE (f)), frame); | |
1211 select_device_1 (FRAME_DEVICE (f)); | |
1212 | |
1213 update_frame_window_mirror (f); | |
1214 } | |
1215 | |
1216 DEFUN ("select-frame", Fselect_frame, 1, 1, 0, /* | |
1217 Select the frame FRAME. | |
1218 Subsequent editing commands apply to its selected window. | |
1219 The selection of FRAME lasts until the next time the user does | |
1220 something to select a different frame, or until the next time this | |
1221 function is called. | |
1222 | |
1223 Note that this does not actually cause the window-system focus to be | |
1224 set to this frame, or the `select-frame-hook' or `deselect-frame-hook' | |
1225 to be run, until the next time that XEmacs is waiting for an event. | |
1226 | |
1227 Also note that when focus-follows-mouse is non-nil, the frame | |
1228 selection is temporary and is reverted when the current command | |
1229 terminates, much like the buffer selected by `set-buffer'. In order | |
1230 to effect a permanent focus change, use `focus-frame'. | |
1231 */ | |
1232 (frame)) | |
1233 { | |
1234 CHECK_LIVE_FRAME (frame); | |
1235 | |
1236 /* select the frame's selected window. This will call | |
1237 selected_frame_1(). */ | |
1238 Fselect_window (FRAME_SELECTED_WINDOW (XFRAME (frame)), Qnil); | |
1239 | |
1240 /* Nothing should be depending on the return value of this function. | |
1241 But, of course, there is stuff out there which is. */ | |
1242 return frame; | |
1243 } | |
1244 | |
1245 /* use this to retrieve the currently selected frame. You should use | |
1246 this in preference to Fselected_frame (Qnil) unless you are prepared | |
1247 to handle the possibility of there being no selected frame (this | |
1248 happens at some points during startup). */ | |
1249 | |
1250 struct frame * | |
1251 selected_frame (void) | |
1252 { | |
1253 Lisp_Object device = Fselected_device (Qnil); | |
1254 Lisp_Object frame = DEVICE_SELECTED_FRAME (XDEVICE (device)); | |
1255 if (NILP (frame)) | |
563 | 1256 gui_error ("No frames exist on device", device); |
428 | 1257 return XFRAME (frame); |
1258 } | |
1259 | |
1260 /* use this instead of XFRAME (DEVICE_SELECTED_FRAME (d)) to catch | |
1261 the possibility of there being no frames on the device (just created). | |
1262 There is no point doing this inside of redisplay because errors | |
2500 | 1263 cause an ABORT(), indicating a flaw in the logic, and error_check_frame() |
428 | 1264 will catch this just as well. */ |
1265 | |
1266 struct frame * | |
1267 device_selected_frame (struct device *d) | |
1268 { | |
1269 Lisp_Object frame = DEVICE_SELECTED_FRAME (d); | |
1270 if (NILP (frame)) | |
1271 { | |
793 | 1272 Lisp_Object device = wrap_device (d); |
1273 | |
563 | 1274 gui_error ("No frames exist on device", device); |
428 | 1275 } |
1276 return XFRAME (frame); | |
1277 } | |
1278 | |
1279 #if 0 /* FSFmacs */ | |
1280 | |
5104
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1281 /* Ben thinks there is no need for `redirect-frame-focus' or `frame-focus', |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1282 crockish FSFmacs functions. See summary on focus in event-stream.c. */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1283 |
826 | 1284 DEFUN ("handle-switch-frame", Fhandle_switch_frame, 1, 2, "e", /* |
428 | 1285 Handle a switch-frame event EVENT. |
1286 Switch-frame events are usually bound to this function. | |
1287 A switch-frame event tells Emacs that the window manager has requested | |
1288 that the user's events be directed to the frame mentioned in the event. | |
1289 This function selects the selected window of the frame of EVENT. | |
1290 | |
1291 If EVENT is frame object, handle it as if it were a switch-frame event | |
1292 to that frame. | |
1293 */ | |
1294 (frame, no_enter)) | |
1295 { | |
1296 /* Preserve prefix arg that the command loop just cleared. */ | |
1297 XCONSOLE (Vselected_console)->prefix_arg = Vcurrent_prefix_arg; | |
1298 #if 0 /* unclean! */ | |
1299 run_hook (Qmouse_leave_buffer_hook); | |
1300 #endif | |
1301 return do_switch_frame (frame, no_enter, 0); | |
1302 } | |
1303 | |
1304 /* A load of garbage. */ | |
826 | 1305 DEFUN ("ignore-event", Fignore_event, 0, 0, "", /* |
428 | 1306 Do nothing, but preserve any prefix argument already specified. |
1307 This is a suitable binding for iconify-frame and make-frame-visible. | |
1308 */ | |
1309 ()) | |
1310 { | |
1311 struct console *c = XCONSOLE (Vselected_console); | |
1312 | |
1313 c->prefix_arg = Vcurrent_prefix_arg; | |
1314 return Qnil; | |
1315 } | |
1316 | |
1317 #endif /* 0 */ | |
1318 | |
1319 DEFUN ("selected-frame", Fselected_frame, 0, 1, 0, /* | |
1320 Return the frame that is now selected on device DEVICE. | |
1321 If DEVICE is not specified, the selected device will be used. | |
1322 If no frames exist on the device, nil is returned. | |
1323 */ | |
1324 (device)) | |
1325 { | |
1326 if (NILP (device) && NILP (Fselected_device (Qnil))) | |
1327 return Qnil; /* happens early in temacs */ | |
1328 return DEVICE_SELECTED_FRAME (decode_device (device)); | |
1329 } | |
1330 | |
1331 Lisp_Object | |
1332 frame_first_window (struct frame *f) | |
1333 { | |
1334 Lisp_Object w = f->root_window; | |
1335 | |
1336 while (1) | |
1337 { | |
1338 if (! NILP (XWINDOW (w)->hchild)) | |
1339 w = XWINDOW (w)->hchild; | |
1340 else if (! NILP (XWINDOW (w)->vchild)) | |
1341 w = XWINDOW (w)->vchild; | |
1342 else | |
1343 break; | |
1344 } | |
1345 | |
1346 return w; | |
1347 } | |
1348 | |
1349 DEFUN ("active-minibuffer-window", Factive_minibuffer_window, 0, 0, 0, /* | |
1350 Return the currently active minibuffer window, or nil if none. | |
1351 */ | |
1352 ()) | |
1353 { | |
1354 return minibuf_level ? minibuf_window : Qnil; | |
1355 } | |
1356 | |
1357 DEFUN ("last-nonminibuf-frame", Flast_nonminibuf_frame, 0, 1, 0, /* | |
1358 Return the most-recently-selected non-minibuffer-only frame on CONSOLE. | |
1359 This will always be the same as (selected-frame device) unless the | |
1360 selected frame is a minibuffer-only frame. | |
1361 CONSOLE defaults to the selected console if omitted. | |
1362 */ | |
1363 (console)) | |
1364 { | |
1365 Lisp_Object result; | |
1366 | |
793 | 1367 console = wrap_console (decode_console (console)); |
428 | 1368 /* Just in case the machinations in delete_frame_internal() resulted |
1369 in the last-nonminibuf-frame getting out of sync, make sure and | |
1370 return the selected frame if it's acceptable. */ | |
1371 result = Fselected_frame (CONSOLE_SELECTED_DEVICE (XCONSOLE (console))); | |
1372 if (!NILP (result) && !FRAME_MINIBUF_ONLY_P (XFRAME (result))) | |
1373 return result; | |
1374 return CONSOLE_LAST_NONMINIBUF_FRAME (XCONSOLE (console)); | |
1375 } | |
1376 | |
1377 DEFUN ("frame-root-window", Fframe_root_window, 0, 1, 0, /* | |
1378 Return the root-window of FRAME. | |
1379 If omitted, FRAME defaults to the currently selected frame. | |
1380 */ | |
1381 (frame)) | |
1382 { | |
1383 struct frame *f = decode_frame (frame); | |
1384 return FRAME_ROOT_WINDOW (f); | |
1385 } | |
1386 | |
1387 DEFUN ("frame-selected-window", Fframe_selected_window, 0, 1, 0, /* | |
1388 Return the selected window of frame object FRAME. | |
1389 If omitted, FRAME defaults to the currently selected frame. | |
1390 */ | |
1391 (frame)) | |
1392 { | |
1393 struct frame *f = decode_frame (frame); | |
1394 return FRAME_SELECTED_WINDOW (f); | |
1395 } | |
1396 | |
1397 void | |
1398 set_frame_selected_window (struct frame *f, Lisp_Object window) | |
1399 { | |
1400 assert (XFRAME (WINDOW_FRAME (XWINDOW (window))) == f); | |
1401 f->selected_window = window; | |
1402 if (!MINI_WINDOW_P (XWINDOW (window)) || FRAME_MINIBUF_ONLY_P (f)) | |
1403 { | |
1404 if (!EQ (f->last_nonminibuf_window, window)) | |
1405 { | |
442 | 1406 #ifdef HAVE_TOOLBARS |
428 | 1407 MARK_TOOLBAR_CHANGED; |
442 | 1408 #endif |
428 | 1409 MARK_GUTTER_CHANGED; |
1410 } | |
1411 f->last_nonminibuf_window = window; | |
1412 } | |
1413 } | |
1414 | |
1415 DEFUN ("set-frame-selected-window", Fset_frame_selected_window, 2, 2, 0, /* | |
460 | 1416 Set the selected window of FRAME to WINDOW. |
428 | 1417 If FRAME is nil, the selected frame is used. |
1418 If FRAME is the selected frame, this makes WINDOW the selected window. | |
1419 */ | |
1420 (frame, window)) | |
1421 { | |
793 | 1422 frame = wrap_frame (decode_frame (frame)); |
428 | 1423 CHECK_LIVE_WINDOW (window); |
1424 | |
1425 if (! EQ (frame, WINDOW_FRAME (XWINDOW (window)))) | |
563 | 1426 invalid_argument ("In `set-frame-selected-window', WINDOW is not on FRAME", Qunbound); |
428 | 1427 |
1428 if (XFRAME (frame) == selected_frame ()) | |
1429 return Fselect_window (window, Qnil); | |
1430 | |
1431 set_frame_selected_window (XFRAME (frame), window); | |
1432 return window; | |
1433 } | |
1434 | |
5104
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1435 DEFUN ("disable-frame", Fdisable_frame, 1, 1, 0, /* |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1436 Disable frame FRAME, so that it cannot have the focus or receive user input. |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1437 This is normally used during modal dialog boxes. |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1438 WARNING: Be very careful not to wedge XEmacs! |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1439 Use an `unwind-protect' that re-enables the frame to avoid this. |
428 | 1440 */ |
1441 (frame)) | |
1442 { | |
5104
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1443 struct frame *f = decode_frame (frame); |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1444 |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1445 f->disabled = 1; |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1446 MAYBE_FRAMEMETH (f, disable_frame, (f)); |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1447 return Qnil; |
428 | 1448 } |
1449 | |
5104
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1450 DEFUN ("enable-frame", Fenable_frame, 1, 1, 0, /* |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1451 Enable frame FRAME, so that it can have the focus and receive user input. |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1452 Frames are normally enabled, unless explicitly disabled using `disable-frame'. |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1453 */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1454 (frame)) |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1455 { |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1456 struct frame *f = decode_frame (frame); |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1457 f->disabled = 0; |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1458 MAYBE_FRAMEMETH (f, enable_frame, (f)); |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1459 return Qnil; |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1460 } |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1461 |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1462 /**************************************************************************/ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1463 /* */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1464 /* traversing the list of frames */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1465 /* */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1466 /**************************************************************************/ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1467 |
428 | 1468 int |
1469 is_surrogate_for_selected_frame (struct frame *f) | |
1470 { | |
1471 struct device *d = XDEVICE (f->device); | |
1472 struct frame *dsf = device_selected_frame (d); | |
1473 | |
1474 /* Can't be a surrogate for ourselves. */ | |
1475 if (f == dsf) | |
1476 return 0; | |
1477 | |
1478 if (!FRAME_HAS_MINIBUF_P (dsf) && | |
1479 f == XFRAME (WINDOW_FRAME (XWINDOW (FRAME_MINIBUF_WINDOW (dsf))))) | |
1480 return 1; | |
1481 else | |
1482 return 0; | |
1483 } | |
1484 | |
1485 static int | |
444 | 1486 frame_matches_frame_spec (Lisp_Object frame, Lisp_Object type) |
428 | 1487 { |
1488 struct frame *f = XFRAME (frame); | |
1489 | |
1490 if (WINDOWP (type)) | |
1491 { | |
1492 CHECK_LIVE_WINDOW (type); | |
1493 | |
1494 if (EQ (FRAME_MINIBUF_WINDOW (f), type) | |
1495 /* Check that F either is, or has forwarded | |
1496 its focus to, TYPE's frame. */ | |
1497 && (EQ (WINDOW_FRAME (XWINDOW (type)), frame) | |
1498 || EQ (WINDOW_FRAME (XWINDOW (type)), | |
1499 FRAME_FOCUS_FRAME (f)))) | |
1500 return 1; | |
1501 else | |
1502 return 0; | |
1503 } | |
1504 | |
1505 #if 0 /* FSFmacs */ | |
1506 if (EQ (type, Qvisible) || EQ (type, Qiconic) || EQ (type, Qvisible_iconic) | |
1507 || EQ (type, Qvisible_nomini) || EQ (type, Qiconic_nomini) | |
1508 || EQ (type, Qvisible_iconic_nomini)) | |
1509 FRAME_SAMPLE_VISIBILITY (f); | |
1510 #endif | |
1511 | |
1512 if (NILP (type)) | |
1513 type = Qnomini; | |
1514 if (ZEROP (type)) | |
1515 type = Qvisible_iconic; | |
1516 | |
1517 if (EQ (type, Qvisible)) | |
1518 return FRAME_VISIBLE_P (f); | |
1519 if (EQ (type, Qiconic)) | |
1520 return FRAME_ICONIFIED_P (f); | |
1521 if (EQ (type, Qinvisible)) | |
1522 return !FRAME_VISIBLE_P (f) && !FRAME_ICONIFIED_P (f); | |
1523 if (EQ (type, Qvisible_iconic)) | |
1524 return FRAME_VISIBLE_P (f) || FRAME_ICONIFIED_P (f); | |
1525 if (EQ (type, Qinvisible_iconic)) | |
1526 return !FRAME_VISIBLE_P (f); | |
1527 | |
1528 if (EQ (type, Qnomini)) | |
1529 return !FRAME_MINIBUF_ONLY_P (f); | |
1530 if (EQ (type, Qvisible_nomini)) | |
1531 return FRAME_VISIBLE_P (f) && !FRAME_MINIBUF_ONLY_P (f); | |
1532 if (EQ (type, Qiconic_nomini)) | |
1533 return FRAME_ICONIFIED_P (f) && !FRAME_MINIBUF_ONLY_P (f); | |
1534 if (EQ (type, Qinvisible_nomini)) | |
1535 return !FRAME_VISIBLE_P (f) && !FRAME_ICONIFIED_P (f) && | |
1536 !FRAME_MINIBUF_ONLY_P (f); | |
1537 if (EQ (type, Qvisible_iconic_nomini)) | |
1538 return ((FRAME_VISIBLE_P (f) || FRAME_ICONIFIED_P (f)) | |
1539 && !FRAME_MINIBUF_ONLY_P (f)); | |
1540 if (EQ (type, Qinvisible_iconic_nomini)) | |
1541 return !FRAME_VISIBLE_P (f) && !FRAME_MINIBUF_ONLY_P (f); | |
1542 | |
1543 return 1; | |
1544 } | |
1545 | |
1546 int | |
444 | 1547 device_matches_device_spec (Lisp_Object device, Lisp_Object device_spec) |
428 | 1548 { |
444 | 1549 if (EQ (device_spec, Qwindow_system)) |
428 | 1550 return DEVICE_WIN_P (XDEVICE (device)); |
444 | 1551 if (DEVICEP (device_spec)) |
1552 return EQ (device, device_spec); | |
1553 if (CONSOLEP (device_spec)) | |
1554 return EQ (DEVICE_CONSOLE (XDEVICE (device)), device_spec); | |
1555 if (valid_console_type_p (device_spec)) | |
1556 return EQ (DEVICE_TYPE (XDEVICE (device)), device_spec); | |
428 | 1557 return 1; |
1558 } | |
1559 | |
1560 /* Return the next frame in the frame list after FRAME. | |
444 | 1561 WHICH-FRAMES and WHICH-DEVICES control which frames and devices |
428 | 1562 are considered; see `next-frame'. */ |
1563 | |
1564 Lisp_Object | |
444 | 1565 next_frame (Lisp_Object frame, Lisp_Object which_frames, Lisp_Object which_devices) |
428 | 1566 { |
442 | 1567 Lisp_Object first = Qnil; |
1568 Lisp_Object devcons, concons; | |
1569 int passed = 0; | |
1570 | |
1571 CHECK_LIVE_FRAME (frame); | |
1572 | |
1573 DEVICE_LOOP_NO_BREAK (devcons, concons) | |
1574 { | |
1575 Lisp_Object device = XCAR (devcons); | |
1576 Lisp_Object frmcons; | |
1577 | |
444 | 1578 if (!device_matches_device_spec (device, which_devices)) |
442 | 1579 { |
1580 if (EQ (device, FRAME_DEVICE (XFRAME (frame)))) | |
1581 passed = 1; | |
1582 continue; | |
1583 } | |
1584 | |
1585 DEVICE_FRAME_LOOP (frmcons, XDEVICE (device)) | |
1586 { | |
1587 Lisp_Object f = XCAR (frmcons); | |
1588 | |
1589 if (passed) | |
1590 { | |
444 | 1591 if (frame_matches_frame_spec (f, which_frames)) |
442 | 1592 return f; |
1593 } | |
1594 else | |
1595 { | |
1596 if (EQ (frame, f)) | |
1597 { | |
1598 passed = 1; | |
1599 } | |
1600 else | |
1601 { | |
444 | 1602 if (NILP (first) && frame_matches_frame_spec (f, which_frames)) |
442 | 1603 first = f; |
1604 } | |
1605 } | |
1606 } | |
1607 } | |
1608 | |
1609 if (NILP (first)) | |
1610 /* We went through the whole frame list without finding a single | |
1611 acceptable frame. Return the original frame. */ | |
1612 return frame; | |
1613 else | |
1614 /* There were no acceptable frames in the list after FRAME; otherwise, | |
1615 we would have returned directly from the loop. Since FIRST is the last | |
1616 acceptable frame in the list, return it. */ | |
1617 return first; | |
428 | 1618 } |
1619 | |
1620 /* Return the previous frame in the frame list before FRAME. | |
444 | 1621 WHICH-FRAMES and WHICH-DEVICES control which frames and devices |
428 | 1622 are considered; see `next-frame'. */ |
1623 | |
1624 Lisp_Object | |
444 | 1625 previous_frame (Lisp_Object frame, Lisp_Object which_frames, Lisp_Object which_devices) |
428 | 1626 { |
1627 Lisp_Object devcons, concons; | |
442 | 1628 Lisp_Object last = Qnil; |
1629 | |
428 | 1630 CHECK_LIVE_FRAME (frame); |
1631 | |
1632 DEVICE_LOOP_NO_BREAK (devcons, concons) | |
1633 { | |
1634 Lisp_Object device = XCAR (devcons); | |
1635 Lisp_Object frmcons; | |
1636 | |
444 | 1637 if (!device_matches_device_spec (device, which_devices)) |
442 | 1638 { |
1639 if (EQ (device, FRAME_DEVICE (XFRAME (frame))) | |
1640 && !NILP (last)) | |
1641 return last; | |
1642 continue; | |
1643 } | |
428 | 1644 |
1645 DEVICE_FRAME_LOOP (frmcons, XDEVICE (device)) | |
1646 { | |
1647 Lisp_Object f = XCAR (frmcons); | |
1648 | |
442 | 1649 if (EQ (frame, f)) |
1650 { | |
1651 if (!NILP (last)) | |
1652 return last; | |
1653 } | |
1654 else | |
1655 { | |
444 | 1656 if (frame_matches_frame_spec (f, which_frames)) |
442 | 1657 last = f; |
1658 } | |
428 | 1659 } |
1660 } | |
1661 | |
442 | 1662 if (NILP (last)) |
428 | 1663 /* We went through the whole frame list without finding a single |
1664 acceptable frame. Return the original frame. */ | |
1665 return frame; | |
1666 else | |
1667 /* There were no acceptable frames in the list before FRAME; otherwise, | |
442 | 1668 we would have returned directly from the loop. Since LAST is the last |
428 | 1669 acceptable frame in the list, return it. */ |
442 | 1670 return last; |
428 | 1671 } |
1672 | |
1673 DEFUN ("next-frame", Fnext_frame, 0, 3, 0, /* | |
1674 Return the next frame of the right type in the frame list after FRAME. | |
444 | 1675 WHICH-FRAMES controls which frames are eligible to be returned; all |
428 | 1676 others will be skipped. Note that if there is only one eligible |
1677 frame, then `next-frame' called repeatedly will always return | |
1678 the same frame, and if there is no eligible frame, then FRAME is | |
1679 returned. | |
1680 | |
444 | 1681 Possible values for WHICH-FRAMES are |
428 | 1682 |
3025 | 1683 `visible' Consider only frames that are visible. |
1684 `iconic' Consider only frames that are iconic. | |
1685 `invisible' Consider only frames that are invisible | |
4207 | 1686 (this is different from iconic). |
3025 | 1687 `visible-iconic' Consider frames that are visible or iconic. |
1688 `invisible-iconic' Consider frames that are invisible or iconic. | |
1689 `nomini' Consider all frames except minibuffer-only ones. | |
1690 `visible-nomini' Like `visible' but omits minibuffer-only frames. | |
1691 `iconic-nomini' Like `iconic' but omits minibuffer-only frames. | |
1692 `invisible-nomini' Like `invisible' but omits minibuffer-only frames. | |
1693 `visible-iconic-nomini' Like `visible-iconic' but omits minibuffer-only | |
4207 | 1694 frames. |
3025 | 1695 `invisible-iconic-nomini' Like `invisible-iconic' but omits minibuffer-only |
4207 | 1696 frames. |
3025 | 1697 any other value Consider all frames. |
1698 | |
1699 If WHICH-FRAMES is omitted, `nomini' is used. A value for WHICH-FRAMES | |
1700 of 0 (a number) is treated like `iconic', for backwards compatibility. | |
444 | 1701 |
1702 If WHICH-FRAMES is a window, include only its own frame and any frame | |
1703 now using that window as the minibuffer. | |
1704 | |
1705 The optional third argument WHICH-DEVICES further clarifies on which | |
1706 devices to search for frames as specified by WHICH-FRAMES. | |
1707 If nil or omitted, search all devices on FRAME's console. | |
1708 If a device, only search that device. | |
1709 If a console, search all devices on that console. | |
1710 If a device type, search all devices of that type. | |
1711 If `window-system', search all window-system devices. | |
1712 Any other non-nil value means search all devices. | |
428 | 1713 */ |
444 | 1714 (frame, which_frames, which_devices)) |
428 | 1715 { |
793 | 1716 frame = wrap_frame (decode_frame (frame)); |
428 | 1717 |
444 | 1718 return next_frame (frame, which_frames, which_devices); |
428 | 1719 } |
1720 | |
1721 DEFUN ("previous-frame", Fprevious_frame, 0, 3, 0, /* | |
1722 Return the next frame of the right type in the frame list after FRAME. | |
444 | 1723 WHICH-FRAMES controls which frames are eligible to be returned; all |
428 | 1724 others will be skipped. Note that if there is only one eligible |
1725 frame, then `previous-frame' called repeatedly will always return | |
1726 the same frame, and if there is no eligible frame, then FRAME is | |
1727 returned. | |
1728 | |
444 | 1729 See `next-frame' for an explanation of the WHICH-FRAMES and WHICH-DEVICES |
428 | 1730 arguments. |
1731 */ | |
444 | 1732 (frame, which_frames, which_devices)) |
428 | 1733 { |
793 | 1734 frame = wrap_frame (decode_frame (frame)); |
428 | 1735 |
444 | 1736 return previous_frame (frame, which_frames, which_devices); |
428 | 1737 } |
1738 | |
1739 /* Return any frame for which PREDICATE is non-zero, or return Qnil | |
1740 if there aren't any. */ | |
1741 | |
1742 Lisp_Object | |
1743 find_some_frame (int (*predicate) (Lisp_Object, void *), | |
1744 void *closure) | |
1745 { | |
1746 Lisp_Object framecons, devcons, concons; | |
1747 | |
1748 FRAME_LOOP_NO_BREAK (framecons, devcons, concons) | |
1749 { | |
1750 Lisp_Object frame = XCAR (framecons); | |
1751 | |
1752 if ((predicate) (frame, closure)) | |
1753 return frame; | |
1754 } | |
1755 | |
1756 return Qnil; | |
1757 } | |
1758 | |
1759 | |
5104
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1760 /**************************************************************************/ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1761 /* */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1762 /* frame deletion */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1763 /* */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
1764 /**************************************************************************/ |
428 | 1765 |
1766 /* extern void free_line_insertion_deletion_costs (struct frame *f); */ | |
1767 | |
1768 /* Return 1 if it is ok to delete frame F; | |
1769 0 if all frames aside from F are invisible. | |
1770 (Exception: if F is a stream frame, it's OK to delete if | |
1771 any other frames exist.) */ | |
1772 | |
442 | 1773 int |
1774 other_visible_frames (struct frame *f) | |
428 | 1775 { |
793 | 1776 Lisp_Object frame = wrap_frame (f); |
1777 | |
428 | 1778 if (FRAME_STREAM_P (f)) |
442 | 1779 return !EQ (frame, next_frame (frame, Qt, Qt)); |
1780 return !EQ (frame, next_frame (frame, Qvisible_iconic_nomini, Qt)); | |
428 | 1781 } |
1782 | |
1783 /* Delete frame F. | |
1784 | |
1785 If FORCE is non-zero, allow deletion of the only frame. | |
1786 | |
1787 If CALLED_FROM_DELETE_DEVICE is non-zero, then, if | |
1788 deleting the last frame on a device, just delete it, | |
1789 instead of calling `delete-device'. | |
1790 | |
1791 If FROM_IO_ERROR is non-zero, then the frame is gone due | |
1792 to an I/O error. This affects what happens if we exit | |
1793 (we do an emergency exit instead of `save-buffers-kill-emacs'.) | |
1794 */ | |
1795 | |
1796 void | |
1797 delete_frame_internal (struct frame *f, int force, | |
1798 int called_from_delete_device, | |
1799 int from_io_error) | |
1800 { | |
1801 /* This function can GC */ | |
1802 int minibuffer_selected; | |
1803 struct device *d; | |
1804 struct console *con; | |
1805 Lisp_Object frame; | |
1806 Lisp_Object device; | |
1807 Lisp_Object console; | |
1808 struct gcpro gcpro1; | |
1313 | 1809 int depth; |
428 | 1810 |
1811 /* OK to delete an already deleted frame. */ | |
853 | 1812 if (!FRAME_LIVE_P (f)) |
428 | 1813 return; |
1814 | |
793 | 1815 frame = wrap_frame (f); |
853 | 1816 |
1817 if (!force) | |
1818 check_allowed_operation (OPERATION_DELETE_OBJECT, frame, Qnil); | |
1819 | |
428 | 1820 GCPRO1 (frame); |
1821 | |
1822 device = FRAME_DEVICE (f); | |
1823 d = XDEVICE (device); | |
1824 console = DEVICE_CONSOLE (d); | |
1825 con = XCONSOLE (console); | |
1826 | |
545 | 1827 if (!called_from_delete_device |
1828 && !DEVICE_IMPL_FLAG (d, XDEVIMPF_FRAMELESS_OK)) | |
428 | 1829 { |
1830 /* If we're deleting the only non-minibuffer frame on the | |
1831 device, delete the device. */ | |
1832 if (EQ (frame, next_frame (frame, Qnomini, FRAME_DEVICE (f)))) | |
1833 { | |
1834 delete_device_internal (d, force, 0, from_io_error); | |
1835 UNGCPRO; | |
1836 return; | |
1837 } | |
1838 } | |
1839 | |
1840 /* In FSF, delete-frame will not normally allow you to delete the | |
1841 last visible frame. This was too annoying, so we changed it to the | |
1842 only frame. However, this would let people shoot themselves by | |
1843 deleting all frames which were either visible or iconified and thus | |
1844 losing any way of communicating with the still running XEmacs process. | |
1845 So we put it back. */ | |
1846 if (!force && !allow_deletion_of_last_visible_frame && | |
442 | 1847 !other_visible_frames (f)) |
563 | 1848 invalid_operation ("Attempt to delete the sole visible or iconified frame", Qunbound); |
428 | 1849 |
1850 /* Does this frame have a minibuffer, and is it the surrogate | |
1851 minibuffer for any other frame? */ | |
1852 if (FRAME_HAS_MINIBUF_P (f)) | |
1853 { | |
1854 Lisp_Object frmcons, devcons, concons; | |
1855 | |
1856 FRAME_LOOP_NO_BREAK (frmcons, devcons, concons) | |
1857 { | |
2552 | 1858 Lisp_Object this_frame = XCAR (frmcons); |
1859 | |
1860 if (! EQ (this_frame, frame) | |
428 | 1861 && EQ (frame, (WINDOW_FRAME |
1862 (XWINDOW | |
2552 | 1863 (FRAME_MINIBUF_WINDOW (XFRAME (this_frame))))))) |
428 | 1864 { |
1865 /* We've found another frame whose minibuffer is on | |
1866 this frame. */ | |
563 | 1867 gui_error |
428 | 1868 ("Attempt to delete a surrogate minibuffer frame", frame); |
1869 } | |
1870 } | |
1871 } | |
1872 | |
1873 /* Test for popup frames hanging around. */ | |
1874 /* Deletion of a parent frame with popups is deadly. */ | |
1875 { | |
1876 Lisp_Object frmcons, devcons, concons; | |
1877 | |
1878 FRAME_LOOP_NO_BREAK (frmcons, devcons, concons) | |
1879 { | |
2552 | 1880 Lisp_Object this_frame = XCAR (frmcons); |
1881 | |
1882 | |
1883 if (! EQ (this_frame, frame)) | |
428 | 1884 { |
1885 struct device *devcons_d = XDEVICE (XCAR (devcons)); | |
1886 if (EQ (frame, DEVMETH_OR_GIVEN (devcons_d, get_frame_parent, | |
2552 | 1887 (XFRAME (this_frame)), |
428 | 1888 Qnil))) |
1889 /* We've found a popup frame whose parent is this frame. */ | |
563 | 1890 gui_error |
428 | 1891 ("Attempt to delete a frame with live popups", frame); |
1892 } | |
1893 } | |
1894 } | |
1895 | |
1896 /* Before here, we haven't made any dangerous changes (just checked for | |
1897 error conditions). Now run the delete-frame-hook. Remember that | |
1898 user code there could do any number of dangerous things, including | |
1899 signalling an error. */ | |
1900 | |
1901 va_run_hook_with_args (Qdelete_frame_hook, 1, frame); | |
1902 | |
1903 if (!FRAME_LIVE_P (f)) /* Make sure the delete-frame-hook didn't */ | |
1904 { /* go ahead and delete anything. */ | |
1905 UNGCPRO; | |
1906 return; | |
1907 } | |
1908 | |
1909 /* Call the delete-device-hook and delete-console-hook now if | |
1910 appropriate, before we do any dangerous things -- they too could | |
1911 signal an error. */ | |
1912 if (XINT (Flength (DEVICE_FRAME_LIST (d))) == 1) | |
1913 { | |
1914 va_run_hook_with_args (Qdelete_device_hook, 1, device); | |
1915 if (!FRAME_LIVE_P (f)) /* Make sure the delete-device-hook didn't */ | |
1916 { /* go ahead and delete anything. */ | |
1917 UNGCPRO; | |
1918 return; | |
1919 } | |
1920 | |
1921 if (XINT (Flength (CONSOLE_DEVICE_LIST (con))) == 1) | |
1922 { | |
1923 va_run_hook_with_args (Qdelete_console_hook, 1, console); | |
1924 if (!FRAME_LIVE_P (f)) /* Make sure the delete-console-hook didn't */ | |
1925 { /* go ahead and delete anything. */ | |
1926 UNGCPRO; | |
1927 return; | |
1928 } | |
1929 } | |
1930 } | |
1931 | |
1932 minibuffer_selected = EQ (minibuf_window, Fselected_window (Qnil)); | |
1933 | |
1934 /* If we were focused on this frame, then we're not any more. | |
1935 Assume that we lost the focus; that way, the call to | |
1936 Fselect_frame() below won't end up making us explicitly | |
1937 focus on another frame, which is generally undesirable in | |
1938 a point-to-type world. If our mouse ends up sitting over | |
1939 another frame, we will receive a FocusIn event and end up | |
1940 making that frame the selected frame. | |
1941 | |
1942 #### This may not be an ideal solution in a click-to-type | |
1943 world (in that case, we might want to explicitly choose | |
1944 another frame to have the focus, rather than relying on | |
1945 the WM, which might focus on a frame in a different app | |
1946 or focus on nothing at all). But there's no easy way | |
1947 to detect which focus model we're running on, and the | |
1948 alternative is more heinous. */ | |
1949 | |
1950 if (EQ (frame, DEVICE_FRAME_WITH_FOCUS_REAL (d))) | |
1951 DEVICE_FRAME_WITH_FOCUS_REAL (d) = Qnil; | |
1952 if (EQ (frame, DEVICE_FRAME_WITH_FOCUS_FOR_HOOKS (d))) | |
1953 DEVICE_FRAME_WITH_FOCUS_FOR_HOOKS (d) = Qnil; | |
1954 if (EQ (frame, DEVICE_FRAME_THAT_OUGHT_TO_HAVE_FOCUS (d))) | |
1955 DEVICE_FRAME_THAT_OUGHT_TO_HAVE_FOCUS (d) = Qnil; | |
1956 | |
1957 /* Don't allow the deleted frame to remain selected. | |
1958 Note that in the former scheme of things, this would | |
1959 have caused us to regain the focus. This no longer | |
1960 applies (see above); I think the new behavior is more | |
1961 logical. If someone disagrees, it can always be | |
1962 changed (or a new user variable can be introduced, ugh.) */ | |
1963 if (EQ (frame, DEVICE_SELECTED_FRAME (d))) | |
1964 { | |
1965 Lisp_Object next; | |
1966 | |
1967 /* If this is a popup frame, select its parent if possible. | |
1968 Otherwise, find another visible frame; if none, just take any frame. | |
4207 | 1969 First try the same device, then the same console. */ |
428 | 1970 |
1971 next = DEVMETH_OR_GIVEN (d, get_frame_parent, (f), Qnil); | |
1972 if (NILP (next) || EQ (next, frame) || ! FRAME_LIVE_P (XFRAME (next))) | |
442 | 1973 next = next_frame (frame, Qvisible, device); |
428 | 1974 if (NILP (next) || EQ (next, frame)) |
442 | 1975 next = next_frame (frame, Qvisible, console); |
1976 if (NILP (next) || EQ (next, frame)) | |
1977 next = next_frame (frame, Qvisible, Qt); | |
428 | 1978 if (NILP (next) || EQ (next, frame)) |
442 | 1979 next = next_frame (frame, Qt, device); |
428 | 1980 if (NILP (next) || EQ (next, frame)) |
442 | 1981 next = next_frame (frame, Qt, console); |
428 | 1982 if (NILP (next) || EQ (next, frame)) |
442 | 1983 next = next_frame (frame, Qt, Qt); |
428 | 1984 |
1985 /* if we haven't found another frame at this point | |
1986 then there aren't any. */ | |
1987 if (NILP (next) || EQ (next, frame)) | |
1988 ; | |
1989 else | |
1990 { | |
1991 int did_select = 0; | |
1992 /* if this is the global selected frame, select another one. */ | |
1993 if (EQ (frame, Fselected_frame (Qnil))) | |
1994 { | |
1995 Fselect_frame (next); | |
1996 did_select = 1; | |
1997 } | |
1998 /* | |
1999 * If the new frame we just selected is on a different | |
2000 * device then we still need to change DEVICE_SELECTED_FRAME(d) | |
2001 * to a live frame, if there are any left on this device. | |
2002 */ | |
2003 if (!EQ (device, FRAME_DEVICE(XFRAME(next)))) | |
2004 { | |
442 | 2005 Lisp_Object next_f = next_frame (frame, Qt, device); |
428 | 2006 if (NILP (next_f) || EQ (next_f, frame)) |
440 | 2007 set_device_selected_frame (d, Qnil); |
428 | 2008 else |
2009 set_device_selected_frame (d, next_f); | |
2010 } | |
2011 else if (! did_select) | |
2012 set_device_selected_frame (d, next); | |
2013 | |
2014 } | |
2015 } | |
2016 | |
2017 /* Don't allow minibuf_window to remain on a deleted frame. */ | |
2018 if (EQ (f->minibuffer_window, minibuf_window)) | |
2019 { | |
2020 struct frame *sel_frame = selected_frame (); | |
2021 Fset_window_buffer (sel_frame->minibuffer_window, | |
440 | 2022 XWINDOW (minibuf_window)->buffer, Qt); |
428 | 2023 minibuf_window = sel_frame->minibuffer_window; |
2024 | |
2025 /* If the dying minibuffer window was selected, | |
2026 select the new one. */ | |
2027 if (minibuffer_selected) | |
2028 Fselect_window (minibuf_window, Qnil); | |
2029 } | |
2030 | |
2031 /* After this point, no errors must be allowed to occur. */ | |
2032 | |
1313 | 2033 /* Checking for QUIT can run all sorts of weird code and may be deadly |
2034 so don't let it happen. */ | |
2035 depth = begin_dont_check_for_quit (); | |
2036 | |
428 | 2037 #ifdef HAVE_MENUBARS |
2038 free_frame_menubars (f); | |
2039 #endif | |
2040 #ifdef HAVE_SCROLLBARS | |
2041 free_frame_scrollbars (f); | |
2042 #endif | |
2043 #ifdef HAVE_TOOLBARS | |
2044 free_frame_toolbars (f); | |
2045 #endif | |
2046 free_frame_gutters (f); | |
442 | 2047 /* Unfortunately deleting the frame will also delete the parent of |
2048 all of the subwindow instances current on the frame. I think this | |
2049 can lead to bad things when trying to finalize the | |
2050 instances. Thus we loop over all instance caches calling the | |
2051 finalize method for each instance. */ | |
2052 free_frame_subwindow_instances (f); | |
428 | 2053 |
2054 /* This must be done before the window and window_mirror structures | |
2055 are freed. The scrollbar information is attached to them. */ | |
2056 MAYBE_FRAMEMETH (f, delete_frame, (f)); | |
2057 | |
2058 /* Mark all the windows that used to be on FRAME as deleted, and then | |
2059 remove the reference to them. */ | |
2060 delete_all_subwindows (XWINDOW (f->root_window)); | |
2061 f->root_window = Qnil; | |
2062 | |
2063 /* clear out the cached glyph information */ | |
442 | 2064 f->subwindow_instance_cache = Qnil; |
428 | 2065 |
2066 /* Remove the frame now from the list. This way, any events generated | |
2067 on this frame by the maneuvers below will disperse themselves. */ | |
2068 | |
2069 /* This used to be Fdelq(), but that will cause a seg fault if the | |
2070 QUIT checker happens to get invoked, because the frame list is in | |
2071 an inconsistent state. */ | |
2072 d->frame_list = delq_no_quit (frame, d->frame_list); | |
2073 RESET_CHANGED_SET_FLAGS; | |
2074 | |
2075 f->visible = 0; | |
2076 | |
617 | 2077 free_window_mirror (XWINDOW_MIRROR (f->root_mirror)); |
853 | 2078 |
428 | 2079 /* free_line_insertion_deletion_costs (f); */ |
2080 | |
2081 /* If we've deleted the last non-minibuf frame, then try to find | |
2082 another one. */ | |
2083 if (EQ (frame, CONSOLE_LAST_NONMINIBUF_FRAME (con))) | |
2084 { | |
2085 Lisp_Object frmcons, devcons; | |
2086 | |
2087 set_console_last_nonminibuf_frame (con, Qnil); | |
2088 | |
2089 CONSOLE_FRAME_LOOP_NO_BREAK (frmcons, devcons, con) | |
2090 { | |
2091 Lisp_Object ecran = XCAR (frmcons); | |
2092 if (!FRAME_MINIBUF_ONLY_P (XFRAME (ecran))) | |
2093 { | |
2094 set_console_last_nonminibuf_frame (con, ecran); | |
2095 goto double_break_1; | |
2096 } | |
2097 } | |
2098 } | |
2099 double_break_1: | |
2100 | |
2101 #if 0 | |
2102 /* The following test is degenerate FALSE */ | |
2103 if (called_from_delete_device < 0) | |
2104 /* then we're being called from delete-console, and we shouldn't | |
2105 try to find another default-minibuffer frame for the console. | |
2106 */ | |
2107 con->default_minibuffer_frame = Qnil; | |
2108 #endif | |
2109 | |
2110 /* If we've deleted this console's default_minibuffer_frame, try to | |
2111 find another one. Prefer minibuffer-only frames, but also notice | |
2112 frames with other windows. */ | |
2113 if (EQ (frame, con->default_minibuffer_frame)) | |
2114 { | |
2115 Lisp_Object frmcons, devcons; | |
2116 /* The last frame we saw with a minibuffer, minibuffer-only or not. */ | |
2117 Lisp_Object frame_with_minibuf; | |
2118 /* Some frame we found on the same console, or nil if there are none. */ | |
2119 Lisp_Object frame_on_same_console; | |
2120 | |
2121 frame_on_same_console = Qnil; | |
2122 frame_with_minibuf = Qnil; | |
2123 | |
2124 set_console_last_nonminibuf_frame (con, Qnil); | |
2125 | |
2126 CONSOLE_FRAME_LOOP_NO_BREAK (frmcons, devcons, con) | |
2127 { | |
2552 | 2128 Lisp_Object this_frame; |
428 | 2129 struct frame *f1; |
2130 | |
2552 | 2131 this_frame = XCAR (frmcons); |
2132 f1 = XFRAME (this_frame); | |
428 | 2133 |
2134 /* Consider only frames on the same console | |
2135 and only those with minibuffers. */ | |
2136 if (FRAME_HAS_MINIBUF_P (f1)) | |
2137 { | |
2552 | 2138 frame_with_minibuf = this_frame; |
428 | 2139 if (FRAME_MINIBUF_ONLY_P (f1)) |
2140 goto double_break_2; | |
2141 } | |
2142 | |
2552 | 2143 frame_on_same_console = this_frame; |
428 | 2144 } |
2145 double_break_2: | |
2146 | |
2147 if (!NILP (frame_on_same_console)) | |
2148 { | |
2149 /* We know that there must be some frame with a minibuffer out | |
2150 there. If this were not true, all of the frames present | |
2151 would have to be minibuffer-less, which implies that at some | |
2152 point their minibuffer frames must have been deleted, but | |
2153 that is prohibited at the top; you can't delete surrogate | |
2154 minibuffer frames. */ | |
5050
6f2158fa75ed
Fix quick-build, use asserts() in place of ABORT()
Ben Wing <ben@xemacs.org>
parents:
4976
diff
changeset
|
2155 assert (!NILP (frame_with_minibuf)); |
428 | 2156 |
2157 con->default_minibuffer_frame = frame_with_minibuf; | |
2158 } | |
2159 else | |
2160 /* No frames left on this console--say no minibuffer either. */ | |
2161 con->default_minibuffer_frame = Qnil; | |
2162 } | |
2163 | |
617 | 2164 /* Nobody should be accessing anything in this object any more, and |
2165 making all Lisp_Objects Qnil allows for better GC'ing in case a | |
2166 pointer to the dead frame continues to hang around. Zero all | |
2167 other structs in case someone tries to access something through | |
2168 them. */ | |
2169 | |
2170 nuke_all_frame_slots (f); | |
428 | 2171 f->framemeths = dead_console_methods; |
1204 | 2172 f->frametype = dead_console; |
617 | 2173 |
853 | 2174 note_object_deleted (frame); |
2175 | |
1313 | 2176 unbind_to (depth); |
2177 | |
428 | 2178 UNGCPRO; |
2179 } | |
2180 | |
2181 void | |
2182 io_error_delete_frame (Lisp_Object frame) | |
2183 { | |
2184 delete_frame_internal (XFRAME (frame), 1, 0, 1); | |
2185 } | |
2186 | |
2187 DEFUN ("delete-frame", Fdelete_frame, 0, 2, "", /* | |
2188 Delete FRAME, permanently eliminating it from use. | |
2189 If omitted, FRAME defaults to the selected frame. | |
2190 A frame may not be deleted if its minibuffer is used by other frames. | |
2191 Normally, you cannot delete the last non-minibuffer-only frame (you must | |
2192 use `save-buffers-kill-emacs' or `kill-emacs'). However, if optional | |
2193 second argument FORCE is non-nil, you can delete the last frame. (This | |
2194 will automatically call `save-buffers-kill-emacs'.) | |
2195 */ | |
2196 (frame, force)) | |
2197 { | |
2198 /* This function can GC */ | |
2199 struct frame *f; | |
2200 | |
2201 if (NILP (frame)) | |
2202 { | |
2203 f = selected_frame (); | |
793 | 2204 frame = wrap_frame (f); |
428 | 2205 } |
2206 else | |
2207 { | |
2208 CHECK_FRAME (frame); | |
2209 f = XFRAME (frame); | |
2210 } | |
2211 | |
2212 delete_frame_internal (f, !NILP (force), 0, 0); | |
2213 return Qnil; | |
2214 } | |
2215 | |
2216 | |
5104
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
2217 /**************************************************************************/ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
2218 /* */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
2219 /* mouse position in frame */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
2220 /* */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
2221 /**************************************************************************/ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
2222 |
428 | 2223 /* Return mouse position in character cell units. */ |
2224 | |
2225 static int | |
2226 mouse_pixel_position_1 (struct device *d, Lisp_Object *frame, | |
2227 int *x, int *y) | |
2228 { | |
2229 switch (DEVMETH_OR_GIVEN (d, get_mouse_position, (d, frame, x, y), -1)) | |
2230 { | |
2231 case 1: | |
2232 return 1; | |
2233 | |
2234 case 0: | |
2235 *frame = Qnil; | |
2236 break; | |
2237 | |
2238 case -1: | |
2239 *frame = DEVICE_SELECTED_FRAME (d); | |
2240 break; | |
2241 | |
2242 default: | |
2500 | 2243 ABORT (); /* method is incorrectly written */ |
428 | 2244 } |
2245 | |
2246 return 0; | |
2247 } | |
2248 | |
2249 DEFUN ("mouse-pixel-position", Fmouse_pixel_position, 0, 1, 0, /* | |
2250 Return a list (WINDOW X . Y) giving the current mouse window and position. | |
442 | 2251 The position is given in pixel units, where (0, 0) is the upper-left corner |
2252 of the window. | |
428 | 2253 |
2254 When the cursor is not over a window, the return value is a list (nil nil). | |
2255 | |
2256 DEVICE specifies the device on which to read the mouse position, and | |
2257 defaults to the selected device. If the device is a mouseless terminal | |
442 | 2258 or XEmacs hasn't been programmed to read its mouse position, it returns |
428 | 2259 the device's selected window for WINDOW and nil for X and Y. |
2260 */ | |
2261 (device)) | |
2262 { | |
2263 struct device *d = decode_device (device); | |
2264 Lisp_Object frame; | |
2265 Lisp_Object window = Qnil; | |
2266 Lisp_Object x = Qnil; | |
2267 Lisp_Object y = Qnil; | |
2268 int intx, inty; | |
2269 | |
2270 if (mouse_pixel_position_1 (d, &frame, &intx, &inty) > 0) | |
2271 { | |
2272 struct window *w = | |
2273 find_window_by_pixel_pos (intx, inty, XFRAME (frame)->root_window); | |
2274 if (w) | |
2275 { | |
793 | 2276 window = wrap_window (w); |
428 | 2277 |
2278 /* Adjust the position to be relative to the window. */ | |
2279 intx -= w->pixel_left; | |
2280 inty -= w->pixel_top; | |
793 | 2281 x = make_int (intx); |
2282 y = make_int (inty); | |
428 | 2283 } |
2284 } | |
2285 else if (FRAMEP (frame)) | |
2286 window = FRAME_SELECTED_WINDOW (XFRAME (frame)); | |
2287 | |
2288 return Fcons (window, Fcons (x, y)); | |
2289 } | |
2290 | |
2291 DEFUN ("mouse-position", Fmouse_position, 0, 1, 0, /* | |
2292 Return a list (WINDOW X . Y) giving the current mouse window and position. | |
2293 The position is of a character under cursor, where (0, 0) is the upper-left | |
2294 corner of the window. | |
2295 | |
2296 When the cursor is not over a character, or not over a window, the return | |
2297 value is a list (nil nil). | |
2298 | |
2299 DEVICE specifies the device on which to read the mouse position, and | |
2300 defaults to the selected device. If the device is a mouseless terminal | |
2301 or Emacs hasn't been programmed to read its mouse position, it returns | |
2302 the device's selected window for WINDOW and nil for X and Y. | |
2303 */ | |
2304 (device)) | |
2305 { | |
2306 struct device *d = decode_device (device); | |
2307 struct window *w; | |
2308 Lisp_Object frame, window = Qnil, lisp_x = Qnil, lisp_y = Qnil; | |
2309 int x, y, obj_x, obj_y; | |
665 | 2310 Charbpos charbpos, closest; |
428 | 2311 Charcount modeline_closest; |
2312 Lisp_Object obj1, obj2; | |
2313 | |
2314 if (mouse_pixel_position_1 (d, &frame, &x, &y) > 0) | |
2315 { | |
2316 int res = pixel_to_glyph_translation (XFRAME (frame), x, y, &x, &y, | |
665 | 2317 &obj_x, &obj_y, &w, &charbpos, |
428 | 2318 &closest, &modeline_closest, |
2319 &obj1, &obj2); | |
2320 if (res == OVER_TEXT) | |
2321 { | |
2322 lisp_x = make_int (x); | |
2323 lisp_y = make_int (y); | |
793 | 2324 window = wrap_window (w); |
428 | 2325 } |
2326 } | |
2327 else if (FRAMEP (frame)) | |
2328 window = FRAME_SELECTED_WINDOW (XFRAME (frame)); | |
2329 | |
2330 return Fcons (window, Fcons (lisp_x, lisp_y)); | |
2331 } | |
2332 | |
2333 DEFUN ("mouse-position-as-motion-event", Fmouse_position_as_motion_event, 0, 1, 0, /* | |
2334 Return the current mouse position as a motion event. | |
2335 This allows you to call the standard event functions such as | |
2336 `event-over-toolbar-p' to determine where the mouse is. | |
2337 | |
2338 DEVICE specifies the device on which to read the mouse position, and | |
2339 defaults to the selected device. If the mouse position can't be determined | |
2340 \(e.g. DEVICE is a TTY device), nil is returned instead of an event. | |
2341 */ | |
2342 (device)) | |
2343 { | |
2344 struct device *d = decode_device (device); | |
2345 Lisp_Object frame; | |
2346 int intx, inty; | |
2347 | |
2348 if (mouse_pixel_position_1 (d, &frame, &intx, &inty)) | |
2349 { | |
2350 Lisp_Object event = Fmake_event (Qnil, Qnil); | |
934 | 2351 XSET_EVENT_TYPE (event, pointer_motion_event); |
2352 XSET_EVENT_CHANNEL (event, frame); | |
1204 | 2353 XSET_EVENT_MOTION_X (event, intx); |
2354 XSET_EVENT_MOTION_Y (event, inty); | |
428 | 2355 return event; |
2356 } | |
2357 else | |
2358 return Qnil; | |
2359 } | |
2360 | |
2361 DEFUN ("set-mouse-position", Fset_mouse_position, 3, 3, 0, /* | |
2362 Move the mouse pointer to the center of character cell (X,Y) in WINDOW. | |
2363 Note, this is a no-op for an X frame that is not visible. | |
2364 If you have just created a frame, you must wait for it to become visible | |
2365 before calling this function on it, like this. | |
2366 (while (not (frame-visible-p frame)) (sleep-for .5)) | |
2367 Note also: Warping the mouse is contrary to the ICCCM, so be very sure | |
2368 that the behavior won't end up being obnoxious! | |
2369 */ | |
2370 (window, x, y)) | |
2371 { | |
2372 struct window *w; | |
2373 int pix_x, pix_y; | |
2374 | |
2375 CHECK_LIVE_WINDOW (window); | |
2376 CHECK_INT (x); | |
2377 CHECK_INT (y); | |
2378 | |
2379 /* Warping the mouse will cause EnterNotify and Focus events under X. */ | |
2380 w = XWINDOW (window); | |
2381 glyph_to_pixel_translation (w, XINT (x), XINT (y), &pix_x, &pix_y); | |
2382 | |
2383 MAYBE_FRAMEMETH (XFRAME (w->frame), set_mouse_position, (w, pix_x, pix_y)); | |
2384 | |
2385 return Qnil; | |
2386 } | |
2387 | |
2388 DEFUN ("set-mouse-pixel-position", Fset_mouse_pixel_position, 3, 3, 0, /* | |
2389 Move the mouse pointer to pixel position (X,Y) in WINDOW. | |
2390 Note, this is a no-op for an X frame that is not visible. | |
2391 If you have just created a frame, you must wait for it to become visible | |
2392 before calling this function on it, like this. | |
2393 (while (not (frame-visible-p frame)) (sleep-for .5)) | |
2394 */ | |
2395 (window, x, y)) | |
2396 { | |
2397 struct window *w; | |
2398 | |
2399 CHECK_LIVE_WINDOW (window); | |
2400 CHECK_INT (x); | |
2401 CHECK_INT (y); | |
2402 | |
2403 /* Warping the mouse will cause EnterNotify and Focus events under X. */ | |
2404 w = XWINDOW (window); | |
2405 FRAMEMETH (XFRAME (w->frame), set_mouse_position, (w, XINT (x), XINT (y))); | |
2406 | |
2407 return Qnil; | |
2408 } | |
2409 | |
5104
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
2410 /**************************************************************************/ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
2411 /* */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
2412 /* frame visibility */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
2413 /* */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
2414 /**************************************************************************/ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
2415 |
428 | 2416 DEFUN ("make-frame-visible", Fmake_frame_visible, 0, 1, 0, /* |
2417 Make the frame FRAME visible (assuming it is an X-window). | |
2418 If omitted, FRAME defaults to the currently selected frame. | |
2419 Also raises the frame so that nothing obscures it. | |
2420 */ | |
2421 (frame)) | |
2422 { | |
2423 struct frame *f = decode_frame (frame); | |
2424 | |
2425 MAYBE_FRAMEMETH (f, make_frame_visible, (f)); | |
2426 return frame; | |
2427 } | |
2428 | |
2429 DEFUN ("make-frame-invisible", Fmake_frame_invisible, 0, 2, 0, /* | |
2430 Unconditionally removes frame from the display (assuming it is an X-window). | |
2431 If omitted, FRAME defaults to the currently selected frame. | |
2432 If what you want to do is iconify the frame (if the window manager uses | |
2433 icons) then you should call `iconify-frame' instead. | |
2434 Normally you may not make FRAME invisible if all other frames are invisible | |
2435 and uniconified, but if the second optional argument FORCE is non-nil, | |
2436 you may do so. | |
2437 */ | |
2438 (frame, force)) | |
2439 { | |
2440 struct frame *f, *sel_frame; | |
2441 struct device *d; | |
2442 | |
2443 f = decode_frame (frame); | |
2444 d = XDEVICE (FRAME_DEVICE (f)); | |
2445 sel_frame = XFRAME (DEVICE_SELECTED_FRAME (d)); | |
2446 | |
2447 if (NILP (force) && !other_visible_frames (f)) | |
563 | 2448 invalid_operation ("Attempt to make invisible the sole visible or iconified frame", Qunbound); |
428 | 2449 |
2450 /* Don't allow minibuf_window to remain on a deleted frame. */ | |
2451 if (EQ (f->minibuffer_window, minibuf_window)) | |
2452 { | |
2453 Fset_window_buffer (sel_frame->minibuffer_window, | |
440 | 2454 XWINDOW (minibuf_window)->buffer, Qt); |
428 | 2455 minibuf_window = sel_frame->minibuffer_window; |
2456 } | |
2457 | |
2458 MAYBE_FRAMEMETH (f, make_frame_invisible, (f)); | |
2459 | |
2460 return Qnil; | |
2461 } | |
2462 | |
2463 DEFUN ("iconify-frame", Ficonify_frame, 0, 1, "", /* | |
2464 Make the frame FRAME into an icon, if the window manager supports icons. | |
2465 If omitted, FRAME defaults to the currently selected frame. | |
2466 */ | |
2467 (frame)) | |
2468 { | |
2469 struct frame *f, *sel_frame; | |
2470 struct device *d; | |
2471 | |
2472 f = decode_frame (frame); | |
2473 d = XDEVICE (FRAME_DEVICE (f)); | |
2474 sel_frame = XFRAME (DEVICE_SELECTED_FRAME (d)); | |
2475 | |
2476 /* Don't allow minibuf_window to remain on a deleted frame. */ | |
2477 if (EQ (f->minibuffer_window, minibuf_window)) | |
2478 { | |
2479 Fset_window_buffer (sel_frame->minibuffer_window, | |
440 | 2480 XWINDOW (minibuf_window)->buffer, Qt); |
428 | 2481 minibuf_window = sel_frame->minibuffer_window; |
2482 } | |
2483 | |
2484 MAYBE_FRAMEMETH (f, iconify_frame, (f)); | |
2485 | |
2486 return Qnil; | |
2487 } | |
2488 | |
2489 DEFUN ("deiconify-frame", Fdeiconify_frame, 0, 1, 0, /* | |
2490 Open (de-iconify) the iconified frame FRAME. | |
2491 Under X, this is currently the same as `make-frame-visible'. | |
2492 If omitted, FRAME defaults to the currently selected frame. | |
2493 Also raises the frame so that nothing obscures it. | |
2494 */ | |
2495 (frame)) | |
2496 { | |
2497 return Fmake_frame_visible (frame); | |
2498 } | |
2499 | |
3025 | 2500 /* FSF returns `icon' for iconized frames. What a crock! */ |
428 | 2501 |
2502 DEFUN ("frame-visible-p", Fframe_visible_p, 0, 1, 0, /* | |
2503 Return non NIL if FRAME is now "visible" (actually in use for display). | |
2504 A frame that is not visible is not updated, and, if it works through a | |
2505 window system, may not show at all. | |
2506 N.B. Under X "visible" means Mapped. It the window is mapped but not | |
3025 | 2507 actually visible on screen then `frame-visible-p' returns `hidden'. |
428 | 2508 */ |
2509 (frame)) | |
2510 { | |
2511 struct frame *f = decode_frame (frame); | |
2512 int visible = FRAMEMETH_OR_GIVEN (f, frame_visible_p, (f), f->visible); | |
2513 return visible ? ( visible > 0 ? Qt : Qhidden ) : Qnil; | |
2514 } | |
2515 | |
2516 DEFUN ("frame-totally-visible-p", Fframe_totally_visible_p, 0, 1, 0, /* | |
2517 Return t if frame is not obscured by any other window system windows. | |
2518 Always returns t for tty frames. | |
2519 */ | |
2520 (frame)) | |
2521 { | |
2522 struct frame *f = decode_frame (frame); | |
2523 return (FRAMEMETH_OR_GIVEN (f, frame_totally_visible_p, (f), f->visible) | |
2524 ? Qt : Qnil); | |
2525 } | |
2526 | |
2527 DEFUN ("frame-iconified-p", Fframe_iconified_p, 0, 1, 0, /* | |
2528 Return t if FRAME is iconified. | |
2529 Not all window managers use icons; some merely unmap the window, so this | |
2530 function is not the inverse of `frame-visible-p'. It is possible for a | |
2531 frame to not be visible and not be iconified either. However, if the | |
2532 frame is iconified, it will not be visible. | |
2533 */ | |
2534 (frame)) | |
2535 { | |
2536 struct frame *f = decode_frame (frame); | |
2537 if (f->visible) | |
2538 return Qnil; | |
2539 f->iconified = FRAMEMETH_OR_GIVEN (f, frame_iconified_p, (f), 0); | |
2540 return f->iconified ? Qt : Qnil; | |
2541 } | |
2542 | |
2543 DEFUN ("visible-frame-list", Fvisible_frame_list, 0, 1, 0, /* | |
2544 Return a list of all frames now "visible" (being updated). | |
2545 If DEVICE is specified only frames on that device will be returned. | |
460 | 2546 Note that under virtual window managers not all these frames are |
2547 necessarily really updated. | |
428 | 2548 */ |
2549 (device)) | |
2550 { | |
2551 Lisp_Object devcons, concons; | |
2552 struct frame *f; | |
2553 Lisp_Object value; | |
2554 | |
2555 value = Qnil; | |
2556 | |
2557 DEVICE_LOOP_NO_BREAK (devcons, concons) | |
2558 { | |
2559 assert (DEVICEP (XCAR (devcons))); | |
2560 | |
2561 if (NILP (device) || EQ (device, XCAR (devcons))) | |
2562 { | |
2563 Lisp_Object frmcons; | |
2564 | |
2565 DEVICE_FRAME_LOOP (frmcons, XDEVICE (XCAR (devcons))) | |
2566 { | |
2567 Lisp_Object frame = XCAR (frmcons); | |
2568 f = XFRAME (frame); | |
2569 if (FRAME_VISIBLE_P(f)) | |
2570 value = Fcons (frame, value); | |
2571 } | |
2572 } | |
2573 } | |
2574 | |
2575 return value; | |
2576 } | |
2577 | |
2578 DEFUN ("raise-frame", Fraise_frame, 0, 1, "", /* | |
2579 Bring FRAME to the front, so it occludes any frames it overlaps. | |
2580 If omitted, FRAME defaults to the currently selected frame. | |
2581 If FRAME is invisible, make it visible. | |
2582 If Emacs is displaying on an ordinary terminal or some other device which | |
2583 doesn't support multiple overlapping frames, this function does nothing. | |
2584 */ | |
2585 (frame)) | |
2586 { | |
2587 struct frame *f = decode_frame (frame); | |
2588 | |
2589 /* Do like the documentation says. */ | |
2590 Fmake_frame_visible (frame); | |
2591 MAYBE_FRAMEMETH (f, raise_frame, (f)); | |
2592 return Qnil; | |
2593 } | |
2594 | |
2595 DEFUN ("lower-frame", Flower_frame, 0, 1, "", /* | |
2596 Send FRAME to the back, so it is occluded by any frames that overlap it. | |
2597 If omitted, FRAME defaults to the currently selected frame. | |
2598 If Emacs is displaying on an ordinary terminal or some other device which | |
2599 doesn't support multiple overlapping frames, this function does nothing. | |
2600 */ | |
2601 (frame)) | |
2602 { | |
2603 struct frame *f = decode_frame (frame); | |
2604 | |
2605 MAYBE_FRAMEMETH (f, lower_frame, (f)); | |
2606 return Qnil; | |
2607 } | |
2608 | |
442 | 2609 |
5104
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
2610 /***************************************************************************/ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
2611 /* */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
2612 /* print-related functions */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
2613 /* */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
2614 /***************************************************************************/ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
2615 |
442 | 2616 DEFUN ("print-job-page-number", Fprint_job_page_number, 1, 1, 0, /* |
2617 Return current page number for the print job FRAME. | |
2618 */ | |
2619 (frame)) | |
2620 { | |
2621 CHECK_PRINTER_FRAME (frame); | |
2622 return make_int (FRAME_PAGENUMBER (XFRAME (frame))); | |
2623 } | |
2624 | |
2625 DEFUN ("print-job-eject-page", Fprint_job_eject_page, 1, 1, 0, /* | |
2626 Eject page in the print job FRAME. | |
2627 */ | |
2628 (frame)) | |
2629 { | |
2630 struct frame *f; | |
2631 | |
2632 CHECK_PRINTER_FRAME (frame); | |
2633 f = XFRAME (frame); | |
2634 FRAMEMETH (f, eject_page, (f)); | |
2635 FRAME_SET_PAGENUMBER (f, 1 + FRAME_PAGENUMBER (f)); | |
2636 f->clear = 1; | |
2637 | |
2638 return Qnil; | |
2639 } | |
428 | 2640 |
2641 | |
2642 /***************************************************************************/ | |
5104
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
2643 /* */ |
428 | 2644 /* frame properties */ |
5104
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
2645 /* */ |
428 | 2646 /***************************************************************************/ |
2647 | |
5104
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
2648 DEFUN ("frame-name", Fframe_name, 0, 1, 0, /* |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
2649 Return the name of FRAME (defaulting to the selected frame). |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
2650 This is not the same as the `title' of the frame. |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
2651 */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
2652 (frame)) |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
2653 { |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
2654 return decode_frame (frame)->name; |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
2655 } |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
2656 |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
2657 DEFUN ("frame-modified-tick", Fframe_modified_tick, 0, 1, 0, /* |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
2658 Return FRAME's tick counter, incremented for each change to the frame. |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
2659 Each frame has a tick counter which is incremented each time the frame |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
2660 is resized, a window is resized, added, or deleted, a face is changed, |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
2661 `set-window-buffer' or `select-window' is called on a window in the |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
2662 frame, the window-start of a window in the frame has changed, or |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
2663 anything else interesting has happened. It wraps around occasionally. |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
2664 No argument or nil as argument means use selected frame as FRAME. |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
2665 */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
2666 (frame)) |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
2667 { |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
2668 return make_int (decode_frame (frame)->modiff); |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
2669 } |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
2670 |
428 | 2671 static void |
2672 store_minibuf_frame_prop (struct frame *f, Lisp_Object val) | |
2673 { | |
1318 | 2674 /* This can call Lisp. */ |
793 | 2675 Lisp_Object frame = wrap_frame (f); |
2676 | |
428 | 2677 if (WINDOWP (val)) |
2678 { | |
2679 if (! MINI_WINDOW_P (XWINDOW (val))) | |
563 | 2680 gui_error |
428 | 2681 ("Surrogate minibuffer windows must be minibuffer windows", |
2682 val); | |
2683 | |
2684 if (FRAME_HAS_MINIBUF_P (f) || FRAME_MINIBUF_ONLY_P (f)) | |
563 | 2685 gui_error |
428 | 2686 ("Can't change the surrogate minibuffer of a frame with its own minibuffer", frame); |
2687 | |
2688 /* Install the chosen minibuffer window, with proper buffer. */ | |
2689 f->minibuffer_window = val; | |
2690 } | |
2691 else if (EQ (val, Qt)) | |
2692 { | |
2693 if (FRAME_HAS_MINIBUF_P (f) || FRAME_MINIBUF_ONLY_P (f)) | |
563 | 2694 gui_error |
428 | 2695 ("Frame already has its own minibuffer", frame); |
2696 else | |
2697 { | |
2698 setup_normal_frame (f); | |
2699 f->mirror_dirty = 1; | |
2700 | |
2701 update_frame_window_mirror (f); | |
2702 internal_set_frame_size (f, f->width, f->height, 1); | |
2703 } | |
2704 } | |
2705 } | |
2706 | |
2707 #if 0 | |
2708 | |
2709 /* possible code if you want to have symbols such as `default-background' | |
2710 map to setting the background of `default', etc. */ | |
2711 | |
2712 static int | |
2713 dissect_as_face_setting (Lisp_Object sym, Lisp_Object *face_out, | |
2714 Lisp_Object *face_prop_out) | |
2715 { | |
2716 Lisp_Object list = Vbuilt_in_face_specifiers; | |
793 | 2717 Lisp_Object s; |
428 | 2718 |
2719 if (!SYMBOLP (sym)) | |
2720 return 0; | |
2721 | |
2722 s = symbol_name (XSYMBOL (sym)); | |
2723 | |
2724 while (!NILP (list)) | |
2725 { | |
2726 Lisp_Object prop = Fcar (list); | |
793 | 2727 Lisp_Object prop_name; |
428 | 2728 |
2729 if (!SYMBOLP (prop)) | |
2730 continue; | |
2731 prop_name = symbol_name (XSYMBOL (prop)); | |
793 | 2732 if (XSTRING_LENGTH (s) > XSTRING_LENGTH (prop_name) + 1 |
2733 && !memcmp (XSTRING_DATA (prop_name), | |
2734 XSTRING_DATA (s) + XSTRING_LENGTH (s) | |
2735 - XSTRING_LENGTH (prop_name), | |
2736 XSTRING_LENGTH (prop_name)) | |
2737 && XSTRING_DATA (s)[XSTRING_LENGTH (s) - XSTRING_LENGTH (prop_name) | |
428 | 2738 - 1] == '-') |
2739 { | |
2740 Lisp_Object face = | |
793 | 2741 Ffind_face (make_string (XSTRING_DATA (s), |
2742 XSTRING_LENGTH (s) | |
2743 - XSTRING_LENGTH (prop_name) | |
428 | 2744 - 1)); |
2745 if (!NILP (face)) | |
2746 { | |
2747 *face_out = face; | |
2748 *face_prop_out = prop; | |
2749 return 1; | |
2750 } | |
2751 } | |
2752 | |
2753 list = Fcdr (list); | |
2754 } | |
2755 | |
2756 return 0; | |
2757 } | |
2758 | |
2759 #endif /* 0 */ | |
2760 | |
2761 static Lisp_Object | |
2762 get_property_alias (Lisp_Object prop) | |
2763 { | |
2764 while (1) | |
2765 { | |
2766 Lisp_Object alias = Qnil; | |
2767 | |
2768 if (SYMBOLP (prop)) | |
2769 alias = Fget (prop, Qframe_property_alias, Qnil); | |
2770 if (NILP (alias)) | |
2771 break; | |
2772 prop = alias; | |
2773 QUIT; | |
2774 } | |
2775 | |
2776 return prop; | |
2777 } | |
2778 | |
2779 /* #### Using this to modify the internal border width has no effect | |
2780 because the change isn't propagated to the windows. Are there | |
2781 other properties which this claims to handle, but doesn't? | |
2782 | |
2783 But of course. This stuff needs more work, but it's a lot closer | |
2784 to sanity now than before with the horrible frame-params stuff. */ | |
2785 | |
2786 DEFUN ("set-frame-properties", Fset_frame_properties, 2, 2, 0, /* | |
2787 Change some properties of a frame. | |
2788 PLIST is a property list. | |
2789 You can also change frame properties individually using `set-frame-property', | |
2790 but it may be more efficient to change many properties at once. | |
2791 | |
2792 Frame properties can be retrieved using `frame-property' or `frame-properties'. | |
2793 | |
2794 The following symbols etc. have predefined meanings: | |
2795 | |
2796 name Name of the frame. Used with X resources. | |
2797 Unchangeable after creation. | |
2798 | |
2799 height Height of the frame, in lines. | |
2800 | |
2801 width Width of the frame, in characters. | |
2802 | |
2803 minibuffer Gives the minibuffer behavior for this frame. Either | |
2804 t (frame has its own minibuffer), `only' (frame is | |
442 | 2805 a minibuffer-only frame), `none' (frame has no minibuffer) |
2806 or a window (frame uses that window, which is on another | |
2807 frame, as the minibuffer). | |
428 | 2808 |
2809 unsplittable If non-nil, frame cannot be split by `display-buffer'. | |
2810 | |
2811 current-display-table, menubar-visible-p, left-margin-width, | |
2812 right-margin-width, minimum-line-ascent, minimum-line-descent, | |
2813 use-left-overflow, use-right-overflow, scrollbar-width, scrollbar-height, | |
2814 default-toolbar, top-toolbar, bottom-toolbar, left-toolbar, right-toolbar, | |
2815 default-toolbar-height, default-toolbar-width, top-toolbar-height, | |
2816 bottom-toolbar-height, left-toolbar-width, right-toolbar-width, | |
2817 default-toolbar-visible-p, top-toolbar-visible-p, bottom-toolbar-visible-p, | |
2818 left-toolbar-visible-p, right-toolbar-visible-p, toolbar-buttons-captioned-p, | |
2819 top-toolbar-border-width, bottom-toolbar-border-width, | |
2820 left-toolbar-border-width, right-toolbar-border-width, | |
442 | 2821 modeline-shadow-thickness, has-modeline-p, |
2822 default-gutter, top-gutter, bottom-gutter, left-gutter, right-gutter, | |
2823 default-gutter-height, default-gutter-width, top-gutter-height, | |
2824 bottom-gutter-height, left-gutter-width, right-gutter-width, | |
2825 default-gutter-visible-p, top-gutter-visible-p, bottom-gutter-visible-p, | |
2826 left-gutter-visible-p, right-gutter-visible-p, top-gutter-border-width, | |
2827 bottom-gutter-border-width, left-gutter-border-width, right-gutter-border-width, | |
428 | 2828 [Giving the name of any built-in specifier variable is |
2829 equivalent to calling `set-specifier' on the specifier, | |
2830 with a locale of FRAME. Giving the name to `frame-property' | |
2831 calls `specifier-instance' on the specifier.] | |
2832 | |
2833 text-pointer-glyph, nontext-pointer-glyph, modeline-pointer-glyph, | |
2834 selection-pointer-glyph, busy-pointer-glyph, toolbar-pointer-glyph, | |
2835 menubar-pointer-glyph, scrollbar-pointer-glyph, gc-pointer-glyph, | |
2836 octal-escape-glyph, control-arrow-glyph, invisible-text-glyph, | |
2837 hscroll-glyph, truncation-glyph, continuation-glyph | |
2838 [Giving the name of any glyph variable is equivalent to | |
2839 calling `set-glyph-image' on the glyph, with a locale | |
2840 of FRAME. Giving the name to `frame-property' calls | |
2841 `glyph-image-instance' on the glyph.] | |
2842 | |
2843 [default foreground], [default background], [default font], | |
2844 [modeline foreground], [modeline background], [modeline font], | |
2845 etc. | |
2846 [Giving a vector of a face and a property is equivalent | |
2847 to calling `set-face-property' on the face and property, | |
2848 with a locale of FRAME. Giving the vector to | |
2849 `frame-property' calls `face-property-instance' on the | |
2850 face and property.] | |
2851 | |
2852 Finally, if a frame property symbol has the property `frame-property-alias' | |
2853 on it, then the value will be used in place of that symbol when looking | |
2854 up and setting frame property values. This allows you to alias one | |
2855 frame property name to another. | |
2856 | |
2857 See the variables `default-x-frame-plist', `default-tty-frame-plist' | |
2858 and `default-mswindows-frame-plist' for a description of the properties | |
2859 recognized for particular types of frames. | |
2860 */ | |
2861 (frame, plist)) | |
2862 { | |
1318 | 2863 /* This can call Lisp. */ |
428 | 2864 struct frame *f = decode_frame (frame); |
2865 Lisp_Object tail; | |
2866 Lisp_Object *tailp; | |
2867 struct gcpro gcpro1, gcpro2; | |
2868 | |
793 | 2869 frame = wrap_frame (f); |
428 | 2870 GCPRO2 (frame, plist); |
2871 Fcheck_valid_plist (plist); | |
2872 plist = Fcopy_sequence (plist); | |
2873 Fcanonicalize_lax_plist (plist, Qnil); | |
2874 for (tail = plist; !NILP (tail); tail = Fcdr (Fcdr (tail))) | |
2875 { | |
2876 Lisp_Object prop = Fcar (tail); | |
2877 Lisp_Object val = Fcar (Fcdr (tail)); | |
2878 | |
2879 prop = get_property_alias (prop); | |
2880 | |
2881 #if 0 | |
2882 /* mly wants this, but it's not reasonable to change the name of a | |
2883 frame after it has been created, because the old name was used | |
2884 for resource lookup. */ | |
2885 if (EQ (prop, Qname)) | |
4207 | 2886 { |
2887 CHECK_STRING (val); | |
2888 f->name = val; | |
2889 } | |
428 | 2890 #endif /* 0 */ |
2891 if (EQ (prop, Qminibuffer)) | |
2892 store_minibuf_frame_prop (f, val); | |
2893 if (EQ (prop, Qunsplittable)) | |
2894 f->no_split = !NILP (val); | |
2895 if (EQ (prop, Qbuffer_predicate)) | |
2896 f->buffer_predicate = val; | |
2897 if (SYMBOLP (prop) && EQ (Fbuilt_in_variable_type (prop), | |
2898 Qconst_specifier)) | |
2899 call3 (Qset_specifier, Fsymbol_value (prop), val, frame); | |
2900 if (SYMBOLP (prop) && !NILP (Fget (prop, Qconst_glyph_variable, Qnil))) | |
2901 call3 (Qset_glyph_image, Fsymbol_value (prop), val, frame); | |
2902 if (VECTORP (prop) && XVECTOR_LENGTH (prop) == 2) | |
2903 { | |
2904 Lisp_Object face_prop = XVECTOR_DATA (prop)[1]; | |
2905 CHECK_SYMBOL (face_prop); | |
2906 call4 (Qset_face_property, | |
2907 Fget_face (XVECTOR_DATA (prop)[0]), | |
2908 face_prop, val, frame); | |
2909 } | |
2910 } | |
2911 | |
2912 MAYBE_FRAMEMETH (f, set_frame_properties, (f, plist)); | |
2913 for (tailp = &plist; !NILP (*tailp);) | |
2914 { | |
2915 Lisp_Object *next_tailp; | |
2916 Lisp_Object next; | |
2917 Lisp_Object prop; | |
2918 | |
2919 next = Fcdr (*tailp); | |
2920 CHECK_CONS (next); | |
2921 next_tailp = &XCDR (next); | |
2922 prop = Fcar (*tailp); | |
2923 | |
2924 prop = get_property_alias (prop); | |
2925 | |
2926 if (EQ (prop, Qminibuffer) | |
2927 || EQ (prop, Qunsplittable) | |
2928 || EQ (prop, Qbuffer_predicate) | |
2929 || EQ (prop, Qheight) | |
2930 || EQ (prop, Qwidth) | |
2931 || (SYMBOLP (prop) && EQ (Fbuilt_in_variable_type (prop), | |
2932 Qconst_specifier)) | |
2933 || (SYMBOLP (prop) && !NILP (Fget (prop, Qconst_glyph_variable, | |
2934 Qnil))) | |
2935 || (VECTORP (prop) && XVECTOR_LENGTH (prop) == 2) | |
2936 || FRAMEMETH_OR_GIVEN (f, internal_frame_property_p, (f, prop), 0)) | |
2937 *tailp = *next_tailp; | |
2938 tailp = next_tailp; | |
2939 } | |
2940 | |
2941 f->plist = nconc2 (plist, f->plist); | |
2942 Fcanonicalize_lax_plist (f->plist, Qnil); | |
2943 UNGCPRO; | |
2944 return Qnil; | |
2945 } | |
2946 | |
2947 DEFUN ("frame-property", Fframe_property, 2, 3, 0, /* | |
2948 Return FRAME's value for property PROPERTY. | |
444 | 2949 Return DEFAULT if there is no such property. |
428 | 2950 See `set-frame-properties' for the built-in property names. |
2951 */ | |
2952 (frame, property, default_)) | |
2953 { | |
2954 struct frame *f = decode_frame (frame); | |
2955 Lisp_Object value; | |
2956 | |
793 | 2957 frame = wrap_frame (f); |
428 | 2958 |
2959 property = get_property_alias (property); | |
2960 | |
2961 if (EQ (Qname, property)) return f->name; | |
2962 | |
2963 if (EQ (Qheight, property) || EQ (Qwidth, property)) | |
2964 { | |
5043 | 2965 int width, height; |
2966 get_frame_char_size (f, &width, &height); | |
2967 return make_int (EQ (Qheight, property) ? height : width); | |
428 | 2968 } |
2969 | |
2970 /* NOTE: FSF returns Qnil instead of Qt for FRAME_HAS_MINIBUF_P. | |
2971 This is over-the-top bogosity, because it's inconsistent with | |
2972 the semantics of `minibuffer' when passed to `make-frame'. | |
2973 Returning Qt makes things consistent. */ | |
2974 if (EQ (Qminibuffer, property)) | |
2975 return (FRAME_MINIBUF_ONLY_P (f) ? Qonly : | |
2976 FRAME_HAS_MINIBUF_P (f) ? Qt : | |
2977 FRAME_MINIBUF_WINDOW (f)); | |
2978 if (EQ (Qunsplittable, property)) | |
2979 return FRAME_NO_SPLIT_P (f) ? Qt : Qnil; | |
2980 if (EQ (Qbuffer_predicate, property)) | |
2981 return f->buffer_predicate; | |
2982 | |
2983 if (SYMBOLP (property)) | |
2984 { | |
2985 if (EQ (Fbuilt_in_variable_type (property), Qconst_specifier)) | |
2986 return Fspecifier_instance (Fsymbol_value (property), | |
2987 frame, default_, Qnil); | |
2988 if (!NILP (Fget (property, Qconst_glyph_variable, Qnil))) | |
2989 { | |
2990 Lisp_Object glyph = Fsymbol_value (property); | |
2991 CHECK_GLYPH (glyph); | |
2992 return Fspecifier_instance (XGLYPH_IMAGE (glyph), | |
2993 frame, default_, Qnil); | |
2994 } | |
2995 } | |
2996 | |
2997 if (VECTORP (property) && XVECTOR_LENGTH (property) == 2) | |
2998 { | |
2999 Lisp_Object face_prop = XVECTOR_DATA (property)[1]; | |
3000 CHECK_SYMBOL (face_prop); | |
3001 return call3 (Qface_property_instance, | |
3002 Fget_face (XVECTOR_DATA (property)[0]), | |
3003 face_prop, frame); | |
3004 } | |
3005 | |
3006 if (HAS_FRAMEMETH_P (f, frame_property)) | |
3007 if (!UNBOUNDP (value = FRAMEMETH (f, frame_property, (f, property)))) | |
3008 return value; | |
3009 | |
3010 if (!UNBOUNDP (value = external_plist_get (&f->plist, property, 1, ERROR_ME))) | |
3011 return value; | |
3012 | |
3013 return default_; | |
3014 } | |
3015 | |
3016 DEFUN ("frame-properties", Fframe_properties, 0, 1, 0, /* | |
3017 Return a property list of the properties of FRAME. | |
3018 Do not modify this list; use `set-frame-property' instead. | |
3019 */ | |
3020 (frame)) | |
3021 { | |
3022 struct frame *f = decode_frame (frame); | |
3023 Lisp_Object result = Qnil; | |
3024 struct gcpro gcpro1; | |
3025 | |
3026 GCPRO1 (result); | |
3027 | |
793 | 3028 frame = wrap_frame (f); |
428 | 3029 |
3030 /* #### for the moment (since old code uses `frame-parameters'), | |
3031 we call `copy-sequence' on f->plist. That allows frame-parameters | |
3032 to destructively convert the plist into an alist, which is more | |
3033 efficient than doing it non-destructively. At some point we | |
3034 should remove the call to copy-sequence. */ | |
3035 result = Fcopy_sequence (f->plist); | |
3036 | |
3037 /* #### should we be adding all the specifiers and glyphs? | |
3038 That would entail having a list of them all. */ | |
3039 if (HAS_FRAMEMETH_P (f, frame_properties)) | |
3040 result = nconc2 (FRAMEMETH (f, frame_properties, (f)), result); | |
3041 | |
3042 if (!NILP (f->buffer_predicate)) | |
3043 result = cons3 (Qbuffer_predicate, f->buffer_predicate, result); | |
3044 | |
3045 if (FRAME_NO_SPLIT_P (f)) | |
3046 result = cons3 (Qunsplittable, Qt, result); | |
3047 | |
3048 /* NOTE: FSF returns Qnil instead of Qt for FRAME_HAS_MINIBUF_P. | |
3049 This is over-the-top bogosity, because it's inconsistent with | |
3050 the semantics of `minibuffer' when passed to `make-frame'. | |
3051 Returning Qt makes things consistent. */ | |
3052 result = cons3 (Qminibuffer, | |
3053 (FRAME_MINIBUF_ONLY_P (f) ? Qonly : | |
3054 FRAME_HAS_MINIBUF_P (f) ? Qt : | |
3055 FRAME_MINIBUF_WINDOW (f)), | |
3056 result); | |
3057 { | |
3058 int width, height; | |
5043 | 3059 get_frame_char_size (f, &width, &height); |
428 | 3060 result = cons3 (Qwidth , make_int (width), result); |
3061 result = cons3 (Qheight, make_int (height), result); | |
3062 } | |
3063 | |
3064 result = cons3 (Qname, f->name, result); | |
3065 | |
3066 UNGCPRO; | |
3067 return result; | |
3068 } | |
3069 | |
3070 | |
5104
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3071 /**************************************************************************/ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3072 /* */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3073 /* frame sizing (user functions) */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3074 /* */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3075 /**************************************************************************/ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3076 |
428 | 3077 DEFUN ("frame-pixel-height", Fframe_pixel_height, 0, 1, 0, /* |
1125 | 3078 Return the total height in pixels of FRAME. |
428 | 3079 */ |
3080 (frame)) | |
3081 { | |
5105
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3082 struct frame *f = decode_frame (frame); |
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3083 int width, height; |
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3084 |
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3085 get_frame_new_total_pixel_size (f, &width, &height); |
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3086 return make_int (height); |
428 | 3087 } |
3088 | |
1125 | 3089 DEFUN ("frame-displayable-pixel-height", Fframe_displayable_pixel_height, 0, 1, 0, /* |
3090 Return the height of the displayable area in pixels of FRAME. | |
3091 */ | |
3092 (frame)) | |
3093 { | |
3094 struct frame *f = decode_frame (frame); | |
5043 | 3095 int width, height; |
3096 | |
5105
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3097 get_frame_new_displayable_pixel_size (f, &width, &height); |
5043 | 3098 return make_int (height); |
1125 | 3099 } |
3100 | |
428 | 3101 DEFUN ("frame-pixel-width", Fframe_pixel_width, 0, 1, 0, /* |
1125 | 3102 Return the total width in pixels of FRAME. |
428 | 3103 */ |
3104 (frame)) | |
3105 { | |
5105
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3106 struct frame *f = decode_frame (frame); |
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3107 int width, height; |
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3108 |
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3109 get_frame_new_total_pixel_size (f, &width, &height); |
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3110 return make_int (width); |
428 | 3111 } |
3112 | |
1125 | 3113 DEFUN ("frame-displayable-pixel-width", Fframe_displayable_pixel_width, 0, 1, 0, /* |
3114 Return the width of the displayable area in pixels of FRAME. | |
3115 */ | |
3116 (frame)) | |
3117 { | |
3118 struct frame *f = decode_frame (frame); | |
5043 | 3119 int width, height; |
3120 | |
5105
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3121 get_frame_new_displayable_pixel_size (f, &width, &height); |
5043 | 3122 return make_int (width); |
1125 | 3123 } |
3124 | |
428 | 3125 DEFUN ("set-frame-height", Fset_frame_height, 2, 3, 0, /* |
3126 Specify that the frame FRAME has LINES lines. | |
3127 Optional third arg non-nil means that redisplay should use LINES lines | |
3128 but that the idea of the actual height of the frame should not be changed. | |
3129 */ | |
444 | 3130 (frame, lines, pretend)) |
428 | 3131 { |
1318 | 3132 /* This can call Lisp. */ |
428 | 3133 struct frame *f = decode_frame (frame); |
5043 | 3134 int cwidth, cheight; |
3135 int guwidth, guheight; | |
3136 | |
444 | 3137 CHECK_INT (lines); |
5043 | 3138 get_frame_char_size (f, &cwidth, &cheight); |
3139 cheight = XINT (lines); | |
3140 frame_conversion_internal (f, SIZE_CHAR_CELL, cwidth, cheight, | |
3141 SIZE_FRAME_UNIT, &guwidth, &guheight); | |
3142 internal_set_frame_size (f, guwidth, guheight, !NILP (pretend)); | |
3143 return wrap_frame (f); | |
428 | 3144 } |
3145 | |
863 | 3146 DEFUN ("set-frame-pixel-height", Fset_frame_pixel_height, 2, 3, 0, /* |
1125 | 3147 Specify that the frame FRAME is a total of HEIGHT pixels tall. |
863 | 3148 Optional third arg non-nil means that redisplay should be HEIGHT pixels tall |
3149 but that the idea of the actual height of the frame should not be changed. | |
3150 */ | |
3151 (frame, height, pretend)) | |
3152 { | |
1318 | 3153 /* This can call Lisp. */ |
863 | 3154 struct frame *f = decode_frame (frame); |
5043 | 3155 int pwidth, pheight; |
3156 int guwidth, guheight; | |
3157 | |
863 | 3158 CHECK_INT (height); |
5105
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3159 get_frame_new_total_pixel_size (f, &pwidth, &pheight); |
5043 | 3160 pheight = XINT (height); |
3161 frame_conversion_internal (f, SIZE_TOTAL_PIXEL, pwidth, pheight, | |
3162 SIZE_FRAME_UNIT, &guwidth, &guheight); | |
3163 internal_set_frame_size (f, guwidth, guheight, !NILP (pretend)); | |
3164 return wrap_frame (f); | |
863 | 3165 } |
3166 | |
1125 | 3167 DEFUN ("set-frame-displayable-pixel-height", Fset_frame_displayable_pixel_height, 2, 3, 0, /* |
3168 Specify that the displayable area of frame FRAME is HEIGHT pixels tall. | |
3169 Optional third arg non-nil means that redisplay should be HEIGHT pixels tall | |
3170 but that the idea of the actual height of the frame should not be changed. | |
3171 */ | |
3172 (frame, height, pretend)) | |
3173 { | |
1318 | 3174 /* This can call Lisp. */ |
1125 | 3175 struct frame *f = decode_frame (frame); |
5043 | 3176 int pwidth, pheight; |
3177 int guwidth, guheight; | |
3178 | |
1125 | 3179 CHECK_INT (height); |
5105
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3180 get_frame_new_displayable_pixel_size (f, &pwidth, &pheight); |
5043 | 3181 pheight = XINT (height); |
3182 frame_conversion_internal (f, SIZE_DISPLAYABLE_PIXEL, pwidth, pheight, | |
3183 SIZE_FRAME_UNIT, &guwidth, &guheight); | |
3184 internal_set_frame_size (f, guwidth, guheight, !NILP (pretend)); | |
3185 return wrap_frame (f); | |
1125 | 3186 } |
3187 | |
3188 | |
428 | 3189 DEFUN ("set-frame-width", Fset_frame_width, 2, 3, 0, /* |
3190 Specify that the frame FRAME has COLS columns. | |
3191 Optional third arg non-nil means that redisplay should use COLS columns | |
3192 but that the idea of the actual width of the frame should not be changed. | |
3193 */ | |
3194 (frame, cols, pretend)) | |
3195 { | |
1318 | 3196 /* This can call Lisp. */ |
428 | 3197 struct frame *f = decode_frame (frame); |
5043 | 3198 int cwidth, cheight; |
3199 int guwidth, guheight; | |
3200 | |
428 | 3201 CHECK_INT (cols); |
5043 | 3202 get_frame_char_size (f, &cwidth, &cheight); |
3203 cwidth = XINT (cols); | |
3204 frame_conversion_internal (f, SIZE_CHAR_CELL, cwidth, cheight, | |
3205 SIZE_FRAME_UNIT, &guwidth, &guheight); | |
3206 internal_set_frame_size (f, guwidth, guheight, !NILP (pretend)); | |
3207 return wrap_frame (f); | |
428 | 3208 } |
3209 | |
863 | 3210 DEFUN ("set-frame-pixel-width", Fset_frame_pixel_width, 2, 3, 0, /* |
1125 | 3211 Specify that the frame FRAME is a total of WIDTH pixels wide. |
863 | 3212 Optional third arg non-nil means that redisplay should be WIDTH wide |
3213 but that the idea of the actual height of the frame should not be changed. | |
3214 */ | |
3215 (frame, width, pretend)) | |
3216 { | |
1318 | 3217 /* This can call Lisp. */ |
863 | 3218 struct frame *f = decode_frame (frame); |
5043 | 3219 int pwidth, pheight; |
3220 int guwidth, guheight; | |
3221 | |
863 | 3222 CHECK_INT (width); |
5105
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3223 get_frame_new_total_pixel_size (f, &pwidth, &pheight); |
5043 | 3224 pwidth = XINT (width); |
3225 frame_conversion_internal (f, SIZE_TOTAL_PIXEL, pwidth, pheight, | |
3226 SIZE_FRAME_UNIT, &guwidth, &guheight); | |
3227 internal_set_frame_size (f, guwidth, guheight, !NILP (pretend)); | |
3228 return wrap_frame (f); | |
1125 | 3229 } |
3230 | |
3231 DEFUN ("set-frame-displayable-pixel-width", Fset_frame_displayable_pixel_width, 2, 3, 0, /* | |
3232 Specify that the displayable area of frame FRAME is WIDTH pixels wide. | |
3233 Optional third arg non-nil means that redisplay should be WIDTH wide | |
3234 but that the idea of the actual height of the frame should not be changed. | |
3235 */ | |
3236 (frame, width, pretend)) | |
3237 { | |
1318 | 3238 /* This can call Lisp. */ |
1125 | 3239 struct frame *f = decode_frame (frame); |
5043 | 3240 int pwidth, pheight; |
3241 int guwidth, guheight; | |
3242 | |
1125 | 3243 CHECK_INT (width); |
5105
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3244 get_frame_new_displayable_pixel_size (f, &pwidth, &pheight); |
5043 | 3245 pwidth = XINT (width); |
3246 frame_conversion_internal (f, SIZE_DISPLAYABLE_PIXEL, pwidth, pheight, | |
3247 SIZE_FRAME_UNIT, &guwidth, &guheight); | |
3248 internal_set_frame_size (f, guwidth, guheight, !NILP (pretend)); | |
3249 return wrap_frame (f); | |
863 | 3250 } |
3251 | |
428 | 3252 DEFUN ("set-frame-size", Fset_frame_size, 3, 4, 0, /* |
444 | 3253 Set the size of FRAME to COLS by ROWS, measured in characters. |
428 | 3254 Optional fourth arg non-nil means that redisplay should use COLS by ROWS |
3255 but that the idea of the actual size of the frame should not be changed. | |
3256 */ | |
3257 (frame, cols, rows, pretend)) | |
3258 { | |
1318 | 3259 /* This can call Lisp. */ |
428 | 3260 struct frame *f = decode_frame (frame); |
5043 | 3261 int guwidth, guheight; |
3262 | |
428 | 3263 CHECK_INT (cols); |
3264 CHECK_INT (rows); | |
5043 | 3265 frame_conversion_internal (f, SIZE_CHAR_CELL, XINT (cols), XINT (rows), |
3266 SIZE_FRAME_UNIT, &guwidth, &guheight); | |
3267 internal_set_frame_size (f, guwidth, guheight, !NILP (pretend)); | |
3268 return wrap_frame (f); | |
428 | 3269 } |
3270 | |
863 | 3271 DEFUN ("set-frame-pixel-size", Fset_frame_pixel_size, 3, 4, 0, /* |
1125 | 3272 Set the total size of FRAME to WIDTH by HEIGHT, measured in pixels. |
863 | 3273 Optional fourth arg non-nil means that redisplay should use WIDTH by HEIGHT |
3274 but that the idea of the actual size of the frame should not be changed. | |
3275 */ | |
3276 (frame, width, height, pretend)) | |
3277 { | |
1318 | 3278 /* This can call Lisp. */ |
863 | 3279 struct frame *f = decode_frame (frame); |
5043 | 3280 int guwidth, guheight; |
3281 | |
863 | 3282 CHECK_INT (width); |
3283 CHECK_INT (height); | |
5043 | 3284 frame_conversion_internal (f, SIZE_TOTAL_PIXEL, XINT (width), XINT (height), |
3285 SIZE_FRAME_UNIT, &guwidth, &guheight); | |
3286 internal_set_frame_size (f, guwidth, guheight, !NILP (pretend)); | |
3287 return wrap_frame (f); | |
1125 | 3288 } |
3289 | |
3290 DEFUN ("set-frame-displayable-pixel-size", Fset_frame_displayable_pixel_size, 3, 4, 0, /* | |
3291 Set the displayable size of FRAME to WIDTH by HEIGHT, measured in pixels. | |
3292 Optional fourth arg non-nil means that redisplay should use WIDTH by HEIGHT | |
3293 but that the idea of the actual size of the frame should not be changed. | |
3294 */ | |
3295 (frame, width, height, pretend)) | |
3296 { | |
1318 | 3297 /* This can call Lisp. */ |
1125 | 3298 struct frame *f = decode_frame (frame); |
5043 | 3299 int guwidth, guheight; |
3300 | |
1125 | 3301 CHECK_INT (width); |
3302 CHECK_INT (height); | |
5043 | 3303 frame_conversion_internal (f, SIZE_DISPLAYABLE_PIXEL, |
3304 XINT (width), XINT (height), | |
3305 SIZE_FRAME_UNIT, &guwidth, &guheight); | |
3306 internal_set_frame_size (f, guwidth, guheight, !NILP (pretend)); | |
3307 return wrap_frame (f); | |
863 | 3308 } |
3309 | |
428 | 3310 DEFUN ("set-frame-position", Fset_frame_position, 3, 3, 0, /* |
3311 Set position of FRAME in pixels to XOFFSET by YOFFSET. | |
3312 This is actually the position of the upper left corner of the frame. | |
3313 Negative values for XOFFSET or YOFFSET are interpreted relative to | |
3314 the rightmost or bottommost possible position (that stays within the screen). | |
3315 */ | |
3316 (frame, xoffset, yoffset)) | |
3317 { | |
3318 struct frame *f = decode_frame (frame); | |
3319 CHECK_INT (xoffset); | |
3320 CHECK_INT (yoffset); | |
3321 | |
3322 MAYBE_FRAMEMETH (f, set_frame_position, (f, XINT (xoffset), XINT (yoffset))); | |
3323 | |
3324 return Qt; | |
3325 } | |
3326 | |
3327 | |
5104
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3328 /**************************************************************************/ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3329 /* */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3330 /* various ways of measuring the frame size */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3331 /* */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3332 /**************************************************************************/ |
428 | 3333 |
3334 /* Frame size conversion functions moved here from EmacsFrame.c | |
3335 because they're generic and really don't belong in that file. | |
3336 Function get_default_char_pixel_size() removed because it's | |
5047
07dcc7000bbf
put width before height consistently, fix a real bug found in the process
Ben Wing <ben@xemacs.org>
parents:
5046
diff
changeset
|
3337 exactly the same as default_face_width_and_height(). |
5043 | 3338 |
3339 Convert between total pixel size, displayable pixel size and | |
5104
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3340 character-cell size. Variables are either "in", "out" or unused, |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3341 depending on the value of PIXEL_TO_CHAR, which indicates which units the |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3342 source and destination values are measured in. |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3343 |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3344 See frame_conversion_internal() for a discussion of the different |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3345 types of units. */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3346 |
428 | 3347 static void |
5043 | 3348 frame_conversion_internal_1 (struct frame *f, |
3349 pixel_to_char_mode_t pixel_to_char, | |
3350 int *total_pixel_width, int *total_pixel_height, | |
3351 int *disp_pixel_width, int *disp_pixel_height, | |
3352 int *char_width, int *char_height) | |
428 | 3353 { |
5043 | 3354 int cpw, cph; |
428 | 3355 int egw; |
3356 int obw, obh, bdr; | |
3357 Lisp_Object frame, window; | |
3358 | |
793 | 3359 frame = wrap_frame (f); |
5047
07dcc7000bbf
put width before height consistently, fix a real bug found in the process
Ben Wing <ben@xemacs.org>
parents:
5046
diff
changeset
|
3360 default_face_width_and_height (frame, &cpw, &cph); |
428 | 3361 |
3362 window = FRAME_SELECTED_WINDOW (f); | |
3363 | |
5045 | 3364 /* #### It really seems like we should also be subtracting out the |
3365 theoretical gutter width and height, just like we do for toolbars. | |
3366 There is currently a bug where if you call `set-frame-pixel-width' | |
3367 on MS Windows (at least, possibly also X) things get confused and | |
3368 the top of the root window overlaps the top gutter instead of being | |
3369 below it. This gets fixed next time you resize the frame using the | |
3370 mouse. Possibly this is caused by not handling the gutter height | |
3371 here? */ | |
438 | 3372 egw = max (glyph_width (Vcontinuation_glyph, window), |
3373 glyph_width (Vtruncation_glyph, window)); | |
428 | 3374 egw = max (egw, cpw); |
3375 bdr = 2 * f->internal_border_width; | |
3376 obw = FRAME_SCROLLBAR_WIDTH (f) + FRAME_THEORETICAL_LEFT_TOOLBAR_WIDTH (f) + | |
3377 FRAME_THEORETICAL_RIGHT_TOOLBAR_WIDTH (f) + | |
3378 2 * FRAME_THEORETICAL_LEFT_TOOLBAR_BORDER_WIDTH (f) + | |
3379 2 * FRAME_THEORETICAL_RIGHT_TOOLBAR_BORDER_WIDTH (f); | |
3380 obh = FRAME_SCROLLBAR_HEIGHT (f) + FRAME_THEORETICAL_TOP_TOOLBAR_HEIGHT (f) + | |
3381 FRAME_THEORETICAL_BOTTOM_TOOLBAR_HEIGHT (f) + | |
3382 2 * FRAME_THEORETICAL_TOP_TOOLBAR_BORDER_WIDTH (f) + | |
3383 2 * FRAME_THEORETICAL_BOTTOM_TOOLBAR_BORDER_WIDTH (f); | |
3384 | |
863 | 3385 /* Convert to chars so that the displayable area is pixel_width x |
3386 pixel_height. | |
3387 | |
3388 #### Consider rounding up to 0.5 characters to avoid adding too | |
3389 much space. */ | |
1125 | 3390 switch (pixel_to_char) |
863 | 3391 { |
1125 | 3392 case DISPLAYABLE_PIXEL_TO_CHAR: |
863 | 3393 if (char_width) |
5043 | 3394 *char_width = ROUND_UP (*disp_pixel_width, cpw) / cpw; |
863 | 3395 if (char_height) |
5043 | 3396 *char_height = ROUND_UP (*disp_pixel_height, cph) / cph; |
3397 break; | |
3398 case CHAR_TO_DISPLAYABLE_PIXEL: | |
3399 if (disp_pixel_width) | |
3400 *disp_pixel_width = *char_width * cpw; | |
3401 if (disp_pixel_height) | |
3402 *disp_pixel_height = *char_height * cph; | |
1125 | 3403 break; |
3404 case TOTAL_PIXEL_TO_CHAR: | |
3405 /* Convert to chars so that the total frame size is pixel_width x | |
3406 pixel_height. */ | |
428 | 3407 if (char_width) |
5043 | 3408 *char_width = 1 + ((*total_pixel_width - egw) - bdr - obw) / cpw; |
428 | 3409 if (char_height) |
5043 | 3410 *char_height = (*total_pixel_height - bdr - obh) / cph; |
1125 | 3411 break; |
3412 case CHAR_TO_TOTAL_PIXEL: | |
5043 | 3413 if (total_pixel_width) |
3414 *total_pixel_width = (*char_width - 1) * cpw + egw + bdr + obw; | |
3415 if (total_pixel_height) | |
3416 *total_pixel_height = *char_height * cph + bdr + obh; | |
1125 | 3417 break; |
5043 | 3418 case TOTAL_PIXEL_TO_DISPLAYABLE_PIXEL: |
3419 /* Convert to chars so that the total frame size is pixel_width x | |
3420 pixel_height. */ | |
3421 if (disp_pixel_width) | |
3422 *disp_pixel_width = cpw + (*total_pixel_width - egw) - bdr - obw; | |
3423 if (disp_pixel_height) | |
3424 *disp_pixel_height = *total_pixel_height - bdr - obh; | |
3425 break; | |
3426 case DISPLAYABLE_PIXEL_TO_TOTAL_PIXEL: | |
3427 if (total_pixel_width) | |
3428 *total_pixel_width = *disp_pixel_width - cpw + egw + bdr + obw; | |
3429 if (total_pixel_height) | |
3430 *total_pixel_height = *disp_pixel_height + bdr + obh; | |
1125 | 3431 break; |
428 | 3432 } |
3433 } | |
3434 | |
5043 | 3435 |
3436 static enum frame_size_type | |
3437 canonicalize_frame_size_type (enum frame_size_type type, int pixgeom) | |
3438 { | |
3439 if (type == SIZE_FRAME_UNIT) | |
3440 { | |
3441 if (pixgeom) | |
3442 type = SIZE_DISPLAYABLE_PIXEL; | |
3443 else | |
3444 type = SIZE_CHAR_CELL; | |
3445 } | |
3446 return type; | |
3447 } | |
3448 | |
3449 /* Basic frame conversion function. Convert source size to destination | |
3450 size, where either of them can be in total pixels, displayable pixels, | |
5104
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3451 frame units or character-cell units. |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3452 |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3453 See comment at top of file for discussion about different types of |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3454 units. */ |
5043 | 3455 |
3456 static void | |
3457 frame_conversion_internal (struct frame *f, | |
3458 enum frame_size_type source, | |
3459 int source_width, int source_height, | |
3460 enum frame_size_type dest, | |
3461 int *dest_width, int *dest_height) | |
3462 { | |
3463 int pixgeom = window_system_pixelated_geometry (wrap_frame (f)); | |
3464 dest = canonicalize_frame_size_type (dest, pixgeom); | |
3465 source = canonicalize_frame_size_type (source, pixgeom); | |
3466 if (source == dest) | |
3467 { | |
3468 *dest_width = source_width; | |
3469 *dest_height = source_height; | |
3470 } | |
3471 else if (source == SIZE_TOTAL_PIXEL && dest == SIZE_CHAR_CELL) | |
3472 frame_conversion_internal_1 (f, TOTAL_PIXEL_TO_CHAR, | |
3473 &source_width, &source_height, 0, 0, | |
3474 dest_width, dest_height); | |
3475 else if (source == SIZE_DISPLAYABLE_PIXEL && dest == SIZE_CHAR_CELL) | |
3476 frame_conversion_internal_1 (f, DISPLAYABLE_PIXEL_TO_CHAR, 0, 0, | |
3477 &source_width, &source_height, | |
3478 dest_width, dest_height); | |
3479 else if (source == SIZE_TOTAL_PIXEL && dest == SIZE_DISPLAYABLE_PIXEL) | |
3480 frame_conversion_internal_1 (f, TOTAL_PIXEL_TO_DISPLAYABLE_PIXEL, | |
3481 &source_width, &source_height, | |
3482 dest_width, dest_height, 0, 0); | |
3483 else if (dest == SIZE_TOTAL_PIXEL && source == SIZE_CHAR_CELL) | |
3484 frame_conversion_internal_1 (f, CHAR_TO_TOTAL_PIXEL, | |
3485 dest_width, dest_height, 0, 0, | |
3486 &source_width, &source_height); | |
3487 else if (dest == SIZE_DISPLAYABLE_PIXEL && source == SIZE_CHAR_CELL) | |
3488 frame_conversion_internal_1 (f, CHAR_TO_DISPLAYABLE_PIXEL, 0, 0, | |
3489 dest_width, dest_height, | |
3490 &source_width, &source_height); | |
3491 else if (dest == SIZE_TOTAL_PIXEL && source == SIZE_DISPLAYABLE_PIXEL) | |
3492 frame_conversion_internal_1 (f, DISPLAYABLE_PIXEL_TO_TOTAL_PIXEL, | |
3493 dest_width, dest_height, | |
3494 &source_width, &source_height, 0, 0); | |
3495 else | |
3496 { | |
3497 ABORT (); | |
3498 if (dest_width) | |
3499 *dest_width = 0; | |
3500 if (dest_height) | |
3501 *dest_height = 0; | |
3502 } | |
3503 } | |
3504 | |
3505 /* This takes the size in pixels of the client area, and returns the number | |
428 | 3506 of characters that will fit there, taking into account the internal |
3507 border width, and the pixel width of the line terminator glyphs (which | |
3508 always count as one "character" wide, even if they are not the same size | |
3509 as the default character size of the default font). The frame scrollbar | |
3510 width and left and right toolbar widths are also subtracted out of the | |
3511 available width. The frame scrollbar height and top and bottom toolbar | |
3512 heights are subtracted out of the available height. | |
3513 | |
3514 Therefore the result is not necessarily a multiple of anything in | |
3515 particular. */ | |
5043 | 3516 |
428 | 3517 void |
3518 pixel_to_char_size (struct frame *f, int pixel_width, int pixel_height, | |
3519 int *char_width, int *char_height) | |
3520 { | |
5043 | 3521 frame_conversion_internal (f, SIZE_TOTAL_PIXEL, pixel_width, pixel_height, |
3522 SIZE_CHAR_CELL, char_width, char_height); | |
428 | 3523 } |
3524 | |
5043 | 3525 /* Given a character size, this returns the minimum pixel size of the |
3526 client area necessary to display that many characters, taking into | |
3527 account the internal border width, scrollbar height and width, toolbar | |
3528 heights and widths and the size of the line terminator glyphs (assuming | |
3529 the line terminators take up exactly one character position). | |
428 | 3530 |
3531 Therefore the result is not necessarily a multiple of anything in | |
3532 particular. */ | |
5043 | 3533 |
428 | 3534 void |
3535 char_to_pixel_size (struct frame *f, int char_width, int char_height, | |
3536 int *pixel_width, int *pixel_height) | |
3537 { | |
5043 | 3538 frame_conversion_internal (f, SIZE_CHAR_CELL, char_width, char_height, |
3539 SIZE_TOTAL_PIXEL, pixel_width, pixel_height); | |
428 | 3540 } |
3541 | |
5043 | 3542 /* Versions of the above that operate in "frame units" instead of |
3543 characters. frame units are the same as characters except on | |
3544 MS Windows and MS Printer frames, where they are displayable-area | |
3545 pixels. */ | |
3546 | |
3547 void | |
3548 pixel_to_frame_unit_size (struct frame *f, int pixel_width, int pixel_height, | |
3549 int *frame_unit_width, int *frame_unit_height) | |
3550 { | |
3551 frame_conversion_internal (f, SIZE_TOTAL_PIXEL, pixel_width, pixel_height, | |
3552 SIZE_FRAME_UNIT, frame_unit_width, | |
3553 frame_unit_height); | |
3554 } | |
3555 | |
3556 void | |
3557 frame_unit_to_pixel_size (struct frame *f, int frame_unit_width, | |
3558 int frame_unit_height, | |
3559 int *pixel_width, int *pixel_height) | |
3560 { | |
3561 frame_conversion_internal (f, SIZE_FRAME_UNIT, frame_unit_width, | |
3562 frame_unit_height, | |
3563 SIZE_TOTAL_PIXEL, pixel_width, pixel_height); | |
3564 } | |
3565 | |
428 | 3566 void |
3567 round_size_to_char (struct frame *f, int in_width, int in_height, | |
3568 int *out_width, int *out_height) | |
3569 { | |
3570 int char_width; | |
3571 int char_height; | |
3572 pixel_to_char_size (f, in_width, in_height, &char_width, &char_height); | |
3573 char_to_pixel_size (f, char_width, char_height, out_width, out_height); | |
3574 } | |
3575 | |
5043 | 3576 static void |
3577 get_frame_char_size (struct frame *f, int *out_width, int *out_height) | |
428 | 3578 { |
5105
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3579 *out_width = FRAME_CHARWIDTH (f); |
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3580 *out_height = FRAME_CHARHEIGHT (f); |
428 | 3581 } |
3582 | |
5105
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3583 /* Return the "new" frame size in displayable pixels, which will be |
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3584 accurate as of next redisplay. If we have changed the default font or |
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3585 toolbar or scrollbar specifiers, the frame pixel size will change as of |
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3586 next redisplay, but the frame character-cell size will remain the same. |
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3587 So use those dimensions to compute the displayable-pixel size. */ |
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3588 |
5043 | 3589 static void |
5105
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3590 get_frame_new_displayable_pixel_size (struct frame *f, int *out_width, |
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3591 int *out_height) |
428 | 3592 { |
5105
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3593 frame_conversion_internal (f, SIZE_CHAR_CELL, FRAME_CHARWIDTH (f), |
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3594 FRAME_CHARHEIGHT (f), SIZE_DISPLAYABLE_PIXEL, |
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3595 out_width, out_height); |
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3596 } |
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3597 |
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3598 /* Return the "new" frame size in total pixels, which will be |
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3599 accurate as of next redisplay. See get_frame_new_displayable_pixel_size(). |
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3600 */ |
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3601 |
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3602 |
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3603 static void |
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3604 get_frame_new_total_pixel_size (struct frame *f, int *out_width, |
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3605 int *out_height) |
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3606 { |
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3607 frame_conversion_internal (f, SIZE_CHAR_CELL, FRAME_CHARWIDTH (f), |
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3608 FRAME_CHARHEIGHT (f), SIZE_TOTAL_PIXEL, |
5043 | 3609 out_width, out_height); |
428 | 3610 } |
3611 | |
5104
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3612 |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3613 /**************************************************************************/ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3614 /* */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3615 /* frame resizing (implementation) */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3616 /* */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3617 /**************************************************************************/ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3618 |
5045 | 3619 /* Change the frame height and/or width. Values passed in are in |
3620 frame units (character cells on X/GTK, displayable-area pixels | |
3621 on MS Windows or generally on pixelated-geometry window systems). */ | |
428 | 3622 static void |
5043 | 3623 change_frame_size_1 (struct frame *f, int newwidth, int newheight) |
428 | 3624 { |
3625 int new_pixheight, new_pixwidth; | |
5105
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3626 int paned_pixheight, paned_pixwidth; |
5043 | 3627 int real_font_height, real_font_width; |
428 | 3628 |
3629 /* #### Chuck -- shouldn't we be checking to see if the frame | |
3630 is being "changed" to its existing size, and do nothing if so? */ | |
3631 /* No, because it would hose toolbar updates. The toolbar | |
3632 update code relies on this function to cause window `top' and | |
3633 `left' coordinates to be recomputed even though no frame size | |
3634 change occurs. --kyle */ | |
5050
6f2158fa75ed
Fix quick-build, use asserts() in place of ABORT()
Ben Wing <ben@xemacs.org>
parents:
4976
diff
changeset
|
3635 assert (!in_display && !hold_frame_size_changes); |
428 | 3636 |
5044
e84a30b0e4a2
remove duplicative code in change_frame_size()
Ben Wing <ben@xemacs.org>
parents:
5043
diff
changeset
|
3637 /* We no longer allow bogus values passed in. */ |
e84a30b0e4a2
remove duplicative code in change_frame_size()
Ben Wing <ben@xemacs.org>
parents:
5043
diff
changeset
|
3638 assert (newheight && newwidth); |
e84a30b0e4a2
remove duplicative code in change_frame_size()
Ben Wing <ben@xemacs.org>
parents:
5043
diff
changeset
|
3639 |
5047
07dcc7000bbf
put width before height consistently, fix a real bug found in the process
Ben Wing <ben@xemacs.org>
parents:
5046
diff
changeset
|
3640 default_face_width_and_height (wrap_frame (f), &real_font_width, |
07dcc7000bbf
put width before height consistently, fix a real bug found in the process
Ben Wing <ben@xemacs.org>
parents:
5046
diff
changeset
|
3641 &real_font_height); |
5044
e84a30b0e4a2
remove duplicative code in change_frame_size()
Ben Wing <ben@xemacs.org>
parents:
5043
diff
changeset
|
3642 |
e84a30b0e4a2
remove duplicative code in change_frame_size()
Ben Wing <ben@xemacs.org>
parents:
5043
diff
changeset
|
3643 frame_conversion_internal (f, SIZE_FRAME_UNIT, newwidth, newheight, |
e84a30b0e4a2
remove duplicative code in change_frame_size()
Ben Wing <ben@xemacs.org>
parents:
5043
diff
changeset
|
3644 SIZE_TOTAL_PIXEL, &new_pixwidth, |
e84a30b0e4a2
remove duplicative code in change_frame_size()
Ben Wing <ben@xemacs.org>
parents:
5043
diff
changeset
|
3645 &new_pixheight); |
428 | 3646 |
3647 /* This size-change overrides any pending one for this frame. */ | |
4307 | 3648 f->size_change_pending = 0; |
428 | 3649 FRAME_NEW_HEIGHT (f) = 0; |
3650 FRAME_NEW_WIDTH (f) = 0; | |
3651 | |
5045 | 3652 /* We need to remove the boundaries of the paned area (see top of file) |
3653 from the total-area pixel size, which is what we have now. | |
5078
a04cf0fea770
fix for clipped minibuffer window
Ben Wing <ben@xemacs.org>
parents:
5052
diff
changeset
|
3654 */ |
5105
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3655 paned_pixheight = new_pixheight - |
5078
a04cf0fea770
fix for clipped minibuffer window
Ben Wing <ben@xemacs.org>
parents:
5052
diff
changeset
|
3656 (FRAME_NONPANED_SIZE (f, TOP_EDGE) + FRAME_NONPANED_SIZE (f, BOTTOM_EDGE)); |
5105
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3657 paned_pixwidth = new_pixwidth - |
5078
a04cf0fea770
fix for clipped minibuffer window
Ben Wing <ben@xemacs.org>
parents:
5052
diff
changeset
|
3658 (FRAME_NONPANED_SIZE (f, LEFT_EDGE) + FRAME_NONPANED_SIZE (f, RIGHT_EDGE)); |
a04cf0fea770
fix for clipped minibuffer window
Ben Wing <ben@xemacs.org>
parents:
5052
diff
changeset
|
3659 |
a04cf0fea770
fix for clipped minibuffer window
Ben Wing <ben@xemacs.org>
parents:
5052
diff
changeset
|
3660 XWINDOW (FRAME_ROOT_WINDOW (f))->pixel_top = FRAME_PANED_TOP_EDGE (f); |
5044
e84a30b0e4a2
remove duplicative code in change_frame_size()
Ben Wing <ben@xemacs.org>
parents:
5043
diff
changeset
|
3661 |
e84a30b0e4a2
remove duplicative code in change_frame_size()
Ben Wing <ben@xemacs.org>
parents:
5043
diff
changeset
|
3662 if (FRAME_HAS_MINIBUF_P (f) |
e84a30b0e4a2
remove duplicative code in change_frame_size()
Ben Wing <ben@xemacs.org>
parents:
5043
diff
changeset
|
3663 && ! FRAME_MINIBUF_ONLY_P (f)) |
e84a30b0e4a2
remove duplicative code in change_frame_size()
Ben Wing <ben@xemacs.org>
parents:
5043
diff
changeset
|
3664 /* Frame has both root and minibuffer. */ |
428 | 3665 { |
5044
e84a30b0e4a2
remove duplicative code in change_frame_size()
Ben Wing <ben@xemacs.org>
parents:
5043
diff
changeset
|
3666 /* |
e84a30b0e4a2
remove duplicative code in change_frame_size()
Ben Wing <ben@xemacs.org>
parents:
5043
diff
changeset
|
3667 * Leave the minibuffer height the same if the frame has |
e84a30b0e4a2
remove duplicative code in change_frame_size()
Ben Wing <ben@xemacs.org>
parents:
5043
diff
changeset
|
3668 * been initialized, and the minibuffer height is tall |
e84a30b0e4a2
remove duplicative code in change_frame_size()
Ben Wing <ben@xemacs.org>
parents:
5043
diff
changeset
|
3669 * enough to display at least one line of text in the default |
e84a30b0e4a2
remove duplicative code in change_frame_size()
Ben Wing <ben@xemacs.org>
parents:
5043
diff
changeset
|
3670 * font, and the old minibuffer height is a multiple of the |
e84a30b0e4a2
remove duplicative code in change_frame_size()
Ben Wing <ben@xemacs.org>
parents:
5043
diff
changeset
|
3671 * default font height. This should cause the minibuffer |
e84a30b0e4a2
remove duplicative code in change_frame_size()
Ben Wing <ben@xemacs.org>
parents:
5043
diff
changeset
|
3672 * height to be recomputed on font changes but not for |
e84a30b0e4a2
remove duplicative code in change_frame_size()
Ben Wing <ben@xemacs.org>
parents:
5043
diff
changeset
|
3673 * other frame size changes, which seems reasonable. |
e84a30b0e4a2
remove duplicative code in change_frame_size()
Ben Wing <ben@xemacs.org>
parents:
5043
diff
changeset
|
3674 */ |
e84a30b0e4a2
remove duplicative code in change_frame_size()
Ben Wing <ben@xemacs.org>
parents:
5043
diff
changeset
|
3675 int old_minibuf_height = |
5105
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3676 XWINDOW (FRAME_MINIBUF_WINDOW (f))->pixel_height; |
5044
e84a30b0e4a2
remove duplicative code in change_frame_size()
Ben Wing <ben@xemacs.org>
parents:
5043
diff
changeset
|
3677 int minibuf_height = |
e84a30b0e4a2
remove duplicative code in change_frame_size()
Ben Wing <ben@xemacs.org>
parents:
5043
diff
changeset
|
3678 f->init_finished && (old_minibuf_height % real_font_height) == 0 ? |
5105
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3679 max (old_minibuf_height, real_font_height) : |
5044
e84a30b0e4a2
remove duplicative code in change_frame_size()
Ben Wing <ben@xemacs.org>
parents:
5043
diff
changeset
|
3680 real_font_height; |
e84a30b0e4a2
remove duplicative code in change_frame_size()
Ben Wing <ben@xemacs.org>
parents:
5043
diff
changeset
|
3681 set_window_pixheight (FRAME_ROOT_WINDOW (f), |
e84a30b0e4a2
remove duplicative code in change_frame_size()
Ben Wing <ben@xemacs.org>
parents:
5043
diff
changeset
|
3682 /* - font_height for minibuffer */ |
5105
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3683 paned_pixheight - minibuf_height, 0); |
5044
e84a30b0e4a2
remove duplicative code in change_frame_size()
Ben Wing <ben@xemacs.org>
parents:
5043
diff
changeset
|
3684 |
e84a30b0e4a2
remove duplicative code in change_frame_size()
Ben Wing <ben@xemacs.org>
parents:
5043
diff
changeset
|
3685 XWINDOW (FRAME_MINIBUF_WINDOW (f))->pixel_top = |
5078
a04cf0fea770
fix for clipped minibuffer window
Ben Wing <ben@xemacs.org>
parents:
5052
diff
changeset
|
3686 FRAME_PANED_TOP_EDGE (f) + |
5044
e84a30b0e4a2
remove duplicative code in change_frame_size()
Ben Wing <ben@xemacs.org>
parents:
5043
diff
changeset
|
3687 FRAME_BOTTOM_GUTTER_BOUNDS (f) + |
5105
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3688 paned_pixheight - minibuf_height; |
5044
e84a30b0e4a2
remove duplicative code in change_frame_size()
Ben Wing <ben@xemacs.org>
parents:
5043
diff
changeset
|
3689 |
e84a30b0e4a2
remove duplicative code in change_frame_size()
Ben Wing <ben@xemacs.org>
parents:
5043
diff
changeset
|
3690 set_window_pixheight (FRAME_MINIBUF_WINDOW (f), minibuf_height, 0); |
428 | 3691 } |
5044
e84a30b0e4a2
remove duplicative code in change_frame_size()
Ben Wing <ben@xemacs.org>
parents:
5043
diff
changeset
|
3692 else |
e84a30b0e4a2
remove duplicative code in change_frame_size()
Ben Wing <ben@xemacs.org>
parents:
5043
diff
changeset
|
3693 /* Frame has just one top-level window. */ |
5105
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3694 set_window_pixheight (FRAME_ROOT_WINDOW (f), paned_pixheight, 0); |
5044
e84a30b0e4a2
remove duplicative code in change_frame_size()
Ben Wing <ben@xemacs.org>
parents:
5043
diff
changeset
|
3695 |
5109
c113da3e2f67
add a comment about where FRAME_PIXWIDTH/FRAME_PIXHEIGHT is set
Ben Wing <ben@xemacs.org>
parents:
5105
diff
changeset
|
3696 /* Set the value of FRAME_WIDTH/FRAME_HEIGHT and |
c113da3e2f67
add a comment about where FRAME_PIXWIDTH/FRAME_PIXHEIGHT is set
Ben Wing <ben@xemacs.org>
parents:
5105
diff
changeset
|
3697 FRAME_CHARWIDTH/FRAME_CHARHEIGHT. |
c113da3e2f67
add a comment about where FRAME_PIXWIDTH/FRAME_PIXHEIGHT is set
Ben Wing <ben@xemacs.org>
parents:
5105
diff
changeset
|
3698 |
c113da3e2f67
add a comment about where FRAME_PIXWIDTH/FRAME_PIXHEIGHT is set
Ben Wing <ben@xemacs.org>
parents:
5105
diff
changeset
|
3699 Question: Where is FRAME_PIXWIDTH/FRAME_PIXHEIGHT set? |
c113da3e2f67
add a comment about where FRAME_PIXWIDTH/FRAME_PIXHEIGHT is set
Ben Wing <ben@xemacs.org>
parents:
5105
diff
changeset
|
3700 Answer: In the device-specific code, as a result of a callback from |
c113da3e2f67
add a comment about where FRAME_PIXWIDTH/FRAME_PIXHEIGHT is set
Ben Wing <ben@xemacs.org>
parents:
5105
diff
changeset
|
3701 the window system indicating that the frame has changed size. |
c113da3e2f67
add a comment about where FRAME_PIXWIDTH/FRAME_PIXHEIGHT is set
Ben Wing <ben@xemacs.org>
parents:
5105
diff
changeset
|
3702 This happens: |
c113da3e2f67
add a comment about where FRAME_PIXWIDTH/FRAME_PIXHEIGHT is set
Ben Wing <ben@xemacs.org>
parents:
5105
diff
changeset
|
3703 |
c113da3e2f67
add a comment about where FRAME_PIXWIDTH/FRAME_PIXHEIGHT is set
Ben Wing <ben@xemacs.org>
parents:
5105
diff
changeset
|
3704 (1) in the WM_SIZE processing in event-msw.c |
c113da3e2f67
add a comment about where FRAME_PIXWIDTH/FRAME_PIXHEIGHT is set
Ben Wing <ben@xemacs.org>
parents:
5105
diff
changeset
|
3705 (2) in update_various_frame_slots() called from EmacsFrameResize() |
c113da3e2f67
add a comment about where FRAME_PIXWIDTH/FRAME_PIXHEIGHT is set
Ben Wing <ben@xemacs.org>
parents:
5105
diff
changeset
|
3706 (called from Xt when the frame is resized) in EmacsFrame.c for X |
c113da3e2f67
add a comment about where FRAME_PIXWIDTH/FRAME_PIXHEIGHT is set
Ben Wing <ben@xemacs.org>
parents:
5105
diff
changeset
|
3707 (3) in resize_event_cb() in frame-gtk.c |
c113da3e2f67
add a comment about where FRAME_PIXWIDTH/FRAME_PIXHEIGHT is set
Ben Wing <ben@xemacs.org>
parents:
5105
diff
changeset
|
3708 (4) For TTY's, there is no such callback, so we have to set it |
c113da3e2f67
add a comment about where FRAME_PIXWIDTH/FRAME_PIXHEIGHT is set
Ben Wing <ben@xemacs.org>
parents:
5105
diff
changeset
|
3709 ourselves. |
c113da3e2f67
add a comment about where FRAME_PIXWIDTH/FRAME_PIXHEIGHT is set
Ben Wing <ben@xemacs.org>
parents:
5105
diff
changeset
|
3710 */ |
c113da3e2f67
add a comment about where FRAME_PIXWIDTH/FRAME_PIXHEIGHT is set
Ben Wing <ben@xemacs.org>
parents:
5105
diff
changeset
|
3711 |
5044
e84a30b0e4a2
remove duplicative code in change_frame_size()
Ben Wing <ben@xemacs.org>
parents:
5043
diff
changeset
|
3712 FRAME_HEIGHT (f) = newheight; |
e84a30b0e4a2
remove duplicative code in change_frame_size()
Ben Wing <ben@xemacs.org>
parents:
5043
diff
changeset
|
3713 if (FRAME_TTY_P (f)) |
e84a30b0e4a2
remove duplicative code in change_frame_size()
Ben Wing <ben@xemacs.org>
parents:
5043
diff
changeset
|
3714 f->pixheight = newheight; |
e84a30b0e4a2
remove duplicative code in change_frame_size()
Ben Wing <ben@xemacs.org>
parents:
5043
diff
changeset
|
3715 |
5078
a04cf0fea770
fix for clipped minibuffer window
Ben Wing <ben@xemacs.org>
parents:
5052
diff
changeset
|
3716 XWINDOW (FRAME_ROOT_WINDOW (f))->pixel_left = FRAME_PANED_LEFT_EDGE (f); |
5105
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3717 set_window_pixwidth (FRAME_ROOT_WINDOW (f), paned_pixwidth, 0); |
5044
e84a30b0e4a2
remove duplicative code in change_frame_size()
Ben Wing <ben@xemacs.org>
parents:
5043
diff
changeset
|
3718 |
e84a30b0e4a2
remove duplicative code in change_frame_size()
Ben Wing <ben@xemacs.org>
parents:
5043
diff
changeset
|
3719 if (FRAME_HAS_MINIBUF_P (f)) |
428 | 3720 { |
5044
e84a30b0e4a2
remove duplicative code in change_frame_size()
Ben Wing <ben@xemacs.org>
parents:
5043
diff
changeset
|
3721 XWINDOW (FRAME_MINIBUF_WINDOW (f))->pixel_left = |
5078
a04cf0fea770
fix for clipped minibuffer window
Ben Wing <ben@xemacs.org>
parents:
5052
diff
changeset
|
3722 FRAME_PANED_LEFT_EDGE (f); |
5105
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3723 set_window_pixwidth (FRAME_MINIBUF_WINDOW (f), paned_pixwidth, 0); |
428 | 3724 } |
3725 | |
5044
e84a30b0e4a2
remove duplicative code in change_frame_size()
Ben Wing <ben@xemacs.org>
parents:
5043
diff
changeset
|
3726 FRAME_WIDTH (f) = newwidth; |
e84a30b0e4a2
remove duplicative code in change_frame_size()
Ben Wing <ben@xemacs.org>
parents:
5043
diff
changeset
|
3727 if (FRAME_TTY_P (f)) |
e84a30b0e4a2
remove duplicative code in change_frame_size()
Ben Wing <ben@xemacs.org>
parents:
5043
diff
changeset
|
3728 f->pixwidth = newwidth; |
e84a30b0e4a2
remove duplicative code in change_frame_size()
Ben Wing <ben@xemacs.org>
parents:
5043
diff
changeset
|
3729 |
5105
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3730 /* Set the frame character-cell width appropriately. */ |
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3731 if (window_system_pixelated_geometry (wrap_frame (f))) |
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3732 pixel_to_char_size (f, new_pixwidth, new_pixheight, |
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3733 &FRAME_CHARWIDTH (f), &FRAME_CHARHEIGHT (f)); |
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3734 else |
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3735 { |
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3736 FRAME_CHARWIDTH (f) = FRAME_WIDTH (f); |
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3737 FRAME_CHARHEIGHT (f) = FRAME_HEIGHT (f); |
d76a51b29d91
fix Stephen's bug with frame sizing
Ben Wing <ben@xemacs.org>
parents:
5104
diff
changeset
|
3738 } |
428 | 3739 |
3740 MARK_FRAME_TOOLBARS_CHANGED (f); | |
442 | 3741 MARK_FRAME_GUTTERS_CHANGED (f); |
428 | 3742 MARK_FRAME_CHANGED (f); |
3743 f->echo_area_garbaged = 1; | |
3744 } | |
3745 | |
5104
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3746 /* This function is called to change the redisplay structures of a frame |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3747 to correspond to a new width and height. IT DOES NOT CHANGE THE ACTUAL |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3748 SIZE OF A FRAME. It is meant to be called after the frame has been |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3749 resized, either as a result of user action or a call to a function |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3750 such as `set-frame-size'. For example, under MS-Windows it is called |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3751 from mswindows_wnd_proc() when a WM_SIZE message is received, indicating |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3752 that the user resized the frame, and from mswindows_set_frame_size(), |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3753 which is the device method that is called (from internal_set_frame_size()) |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3754 when `set-frame-size' or similar function is called. |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3755 |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3756 Values passed in are in frame units (character cells on X/GTK, |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3757 displayable-area pixels on MS Windows or generally on pixelated-geometry |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3758 window systems). See discussion at top of file. |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3759 |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3760 See also internal_set_frame_size() and adjust_frame_size(). |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3761 */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3762 |
428 | 3763 void |
5043 | 3764 change_frame_size (struct frame *f, int newwidth, int newheight, int delay) |
428 | 3765 { |
3766 /* sometimes we get passed a size that's too small (esp. when a | |
3767 client widget gets resized, since we have no control over this). | |
3768 So deal. */ | |
5047
07dcc7000bbf
put width before height consistently, fix a real bug found in the process
Ben Wing <ben@xemacs.org>
parents:
5046
diff
changeset
|
3769 check_frame_size (f, &newwidth, &newheight); |
428 | 3770 |
450 | 3771 /* Unconditionally mark that the frame has changed size. This is |
3772 because many things need to know after the | |
3773 fact. f->size_change_pending will get reset below. The most that | |
3774 can happen is that we will cycle through redisplay once more | |
3775 --andy. */ | |
3776 MARK_FRAME_SIZE_CHANGED (f); | |
3777 | |
3092 | 3778 #ifdef NEW_GC |
3779 if (delay || hold_frame_size_changes) | |
3780 #else /* not NEW_GC */ | |
1318 | 3781 if (delay || hold_frame_size_changes || gc_in_progress) |
3092 | 3782 #endif /* not NEW_GC */ |
428 | 3783 { |
3784 f->new_width = newwidth; | |
3785 f->new_height = newheight; | |
3786 return; | |
3787 } | |
3788 | |
3789 /* For TTY frames, it's like one, like all ... | |
3790 Can't have two TTY frames of different sizes on the same device. */ | |
3791 if (FRAME_TTY_P (f)) | |
3792 { | |
3793 Lisp_Object frmcons; | |
3794 | |
3795 DEVICE_FRAME_LOOP (frmcons, XDEVICE (FRAME_DEVICE (f))) | |
5043 | 3796 change_frame_size_1 (XFRAME (XCAR (frmcons)), newwidth, newheight); |
428 | 3797 } |
3798 else | |
5043 | 3799 change_frame_size_1 (f, newwidth, newheight); |
428 | 3800 } |
3801 | |
5104
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3802 |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3803 /* This function is called from `set-frame-size' or the like, to explicitly |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3804 change the size of a frame. It calls the `set_frame_size' device |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3805 method, which makes the necessary window-system-specific call to change |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3806 the size of the frame and then calls change_frame_size() to change |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3807 the redisplay structures appropriately. |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3808 |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3809 Values passed in are in frame units (character cells on X/GTK, |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3810 displayable-area pixels on MS Windows or generally on pixelated-geometry |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3811 window systems). See discussion at top of file. |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3812 */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3813 |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3814 void |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3815 internal_set_frame_size (struct frame *f, int cols, int rows, int pretend) |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3816 { |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3817 /* This can call Lisp. See mswindows_set_frame_size(). */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3818 /* An explicit size change cancels any pending frame size adjustment */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3819 CLEAR_FRAME_SIZE_SLIPPED (f); |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3820 |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3821 if (pretend || !HAS_FRAMEMETH_P (f, set_frame_size)) |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3822 change_frame_size (f, cols, rows, 0); |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3823 else |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3824 FRAMEMETH (f, set_frame_size, (f, cols, rows)); |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3825 } |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3826 |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3827 /* This function is called from redisplay_frame() as a result of the |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3828 "frame_slipped" flag being set. This flag is set when the default font |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3829 changes or when a change to scrollbar or toolbar visibility or size |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3830 is made (e.g. when a specifier such as `scrollbar-width' is changed). |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3831 Its purpose is to resize the frame so that its size in character-cell |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3832 units stays the same. |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3833 |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3834 #### It should also be triggered by a change the gutter visibility or |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3835 size. |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3836 |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3837 When a scrollbar or toolbar specifier is changed, the |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3838 frame_size_slipped() function is called (this happens because the |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3839 specifier's value_changed_in_frame() hook has been set to |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3840 frame_size_slipped() by a call to set_specifier_caching()). |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3841 All this does is call MARK_FRAME_SIZE_SLIPPED(), which sets the |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3842 frame_slipped flag, which gets noticed by redisplay_frame(), as just |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3843 discussed. |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3844 |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3845 The way things get triggered when a change is made to the default font |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3846 is as follows: |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3847 |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3848 (1) The specifier for the default font, which is attached to the |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3849 face named `default', has its "face" property set to the `default' |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3850 face. |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3851 |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3852 (2) font_after_change() (the font specifier's after_changed() method) |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3853 is called for the font specifier. |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3854 |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3855 |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3856 (3) It in turn calls face_property_was_changed(), passing in the |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3857 default face. |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3858 |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3859 (4) face_property_was_changed() notices that the default face is having |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3860 a property set and calls update_EmacsFrame(). |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3861 |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3862 (5) This in turn notices that the default face's font is being changed |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3863 and calls MARK_FRAME_SIZE_SLIPPED() -- see above. |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3864 */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3865 |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3866 void |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3867 adjust_frame_size (struct frame *f) |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3868 { |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3869 /* This can call Lisp. */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3870 int keep_char_size = 0; |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3871 Lisp_Object frame = wrap_frame (f); |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3872 |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3873 if (!f->size_slipped) |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3874 return; |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3875 |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3876 /* Don't adjust tty frames. #### May break when TTY have menubars. |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3877 Then, write an Vadjust_frame_function which will return t for TTY |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3878 frames. Another solution is frame_size_fixed_p method for TTYs, |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3879 which always returned yes it's fixed. |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3880 */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3881 if (!FRAME_WIN_P (f)) |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3882 { |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3883 CLEAR_FRAME_SIZE_SLIPPED (f); |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3884 return; |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3885 } |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3886 |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3887 /* frame_size_fixed_p tells that frame size cannot currently |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3888 be changed change due to external conditions */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3889 if (!FRAMEMETH_OR_GIVEN (f, frame_size_fixed_p, (f), 0)) |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3890 { |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3891 if (NILP (Vadjust_frame_function)) |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3892 keep_char_size = 1; |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3893 else if (EQ (Vadjust_frame_function, Qt)) |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3894 keep_char_size = 0; |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3895 else |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3896 keep_char_size = |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3897 NILP (call1_trapping_problems ("Error in adjust-frame-function", |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3898 Vadjust_frame_function, frame, |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3899 0)); |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3900 |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3901 if (keep_char_size) |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3902 Fset_frame_size (frame, make_int (FRAME_CHARWIDTH(f)), |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3903 make_int (FRAME_CHARHEIGHT(f)), Qnil); |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3904 } |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3905 |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3906 if (!keep_char_size) |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3907 { |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3908 int height, width; |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3909 pixel_to_frame_unit_size (f, FRAME_PIXWIDTH(f), FRAME_PIXHEIGHT(f), |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3910 &width, &height); |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3911 change_frame_size (f, width, height, 0); |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3912 CLEAR_FRAME_SIZE_SLIPPED (f); |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3913 } |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3914 } |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3915 |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3916 /* This is a "specifier changed in frame" handler for various specifiers |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3917 changing which causes frame size adjustment. See the discussion in |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3918 adjust_frame_size(). |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3919 */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3920 |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3921 void |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3922 frame_size_slipped (Lisp_Object UNUSED (specifier), struct frame *f, |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3923 Lisp_Object UNUSED (oldval)) |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3924 { |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3925 MARK_FRAME_SIZE_SLIPPED (f); |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3926 } |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3927 |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3928 void |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3929 invalidate_vertical_divider_cache_in_frame (struct frame *f) |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3930 { |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3931 /* Invalidate cached value of needs_vertical_divider_p in |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3932 every and all windows */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3933 map_windows (f, invalidate_vertical_divider_cache_in_window, 0); |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3934 } |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3935 |
428 | 3936 |
5104
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3937 /**************************************************************************/ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3938 /* */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3939 /* frame title, icon, pointer */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3940 /* */ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3941 /**************************************************************************/ |
868a5349acee
add documentation to frame.c, rearrange some functions to consolidate in related areas
Ben Wing <ben@xemacs.org>
parents:
5090
diff
changeset
|
3942 |
438 | 3943 /* The caller is responsible for freeing the returned string. */ |
867 | 3944 static Ibyte * |
438 | 3945 generate_title_string (struct window *w, Lisp_Object format_str, |
3946 face_index findex, int type) | |
3947 { | |
3948 struct display_line *dl; | |
3949 struct display_block *db; | |
3950 int elt = 0; | |
3951 | |
3952 dl = &title_string_display_line; | |
3953 db = get_display_block_from_line (dl, TEXT); | |
3954 Dynarr_reset (db->runes); | |
3955 | |
3956 generate_formatted_string_db (format_str, Qnil, w, dl, db, findex, 0, | |
4207 | 3957 -1, type); |
438 | 3958 |
867 | 3959 Dynarr_reset (title_string_ichar_dynarr); |
438 | 3960 while (elt < Dynarr_length (db->runes)) |
3961 { | |
3962 if (Dynarr_atp (db->runes, elt)->type == RUNE_CHAR) | |
867 | 3963 Dynarr_add (title_string_ichar_dynarr, |
438 | 3964 Dynarr_atp (db->runes, elt)->object.chr.ch); |
3965 elt++; | |
3966 } | |
3967 | |
3968 return | |
867 | 3969 convert_ichar_string_into_malloced_string |
4967 | 3970 (Dynarr_begin (title_string_ichar_dynarr), |
867 | 3971 Dynarr_length (title_string_ichar_dynarr), 0); |
438 | 3972 } |
3973 | |
428 | 3974 void |
3975 update_frame_title (struct frame *f) | |
3976 { | |
3977 struct window *w = XWINDOW (FRAME_SELECTED_WINDOW (f)); | |
3978 Lisp_Object title_format; | |
3979 Lisp_Object icon_format; | |
867 | 3980 Ibyte *title; |
428 | 3981 |
3982 /* We don't change the title for the minibuffer unless the frame | |
3983 only has a minibuffer. */ | |
3984 if (MINI_WINDOW_P (w) && !FRAME_MINIBUF_ONLY_P (f)) | |
3985 return; | |
3986 | |
3987 /* And we don't want dead buffers to blow up on us. */ | |
3988 if (!BUFFER_LIVE_P (XBUFFER (w->buffer))) | |
3989 return; | |
3990 | |
3991 title = NULL; | |
3992 title_format = symbol_value_in_buffer (Qframe_title_format, w->buffer); | |
3993 icon_format = symbol_value_in_buffer (Qframe_icon_title_format, w->buffer); | |
3994 | |
867 | 3995 if (HAS_FRAMEMETH_P (f, set_title_from_ibyte)) |
428 | 3996 { |
438 | 3997 title = generate_title_string (w, title_format, |
3998 DEFAULT_INDEX, CURRENT_DISP); | |
867 | 3999 FRAMEMETH (f, set_title_from_ibyte, (f, title)); |
428 | 4000 } |
4001 | |
867 | 4002 if (HAS_FRAMEMETH_P (f, set_icon_name_from_ibyte)) |
428 | 4003 { |
4004 if (!EQ (icon_format, title_format) || !title) | |
4005 { | |
4006 if (title) | |
4976
16112448d484
Rename xfree(FOO, TYPE) -> xfree(FOO)
Ben Wing <ben@xemacs.org>
parents:
4968
diff
changeset
|
4007 xfree (title); |
428 | 4008 |
438 | 4009 title = generate_title_string (w, icon_format, |
4010 DEFAULT_INDEX, CURRENT_DISP); | |
428 | 4011 } |
867 | 4012 FRAMEMETH (f, set_icon_name_from_ibyte, (f, title)); |
428 | 4013 } |
4014 | |
4015 if (title) | |
4976
16112448d484
Rename xfree(FOO, TYPE) -> xfree(FOO)
Ben Wing <ben@xemacs.org>
parents:
4968
diff
changeset
|
4016 xfree (title); |
428 | 4017 } |
4018 | |
4019 | |
4020 DEFUN ("set-frame-pointer", Fset_frame_pointer, 2, 2, 0, /* | |
4021 Set the mouse pointer of FRAME to the given pointer image instance. | |
4022 You should not call this function directly. Instead, set one of | |
4023 the variables `text-pointer-glyph', `nontext-pointer-glyph', | |
4024 `modeline-pointer-glyph', `selection-pointer-glyph', | |
4025 `busy-pointer-glyph', or `toolbar-pointer-glyph'. | |
4026 */ | |
4027 (frame, image_instance)) | |
4028 { | |
4029 struct frame *f = decode_frame (frame); | |
4030 CHECK_POINTER_IMAGE_INSTANCE (image_instance); | |
4031 if (!EQ (f->pointer, image_instance)) | |
4032 { | |
4033 f->pointer = image_instance; | |
4034 MAYBE_FRAMEMETH (f, set_frame_pointer, (f)); | |
4035 } | |
4036 return Qnil; | |
4037 } | |
4038 | |
4039 | |
4040 void | |
4041 update_frame_icon (struct frame *f) | |
4042 { | |
4043 if (f->icon_changed || f->windows_changed) | |
4044 { | |
4045 Lisp_Object frame; | |
4046 Lisp_Object new_icon; | |
4047 | |
793 | 4048 frame = wrap_frame (f); |
428 | 4049 new_icon = glyph_image_instance (Vframe_icon_glyph, frame, |
4050 ERROR_ME_WARN, 0); | |
4051 if (!EQ (new_icon, f->icon)) | |
4052 { | |
4053 f->icon = new_icon; | |
4054 MAYBE_FRAMEMETH (f, set_frame_icon, (f)); | |
4055 } | |
4056 } | |
4057 | |
4058 f->icon_changed = 0; | |
4059 } | |
4060 | |
4061 static void | |
2286 | 4062 icon_glyph_changed (Lisp_Object UNUSED (glyph), Lisp_Object UNUSED (property), |
4063 Lisp_Object UNUSED (locale)) | |
428 | 4064 { |
4065 MARK_ICON_CHANGED; | |
4066 } | |
4067 | |
4068 | |
5158
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4069 #ifdef MEMORY_USAGE_STATS |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4070 |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4071 struct frame_stats |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4072 { |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4073 struct usage_stats u; |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4074 Bytecount gutter; |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4075 Bytecount expose_ignore; |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4076 Bytecount other; |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4077 }; |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4078 |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4079 static void |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4080 compute_frame_usage (struct frame *f, struct frame_stats *stats, |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4081 struct usage_stats *ustats) |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4082 { |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4083 enum edge_pos edge; |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4084 EDGE_POS_LOOP (edge) |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4085 { |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4086 stats->gutter += |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4087 compute_display_line_dynarr_usage (f->current_display_lines[edge], |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4088 ustats); |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4089 stats->gutter += |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4090 compute_display_line_dynarr_usage (f->desired_display_lines[edge], |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4091 ustats); |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4092 } |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4093 { |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4094 struct expose_ignore *e; |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4095 |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4096 for (e = f->subwindow_exposures; e; e = e->next) |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4097 stats->expose_ignore += malloced_storage_size (e, sizeof (*e), ustats); |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4098 } |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4099 |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4100 #if 0 |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4101 stats->other += FRAMEMETH (f, frame_memory_usage, (f, ustats)); |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4102 #endif |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4103 } |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4104 |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4105 static void |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4106 frame_memory_usage (Lisp_Object frame, struct generic_usage_stats *gustats) |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4107 { |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4108 struct frame_stats *stats = (struct frame_stats *) gustats; |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4109 |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4110 compute_frame_usage (XFRAME (frame), stats, &stats->u); |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4111 } |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4112 |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4113 #endif /* MEMORY_USAGE_STATS */ |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4114 |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4115 |
438 | 4116 /***************************************************************************/ |
4117 /* */ | |
4118 /* initialization */ | |
4119 /* */ | |
4120 /***************************************************************************/ | |
4121 | |
4122 void | |
5158
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4123 frame_objects_create (void) |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4124 { |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4125 #ifdef MEMORY_USAGE_STATS |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4126 OBJECT_HAS_METHOD (frame, memory_usage); |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4127 #endif |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4128 } |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4129 |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4130 void |
438 | 4131 init_frame (void) |
4132 { | |
4133 #ifndef PDUMP | |
4134 if (!initialized) | |
4135 #endif | |
4136 { | |
867 | 4137 title_string_ichar_dynarr = Dynarr_new (Ichar); |
4207 | 4138 DISPLAY_LINE_INIT (title_string_display_line); |
438 | 4139 } |
4140 } | |
4141 | |
428 | 4142 void |
4143 syms_of_frame (void) | |
4144 { | |
5117
3742ea8250b5
Checking in final CVS version of workspace 'ben-lisp-object'
Ben Wing <ben@xemacs.org>
parents:
3025
diff
changeset
|
4145 INIT_LISP_OBJECT (frame); |
3092 | 4146 #ifdef NEW_GC |
5118
e0db3c197671
merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
diff
changeset
|
4147 INIT_LISP_OBJECT (expose_ignore); |
3092 | 4148 #endif /* NEW_GC */ |
442 | 4149 |
563 | 4150 DEFSYMBOL (Qdelete_frame_hook); |
4151 DEFSYMBOL (Qselect_frame_hook); | |
4152 DEFSYMBOL (Qdeselect_frame_hook); | |
4153 DEFSYMBOL (Qcreate_frame_hook); | |
4154 DEFSYMBOL (Qcustom_initialize_frame); | |
4155 DEFSYMBOL (Qmouse_enter_frame_hook); | |
4156 DEFSYMBOL (Qmouse_leave_frame_hook); | |
4157 DEFSYMBOL (Qmap_frame_hook); | |
4158 DEFSYMBOL (Qunmap_frame_hook); | |
4159 | |
4160 DEFSYMBOL (Qframep); | |
4161 DEFSYMBOL (Qframe_live_p); | |
4162 DEFSYMBOL (Qdelete_frame); | |
4163 DEFSYMBOL (Qsynchronize_minibuffers); | |
4164 DEFSYMBOL (Qbuffer_predicate); | |
4165 DEFSYMBOL (Qframe_being_created); | |
4166 DEFSYMBOL (Qmake_initial_minibuffer_frame); | |
4167 | |
4168 DEFSYMBOL (Qframe_title_format); | |
4169 DEFSYMBOL (Qframe_icon_title_format); | |
4170 | |
4171 DEFSYMBOL (Qhidden); | |
4172 DEFSYMBOL (Qvisible); | |
4173 DEFSYMBOL (Qiconic); | |
4174 DEFSYMBOL (Qinvisible); | |
4175 DEFSYMBOL (Qvisible_iconic); | |
4176 DEFSYMBOL (Qinvisible_iconic); | |
4177 DEFSYMBOL (Qnomini); | |
4178 DEFSYMBOL (Qvisible_nomini); | |
4179 DEFSYMBOL (Qiconic_nomini); | |
4180 DEFSYMBOL (Qinvisible_nomini); | |
4181 DEFSYMBOL (Qvisible_iconic_nomini); | |
4182 DEFSYMBOL (Qinvisible_iconic_nomini); | |
4183 | |
4184 DEFSYMBOL (Qminibuffer); | |
4185 DEFSYMBOL (Qunsplittable); | |
4186 DEFSYMBOL (Qinternal_border_width); | |
4187 DEFSYMBOL (Qtop_toolbar_shadow_color); | |
4188 DEFSYMBOL (Qbottom_toolbar_shadow_color); | |
4189 DEFSYMBOL (Qbackground_toolbar_color); | |
4190 DEFSYMBOL (Qtop_toolbar_shadow_pixmap); | |
4191 DEFSYMBOL (Qbottom_toolbar_shadow_pixmap); | |
4192 DEFSYMBOL (Qtoolbar_shadow_thickness); | |
4193 DEFSYMBOL (Qscrollbar_placement); | |
4194 DEFSYMBOL (Qinter_line_space); | |
428 | 4195 /* Qiconic already in this function. */ |
563 | 4196 DEFSYMBOL (Qvisual_bell); |
4197 DEFSYMBOL (Qbell_volume); | |
4198 DEFSYMBOL (Qpointer_background); | |
4199 DEFSYMBOL (Qpointer_color); | |
4200 DEFSYMBOL (Qtext_pointer); | |
4201 DEFSYMBOL (Qspace_pointer); | |
4202 DEFSYMBOL (Qmodeline_pointer); | |
4203 DEFSYMBOL (Qgc_pointer); | |
4204 DEFSYMBOL (Qinitially_unmapped); | |
4205 DEFSYMBOL (Quse_backing_store); | |
4206 DEFSYMBOL (Qborder_color); | |
4207 DEFSYMBOL (Qborder_width); | |
428 | 4208 /* Qwidth, Qheight, Qleft, Qtop in general.c */ |
563 | 4209 DEFSYMBOL (Qset_specifier); |
4210 DEFSYMBOL (Qset_face_property); | |
4211 DEFSYMBOL (Qface_property_instance); | |
4212 DEFSYMBOL (Qframe_property_alias); | |
428 | 4213 |
4214 DEFSUBR (Fmake_frame); | |
4215 DEFSUBR (Fframep); | |
4216 DEFSUBR (Fframe_live_p); | |
4217 #if 0 /* FSFmacs */ | |
4218 DEFSUBR (Fignore_event); | |
4219 #endif | |
4220 DEFSUBR (Ffocus_frame); | |
4221 DEFSUBR (Fselect_frame); | |
4222 DEFSUBR (Fselected_frame); | |
4223 DEFSUBR (Factive_minibuffer_window); | |
4224 DEFSUBR (Flast_nonminibuf_frame); | |
4225 DEFSUBR (Fframe_root_window); | |
4226 DEFSUBR (Fframe_selected_window); | |
4227 DEFSUBR (Fset_frame_selected_window); | |
4228 DEFSUBR (Fframe_device); | |
4229 DEFSUBR (Fnext_frame); | |
4230 DEFSUBR (Fprevious_frame); | |
4231 DEFSUBR (Fdelete_frame); | |
4232 DEFSUBR (Fmouse_position); | |
4233 DEFSUBR (Fmouse_pixel_position); | |
4234 DEFSUBR (Fmouse_position_as_motion_event); | |
4235 DEFSUBR (Fset_mouse_position); | |
4236 DEFSUBR (Fset_mouse_pixel_position); | |
4237 DEFSUBR (Fmake_frame_visible); | |
4238 DEFSUBR (Fmake_frame_invisible); | |
4239 DEFSUBR (Ficonify_frame); | |
4240 DEFSUBR (Fdeiconify_frame); | |
4241 DEFSUBR (Fframe_visible_p); | |
4242 DEFSUBR (Fframe_totally_visible_p); | |
4243 DEFSUBR (Fframe_iconified_p); | |
4244 DEFSUBR (Fvisible_frame_list); | |
4245 DEFSUBR (Fraise_frame); | |
4246 DEFSUBR (Flower_frame); | |
442 | 4247 DEFSUBR (Fdisable_frame); |
4248 DEFSUBR (Fenable_frame); | |
428 | 4249 DEFSUBR (Fframe_property); |
4250 DEFSUBR (Fframe_properties); | |
4251 DEFSUBR (Fset_frame_properties); | |
4252 DEFSUBR (Fframe_pixel_height); | |
1125 | 4253 DEFSUBR (Fframe_displayable_pixel_height); |
428 | 4254 DEFSUBR (Fframe_pixel_width); |
1125 | 4255 DEFSUBR (Fframe_displayable_pixel_width); |
428 | 4256 DEFSUBR (Fframe_name); |
4257 DEFSUBR (Fframe_modified_tick); | |
4258 DEFSUBR (Fset_frame_height); | |
4259 DEFSUBR (Fset_frame_width); | |
4260 DEFSUBR (Fset_frame_size); | |
863 | 4261 DEFSUBR (Fset_frame_pixel_height); |
1125 | 4262 DEFSUBR (Fset_frame_displayable_pixel_height); |
863 | 4263 DEFSUBR (Fset_frame_pixel_width); |
1125 | 4264 DEFSUBR (Fset_frame_displayable_pixel_width); |
863 | 4265 DEFSUBR (Fset_frame_pixel_size); |
1125 | 4266 DEFSUBR (Fset_frame_displayable_pixel_size); |
428 | 4267 DEFSUBR (Fset_frame_position); |
4268 DEFSUBR (Fset_frame_pointer); | |
442 | 4269 DEFSUBR (Fprint_job_page_number); |
4270 DEFSUBR (Fprint_job_eject_page); | |
428 | 4271 } |
4272 | |
4273 void | |
4274 vars_of_frame (void) | |
4275 { | |
5158
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4276 #ifdef MEMORY_USAGE_STATS |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4277 OBJECT_HAS_PROPERTY |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4278 (frame, memusage_stats_list, list3 (Qgutter, intern ("expose-ignore"), |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4279 Qother)); |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4280 #endif /* MEMORY_USAGE_STATS */ |
9e0b43d3095c
more cleanups to object-memory-usage stuff
Ben Wing <ben@xemacs.org>
parents:
5146
diff
changeset
|
4281 |
428 | 4282 /* */ |
4283 Vframe_being_created = Qnil; | |
4284 staticpro (&Vframe_being_created); | |
4285 | |
4286 #ifdef HAVE_CDE | |
4287 Fprovide (intern ("cde")); | |
4288 #endif | |
4289 | |
4290 #if 0 /* FSFmacs stupidity */ | |
4291 xxDEFVAR_LISP ("emacs-iconified", &Vemacs_iconified /* | |
4292 Non-nil if all of emacs is iconified and frame updates are not needed. | |
4293 */ ); | |
4294 Vemacs_iconified = Qnil; | |
4295 #endif | |
4296 | |
4297 DEFVAR_LISP ("select-frame-hook", &Vselect_frame_hook /* | |
4298 Function or functions to run just after a new frame is given the focus. | |
4299 Note that calling `select-frame' does not necessarily set the focus: | |
4300 The actual window-system focus will not be changed until the next time | |
4301 that XEmacs is waiting for an event, and even then, the window manager | |
4302 may refuse the focus-change request. | |
4303 */ ); | |
4304 Vselect_frame_hook = Qnil; | |
4305 | |
4306 DEFVAR_LISP ("deselect-frame-hook", &Vdeselect_frame_hook /* | |
4307 Function or functions to run just before a frame loses the focus. | |
4308 See `select-frame-hook'. | |
4309 */ ); | |
4310 Vdeselect_frame_hook = Qnil; | |
4311 | |
4312 DEFVAR_LISP ("delete-frame-hook", &Vdelete_frame_hook /* | |
4313 Function or functions to call when a frame is deleted. | |
4314 One argument, the about-to-be-deleted frame. | |
4315 */ ); | |
4316 Vdelete_frame_hook = Qnil; | |
4317 | |
4318 DEFVAR_LISP ("create-frame-hook", &Vcreate_frame_hook /* | |
4319 Function or functions to call when a frame is created. | |
4320 One argument, the newly-created frame. | |
4321 */ ); | |
4322 Vcreate_frame_hook = Qnil; | |
4323 | |
4324 DEFVAR_LISP ("mouse-enter-frame-hook", &Vmouse_enter_frame_hook /* | |
4325 Function or functions to call when the mouse enters a frame. | |
4326 One argument, the frame. | |
4327 Be careful not to make assumptions about the window manager's focus model. | |
4328 In most cases, the `deselect-frame-hook' is more appropriate. | |
4329 */ ); | |
4330 Vmouse_enter_frame_hook = Qnil; | |
4331 | |
4332 DEFVAR_LISP ("mouse-leave-frame-hook", &Vmouse_leave_frame_hook /* | |
4333 Function or functions to call when the mouse leaves a frame. | |
4334 One argument, the frame. | |
4335 Be careful not to make assumptions about the window manager's focus model. | |
4336 In most cases, the `select-frame-hook' is more appropriate. | |
4337 */ ); | |
4338 Vmouse_leave_frame_hook = Qnil; | |
4339 | |
4340 DEFVAR_LISP ("map-frame-hook", &Vmap_frame_hook /* | |
4341 Function or functions to call when a frame is mapped. | |
4342 One argument, the frame. | |
4343 */ ); | |
4344 Vmap_frame_hook = Qnil; | |
4345 | |
4346 DEFVAR_LISP ("unmap-frame-hook", &Vunmap_frame_hook /* | |
4347 Function or functions to call when a frame is unmapped. | |
4348 One argument, the frame. | |
4349 */ ); | |
4350 Vunmap_frame_hook = Qnil; | |
4351 | |
4352 DEFVAR_BOOL ("allow-deletion-of-last-visible-frame", | |
4353 &allow_deletion_of_last_visible_frame /* | |
4354 *Non-nil means to assume the force option to delete-frame. | |
4355 */ ); | |
4356 allow_deletion_of_last_visible_frame = 0; | |
4357 | |
4358 DEFVAR_LISP ("adjust-frame-function", &Vadjust_frame_function /* | |
4359 Function or constant controlling adjustment of frame. | |
4360 When scrollbars, toolbars, default font etc. change in frame, the frame | |
4361 needs to be adjusted. The adjustment is controlled by this variable. | |
4362 Legal values are: | |
4363 nil to keep character frame size unchanged when possible (resize) | |
4364 t to keep pixel size unchanged (never resize) | |
4365 function symbol or lambda form. This function must return boolean | |
4366 value which is treated as above. Function is passed one parameter, | |
4367 the frame being adjusted. It function should not modify or delete | |
4368 the frame. | |
4369 */ ); | |
4370 Vadjust_frame_function = Qnil; | |
4371 | |
4372 DEFVAR_LISP ("mouse-motion-handler", &Vmouse_motion_handler /* | |
3577 | 4373 Handler for motion events. Must be a function taking one argument, the event. |
428 | 4374 For most applications, you should use `mode-motion-hook' instead of this. |
3577 | 4375 The default value is `default-mouse-motion-handler'. |
4376 | |
4377 Note that this is NOT a hook variable, so there is no standard way to remove | |
4378 actions from it. Instead, when adding a new kind of action, a hook variable | |
4379 should be defined and initialized to the current value of this variable, then | |
4380 this variable set to a function that runs the new hook. To disable the new | |
4381 actions, use `remove-hook' rather than setting `mouse-motion-handler'. | |
4382 | |
4383 `mouse-motion-hook' in the balloon-help library exemplifies this pattern. | |
428 | 4384 */ ); |
4385 Vmouse_motion_handler = Qnil; | |
4386 | |
4387 DEFVAR_LISP ("synchronize-minibuffers",&Vsynchronize_minibuffers /* | |
4388 Set to t if all minibuffer windows are to be synchronized. | |
4389 This will cause echo area messages to appear in the minibuffers of all | |
4390 visible frames. | |
4391 */ ); | |
4392 Vsynchronize_minibuffers = Qnil; | |
4393 | |
4394 DEFVAR_LISP ("frame-title-format", &Vframe_title_format /* | |
442 | 4395 Controls the title of the window-system window of the selected frame. |
428 | 4396 This is the same format as `modeline-format' with the exception that |
4397 %- is ignored. | |
4398 */ ); | |
442 | 4399 /* #### I would change this unilaterally but for the wrath of the Kyles |
4400 of the world. */ | |
4401 #ifdef WIN32_NATIVE | |
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4846
diff
changeset
|
4402 Vframe_title_format = build_ascstring ("%b - XEmacs"); |
442 | 4403 #else |
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4846
diff
changeset
|
4404 Vframe_title_format = build_ascstring ("%S: %b"); |
442 | 4405 #endif |
428 | 4406 |
4407 DEFVAR_LISP ("frame-icon-title-format", &Vframe_icon_title_format /* | |
4408 Controls the title of the icon corresponding to the selected frame. | |
4409 See also the variable `frame-title-format'. | |
4410 */ ); | |
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4846
diff
changeset
|
4411 Vframe_icon_title_format = build_ascstring ("%b"); |
428 | 4412 |
4413 DEFVAR_LISP ("default-frame-name", &Vdefault_frame_name /* | |
4414 The default name to assign to newly-created frames. | |
442 | 4415 This can be overridden by arguments to `make-frame'. This must be a string. |
4416 This is used primarily for picking up X resources, and is *not* the title | |
4417 of the frame. (See `frame-title-format'.) | |
2681 | 4418 |
4419 Previous to 21.5.21, this defaulted to `emacs'; since that release, it has | |
4420 defaulted to `XEmacs'. In the short term you can restore the old default by | |
4421 setting the environment variable USE_EMACS_AS_DEFAULT_APPLICATION_CLASS | |
4422 (which does affect the frame name, despite what it's called) to some value | |
4423 before starting XEmacs, but this is deprecated. | |
428 | 4424 */ ); |
2681 | 4425 Vdefault_frame_name = Qnil; |
428 | 4426 |
4427 DEFVAR_LISP ("default-frame-plist", &Vdefault_frame_plist /* | |
4428 Plist of default values for frame creation, other than the first one. | |
4429 These may be set in your init file, like this: | |
4430 | |
4431 \(setq default-frame-plist '(width 80 height 55)) | |
4432 | |
2747 | 4433 Predefined properties are described in `set-frame-properties'. |
4434 | |
428 | 4435 The properties may be in alist format for backward compatibility |
4436 but you should not rely on this behavior. | |
4437 | |
4438 These override values given in window system configuration data, | |
2747 | 4439 including X Windows' defaults database. |
4440 | |
4441 Values for the first Emacs frame are taken from `initial-frame-plist'. | |
4442 Since the first X frame is created before loading your .emacs file, you | |
4443 may wish use the X resource database to avoid flashing. | |
4444 | |
428 | 4445 For values specific to the separate minibuffer frame, see |
2747 | 4446 `minibuffer-frame-plist'. See also the variables `default-x-frame-plist' |
4447 and `default-tty-frame-plist', which are like `default-frame-plist' | |
4448 except that they apply only to X or tty frames, respectively \(whereas | |
4449 `default-frame-plist' applies to all types of frames). | |
428 | 4450 */ ); |
4451 Vdefault_frame_plist = Qnil; | |
4452 | |
4453 DEFVAR_LISP ("frame-icon-glyph", &Vframe_icon_glyph /* | |
4454 Icon glyph used to iconify a frame. | |
4455 */ ); | |
4456 } | |
4457 | |
4458 void | |
4459 complex_vars_of_frame (void) | |
4460 { | |
4461 Vframe_icon_glyph = allocate_glyph (GLYPH_ICON, icon_glyph_changed); | |
4462 } |