Commit | Line | Data |
---|---|---|
ff11dfa1 | 1 | /* Define frame-object for GNU Emacs. |
0b5538bd | 2 | Copyright (C) 1993, 1994, 1999, 2000, 2001, 2002, 2003, 2004, |
8cabe764 | 3 | 2005, 2006, 2007, 2008 Free Software Foundation, Inc. |
efa4ce8b JB |
4 | |
5 | This file is part of GNU Emacs. | |
6 | ||
7 | GNU Emacs is free software; you can redistribute it and/or modify | |
8 | it under the terms of the GNU General Public License as published by | |
684d6f5b | 9 | the Free Software Foundation; either version 3, or (at your option) |
efa4ce8b JB |
10 | any later version. |
11 | ||
12 | GNU Emacs is distributed in the hope that it will be useful, | |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
18 | along with GNU Emacs; see the file COPYING. If not, write to | |
4fc5845f LK |
19 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
20 | Boston, MA 02110-1301, USA. */ | |
efa4ce8b | 21 | |
843c9999 GM |
22 | /* Don't multiply include: dispextern.h includes macterm.h which |
23 | includes frame.h some emacs source includes both dispextern.h and | |
24 | frame.h */ | |
25 | ||
84e01749 GM |
26 | #ifndef EMACS_FRAME_H |
27 | #define EMACS_FRAME_H | |
1f922834 | 28 | |
20a6c8d7 JB |
29 | \f |
30 | /* Miscellanea. */ | |
31 | ||
9628b887 | 32 | /* Nonzero means there is at least one garbaged frame. */ |
20a6c8d7 JB |
33 | extern int frame_garbaged; |
34 | ||
35 | /* Nonzero means FRAME_MESSAGE_BUF (selected_frame) is being used by | |
36 | print. */ | |
3b83d631 | 37 | |
20a6c8d7 | 38 | extern int message_buf_print; |
efa4ce8b | 39 | |
9cfa62c7 MR |
40 | /* Nonzero means window system changes focus when moving the |
41 | mouse. */ | |
42 | ||
43 | extern int focus_follows_mouse; | |
44 | ||
20a6c8d7 | 45 | \f |
e3678b64 | 46 | /* The structure representing a frame. */ |
efa4ce8b JB |
47 | |
48 | enum output_method | |
3b83d631 | 49 | { |
3224dac1 | 50 | output_initial, |
3b83d631 GM |
51 | output_termcap, |
52 | output_x_window, | |
53 | output_msdos_raw, | |
0e015153 RS |
54 | output_w32, |
55 | output_mac | |
3b83d631 | 56 | }; |
efa4ce8b | 57 | |
a3211441 | 58 | enum vertical_scroll_bar_type |
3b83d631 GM |
59 | { |
60 | vertical_scroll_bar_none, | |
61 | vertical_scroll_bar_left, | |
62 | vertical_scroll_bar_right | |
63 | }; | |
a3211441 | 64 | |
4d418fcc KS |
65 | enum text_cursor_kinds |
66 | { | |
67 | DEFAULT_CURSOR = -2, | |
68 | NO_CURSOR = -1, | |
69 | FILLED_BOX_CURSOR, | |
70 | HOLLOW_BOX_CURSOR, | |
71 | BAR_CURSOR, | |
72 | HBAR_CURSOR | |
73 | }; | |
74 | ||
28d7d09f KL |
75 | #define FRAME_FOREGROUND_PIXEL(f) ((f)->foreground_pixel) |
76 | #define FRAME_BACKGROUND_PIXEL(f) ((f)->background_pixel) | |
2d764c78 | 77 | |
6ed8eeff | 78 | struct terminal; |
2d764c78 | 79 | |
adf494ff | 80 | struct font_driver_list; |
adf494ff | 81 | |
ff11dfa1 | 82 | struct frame |
efa4ce8b | 83 | { |
d0fdb6da | 84 | EMACS_UINT size; |
efa4ce8b JB |
85 | struct Lisp_Vector *next; |
86 | ||
21015f9c | 87 | /* All Lisp_Object components must come first. |
21015f9c | 88 | That ensures they are all aligned normally. */ |
efa4ce8b | 89 | |
fa5d1baa RS |
90 | /* Name of this frame: a Lisp string. It is used for looking up resources, |
91 | as well as for the title in some cases. */ | |
efa4ce8b JB |
92 | Lisp_Object name; |
93 | ||
e7f79a67 RS |
94 | /* The name to use for the icon, the last time |
95 | it was refreshed. nil means not explicitly specified. */ | |
96 | Lisp_Object icon_name; | |
97 | ||
fa5d1baa RS |
98 | /* This is the frame title specified explicitly, if any. |
99 | Usually it is nil. */ | |
100 | Lisp_Object title; | |
101 | ||
eb8c3be9 | 102 | /* The frame which should receive keystrokes that occur in this |
46a5c487 JB |
103 | frame, or nil if they should go to the frame itself. This is |
104 | usually nil, but if the frame is minibufferless, we can use this | |
105 | to redirect keystrokes to a surrogate minibuffer frame when | |
106 | needed. | |
107 | ||
108 | Note that a value of nil is different than having the field point | |
109 | to the frame itself. Whenever the Fselect_frame function is used | |
110 | to shift from one frame to the other, any redirections to the | |
111 | original frame are shifted to the newly selected frame; if | |
112 | focus_frame is nil, Fselect_frame will leave it alone. */ | |
ff11dfa1 | 113 | Lisp_Object focus_frame; |
0f79a4ae | 114 | |
ff11dfa1 JB |
115 | /* This frame's root window. Every frame has one. |
116 | If the frame has only a minibuffer window, this is it. | |
117 | Otherwise, if the frame has a minibuffer window, this is its sibling. */ | |
efa4ce8b JB |
118 | Lisp_Object root_window; |
119 | ||
ff11dfa1 JB |
120 | /* This frame's selected window. |
121 | Each frame has its own window hierarchy | |
122 | and one of the windows in it is selected within the frame. | |
123 | The selected window of the selected frame is Emacs's selected window. */ | |
efa4ce8b JB |
124 | Lisp_Object selected_window; |
125 | ||
ff11dfa1 JB |
126 | /* This frame's minibuffer window. |
127 | Most frames have their own minibuffer windows, | |
128 | but only the selected frame's minibuffer window | |
efa4ce8b JB |
129 | can actually appear to exist. */ |
130 | Lisp_Object minibuffer_window; | |
131 | ||
ff11dfa1 JB |
132 | /* Parameter alist of this frame. |
133 | These are the parameters specified when creating the frame | |
134 | or modified with modify-frame-parameters. */ | |
efa4ce8b JB |
135 | Lisp_Object param_alist; |
136 | ||
177c0ea7 | 137 | /* List of scroll bars on this frame. |
20a6c8d7 | 138 | Actually, we don't specify exactly what is stored here at all; the |
a3c87d4e | 139 | scroll bar implementation code can use it to store anything it likes. |
20a6c8d7 | 140 | This field is marked by the garbage collector. It is here |
7e59217d | 141 | instead of in the `device' structure so that the garbage |
20a6c8d7 JB |
142 | collector doesn't need to look inside the window-system-dependent |
143 | structure. */ | |
a3c87d4e JB |
144 | Lisp_Object scroll_bars; |
145 | Lisp_Object condemned_scroll_bars; | |
20a6c8d7 | 146 | |
ad6cd733 RS |
147 | /* Vector describing the items to display in the menu bar. |
148 | Each item has four elements in this vector. | |
149 | They are KEY, STRING, SUBMAP, and HPOS. | |
150 | (HPOS is not used in when the X toolkit is in use.) | |
151 | There are four additional elements of nil at the end, to terminate. */ | |
6d05db81 RS |
152 | Lisp_Object menu_bar_items; |
153 | ||
fb63ba7d RS |
154 | /* Alist of elements (FACE-NAME . FACE-VECTOR-DATA). */ |
155 | Lisp_Object face_alist; | |
156 | ||
21015f9c RS |
157 | /* A vector that records the entire structure of this frame's menu bar. |
158 | For the format of the data, see extensive comments in xmenu.c. | |
159 | Only the X toolkit version uses this. */ | |
160 | Lisp_Object menu_bar_vector; | |
21015f9c RS |
161 | |
162 | /* Predicate for selecting buffers for other-buffer. */ | |
163 | Lisp_Object buffer_predicate; | |
164 | ||
375ff4f1 RS |
165 | /* List of buffers viewed in this frame, for other-buffer. */ |
166 | Lisp_Object buffer_list; | |
167 | ||
a18b8cb5 KL |
168 | /* List of buffers that were viewed, then buried in this frame. The |
169 | most recently buried buffer is first. For last-buffer. */ | |
170 | Lisp_Object buried_buffer_list; | |
63bb3d8e | 171 | |
3b83d631 GM |
172 | /* A dummy window used to display menu bars under X when no X |
173 | toolkit support is available. */ | |
174 | Lisp_Object menu_bar_window; | |
175 | ||
9ea173e8 GM |
176 | /* A window used to display the tool-bar of a frame. */ |
177 | Lisp_Object tool_bar_window; | |
3b83d631 | 178 | |
9ea173e8 | 179 | /* Desired and current tool-bar items. */ |
e3303a23 | 180 | Lisp_Object tool_bar_items; |
3b83d631 | 181 | |
9ea173e8 GM |
182 | /* Desired and current contents displayed in tool_bar_window. */ |
183 | Lisp_Object desired_tool_bar_string, current_tool_bar_string; | |
3b83d631 | 184 | |
63bb3d8e | 185 | /* Beyond here, there should be no more Lisp_Object components. */ |
21015f9c | 186 | |
3b83d631 GM |
187 | /* Cache of realized faces. */ |
188 | struct face_cache *face_cache; | |
21015f9c | 189 | |
a390930c SM |
190 | /* Number of elements in `menu_bar_vector' that have meaningful data. */ |
191 | EMACS_INT menu_bar_items_used; | |
192 | ||
3b83d631 GM |
193 | /* A buffer to hold the frame's name. We can't use the Lisp |
194 | string's pointer (`name', above) because it might get relocated. */ | |
bd601e2a KH |
195 | char *namebuf; |
196 | ||
3b83d631 GM |
197 | /* Glyph pool and matrix. */ |
198 | struct glyph_pool *current_pool; | |
199 | struct glyph_pool *desired_pool; | |
200 | struct glyph_matrix *desired_matrix; | |
201 | struct glyph_matrix *current_matrix; | |
202 | ||
203 | /* 1 means that glyphs on this frame have been initialized so it can | |
204 | be used for output. */ | |
205 | unsigned glyphs_initialized_p : 1; | |
21015f9c | 206 | |
e3d7bd83 DN |
207 | /* Set to non-zero in change_frame_size when size of frame changed |
208 | Clear the frame in clear_garbaged_frames if set. */ | |
209 | unsigned resized_p : 1; | |
210 | ||
211 | /* Set to non-zero in when we want for force a flush_display in | |
212 | update_frame, usually after resizing the frame. */ | |
213 | unsigned force_flush_display_p : 1; | |
214 | ||
215 | /* Set to non-zero if the default face for the frame has been | |
216 | realized. Reset to zero whenever the default face changes. | |
217 | Used to see the difference between a font change and face change. */ | |
218 | unsigned default_face_done_p : 1; | |
219 | ||
220 | /* Set to non-zero if this frame has already been hscrolled during | |
221 | current redisplay. */ | |
222 | unsigned already_hscrolled_p : 1; | |
223 | ||
224 | /* Set to non-zero when current redisplay has updated frame. */ | |
225 | unsigned updated_p : 1; | |
226 | ||
227 | /* Set to non-zero to minimize tool-bar height even when | |
228 | auto-resize-tool-bar is set to grow-only. */ | |
229 | unsigned minimize_tool_bar_window_p : 1; | |
230 | ||
66d8c489 | 231 | #if defined (USE_GTK) || defined (MAC_OS) |
488dd4c4 JD |
232 | /* Nonzero means using a tool bar that comes from the toolkit. */ |
233 | int external_tool_bar; | |
234 | #endif | |
235 | ||
9ea173e8 GM |
236 | /* Margin at the top of the frame. Used to display the tool-bar. */ |
237 | int tool_bar_lines; | |
3b83d631 | 238 | |
045cff16 | 239 | int n_tool_bar_rows; |
e3303a23 | 240 | int n_tool_bar_items; |
177c0ea7 | 241 | |
3b83d631 GM |
242 | /* A buffer for decode_mode_line. */ |
243 | char *decode_mode_spec_buffer; | |
21015f9c RS |
244 | |
245 | /* See do_line_insertion_deletion_costs for info on these arrays. */ | |
246 | /* Cost of inserting 1 line on this frame */ | |
247 | int *insert_line_cost; | |
248 | /* Cost of deleting 1 line on this frame */ | |
249 | int *delete_line_cost; | |
250 | /* Cost of inserting n lines on this frame */ | |
251 | int *insert_n_lines_cost; | |
252 | /* Cost of deleting n lines on this frame */ | |
253 | int *delete_n_lines_cost; | |
254 | ||
b45afe99 KS |
255 | /* Size of this frame, excluding fringes, scroll bars etc., |
256 | in units of canonical characters. */ | |
257 | EMACS_INT text_lines, text_cols; | |
258 | ||
259 | /* Total size of this frame (i.e. its native window), in units of | |
260 | canonical characters. */ | |
261 | EMACS_INT total_lines, total_cols; | |
262 | ||
263 | /* New text height and width for pending size change. | |
264 | 0 if no change pending. */ | |
265 | int new_text_lines, new_text_cols; | |
266 | ||
267 | /* Pixel position of the frame window (x and y offsets in root window). */ | |
268 | int left_pos, top_pos; | |
269 | ||
270 | /* Size of the frame window in pixels. */ | |
271 | int pixel_height, pixel_width; | |
272 | ||
adf494ff KH |
273 | /* Dots per inch of the screen the frame is on. */ |
274 | double resx, resy; | |
275 | ||
b45afe99 KS |
276 | /* These many pixels are the difference between the outer window (i.e. the |
277 | left and top of the window manager decoration) and FRAME_X_WINDOW. */ | |
278 | int x_pixels_diff, y_pixels_diff; | |
279 | ||
280 | /* This is the gravity value for the specified window position. */ | |
281 | int win_gravity; | |
282 | ||
283 | /* The geometry flags for this window. */ | |
284 | int size_hint_flags; | |
21015f9c | 285 | |
b45afe99 KS |
286 | /* Border width of the frame window as known by the (X) window system. */ |
287 | int border_width; | |
288 | ||
289 | /* Width of the internal border. This is a line of background color | |
290 | just inside the window's border. When the frame is selected, | |
291 | a highlighting is displayed inside the internal border. */ | |
292 | int internal_border_width; | |
293 | ||
294 | /* Canonical X unit. Width of default font, in pixels. */ | |
295 | int column_width; | |
296 | ||
0fc63cc4 KH |
297 | /* Widht of space glyph of default font, in pixels. */ |
298 | int space_width; | |
299 | ||
b45afe99 KS |
300 | /* Canonical Y unit. Height of a line, in pixels. */ |
301 | int line_height; | |
21015f9c | 302 | |
428a555e KL |
303 | /* The output method says how the contents of this frame are |
304 | displayed. It could be using termcap, or using an X window. | |
6ed8eeff | 305 | This must be the same as the terminal->type. */ |
efa4ce8b JB |
306 | enum output_method output_method; |
307 | ||
6ed8eeff | 308 | /* The terminal device that this frame uses. If this is NULL, then |
7e59217d | 309 | the frame has been deleted. */ |
6ed8eeff | 310 | struct terminal *terminal; |
63bb3d8e | 311 | |
7e59217d | 312 | /* Device-dependent, frame-local auxiliary data used for displaying |
428a555e KL |
313 | the contents. When the frame is deleted, this data is deleted as |
314 | well. */ | |
3b83d631 GM |
315 | union output_data |
316 | { | |
428a555e KL |
317 | struct tty_output *tty; /* termchar.h */ |
318 | struct x_output *x; /* xterm.h */ | |
319 | struct w32_output *w32; /* w32term.h */ | |
320 | struct mac_output *mac; /* macterm.h */ | |
cf0fb540 | 321 | EMACS_INT nothing; |
3b83d631 GM |
322 | } |
323 | output_data; | |
efa4ce8b | 324 | |
adf494ff KH |
325 | /* List of font-drivers available on the frame. */ |
326 | struct font_driver_list *font_driver_list; | |
6aae9c92 KH |
327 | /* List of data specific to font-driver and frame, but common to |
328 | faces. */ | |
329 | struct font_data_list *font_data_list; | |
adf494ff | 330 | |
b45afe99 KS |
331 | /* Total width of fringes reserved for drawing truncation bitmaps, |
332 | continuation bitmaps and alike. The width is in canonical char | |
333 | units of the frame. This must currently be the case because window | |
334 | sizes aren't pixel values. If it weren't the case, we wouldn't be | |
335 | able to split windows horizontally nicely. */ | |
336 | int fringe_cols; | |
337 | ||
338 | /* The extra width (in pixels) currently allotted for fringes. */ | |
339 | int left_fringe_width, right_fringe_width; | |
340 | ||
b45afe99 KS |
341 | /* See FULLSCREEN_ enum below */ |
342 | int want_fullscreen; | |
343 | ||
6d05db81 RS |
344 | /* Number of lines of menu bar. */ |
345 | int menu_bar_lines; | |
346 | ||
488dd4c4 JD |
347 | #if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) || defined (MAC_OS) \ |
348 | || defined (USE_GTK) | |
9c95189b RS |
349 | /* Nonzero means using a menu bar that comes from the X toolkit. */ |
350 | int external_menu_bar; | |
351 | #endif | |
352 | ||
ff11dfa1 | 353 | /* Nonzero if last attempt at redisplay on this frame was preempted. */ |
efa4ce8b JB |
354 | char display_preempted; |
355 | ||
a4659527 JB |
356 | /* visible is nonzero if the frame is currently displayed; we check |
357 | it to see if we should bother updating the frame's contents. | |
46a5c487 | 358 | DON'T SET IT DIRECTLY; instead, use FRAME_SET_VISIBLE. |
efa4ce8b | 359 | |
20a6c8d7 JB |
360 | Note that, since invisible frames aren't updated, whenever a |
361 | frame becomes visible again, it must be marked as garbaged. The | |
362 | FRAME_SAMPLE_VISIBILITY macro takes care of this. | |
363 | ||
6548cf00 KL |
364 | On ttys and on Windows NT/9X, to avoid wasting effort updating |
365 | visible frames that are actually completely obscured by other | |
366 | windows on the display, we bend the meaning of visible slightly: | |
367 | if greater than 1, then the frame is obscured - we still consider | |
368 | it to be "visible" as seen from lisp, but we don't bother | |
369 | updating it. We must take care to garbage the frame when it | |
370 | ceaces to be obscured though. | |
0969b893 | 371 | |
a4659527 JB |
372 | iconified is nonzero if the frame is currently iconified. |
373 | ||
374 | Asynchronous input handlers should NOT change these directly; | |
375 | instead, they should change async_visible or async_iconified, and | |
376 | let the FRAME_SAMPLE_VISIBILITY macro set visible and iconified | |
377 | at the next redisplay. | |
378 | ||
379 | These should probably be considered read-only by everyone except | |
380 | FRAME_SAMPLE_VISIBILITY. | |
381 | ||
74cc2959 | 382 | These two are mutually exclusive. They might both be zero, if the |
a4659527 JB |
383 | frame has been made invisible without an icon. */ |
384 | char visible, iconified; | |
385 | ||
386 | /* Asynchronous input handlers change these, and | |
387 | FRAME_SAMPLE_VISIBILITY copies them into visible and iconified. | |
388 | See FRAME_SAMPLE_VISIBILITY, below. */ | |
b975254e | 389 | volatile char async_visible, async_iconified; |
efa4ce8b | 390 | |
ff11dfa1 | 391 | /* Nonzero if this frame should be redrawn. */ |
b975254e | 392 | volatile char garbaged; |
efa4ce8b | 393 | |
ff11dfa1 JB |
394 | /* True if frame actually has a minibuffer window on it. |
395 | 0 if using a minibuffer window that isn't on this frame. */ | |
efa4ce8b | 396 | char has_minibuffer; |
177c0ea7 | 397 | |
ff11dfa1 | 398 | /* 0 means, if this frame has just one window, |
efa4ce8b JB |
399 | show no modeline for that window. */ |
400 | char wants_modeline; | |
401 | ||
46a5c487 | 402 | /* Non-zero if the hardware device this frame is displaying on can |
a3c87d4e JB |
403 | support scroll bars. */ |
404 | char can_have_scroll_bars; | |
46a5c487 | 405 | |
ff11dfa1 | 406 | /* Non-0 means raise this frame to the top of the heap when selected. */ |
efa4ce8b JB |
407 | char auto_raise; |
408 | ||
ff11dfa1 | 409 | /* Non-0 means lower this frame to the bottom of the stack when left. */ |
efa4ce8b JB |
410 | char auto_lower; |
411 | ||
ff11dfa1 | 412 | /* True if frame's root window can't be split. */ |
efa4ce8b JB |
413 | char no_split; |
414 | ||
fbfed6f0 JB |
415 | /* If this is set, then Emacs won't change the frame name to indicate |
416 | the current buffer, etcetera. If the user explicitly sets the frame | |
417 | name, this gets set. If the user sets the name to Qnil, this is | |
418 | cleared. */ | |
419 | char explicit_name; | |
420 | ||
adc12f0f RS |
421 | /* Nonzero if size of some window on this frame has changed. */ |
422 | char window_sizes_changed; | |
423 | ||
e3d7bd83 DN |
424 | /* Nonzero if the mouse has moved on this display device |
425 | since the last time we checked. */ | |
426 | char mouse_moved; | |
427 | ||
428 | /* If can_have_scroll_bars is non-zero, this is non-zero if we should | |
429 | actually display them on this frame. */ | |
430 | enum vertical_scroll_bar_type vertical_scroll_bar_type; | |
431 | ||
432 | /* What kind of text cursor should we draw in the future? | |
433 | This should always be filled_box_cursor or bar_cursor. */ | |
434 | enum text_cursor_kinds desired_cursor; | |
435 | ||
436 | /* Width of bar cursor (if we are using that). */ | |
437 | int cursor_width; | |
438 | ||
439 | /* What kind of text cursor should we draw when the cursor blinks off? | |
440 | This can be filled_box_cursor or bar_cursor or no_cursor. */ | |
441 | enum text_cursor_kinds blink_off_cursor; | |
442 | ||
443 | /* Width of bar cursor (if we are using that) for blink-off state. */ | |
444 | int blink_off_cursor_width; | |
445 | ||
ff11dfa1 | 446 | /* Storage for messages to this frame. */ |
efa4ce8b JB |
447 | char *message_buf; |
448 | ||
449 | /* Nonnegative if current redisplay should not do scroll computation | |
450 | for lines beyond a certain vpos. This is the vpos. */ | |
451 | int scroll_bottom_vpos; | |
8d6de7ce | 452 | |
b45afe99 KS |
453 | /* Configured width of the scroll bar, in pixels and in characters. |
454 | config_scroll_bar_cols tracks config_scroll_bar_width if the | |
455 | latter is positive; a zero value in config_scroll_bar_width means | |
456 | to compute the actual width on the fly, using config_scroll_bar_cols | |
457 | and the current font width. */ | |
458 | int config_scroll_bar_width; | |
459 | int config_scroll_bar_cols; | |
460 | ||
461 | /* The size of the extra width currently allotted for vertical | |
462 | scroll bars in this frame, in pixels. */ | |
463 | int scroll_bar_actual_width; | |
95b999aa RS |
464 | |
465 | /* The baud rate that was used to calculate costs for this frame. */ | |
466 | int cost_calculation_baud_rate; | |
6462918c | 467 | |
b61cbba3 GM |
468 | /* Exponent for gamma correction of colors. 1/(VIEWING_GAMMA * |
469 | SCREEN_GAMMA) where viewing_gamma is 0.4545 and SCREEN_GAMMA is a | |
470 | frame parameter. 0 means don't do gamma correction. */ | |
471 | double gamma; | |
d1738c45 GM |
472 | |
473 | /* Additional space to put between text lines on this frame. */ | |
474 | int extra_line_spacing; | |
f1c69c61 | 475 | |
28d7d09f KL |
476 | /* All display backends seem to need these two pixel values. */ |
477 | unsigned long background_pixel; | |
478 | unsigned long foreground_pixel; | |
efa4ce8b JB |
479 | }; |
480 | ||
e3678b64 | 481 | #ifdef MULTI_KBOARD |
6ed8eeff | 482 | #define FRAME_KBOARD(f) ((f)->terminal->kboard) |
37ea66e1 KH |
483 | #else |
484 | #define FRAME_KBOARD(f) (&the_only_kboard) | |
485 | #endif | |
486 | ||
354884c4 SM |
487 | /* Return a pointer to the image cache of frame F. */ |
488 | #define FRAME_IMAGE_CACHE(F) ((F)->terminal->image_cache) | |
489 | ||
ff11dfa1 JB |
490 | typedef struct frame *FRAME_PTR; |
491 | ||
8e50cc2d | 492 | #define XFRAME(p) (eassert (FRAMEP(p)),(struct frame *) XPNTR (p)) |
aac03cca | 493 | #define XSETFRAME(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_FRAME)) |
ff11dfa1 | 494 | |
cea6021b | 495 | /* Given a window, return its frame as a Lisp_Object. */ |
ff11dfa1 JB |
496 | #define WINDOW_FRAME(w) (w)->frame |
497 | ||
cea6021b | 498 | /* Test a frame for particular kinds of display methods. */ |
3224dac1 | 499 | #define FRAME_INITIAL_P(f) ((f)->output_method == output_initial) |
cea6021b | 500 | #define FRAME_TERMCAP_P(f) ((f)->output_method == output_termcap) |
efa7f0f9 | 501 | #define FRAME_X_P(f) ((f)->output_method == output_x_window) |
fbd6baed | 502 | #define FRAME_W32_P(f) ((f)->output_method == output_w32) |
6f181713 | 503 | #define FRAME_MSDOS_P(f) ((f)->output_method == output_msdos_raw) |
0e015153 | 504 | #define FRAME_MAC_P(f) ((f)->output_method == output_mac) |
efa7f0f9 GV |
505 | |
506 | /* FRAME_WINDOW_P tests whether the frame is a window, and is | |
507 | defined to be the predicate for the window system being used. */ | |
3b83d631 | 508 | |
efa7f0f9 GV |
509 | #ifdef HAVE_X_WINDOWS |
510 | #define FRAME_WINDOW_P(f) FRAME_X_P (f) | |
511 | #endif | |
512 | #ifdef HAVE_NTGUI | |
fbd6baed | 513 | #define FRAME_WINDOW_P(f) FRAME_W32_P (f) |
efa7f0f9 | 514 | #endif |
e0f712ba | 515 | #ifdef MAC_OS |
0e015153 RS |
516 | #define FRAME_WINDOW_P(f) FRAME_MAC_P (f) |
517 | #endif | |
7651b07e RS |
518 | #ifndef FRAME_WINDOW_P |
519 | #define FRAME_WINDOW_P(f) (0) | |
520 | #endif | |
efa7f0f9 | 521 | |
cea6021b | 522 | /* Nonzero if frame F is still alive (not deleted). */ |
6ed8eeff | 523 | #define FRAME_LIVE_P(f) ((f)->terminal != 0) |
cea6021b RS |
524 | |
525 | /* Nonzero if frame F is a minibuffer-only frame. */ | |
ff11dfa1 JB |
526 | #define FRAME_MINIBUF_ONLY_P(f) \ |
527 | EQ (FRAME_ROOT_WINDOW (f), FRAME_MINIBUF_WINDOW (f)) | |
cea6021b RS |
528 | |
529 | /* Nonzero if frame F contains a minibuffer window. | |
530 | (If this is 0, F must use some other minibuffer window.) */ | |
10a4cc63 | 531 | #define FRAME_HAS_MINIBUF_P(f) ((f)->has_minibuffer) |
cea6021b | 532 | |
b45afe99 KS |
533 | /* Pixel height of frame F, including non-toolkit menu bar and |
534 | non-toolkit tool bar lines. */ | |
535 | #define FRAME_PIXEL_HEIGHT(f) ((f)->pixel_height) | |
536 | ||
537 | /* Pixel width of frame F. */ | |
538 | #define FRAME_PIXEL_WIDTH(f) ((f)->pixel_width) | |
539 | ||
540 | /* Height of frame F, measured in canonical lines, including | |
541 | non-toolkit menu bar and non-toolkit tool bar lines. */ | |
542 | #define FRAME_LINES(f) (f)->text_lines | |
543 | ||
544 | /* Width of frame F, measured in canonical character columns, | |
cea6021b | 545 | not including scroll bars if any. */ |
b45afe99 | 546 | #define FRAME_COLS(f) (f)->text_cols |
cea6021b RS |
547 | |
548 | /* Number of lines of frame F used for menu bar. | |
549 | This is relevant on terminal frames and on | |
550 | X Windows when not using the X toolkit. | |
b45afe99 | 551 | These lines are counted in FRAME_LINES. */ |
6d05db81 | 552 | #define FRAME_MENU_BAR_LINES(f) (f)->menu_bar_lines |
cea6021b | 553 | |
488dd4c4 JD |
554 | /* Nonzero if this frame should display a tool bar |
555 | in a way that does not use any text lines. */ | |
66d8c489 | 556 | #if defined (USE_GTK) || defined (MAC_OS) |
488dd4c4 JD |
557 | #define FRAME_EXTERNAL_TOOL_BAR(f) (f)->external_tool_bar |
558 | #else | |
559 | #define FRAME_EXTERNAL_TOOL_BAR(f) 0 | |
560 | #endif | |
561 | ||
9ea173e8 | 562 | /* Number of lines of frame F used for the tool-bar. */ |
3b83d631 | 563 | |
9ea173e8 | 564 | #define FRAME_TOOL_BAR_LINES(f) (f)->tool_bar_lines |
3b83d631 | 565 | |
488dd4c4 | 566 | |
3b83d631 GM |
567 | /* Lines above the top-most window in frame F. */ |
568 | ||
569 | #define FRAME_TOP_MARGIN(F) \ | |
9ea173e8 | 570 | (FRAME_MENU_BAR_LINES (F) + FRAME_TOOL_BAR_LINES (F)) |
3b83d631 | 571 | |
cea6021b RS |
572 | /* Nonzero if this frame should display a menu bar |
573 | in a way that does not use any text lines. */ | |
488dd4c4 JD |
574 | #if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) || defined (MAC_OS) \ |
575 | || defined (USE_GTK) | |
9c95189b | 576 | #define FRAME_EXTERNAL_MENU_BAR(f) (f)->external_menu_bar |
4c8888a0 RS |
577 | #else |
578 | #define FRAME_EXTERNAL_MENU_BAR(f) 0 | |
579 | #endif | |
46a5c487 | 580 | #define FRAME_VISIBLE_P(f) ((f)->visible != 0) |
cea6021b RS |
581 | |
582 | /* Nonzero if frame F is currently visible but hidden. */ | |
0969b893 | 583 | #define FRAME_OBSCURED_P(f) ((f)->visible > 1) |
cea6021b RS |
584 | |
585 | /* Nonzero if frame F is currently iconified. */ | |
586 | #define FRAME_ICONIFIED_P(f) (f)->iconified | |
587 | ||
46a5c487 JB |
588 | #define FRAME_SET_VISIBLE(f,p) \ |
589 | ((f)->async_visible = (p), FRAME_SAMPLE_VISIBILITY (f)) | |
ff11dfa1 JB |
590 | #define SET_FRAME_GARBAGED(f) (frame_garbaged = 1, f->garbaged = 1) |
591 | #define FRAME_GARBAGED_P(f) (f)->garbaged | |
cea6021b RS |
592 | |
593 | /* Nonzero means do not allow splitting this frame's window. */ | |
ff11dfa1 | 594 | #define FRAME_NO_SPLIT_P(f) (f)->no_split |
cea6021b RS |
595 | |
596 | /* Not really implemented. */ | |
ff11dfa1 | 597 | #define FRAME_WANTS_MODELINE_P(f) (f)->wants_modeline |
cea6021b RS |
598 | |
599 | /* Nonzero if a size change has been requested for frame F | |
600 | but not yet really put into effect. This can be true temporarily | |
601 | when an X event comes in at a bad time. */ | |
adc12f0f | 602 | #define FRAME_WINDOW_SIZES_CHANGED(f) (f)->window_sizes_changed |
cea6021b RS |
603 | |
604 | /* The minibuffer window of frame F, if it has one; otherwise nil. */ | |
ff11dfa1 | 605 | #define FRAME_MINIBUF_WINDOW(f) (f)->minibuffer_window |
cea6021b RS |
606 | |
607 | /* The root window of the window tree of frame F. */ | |
ff11dfa1 | 608 | #define FRAME_ROOT_WINDOW(f) (f)->root_window |
cea6021b RS |
609 | |
610 | /* The currently selected window of the window tree of frame F. */ | |
ff11dfa1 | 611 | #define FRAME_SELECTED_WINDOW(f) (f)->selected_window |
cea6021b | 612 | |
177c0ea7 JB |
613 | #define FRAME_INSERT_COST(f) (f)->insert_line_cost |
614 | #define FRAME_DELETE_COST(f) (f)->delete_line_cost | |
ff11dfa1 JB |
615 | #define FRAME_INSERTN_COST(f) (f)->insert_n_lines_cost |
616 | #define FRAME_DELETEN_COST(f) (f)->delete_n_lines_cost | |
617 | #define FRAME_MESSAGE_BUF(f) (f)->message_buf | |
618 | #define FRAME_SCROLL_BOTTOM_VPOS(f) (f)->scroll_bottom_vpos | |
619 | #define FRAME_FOCUS_FRAME(f) (f)->focus_frame | |
cea6021b RS |
620 | |
621 | /* Nonzero if frame F supports scroll bars. | |
622 | If this is zero, then it is impossible to enable scroll bars | |
623 | on frame F. */ | |
a3c87d4e | 624 | #define FRAME_CAN_HAVE_SCROLL_BARS(f) ((f)->can_have_scroll_bars) |
cea6021b RS |
625 | |
626 | /* This frame slot says whether scroll bars are currently enabled for frame F, | |
627 | and which side they are on. */ | |
a3211441 RS |
628 | #define FRAME_VERTICAL_SCROLL_BAR_TYPE(f) ((f)->vertical_scroll_bar_type) |
629 | #define FRAME_HAS_VERTICAL_SCROLL_BARS(f) \ | |
630 | ((f)->vertical_scroll_bar_type != vertical_scroll_bar_none) | |
631 | #define FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT(f) \ | |
632 | ((f)->vertical_scroll_bar_type == vertical_scroll_bar_left) | |
633 | #define FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT(f) \ | |
634 | ((f)->vertical_scroll_bar_type == vertical_scroll_bar_right) | |
cea6021b RS |
635 | |
636 | /* Width that a scroll bar in frame F should have, if there is one. | |
637 | Measured in pixels. | |
638 | If scroll bars are turned off, this is still nonzero. */ | |
b45afe99 | 639 | #define FRAME_CONFIG_SCROLL_BAR_WIDTH(f) ((f)->config_scroll_bar_width) |
cea6021b RS |
640 | |
641 | /* Width that a scroll bar in frame F should have, if there is one. | |
642 | Measured in columns (characters). | |
643 | If scroll bars are turned off, this is still nonzero. */ | |
b45afe99 | 644 | #define FRAME_CONFIG_SCROLL_BAR_COLS(f) ((f)->config_scroll_bar_cols) |
cea6021b RS |
645 | |
646 | /* Width of a scroll bar in frame F, measured in columns (characters), | |
7d81cf83 GM |
647 | but only if scroll bars are on the left. If scroll bars are on |
648 | the right in this frame, or there are no scroll bars, value is 0. */ | |
649 | ||
b45afe99 | 650 | #define FRAME_LEFT_SCROLL_BAR_COLS(f) \ |
7d81cf83 | 651 | (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f) \ |
b45afe99 | 652 | ? FRAME_CONFIG_SCROLL_BAR_COLS (f) \ |
7d81cf83 GM |
653 | : 0) |
654 | ||
b45afe99 KS |
655 | /* Width of a left scroll bar in frame F, measured in pixels */ |
656 | ||
657 | #define FRAME_LEFT_SCROLL_BAR_AREA_WIDTH(f) \ | |
658 | (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f) \ | |
659 | ? (FRAME_CONFIG_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f)) \ | |
660 | : 0) | |
661 | ||
7d81cf83 GM |
662 | /* Width of a scroll bar in frame F, measured in columns (characters), |
663 | but only if scroll bars are on the right. If scroll bars are on | |
664 | the left in this frame, or there are no scroll bars, value is 0. */ | |
665 | ||
b45afe99 | 666 | #define FRAME_RIGHT_SCROLL_BAR_COLS(f) \ |
7d81cf83 | 667 | (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f) \ |
b45afe99 | 668 | ? FRAME_CONFIG_SCROLL_BAR_COLS (f) \ |
a3211441 | 669 | : 0) |
cea6021b | 670 | |
b45afe99 KS |
671 | /* Width of a right scroll bar area in frame F, measured in pixels */ |
672 | ||
673 | #define FRAME_RIGHT_SCROLL_BAR_AREA_WIDTH(f) \ | |
674 | (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f) \ | |
675 | ? (FRAME_CONFIG_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f)) \ | |
676 | : 0) | |
677 | ||
678 | /* Actual width of a scroll bar in frame F, measured in columns. */ | |
679 | ||
680 | #define FRAME_SCROLL_BAR_COLS(f) \ | |
681 | (FRAME_HAS_VERTICAL_SCROLL_BARS (f) \ | |
682 | ? FRAME_CONFIG_SCROLL_BAR_COLS (f) \ | |
a3211441 | 683 | : 0) |
cea6021b | 684 | |
b45afe99 KS |
685 | /* Actual width of a scroll bar area in frame F, measured in pixels. */ |
686 | ||
687 | #define FRAME_SCROLL_BAR_AREA_WIDTH(f) \ | |
688 | (FRAME_HAS_VERTICAL_SCROLL_BARS (f) \ | |
689 | ? (FRAME_CONFIG_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f)) \ | |
690 | : 0) | |
691 | ||
cea6021b RS |
692 | /* Total width of frame F, in columns (characters), |
693 | including the width used by scroll bars if any. */ | |
b45afe99 KS |
694 | |
695 | #define FRAME_TOTAL_COLS(f) ((f)->total_cols) | |
cea6021b RS |
696 | |
697 | /* Set the width of frame F to VAL. | |
698 | VAL is the width of a full-frame window, | |
b45afe99 KS |
699 | not including scroll bars and fringes. */ |
700 | ||
701 | #define SET_FRAME_COLS(f, val) \ | |
702 | (FRAME_COLS (f) = (val), \ | |
703 | (f)->total_cols = FRAME_TOTAL_COLS_ARG (f, FRAME_COLS (f))) | |
cea6021b RS |
704 | |
705 | /* Given a value WIDTH for frame F's nominal width, | |
b45afe99 KS |
706 | return the value that FRAME_TOTAL_COLS should have. */ |
707 | ||
708 | #define FRAME_TOTAL_COLS_ARG(f, width) \ | |
3b83d631 | 709 | ((width) \ |
b45afe99 | 710 | + FRAME_SCROLL_BAR_COLS (f) \ |
986f10ad | 711 | + FRAME_FRINGE_COLS (f)) |
cea6021b | 712 | |
4ff34795 | 713 | /* Maximum + 1 legitimate value for FRAME_CURSOR_X. */ |
b45afe99 | 714 | |
4ff34795 | 715 | #define FRAME_CURSOR_X_LIMIT(f) \ |
b45afe99 | 716 | (FRAME_COLS (f) + FRAME_LEFT_SCROLL_BAR_COLS (f)) |
cea6021b RS |
717 | |
718 | /* Nonzero if frame F has scroll bars. */ | |
b45afe99 | 719 | |
a3c87d4e | 720 | #define FRAME_SCROLL_BARS(f) ((f)->scroll_bars) |
cea6021b | 721 | |
a3c87d4e | 722 | #define FRAME_CONDEMNED_SCROLL_BARS(f) ((f)->condemned_scroll_bars) |
6d05db81 | 723 | #define FRAME_MENU_BAR_ITEMS(f) ((f)->menu_bar_items) |
95b999aa | 724 | #define FRAME_COST_BAUD_RATE(f) ((f)->cost_calculation_baud_rate) |
81d00831 | 725 | |
4d418fcc KS |
726 | #define FRAME_DESIRED_CURSOR(f) ((f)->desired_cursor) |
727 | #define FRAME_BLINK_OFF_CURSOR(f) ((f)->blink_off_cursor) | |
728 | #define FRAME_CURSOR_WIDTH(f) ((f)->cursor_width) | |
729 | #define FRAME_BLINK_OFF_CURSOR_WIDTH(f) ((f)->blink_off_cursor_width) | |
730 | ||
3b83d631 GM |
731 | /* Return a pointer to the face cache of frame F. */ |
732 | ||
733 | #define FRAME_FACE_CACHE(F) (F)->face_cache | |
734 | ||
81d00831 KH |
735 | /* Return the size of message_buf of the frame F. We multiply the |
736 | width of the frame by 4 because multi-byte form may require at most | |
737 | 4-byte for a character. */ | |
177c0ea7 | 738 | |
b45afe99 | 739 | #define FRAME_MESSAGE_BUF_SIZE(f) (((int) FRAME_COLS (f)) * 4) |
ff11dfa1 | 740 | |
a4659527 JB |
741 | /* Emacs's redisplay code could become confused if a frame's |
742 | visibility changes at arbitrary times. For example, if a frame is | |
743 | visible while the desired glyphs are being built, but becomes | |
744 | invisible before they are updated, then some rows of the | |
745 | desired_glyphs will be left marked as enabled after redisplay is | |
746 | complete, which should never happen. The next time the frame | |
747 | becomes visible, redisplay will probably barf. | |
748 | ||
749 | Currently, there are no similar situations involving iconified, but | |
750 | the principle is the same. | |
751 | ||
752 | So instead of having asynchronous input handlers directly set and | |
753 | clear the frame's visibility and iconification flags, they just set | |
754 | the async_visible and async_iconified flags; the redisplay code | |
755 | calls the FRAME_SAMPLE_VISIBILITY macro before doing any redisplay, | |
756 | which sets visible and iconified from their asynchronous | |
46a5c487 JB |
757 | counterparts. |
758 | ||
20a6c8d7 JB |
759 | Synchronous code must use the FRAME_SET_VISIBLE macro. |
760 | ||
761 | Also, if a frame used to be invisible, but has just become visible, | |
762 | it must be marked as garbaged, since redisplay hasn't been keeping | |
9628b887 KL |
763 | up its contents. |
764 | ||
765 | Note that a tty frame is visible if and only if it is the topmost | |
766 | frame. */ | |
177c0ea7 | 767 | |
a4659527 | 768 | #define FRAME_SAMPLE_VISIBILITY(f) \ |
0969b893 GV |
769 | (((f)->async_visible && (f)->visible != (f)->async_visible) ? \ |
770 | SET_FRAME_GARBAGED (f) : 0, \ | |
20a6c8d7 | 771 | (f)->visible = (f)->async_visible, \ |
a4659527 JB |
772 | (f)->iconified = (f)->async_iconified) |
773 | ||
915a3e00 KS |
774 | #define CHECK_FRAME(x) \ |
775 | CHECK_TYPE (FRAMEP (x), Qframep, x) | |
776 | ||
777 | #define CHECK_LIVE_FRAME(x) \ | |
778 | CHECK_TYPE (FRAMEP (x) && FRAME_LIVE_P (XFRAME (x)), Qframe_live_p, x) | |
265a9e55 | 779 | |
ff11dfa1 JB |
780 | /* FOR_EACH_FRAME (LIST_VAR, FRAME_VAR) followed by a statement is a |
781 | `for' loop which iterates over the elements of Vframe_list. The | |
35f56f96 | 782 | loop will set FRAME_VAR, a Lisp_Object, to each frame in |
ff11dfa1 | 783 | Vframe_list in succession and execute the statement. LIST_VAR |
35f56f96 | 784 | should be a Lisp_Object too; it is used to iterate through the |
177c0ea7 | 785 | Vframe_list. |
e5d77022 | 786 | |
e3678b64 KH |
787 | This macro is a holdover from a time when multiple frames weren't always |
788 | supported. An alternate definition of the macro would expand to | |
789 | something which executes the statement once. */ | |
3b83d631 | 790 | |
ff11dfa1 JB |
791 | #define FOR_EACH_FRAME(list_var, frame_var) \ |
792 | for ((list_var) = Vframe_list; \ | |
e5d77022 | 793 | (CONSP (list_var) \ |
ee88f64d KR |
794 | && (frame_var = XCAR (list_var), 1)); \ |
795 | list_var = XCDR (list_var)) | |
e5d77022 JB |
796 | |
797 | ||
5e02ce11 | 798 | extern Lisp_Object Qframep, Qframe_live_p; |
2666355c | 799 | extern Lisp_Object Qtty, Qtty_type; |
6ed8eeff | 800 | extern Lisp_Object Qterminal, Qterminal_live_p; |
c53956fe | 801 | extern Lisp_Object Qnoelisp; |
efa4ce8b | 802 | |
ff11dfa1 | 803 | extern struct frame *last_nonminibuf_frame; |
efa4ce8b | 804 | |
3224dac1 | 805 | extern struct frame *make_initial_frame P_ ((void)); |
6ed8eeff | 806 | extern struct frame *make_terminal_frame P_ ((struct terminal *)); |
fd6a330f | 807 | extern struct frame *make_frame P_ ((int)); |
c9e5d3d1 | 808 | #ifdef HAVE_WINDOW_SYSTEM |
fd6a330f AS |
809 | extern struct frame *make_minibuffer_frame P_ ((void)); |
810 | extern struct frame *make_frame_without_minibuffer P_ ((Lisp_Object, | |
811 | struct kboard *, | |
812 | Lisp_Object)); | |
c9e5d3d1 | 813 | #endif /* HAVE_WINDOW_SYSTEM */ |
fd6a330f | 814 | extern int other_visible_frames P_ ((struct frame *)); |
efa4ce8b | 815 | |
ff11dfa1 JB |
816 | extern Lisp_Object Vframe_list; |
817 | extern Lisp_Object Vdefault_frame_alist; | |
efa4ce8b | 818 | |
ff11dfa1 | 819 | extern Lisp_Object Vterminal_frame; |
0349c9af KS |
820 | |
821 | extern Lisp_Object Vmouse_highlight; | |
efa4ce8b | 822 | \f |
650afd94 GM |
823 | /* The currently selected frame. */ |
824 | ||
825 | extern Lisp_Object selected_frame; | |
826 | ||
827 | /* Value is a pointer to the selected frame. If the selected frame | |
b975254e | 828 | isn't live, abort. */ |
650afd94 GM |
829 | |
830 | #define SELECTED_FRAME() \ | |
831 | ((FRAMEP (selected_frame) \ | |
832 | && FRAME_LIVE_P (XFRAME (selected_frame))) \ | |
833 | ? XFRAME (selected_frame) \ | |
e1ef1fb2 | 834 | : (abort (), (struct frame *) 0)) |
3b83d631 GM |
835 | |
836 | \f | |
837 | /*********************************************************************** | |
838 | Display-related Macros | |
839 | ***********************************************************************/ | |
840 | ||
d3378f02 | 841 | /* Canonical y-unit on frame F. |
b45afe99 KS |
842 | This value currently equals the line height of the frame (which is |
843 | the height of the default font of F). */ | |
844 | ||
845 | #define FRAME_LINE_HEIGHT(F) ((F)->line_height) | |
3b83d631 | 846 | |
d3378f02 | 847 | /* Canonical x-unit on frame F. |
0fc63cc4 | 848 | This value currently equals the average width of the default font of F. */ |
3b83d631 | 849 | |
b45afe99 | 850 | #define FRAME_COLUMN_WIDTH(F) ((F)->column_width) |
3b83d631 | 851 | |
0fc63cc4 KH |
852 | /* Space glyph width of the default font of frame F. */ |
853 | ||
854 | #define FRAME_SPACE_WIDTH(F) ((F)->space_width) | |
855 | ||
3b83d631 GM |
856 | |
857 | /* Pixel width of areas used to display truncation marks, continuation | |
5cb26370 | 858 | marks, overlay arrows. This is 0 for terminal frames. */ |
3b83d631 GM |
859 | |
860 | #ifdef HAVE_WINDOW_SYSTEM | |
aa5b8e15 | 861 | |
b45afe99 KS |
862 | /* Total width of fringes reserved for drawing truncation bitmaps, |
863 | continuation bitmaps and alike. The width is in canonical char | |
864 | units of the frame. This must currently be the case because window | |
865 | sizes aren't pixel values. If it weren't the case, we wouldn't be | |
866 | able to split windows horizontally nicely. */ | |
867 | ||
868 | #define FRAME_FRINGE_COLS(F) ((F)->fringe_cols) | |
869 | ||
870 | /* Pixel-width of the left and right fringe. */ | |
871 | ||
872 | #define FRAME_LEFT_FRINGE_WIDTH(F) ((F)->left_fringe_width) | |
873 | #define FRAME_RIGHT_FRINGE_WIDTH(F) ((F)->right_fringe_width) | |
874 | ||
875 | /* Total width of fringes in pixels. */ | |
876 | ||
877 | #define FRAME_TOTAL_FRINGE_WIDTH(F) \ | |
878 | (FRAME_LEFT_FRINGE_WIDTH (F) + FRAME_RIGHT_FRINGE_WIDTH (F)) | |
879 | ||
880 | ||
881 | /* Pixel-width of internal border lines */ | |
882 | ||
883 | #define FRAME_INTERNAL_BORDER_WIDTH(F) ((F)->internal_border_width) | |
177c0ea7 | 884 | |
aa5b8e15 GM |
885 | #else /* not HAVE_WINDOW_SYSTEM */ |
886 | ||
986f10ad | 887 | #define FRAME_FRINGE_COLS(F) 0 |
b45afe99 | 888 | #define FRAME_TOTAL_FRINGE_WIDTH(F) 0 |
986f10ad | 889 | #define FRAME_LEFT_FRINGE_WIDTH(F) 0 |
8432bb78 | 890 | #define FRAME_RIGHT_FRINGE_WIDTH(F) 0 |
b45afe99 | 891 | #define FRAME_INTERNAL_BORDER_WIDTH(F) 0 |
aa5b8e15 GM |
892 | |
893 | #endif /* not HAVE_WINDOW_SYSTEM */ | |
177c0ea7 | 894 | |
3b83d631 GM |
895 | |
896 | ||
897 | \f | |
898 | /*********************************************************************** | |
899 | Conversion between canonical units and pixels | |
900 | ***********************************************************************/ | |
901 | ||
b45afe99 KS |
902 | /* Canonical x-values are fractions of FRAME_COLUMN_WIDTH, canonical |
903 | y-unit are fractions of FRAME_LINE_HEIGHT of a frame. Both are | |
904 | represented as Lisp numbers, i.e. integers or floats. */ | |
3b83d631 GM |
905 | |
906 | /* Convert canonical value X to pixels. F is the frame whose | |
907 | canonical char width is to be used. X must be a Lisp integer or | |
908 | float. Value is a C integer. */ | |
177c0ea7 | 909 | |
b45afe99 | 910 | #define FRAME_PIXEL_X_FROM_CANON_X(F, X) \ |
3b83d631 | 911 | (INTEGERP (X) \ |
b45afe99 KS |
912 | ? XINT (X) * FRAME_COLUMN_WIDTH (F) \ |
913 | : (int) (XFLOAT_DATA (X) * FRAME_COLUMN_WIDTH (F))) | |
177c0ea7 | 914 | |
3b83d631 GM |
915 | /* Convert canonical value Y to pixels. F is the frame whose |
916 | canonical character height is to be used. X must be a Lisp integer | |
917 | or float. Value is a C integer. */ | |
177c0ea7 | 918 | |
b45afe99 | 919 | #define FRAME_PIXEL_Y_FROM_CANON_Y(F, Y) \ |
3b83d631 | 920 | (INTEGERP (Y) \ |
b45afe99 KS |
921 | ? XINT (Y) * FRAME_LINE_HEIGHT (F) \ |
922 | : (int) (XFLOAT_DATA (Y) * FRAME_LINE_HEIGHT (F))) | |
3b83d631 GM |
923 | |
924 | /* Convert pixel-value X to canonical units. F is the frame whose | |
925 | canonical character width is to be used. X is a C integer. Result | |
926 | is a Lisp float if X is not a multiple of the canon width, | |
927 | otherwise it's a Lisp integer. */ | |
928 | ||
b45afe99 KS |
929 | #define FRAME_CANON_X_FROM_PIXEL_X(F, X) \ |
930 | ((X) % FRAME_COLUMN_WIDTH (F) != 0 \ | |
931 | ? make_float ((double) (X) / FRAME_COLUMN_WIDTH (F)) \ | |
932 | : make_number ((X) / FRAME_COLUMN_WIDTH (F))) | |
3b83d631 GM |
933 | |
934 | /* Convert pixel-value Y to canonical units. F is the frame whose | |
935 | canonical character height is to be used. Y is a C integer. | |
936 | Result is a Lisp float if Y is not a multiple of the canon width, | |
937 | otherwise it's a Lisp integer. */ | |
938 | ||
b45afe99 KS |
939 | #define FRAME_CANON_Y_FROM_PIXEL_Y(F, Y) \ |
940 | ((Y) % FRAME_LINE_HEIGHT (F) \ | |
941 | ? make_float ((double) (Y) / FRAME_LINE_HEIGHT (F)) \ | |
942 | : make_number ((Y) / FRAME_LINE_HEIGHT (F))) | |
943 | ||
944 | ||
945 | \f | |
946 | /* Manipulating pixel sizes and character sizes. | |
947 | Knowledge of which factors affect the overall size of the window should | |
948 | be hidden in these macros, if that's possible. | |
949 | ||
950 | Return the upper/left pixel position of the character cell on frame F | |
951 | at ROW/COL. */ | |
952 | ||
953 | #define FRAME_LINE_TO_PIXEL_Y(f, row) \ | |
954 | (FRAME_INTERNAL_BORDER_WIDTH (f) \ | |
955 | + (row) * FRAME_LINE_HEIGHT (f)) | |
956 | ||
957 | #define FRAME_COL_TO_PIXEL_X(f, col) \ | |
958 | (FRAME_INTERNAL_BORDER_WIDTH (f) \ | |
959 | + (col) * FRAME_COLUMN_WIDTH (f)) | |
960 | ||
961 | /* Return the pixel width/height of frame F if it has | |
962 | COLS columns/LINES rows. */ | |
963 | ||
964 | #define FRAME_TEXT_COLS_TO_PIXEL_WIDTH(f, cols) \ | |
965 | (FRAME_COL_TO_PIXEL_X (f, cols) \ | |
966 | + (f)->scroll_bar_actual_width \ | |
967 | + FRAME_TOTAL_FRINGE_WIDTH (f) \ | |
968 | + FRAME_INTERNAL_BORDER_WIDTH (f)) | |
969 | ||
970 | #define FRAME_TEXT_LINES_TO_PIXEL_HEIGHT(f, lines) \ | |
971 | (FRAME_LINE_TO_PIXEL_Y (f, lines) \ | |
972 | + FRAME_INTERNAL_BORDER_WIDTH (f)) | |
973 | ||
974 | ||
975 | /* Return the row/column (zero-based) of the character cell containing | |
976 | the pixel on FRAME at Y/X. */ | |
977 | ||
978 | #define FRAME_PIXEL_Y_TO_LINE(f, y) \ | |
979 | (((y) - FRAME_INTERNAL_BORDER_WIDTH (f)) \ | |
980 | / FRAME_LINE_HEIGHT (f)) | |
981 | ||
982 | #define FRAME_PIXEL_X_TO_COL(f, x) \ | |
983 | (((x) - FRAME_INTERNAL_BORDER_WIDTH (f)) \ | |
984 | / FRAME_COLUMN_WIDTH (f)) | |
985 | ||
986 | /* How many columns/rows of text can we fit in WIDTH/HEIGHT pixels on | |
987 | frame F? */ | |
988 | ||
989 | #define FRAME_PIXEL_WIDTH_TO_TEXT_COLS(f, width) \ | |
990 | (FRAME_PIXEL_X_TO_COL (f, ((width) \ | |
991 | - FRAME_INTERNAL_BORDER_WIDTH (f) \ | |
992 | - FRAME_TOTAL_FRINGE_WIDTH (f) \ | |
993 | - (f)->scroll_bar_actual_width))) | |
994 | ||
995 | #define FRAME_PIXEL_HEIGHT_TO_TEXT_LINES(f, height) \ | |
996 | (FRAME_PIXEL_Y_TO_LINE (f, ((height) \ | |
997 | - FRAME_INTERNAL_BORDER_WIDTH (f)))) | |
177c0ea7 | 998 | |
5e02ce11 KS |
999 | |
1000 | /*********************************************************************** | |
1001 | Frame Parameters | |
1002 | ***********************************************************************/ | |
1003 | ||
1004 | extern Lisp_Object Qauto_raise, Qauto_lower; | |
1005 | extern Lisp_Object Qborder_color, Qborder_width; | |
a18b8cb5 | 1006 | extern Lisp_Object Qbuffer_predicate, Qbuffer_list, Qburied_buffer_list; |
5e02ce11 KS |
1007 | extern Lisp_Object Qcursor_color, Qcursor_type; |
1008 | extern Lisp_Object Qfont; | |
1009 | extern Lisp_Object Qbackground_color, Qforeground_color; | |
1010 | extern Lisp_Object Qicon, Qicon_name, Qicon_type, Qicon_left, Qicon_top; | |
1011 | extern Lisp_Object Qinternal_border_width; | |
1012 | extern Lisp_Object Qmenu_bar_lines, Qtool_bar_lines; | |
1013 | extern Lisp_Object Qmouse_color; | |
1014 | extern Lisp_Object Qname, Qtitle; | |
1015 | extern Lisp_Object Qparent_id; | |
1016 | extern Lisp_Object Qunsplittable, Qvisibility; | |
1017 | extern Lisp_Object Qscroll_bar_width, Qvertical_scroll_bars; | |
1018 | extern Lisp_Object Qscroll_bar_foreground, Qscroll_bar_background; | |
1019 | extern Lisp_Object Qscreen_gamma; | |
1020 | extern Lisp_Object Qline_spacing; | |
1021 | extern Lisp_Object Qwait_for_wm; | |
1022 | extern Lisp_Object Qfullscreen; | |
1a8a83b2 | 1023 | extern Lisp_Object Qfont_backend; |
5e02ce11 KS |
1024 | |
1025 | extern Lisp_Object Qleft_fringe, Qright_fringe; | |
1026 | extern Lisp_Object Qheight, Qwidth; | |
1027 | extern Lisp_Object Qminibuffer, Qmodeline; | |
1028 | extern Lisp_Object Qonly; | |
1029 | extern Lisp_Object Qx, Qw32, Qmac, Qpc; | |
1030 | extern Lisp_Object Qvisible; | |
1031 | extern Lisp_Object Qdisplay_type; | |
1032 | extern Lisp_Object Qbackground_mode; | |
1033 | ||
1034 | extern Lisp_Object Qx_resource_name; | |
1035 | ||
1036 | extern Lisp_Object Qleft, Qright, Qtop, Qbox; | |
1037 | extern Lisp_Object Qdisplay; | |
1038 | ||
1039 | #ifdef HAVE_WINDOW_SYSTEM | |
1040 | ||
1041 | /* The class of this X application. */ | |
1042 | #define EMACS_CLASS "Emacs" | |
1043 | ||
1044 | enum | |
1045 | { | |
1046 | /* Values used as a bit mask, BOTH == WIDTH | HEIGHT. */ | |
1047 | FULLSCREEN_NONE = 0, | |
1048 | FULLSCREEN_WIDTH = 1, | |
1049 | FULLSCREEN_HEIGHT = 2, | |
1050 | FULLSCREEN_BOTH = 3, | |
a8316a7c | 1051 | FULLSCREEN_WAIT = 4 |
5e02ce11 KS |
1052 | }; |
1053 | ||
1054 | ||
1055 | /* These are in xterm.c, w32term.c, etc. */ | |
1056 | ||
1057 | extern void x_set_scroll_bar_default_width P_ ((struct frame *)); | |
1058 | extern void x_set_offset P_ ((struct frame *, int, int, int)); | |
1059 | extern void x_wm_set_icon_position P_ ((struct frame *, int, int)); | |
1060 | ||
1061 | extern Lisp_Object x_new_font P_ ((struct frame *, char *)); | |
8f924df7 | 1062 | extern Lisp_Object x_new_fontset P_ ((struct frame *, Lisp_Object)); |
adf494ff | 1063 | #ifdef USE_FONT_BACKEND |
2090e2a3 | 1064 | extern Lisp_Object x_new_fontset2 P_ ((struct frame *, int, Lisp_Object)); |
adf494ff | 1065 | #endif /* USE_FONT_BACKEND */ |
5e02ce11 KS |
1066 | |
1067 | /* These are in frame.c */ | |
1068 | ||
1069 | extern Lisp_Object Vx_resource_name; | |
1070 | extern Lisp_Object Vx_resource_class; | |
1071 | ||
1072 | ||
1073 | extern Lisp_Object Qface_set_after_frame_default; | |
1074 | ||
1075 | extern void x_fullscreen_adjust P_ ((struct frame *f, int *, int *, | |
1076 | int *, int *)); | |
1077 | ||
1078 | extern void x_set_frame_parameters P_ ((struct frame *, Lisp_Object)); | |
1079 | extern void x_report_frame_params P_ ((struct frame *, Lisp_Object *)); | |
1080 | ||
1081 | extern void x_set_fullscreen P_ ((struct frame *, Lisp_Object, Lisp_Object)); | |
1082 | extern void x_set_line_spacing P_ ((struct frame *, Lisp_Object, Lisp_Object)); | |
1083 | extern void x_set_screen_gamma P_ ((struct frame *, Lisp_Object, Lisp_Object)); | |
1084 | extern void x_set_font P_ ((struct frame *, Lisp_Object, Lisp_Object)); | |
1a8a83b2 | 1085 | extern void x_set_font_backend P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
5e02ce11 KS |
1086 | extern void x_set_fringe_width P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
1087 | extern void x_set_border_width P_ ((struct frame *, Lisp_Object, Lisp_Object)); | |
1088 | extern void x_set_internal_border_width P_ ((struct frame *, Lisp_Object, | |
1089 | Lisp_Object)); | |
1090 | extern void x_set_visibility P_ ((struct frame *, Lisp_Object, Lisp_Object)); | |
1091 | extern void x_set_autoraise P_ ((struct frame *, Lisp_Object, Lisp_Object)); | |
1092 | extern void x_set_autolower P_ ((struct frame *, Lisp_Object, Lisp_Object)); | |
1093 | extern void x_set_unsplittable P_ ((struct frame *, Lisp_Object, Lisp_Object)); | |
1094 | extern void x_set_vertical_scroll_bars P_ ((struct frame *, Lisp_Object, | |
1095 | Lisp_Object)); | |
1096 | extern void x_set_scroll_bar_width P_ ((struct frame *, Lisp_Object, | |
1097 | Lisp_Object)); | |
1098 | ||
1099 | extern Lisp_Object x_icon_type P_ ((struct frame *)); | |
1100 | ||
1101 | extern int x_figure_window_size P_ ((struct frame *, Lisp_Object, int)); | |
1102 | ||
1103 | ||
1104 | extern void validate_x_resource_name P_ ((void)); | |
1105 | ||
1106 | #endif /* HAVE_WINDOW_SYSTEM */ | |
1107 | ||
84e01749 | 1108 | #endif /* not EMACS_FRAME_H */ |
6b61353c KH |
1109 | |
1110 | /* arch-tag: 0df048ee-e6bf-4f48-bd56-e3cd055dd8c4 | |
1111 | (do not change this comment) */ |