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