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