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