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