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