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