1 /* Define frame-object for GNU Emacs.
2 Copyright (C) 1993-1994, 1999-2021 Free Software Foundation, Inc.
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
8 the Free Software Foundation, either version 3 of the License, or (at
9 your option) 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. If not, see <https://www.gnu.org/licenses/>. */
18
19 #ifndef EMACS_FRAME_H
20 #define EMACS_FRAME_H
21
22 #include "termhooks.h"
23 #include "window.h"
24
25 INLINE_HEADER_BEGIN
26
27 enum vertical_scroll_bar_type
28 {
29 vertical_scroll_bar_none,
30 vertical_scroll_bar_left,
31 vertical_scroll_bar_right
32 };
33
34 #ifdef HAVE_WINDOW_SYSTEM
35
36 enum fullscreen_type
37 {
38 FULLSCREEN_NONE,
39 FULLSCREEN_WIDTH = 0x1,
40 FULLSCREEN_HEIGHT = 0x2,
41 FULLSCREEN_BOTH = 0x3, /* Not a typo but means "width and height". */
42 FULLSCREEN_MAXIMIZED = 0x4,
43 #ifdef HAVE_NTGUI
44 FULLSCREEN_WAIT = 0x8
45 #endif
46 };
47
48 enum z_group
49 {
50 z_group_none,
51 z_group_above,
52 z_group_below,
53 z_group_above_suspended,
54 };
55
56 enum internal_border_part
57 {
58 INTERNAL_BORDER_NONE,
59 INTERNAL_BORDER_LEFT_EDGE,
60 INTERNAL_BORDER_TOP_LEFT_CORNER,
61 INTERNAL_BORDER_TOP_EDGE,
62 INTERNAL_BORDER_TOP_RIGHT_CORNER,
63 INTERNAL_BORDER_RIGHT_EDGE,
64 INTERNAL_BORDER_BOTTOM_RIGHT_CORNER,
65 INTERNAL_BORDER_BOTTOM_EDGE,
66 INTERNAL_BORDER_BOTTOM_LEFT_CORNER,
67 };
68
69 #ifdef NS_IMPL_COCOA
70 enum ns_appearance_type
71 {
72 ns_appearance_system_default,
73 ns_appearance_aqua,
74 ns_appearance_vibrant_dark
75 };
76 #endif
77 #endif /* HAVE_WINDOW_SYSTEM */
78
79 /* The structure representing a frame. */
80
81 struct frame
82 {
83 union vectorlike_header header;
84
85 /* All Lisp_Object components must come first.
86 That ensures they are all aligned normally. */
87
88 /* Name of this frame: a Lisp string. It is used for looking up resources,
89 as well as for the title in some cases. */
90 Lisp_Object name;
91
92 /* The name to use for the icon, the last time
93 it was refreshed. nil means not explicitly specified. */
94 Lisp_Object icon_name;
95
96 /* This is the frame title specified explicitly, if any.
97 Usually it is nil. */
98 Lisp_Object title;
99
100 #if defined (HAVE_WINDOW_SYSTEM)
101 /* This frame's parent frame, if it has one. */
102 Lisp_Object parent_frame;
103 #endif /* HAVE_WINDOW_SYSTEM */
104
105 /* The frame which should receive keystrokes that occur in this
106 frame, or nil if they should go to the frame itself. This is
107 usually nil, but if the frame is minibufferless, we can use this
108 to redirect keystrokes to a surrogate minibuffer frame when
109 needed.
110
111 Note that a value of nil is different from having the field point
112 to the frame itself. Whenever the Fselect_frame function is used
113 to shift from one frame to the other, any redirections to the
114 original frame are shifted to the newly selected frame; if
115 focus_frame is nil, Fselect_frame will leave it alone. */
116 Lisp_Object focus_frame;
117
118 /* This frame's root window. Every frame has one.
119 If the frame has only a minibuffer window, this is it.
120 Otherwise, if the frame has a minibuffer window, this is its sibling. */
121 Lisp_Object root_window;
122
123 /* This frame's selected window.
124 Each frame has its own window hierarchy
125 and one of the windows in it is selected within the frame.
126 The selected window of the selected frame is Emacs's selected window. */
127 Lisp_Object selected_window;
128
129 /* This frame's selected window when run_window_change_functions was
130 called the last time on this frame. */
131 Lisp_Object old_selected_window;
132
133 /* This frame's minibuffer window.
134 Most frames have their own minibuffer windows,
135 but only the selected frame's minibuffer window
136 can actually appear to exist. */
137 Lisp_Object minibuffer_window;
138
139 /* Parameter alist of this frame.
140 These are the parameters specified when creating the frame
141 or modified with modify-frame-parameters. */
142 Lisp_Object param_alist;
143
144 /* List of scroll bars on this frame.
145 Actually, we don't specify exactly what is stored here at all; the
146 scroll bar implementation code can use it to store anything it likes.
147 This field is marked by the garbage collector. It is here
148 instead of in the `device' structure so that the garbage
149 collector doesn't need to look inside the window-system-dependent
150 structure. */
151 Lisp_Object scroll_bars;
152 Lisp_Object condemned_scroll_bars;
153
154 /* Vector describing the items to display in the menu bar.
155 Each item has four elements in this vector.
156 They are KEY, STRING, SUBMAP, and HPOS.
157 (HPOS is not used in when the X toolkit is in use.)
158 There are four additional elements of nil at the end, to terminate. */
159 Lisp_Object menu_bar_items;
160
161 /* Hash table of FACE-NAME keys and FACE-VECTOR-DATA values. */
162 Lisp_Object face_hash_table;
163
164 /* A vector that records the entire structure of this frame's menu bar.
165 For the format of the data, see extensive comments in xmenu.c.
166 Only the X toolkit version uses this. */
167 Lisp_Object menu_bar_vector;
168
169 /* Predicate for selecting buffers for other-buffer. */
170 Lisp_Object buffer_predicate;
171
172 /* List of buffers viewed in this frame, for other-buffer. */
173 Lisp_Object buffer_list;
174
175 /* List of buffers that were viewed, then buried in this frame. The
176 most recently buried buffer is first. For last-buffer. */
177 Lisp_Object buried_buffer_list;
178
179 #if defined (HAVE_X_WINDOWS) && ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK)
180 /* A dummy window used to display menu bars under X when no X
181 toolkit support is available. */
182 Lisp_Object menu_bar_window;
183 #endif
184
185 #if defined (HAVE_WINDOW_SYSTEM)
186 /* A window used to display the tab-bar of a frame. */
187 Lisp_Object tab_bar_window;
188
189 /* Desired and current contents displayed in that window. */
190 Lisp_Object desired_tab_bar_string;
191 Lisp_Object current_tab_bar_string;
192 #endif
193
194 #if defined (HAVE_WINDOW_SYSTEM) && ! defined (HAVE_EXT_TOOL_BAR)
195 /* A window used to display the tool-bar of a frame. */
196 Lisp_Object tool_bar_window;
197
198 /* Desired and current contents displayed in that window. */
199 Lisp_Object desired_tool_bar_string;
200 Lisp_Object current_tool_bar_string;
201 #endif
202
203 #ifdef USE_GTK
204 /* Where tool bar is, can be left, right, top or bottom.
205 Except with GTK, the only supported position is `top'. */
206 Lisp_Object tool_bar_position;
207 #endif
208
209 #if defined (HAVE_XFT) || defined (HAVE_FREETYPE)
210 /* List of data specific to font-driver and frame, but common to faces. */
211 Lisp_Object font_data;
212 #endif
213
214 /* Desired and current tab-bar items. */
215 Lisp_Object tab_bar_items;
216
217 /* Desired and current tool-bar items. */
218 Lisp_Object tool_bar_items;
219 /* tool_bar_items should be the last Lisp_Object member. */
220
221 /* Cache of realized faces. */
222 struct face_cache *face_cache;
223
224 /* Tab-bar item index of the item on which a mouse button was pressed. */
225 int last_tab_bar_item;
226
227 #if defined (HAVE_WINDOW_SYSTEM) && ! defined (HAVE_EXT_TOOL_BAR)
228 /* Tool-bar item index of the item on which a mouse button was pressed. */
229 int last_tool_bar_item;
230 #endif
231
232 /* Number of elements in `menu_bar_vector' that have meaningful data. */
233 int menu_bar_items_used;
234
235 #if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI)
236 /* A buffer to hold the frame's name. Since this is used by the
237 window system toolkit, we can't use the Lisp string's pointer
238 (`name', above) because it might get relocated. */
239 char *namebuf;
240 #endif
241
242 #ifdef USE_X_TOOLKIT
243 /* Used to pass geometry parameters to toolkit functions. */
244 char *shell_position;
245 #endif
246
247 /* Glyph pool and matrix. */
248 struct glyph_pool *current_pool;
249 struct glyph_pool *desired_pool;
250 struct glyph_matrix *desired_matrix;
251 struct glyph_matrix *current_matrix;
252
253 /* Bitfield area begins here. Keep them together to avoid extra padding. */
254
255 /* True means that glyphs on this frame have been initialized so it can
256 be used for output. */
257 bool_bf glyphs_initialized_p : 1;
258
259 /* Set to true in adjust_frame_size when one of the frame's sizes
260 changed. Clear the frame in clear_garbaged_frames if set. */
261 bool_bf resized_p : 1;
262
263 /* Set to true if the default face for the frame has been
264 realized. Reset to zero whenever the default face changes.
265 Used to see the difference between a font change and face change. */
266 bool_bf default_face_done_p : 1;
267
268 /* Set to true if this frame has already been hscrolled during
269 current redisplay. */
270 bool_bf already_hscrolled_p : 1;
271
272 /* Set to true when current redisplay has updated frame. */
273 bool_bf updated_p : 1;
274
275 #if defined (HAVE_WINDOW_SYSTEM)
276 /* Set to true to minimize tab-bar height even when
277 auto-resize-tab-bar is set to grow-only. */
278 bool_bf minimize_tab_bar_window_p : 1;
279 #endif
280
281 #if defined (HAVE_WINDOW_SYSTEM) && ! defined (HAVE_EXT_TOOL_BAR)
282 /* Set to true to minimize tool-bar height even when
283 auto-resize-tool-bar is set to grow-only. */
284 bool_bf minimize_tool_bar_window_p : 1;
285 #endif
286
287 #ifdef HAVE_EXT_TOOL_BAR
288 /* True means using a tool bar that comes from the toolkit. */
289 bool_bf external_tool_bar : 1;
290 #endif
291
292 /* True means that fonts have been loaded since the last glyph
293 matrix adjustments. */
294 bool_bf fonts_changed : 1;
295
296 /* True means that cursor type has been changed. */
297 bool_bf cursor_type_changed : 1;
298
299 /* True if it needs to be redisplayed. */
300 bool_bf redisplay : 1;
301
302 #ifdef HAVE_EXT_MENU_BAR
303 /* True means using a menu bar that comes from the toolkit. */
304 bool_bf external_menu_bar : 1;
305 #endif
306
307 /* Next two bitfields are mutually exclusive. They might both be
308 zero if the frame has been made invisible without an icon. */
309
310 /* Nonzero if the frame is currently displayed; we check
311 it to see if we should bother updating the frame's contents.
312
313 On ttys and on Windows NT/9X, to avoid wasting effort updating
314 visible frames that are actually completely obscured by other
315 windows on the display, we bend the meaning of visible slightly:
316 if equal to 2, then the frame is obscured - we still consider
317 it to be "visible" as seen from lisp, but we don't bother
318 updating it. */
319 unsigned visible : 2;
320
321 /* True if the frame is currently iconified. Do not
322 set this directly, use SET_FRAME_ICONIFIED instead. */
323 bool_bf iconified : 1;
324
325 /* True if this frame should be fully redisplayed. Disables all
326 optimizations while rebuilding matrices and redrawing. */
327 bool_bf garbaged : 1;
328
329 /* False means, if this frame has just one window,
330 show no modeline for that window. */
331 bool_bf wants_modeline : 1;
332
333 /* True means raise this frame to the top of the heap when selected. */
334 bool_bf auto_raise : 1;
335
336 /* True means lower this frame to the bottom of the stack when left. */
337 bool_bf auto_lower : 1;
338
339 /* True if frame's root window can't be split. */
340 bool_bf no_split : 1;
341
342 /* If this is set, then Emacs won't change the frame name to indicate
343 the current buffer, etcetera. If the user explicitly sets the frame
344 name, this gets set. If the user sets the name to Qnil, this is
345 cleared. */
346 bool_bf explicit_name : 1;
347
348 /* True if at least one window on this frame changed since the last
349 call of run_window_change_functions. Changes are either "state
350 changes" (a window has been created, deleted or got assigned
351 another buffer) or "size changes" (the total or body size of a
352 window changed). run_window_change_functions exits early unless
353 either this flag is true or a window selection happened on this
354 frame. */
355 bool_bf window_change : 1;
356
357 /* True if running window state change functions has been explicitly
358 requested for this frame since last redisplay. */
359 bool_bf window_state_change : 1;
360
361 /* True if the mouse has moved on this display device
362 since the last time we checked. */
363 bool_bf mouse_moved : 1;
364
365 /* True means that the pointer is invisible. */
366 bool_bf pointer_invisible : 1;
367
368 /* True means that all windows except mini-window and
369 selected window on this frame have frozen window starts. */
370 bool_bf frozen_window_starts : 1;
371
372 /* The output method says how the contents of this frame are
373 displayed. It could be using termcap, or using an X window.
374 This must be the same as the terminal->type. */
375 ENUM_BF (output_method) output_method : 3;
376
377 #ifdef HAVE_WINDOW_SYSTEM
378 /* True if this frame is a tooltip frame. */
379 bool_bf tooltip : 1;
380
381 /* See FULLSCREEN_ enum on top. */
382 ENUM_BF (fullscreen_type) want_fullscreen : 4;
383
384 /* If not vertical_scroll_bar_none, we should actually
385 display the scroll bars of this type on this frame. */
386 ENUM_BF (vertical_scroll_bar_type) vertical_scroll_bar_type : 2;
387
388 /* Nonzero if we should actually display horizontal scroll bars on this frame. */
389 bool_bf horizontal_scroll_bars : 1;
390
391 /* True if this is an undecorated frame. */
392 bool_bf undecorated : 1;
393
394 #ifndef HAVE_NTGUI
395 /* True if this is an override_redirect frame. */
396 bool_bf override_redirect : 1;
397 #endif
398
399 /* Nonzero if this frame's icon should not appear on its display's taskbar. */
400 bool_bf skip_taskbar : 1;
401
402 /* Nonzero if this frame's window F's X window does not want to
403 receive input focus when it is mapped. */
404 bool_bf no_focus_on_map : 1;
405
406 /* Nonzero if this frame's window does not want to receive input focus
407 via mouse clicks or by moving the mouse into it. */
408 bool_bf no_accept_focus : 1;
409
410 /* The z-group this frame's window belongs to. */
411 ENUM_BF (z_group) z_group : 2;
412
413 /* Non-zero if display of truncation and continuation glyphs outside
414 the fringes is suppressed. */
415 bool_bf no_special_glyphs : 1;
416 #endif /* HAVE_WINDOW_SYSTEM */
417
418 /* True means set_window_size_hook requests can be processed for
419 this frame. */
420 bool_bf can_set_window_size : 1;
421
422 /* Set to true after this frame was made by `make-frame'. */
423 bool_bf after_make_frame : 1;
424
425 /* Two sticky flags, that are both false when a frame is created.
426 'display_tab_bar' sets the former to true the first time it
427 displays the tab bar. When the former is true, the next call of
428 'x_change_tab_bar_height' and associates sets the latter true and
429 tries to adjust the frame height in a way that the now valid pixel
430 height of the tab bar is taken into account by the frame's native
431 height. */
432 bool_bf tab_bar_redisplayed : 1;
433 bool_bf tab_bar_resized : 1;
434
435 /* Two sticky flags, that are both false when a frame is created.
436 'redisplay_tool_bar' sets the former to true the first time it
437 displays the tool bar. When the former is true, the next call of
438 'x_change_tool_bar_height' and associates sets the latter true and
439 tries to adjust the frame height in a way that the now valid pixel
440 height of the tool bar is taken into account by the frame's native
441 height. */
442 bool_bf tool_bar_redisplayed : 1;
443 bool_bf tool_bar_resized : 1;
444
445 /* Inhibit implied resize before after_make_frame is set. */
446 bool_bf inhibit_horizontal_resize : 1;
447 bool_bf inhibit_vertical_resize : 1;
448
449 /* Non-zero if this frame's faces need to be recomputed. */
450 bool_bf face_change : 1;
451
452 /* Non-zero if this frame's image cache and face cache cannot be
453 freed because the frame is in the process of being redisplayed. */
454 bool_bf inhibit_clear_image_cache : 1;
455
456 /* True when new_width or new_height were set by change_frame_size,
457 false when they were set by adjust_frame_size internally or not
458 set. */
459 bool_bf new_size_p : 1;
460
461 /* True when frame was invisible before first MapNotify event. Used
462 in X builds only. */
463 bool_bf was_invisible : 1;
464
465 /* True when the frame isn't selected, and selecting it in the
466 future should select the mini-window rather than the currently
467 selected window in the frame, assuming there is still an active
468 minibuffer in that mini-window. */
469 bool_bf select_mini_window_flag : 1;
470 /* Bitfield area ends here. */
471
472 /* This frame's change stamp, set the last time window change
473 functions were run for this frame. Should never be 0 because
474 that's the change stamp of a new window. A window was not on a
475 frame the last run_window_change_functions was called on it if
476 it's change stamp differs from that of its frame. */
477 int change_stamp;
478
479 /* This frame's number of windows, set the last time window change
480 functions were run for this frame. Should never be 0 even for
481 minibuffer-only frames. If no window has been added, this allows
482 to detect whether a window was deleted on this frame since the
483 last time run_window_change_functions was called on it. */
484 ptrdiff_t number_of_windows;
485
486 /* Number of frame lines (rounded up) of tab bar. */
487 int tab_bar_lines;
488
489 /* Height of frame internal tab bar in pixels. */
490 int tab_bar_height;
491
492 int n_tab_bar_rows;
493 int n_tab_bar_items;
494
495 /* Number of frame lines (rounded up) of tool bar. */
496 int tool_bar_lines;
497
498 /* Height of frame internal tool bar in pixels. */
499 int tool_bar_height;
500
501 int n_tool_bar_rows;
502 int n_tool_bar_items;
503
504 /* A buffer for decode_mode_line. */
505 char *decode_mode_spec_buffer;
506
507 /* See do_line_insertion_deletion_costs for info on these arrays. */
508 /* Cost of inserting 1 line on this frame. */
509 int *insert_line_cost;
510 /* Cost of deleting 1 line on this frame. */
511 int *delete_line_cost;
512 /* Cost of inserting n lines on this frame. */
513 int *insert_n_lines_cost;
514 /* Cost of deleting n lines on this frame. */
515 int *delete_n_lines_cost;
516
517 /* Text width and height of this frame in (and maybe rounded to) frame
518 columns and lines. */
519 int text_cols, text_lines;
520 /* Text width and height of this frame in pixels. */
521 int text_width, text_height;
522
523 /* Native width of this frame in (and maybe rounded to) frame columns
524 and lines. */
525 int total_cols, total_lines;
526 /* Native width and height of this frame in pixels. */
527 int pixel_width, pixel_height;
528 /* New native width and height of this frame for pending size change,
529 in pixels. -1 if no change pending. */
530 int new_width, new_height;
531
532 /* Pixel position of the frame window (x and y offsets in root window). */
533 int left_pos, top_pos;
534
535 /* This is the gravity value for the specified window position. */
536 int win_gravity;
537
538 /* The geometry flags for this window. */
539 int size_hint_flags;
540
541 /* Border width of the frame window as known by the (X) window system. */
542 int border_width;
543
544 /* Width of child frames' internal border. Acts as
545 internal_border_width for child frames. */
546 int child_frame_border_width;
547
548 /* Width of the internal border. This is a line of background color
549 just inside the window's border. When the frame is selected,
550 a highlighting is displayed inside the internal border. */
551 int internal_border_width;
552
553 /* Widths of dividers between this frame's windows in pixels. */
554 int right_divider_width, bottom_divider_width;
555
556 /* Widths of fringes in pixels. */
557 int left_fringe_width, right_fringe_width;
558
559 /* Total width of fringes reserved for drawing truncation bitmaps,
560 continuation bitmaps and alike - REMOVE THIS !!!!. */
561 int fringe_cols;
562
563 /* Number of lines of menu bar. */
564 int menu_bar_lines;
565
566 /* Pixel height of menubar. */
567 int menu_bar_height;
568
569 /* Canonical X unit. Width of default font, in pixels. */
570 int column_width;
571
572 /* Canonical Y unit. Height of a line, in pixels. */
573 int line_height;
574
575 /* The terminal device that this frame uses. If this is NULL, then
576 the frame has been deleted. */
577 struct terminal *terminal;
578
579 /* Device-dependent, frame-local auxiliary data used for displaying
580 the contents. When the frame is deleted, this data is deleted as
581 well. */
582 union output_data
583 {
584 struct tty_output *tty; /* From termchar.h. */
585 struct x_output *x; /* From xterm.h. */
586 struct w32_output *w32; /* From w32term.h. */
587 struct ns_output *ns; /* From nsterm.h. */
588 struct pgtk_output *pgtk; /* From pgtkterm.h. */
589 struct haiku_output *haiku; /* From haikuterm.h. */
590 }
591 output_data;
592
593 /* List of font-drivers available on the frame. */
594 struct font_driver_list *font_driver_list;
595
596 #if defined (HAVE_X_WINDOWS)
597 /* Used by x_wait_for_event when watching for an X event on this frame. */
598 int wait_event_type;
599 #endif
600
601 /* What kind of text cursor should we draw in the future?
602 This should always be filled_box_cursor or bar_cursor. */
603 enum text_cursor_kinds desired_cursor;
604
605 /* Width of bar cursor (if we are using that). */
606 int cursor_width;
607
608 /* What kind of text cursor should we draw when the cursor blinks off?
609 This can be filled_box_cursor or bar_cursor or no_cursor. */
610 enum text_cursor_kinds blink_off_cursor;
611
612 /* Width of bar cursor (if we are using that) for blink-off state. */
613 int blink_off_cursor_width;
614
615 /* Configured width of the scroll bar, in pixels and in characters.
616 config_scroll_bar_cols tracks config_scroll_bar_width if the
617 latter is positive; a zero value in config_scroll_bar_width means
618 to compute the actual width on the fly, using config_scroll_bar_cols
619 and the current font width. */
620 int config_scroll_bar_width;
621 int config_scroll_bar_cols;
622
623 /* Configured height of the scroll bar, in pixels and in characters.
624 config_scroll_bar_lines tracks config_scroll_bar_height if the
625 latter is positive; a zero value in config_scroll_bar_height means
626 to compute the actual width on the fly, using
627 config_scroll_bar_lines and the current font width. */
628 int config_scroll_bar_height;
629 int config_scroll_bar_lines;
630
631 /* The baud rate that was used to calculate costs for this frame. */
632 intmax_t cost_calculation_baud_rate;
633
634 /* Frame opacity
635 alpha[0]: alpha transparency of the active frame
636 alpha[1]: alpha transparency of inactive frames
637 Negative values mean not to change alpha. */
638 double alpha[2];
639
640 /* Exponent for gamma correction of colors. 1/(VIEWING_GAMMA *
641 SCREEN_GAMMA) where viewing_gamma is 0.4545 and SCREEN_GAMMA is a
642 frame parameter. 0 means don't do gamma correction. */
643 double gamma;
644
645 /* Additional space to put between text lines on this frame. */
646 int extra_line_spacing;
647
648 /* All display backends seem to need these two pixel values. */
649 unsigned long background_pixel;
650 unsigned long foreground_pixel;
651
652 #ifdef NS_IMPL_COCOA
653 /* NSAppearance theme used on this frame. */
654 enum ns_appearance_type ns_appearance;
655 bool_bf ns_transparent_titlebar;
656 #endif
657 } GCALIGNED_STRUCT;
658
659 /* Most code should use these functions to set Lisp fields in struct frame. */
660
661 INLINE void
fset_buffer_list(struct frame * f,Lisp_Object val)662 fset_buffer_list (struct frame *f, Lisp_Object val)
663 {
664 f->buffer_list = val;
665 }
666 INLINE void
fset_buried_buffer_list(struct frame * f,Lisp_Object val)667 fset_buried_buffer_list (struct frame *f, Lisp_Object val)
668 {
669 f->buried_buffer_list = val;
670 }
671 INLINE void
fset_condemned_scroll_bars(struct frame * f,Lisp_Object val)672 fset_condemned_scroll_bars (struct frame *f, Lisp_Object val)
673 {
674 f->condemned_scroll_bars = val;
675 }
676 INLINE void
fset_face_hash_table(struct frame * f,Lisp_Object val)677 fset_face_hash_table (struct frame *f, Lisp_Object val)
678 {
679 f->face_hash_table = val;
680 }
681 #if defined (HAVE_WINDOW_SYSTEM)
682 INLINE void
fset_parent_frame(struct frame * f,Lisp_Object val)683 fset_parent_frame (struct frame *f, Lisp_Object val)
684 {
685 f->parent_frame = val;
686 }
687 #endif
688 INLINE void
fset_focus_frame(struct frame * f,Lisp_Object val)689 fset_focus_frame (struct frame *f, Lisp_Object val)
690 {
691 f->focus_frame = val;
692 }
693 INLINE void
fset_icon_name(struct frame * f,Lisp_Object val)694 fset_icon_name (struct frame *f, Lisp_Object val)
695 {
696 f->icon_name = val;
697 }
698 INLINE void
fset_menu_bar_items(struct frame * f,Lisp_Object val)699 fset_menu_bar_items (struct frame *f, Lisp_Object val)
700 {
701 f->menu_bar_items = val;
702 }
703 INLINE void
fset_menu_bar_vector(struct frame * f,Lisp_Object val)704 fset_menu_bar_vector (struct frame *f, Lisp_Object val)
705 {
706 f->menu_bar_vector = val;
707 }
708 #if defined (HAVE_X_WINDOWS) && ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK)
709 INLINE void
fset_menu_bar_window(struct frame * f,Lisp_Object val)710 fset_menu_bar_window (struct frame *f, Lisp_Object val)
711 {
712 f->menu_bar_window = val;
713 }
714 #endif
715 INLINE void
fset_name(struct frame * f,Lisp_Object val)716 fset_name (struct frame *f, Lisp_Object val)
717 {
718 f->name = val;
719 }
720 INLINE void
fset_param_alist(struct frame * f,Lisp_Object val)721 fset_param_alist (struct frame *f, Lisp_Object val)
722 {
723 f->param_alist = val;
724 }
725 INLINE void
fset_root_window(struct frame * f,Lisp_Object val)726 fset_root_window (struct frame *f, Lisp_Object val)
727 {
728 f->root_window = val;
729 }
730 INLINE void
fset_scroll_bars(struct frame * f,Lisp_Object val)731 fset_scroll_bars (struct frame *f, Lisp_Object val)
732 {
733 f->scroll_bars = val;
734 }
735 INLINE void
fset_selected_window(struct frame * f,Lisp_Object val)736 fset_selected_window (struct frame *f, Lisp_Object val)
737 {
738 f->selected_window = val;
739 }
740 INLINE void
fset_old_selected_window(struct frame * f,Lisp_Object val)741 fset_old_selected_window (struct frame *f, Lisp_Object val)
742 {
743 f->old_selected_window = val;
744 }
745 INLINE void
fset_title(struct frame * f,Lisp_Object val)746 fset_title (struct frame *f, Lisp_Object val)
747 {
748 f->title = val;
749 }
750 INLINE void
fset_tab_bar_items(struct frame * f,Lisp_Object val)751 fset_tab_bar_items (struct frame *f, Lisp_Object val)
752 {
753 f->tab_bar_items = val;
754 }
755 #if defined (HAVE_WINDOW_SYSTEM)
756 INLINE void
fset_tab_bar_window(struct frame * f,Lisp_Object val)757 fset_tab_bar_window (struct frame *f, Lisp_Object val)
758 {
759 f->tab_bar_window = val;
760 }
761 INLINE void
fset_current_tab_bar_string(struct frame * f,Lisp_Object val)762 fset_current_tab_bar_string (struct frame *f, Lisp_Object val)
763 {
764 f->current_tab_bar_string = val;
765 }
766 INLINE void
fset_desired_tab_bar_string(struct frame * f,Lisp_Object val)767 fset_desired_tab_bar_string (struct frame *f, Lisp_Object val)
768 {
769 f->desired_tab_bar_string = val;
770 }
771 #endif /* HAVE_WINDOW_SYSTEM */
772 INLINE void
fset_tool_bar_items(struct frame * f,Lisp_Object val)773 fset_tool_bar_items (struct frame *f, Lisp_Object val)
774 {
775 f->tool_bar_items = val;
776 }
777 #ifdef USE_GTK
778 INLINE void
fset_tool_bar_position(struct frame * f,Lisp_Object val)779 fset_tool_bar_position (struct frame *f, Lisp_Object val)
780 {
781 f->tool_bar_position = val;
782 }
783 #endif /* USE_GTK */
784 #if defined (HAVE_WINDOW_SYSTEM) && ! defined (HAVE_EXT_TOOL_BAR)
785 INLINE void
fset_tool_bar_window(struct frame * f,Lisp_Object val)786 fset_tool_bar_window (struct frame *f, Lisp_Object val)
787 {
788 f->tool_bar_window = val;
789 }
790 INLINE void
fset_current_tool_bar_string(struct frame * f,Lisp_Object val)791 fset_current_tool_bar_string (struct frame *f, Lisp_Object val)
792 {
793 f->current_tool_bar_string = val;
794 }
795 INLINE void
fset_desired_tool_bar_string(struct frame * f,Lisp_Object val)796 fset_desired_tool_bar_string (struct frame *f, Lisp_Object val)
797 {
798 f->desired_tool_bar_string = val;
799 }
800 #endif /* HAVE_WINDOW_SYSTEM && !USE_GTK && !HAVE_NS */
801
802 INLINE double
NUMVAL(Lisp_Object x)803 NUMVAL (Lisp_Object x)
804 {
805 return NUMBERP (x) ? XFLOATINT (x) : -1;
806 }
807
808 INLINE double
default_pixels_per_inch_x(void)809 default_pixels_per_inch_x (void)
810 {
811 Lisp_Object v = (CONSP (Vdisplay_pixels_per_inch)
812 ? XCAR (Vdisplay_pixels_per_inch)
813 : Vdisplay_pixels_per_inch);
814 return NUMVAL (v) > 0 ? NUMVAL (v) : 72.0;
815 }
816
817 INLINE double
default_pixels_per_inch_y(void)818 default_pixels_per_inch_y (void)
819 {
820 Lisp_Object v = (CONSP (Vdisplay_pixels_per_inch)
821 ? XCDR (Vdisplay_pixels_per_inch)
822 : Vdisplay_pixels_per_inch);
823 return NUMVAL (v) > 0 ? NUMVAL (v) : 72.0;
824 }
825
826 #define FRAME_KBOARD(f) ((f)->terminal->kboard)
827
828 /* Return a pointer to the image cache of frame F. */
829 #define FRAME_IMAGE_CACHE(F) ((F)->terminal->image_cache)
830
831 #define XFRAME(p) \
832 (eassert (FRAMEP (p)), XUNTAG (p, Lisp_Vectorlike, struct frame))
833 #define XSETFRAME(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_FRAME))
834
835 /* Given a window, return its frame as a Lisp_Object. */
836 #define WINDOW_FRAME(w) ((w)->frame)
837
838 /* Test a frame for particular kinds of display methods. */
839 #define FRAME_INITIAL_P(f) ((f)->output_method == output_initial)
840 #define FRAME_TERMCAP_P(f) ((f)->output_method == output_termcap)
841 #define FRAME_X_P(f) ((f)->output_method == output_x_window)
842 #ifndef HAVE_NTGUI
843 #define FRAME_W32_P(f) false
844 #else
845 #define FRAME_W32_P(f) ((f)->output_method == output_w32)
846 #endif
847 #ifndef MSDOS
848 #define FRAME_MSDOS_P(f) false
849 #else
850 #define FRAME_MSDOS_P(f) ((f)->output_method == output_msdos_raw)
851 #endif
852 #ifndef HAVE_NS
853 #define FRAME_NS_P(f) false
854 #else
855 #define FRAME_NS_P(f) ((f)->output_method == output_ns)
856 #endif
857 #ifndef HAVE_PGTK
858 #define FRAME_PGTK_P(f) false
859 #else
860 #define FRAME_PGTK_P(f) ((f)->output_method == output_pgtk)
861 #endif
862 #ifndef HAVE_HAIKU
863 #define FRAME_HAIKU_P(f) false
864 #else
865 #define FRAME_HAIKU_P(f) ((f)->output_method == output_haiku)
866 #endif
867
868 /* FRAME_WINDOW_P tests whether the frame is a graphical window system
869 frame. */
870 #ifdef HAVE_X_WINDOWS
871 #define FRAME_WINDOW_P(f) FRAME_X_P (f)
872 #endif
873 #ifdef HAVE_NTGUI
874 #define FRAME_WINDOW_P(f) FRAME_W32_P (f)
875 #endif
876 #ifdef HAVE_NS
877 #define FRAME_WINDOW_P(f) FRAME_NS_P(f)
878 #endif
879 #ifdef HAVE_PGTK
880 #define FRAME_WINDOW_P(f) FRAME_PGTK_P(f)
881 #endif
882 #ifdef HAVE_HAIKU
883 #define FRAME_WINDOW_P(f) FRAME_HAIKU_P (f)
884 #endif
885 #ifndef FRAME_WINDOW_P
886 #define FRAME_WINDOW_P(f) ((void) (f), false)
887 #endif
888
889 /* Dots per inch of the screen the frame F is on. */
890
891 #ifdef HAVE_WINDOW_SYSTEM
892
893 #define FRAME_RES_X(f) \
894 (eassert (FRAME_WINDOW_P (f)), FRAME_DISPLAY_INFO (f)->resx)
895 #define FRAME_RES_Y(f) \
896 (eassert (FRAME_WINDOW_P (f)), FRAME_DISPLAY_INFO (f)->resy)
897
898 #else /* !HAVE_WINDOW_SYSTEM */
899
900 /* Defaults when no window system available. */
901
902 #define FRAME_RES_X(f) default_pixels_per_inch_x ()
903 #define FRAME_RES_Y(f) default_pixels_per_inch_y ()
904
905 #endif /* HAVE_WINDOW_SYSTEM */
906
907 /* Return a pointer to the structure holding information about the
908 region of text, if any, that is currently shown in mouse-face on
909 frame F. We need to define two versions because a TTY-only build
910 does not have FRAME_DISPLAY_INFO. */
911 #ifdef HAVE_WINDOW_SYSTEM
912 # define MOUSE_HL_INFO(F) \
913 (FRAME_WINDOW_P(F) \
914 ? &FRAME_DISPLAY_INFO(F)->mouse_highlight \
915 : &(F)->output_data.tty->display_info->mouse_highlight)
916 #else
917 # define MOUSE_HL_INFO(F) \
918 (&(F)->output_data.tty->display_info->mouse_highlight)
919 #endif
920
921 /* True if frame F is still alive (not deleted). */
922 #define FRAME_LIVE_P(f) ((f)->terminal != 0)
923
924 /* True if frame F is a minibuffer-only frame. */
925 #define FRAME_MINIBUF_ONLY_P(f) \
926 EQ (FRAME_ROOT_WINDOW (f), FRAME_MINIBUF_WINDOW (f))
927
928 /* True if frame F contains it's own minibuffer window. Frame always has
929 minibuffer window, but it could use minibuffer window of another frame. */
930 #define FRAME_HAS_MINIBUF_P(f) \
931 (WINDOWP (f->minibuffer_window) \
932 && XFRAME (XWINDOW (f->minibuffer_window)->frame) == f)
933
934 /* Scale factor of frame F. */
935 #if defined HAVE_NS
936 # define FRAME_SCALE_FACTOR(f) (FRAME_NS_P (f) ? ns_frame_scale_factor (f) : 1)
937 #elif defined HAVE_PGTK
938 # define FRAME_SCALE_FACTOR(f) (FRAME_PGTK_P (f) ? pgtk_frame_scale_factor (f) : 1)
939 #else
940 # define FRAME_SCALE_FACTOR(f) 1
941 #endif
942
943 /* Native width and height of frame F, in pixels and frame
944 columns/lines. */
945 #define FRAME_PIXEL_WIDTH(f) ((f)->pixel_width)
946 #define FRAME_PIXEL_HEIGHT(f) ((f)->pixel_height)
947 #define FRAME_TOTAL_COLS(f) ((f)->total_cols)
948 #define FRAME_TOTAL_LINES(f) ((f)->total_lines)
949
950 /* Text width and height of frame F, in pixels and frame
951 columns/lines. */
952 #define FRAME_TEXT_WIDTH(f) (f)->text_width
953 #define FRAME_TEXT_HEIGHT(f) (f)->text_height
954 #define FRAME_COLS(f) ((f)->text_cols)
955 #define FRAME_LINES(f) ((f)->text_lines)
956
957 /* True if this frame should display an external menu bar. */
958 #ifdef HAVE_EXT_MENU_BAR
959 #define FRAME_EXTERNAL_MENU_BAR(f) (f)->external_menu_bar
960 #else
961 #define FRAME_EXTERNAL_MENU_BAR(f) false
962 #endif
963
964 /* Size of frame F's internal menu bar in frame lines and pixels. */
965 #define FRAME_MENU_BAR_LINES(f) (f)->menu_bar_lines
966 #define FRAME_MENU_BAR_HEIGHT(f) (f)->menu_bar_height
967
968 /* Size of frame F's tab bar in frame lines and pixels. */
969 #define FRAME_TAB_BAR_LINES(f) (f)->tab_bar_lines
970 #define FRAME_TAB_BAR_HEIGHT(f) (f)->tab_bar_height
971
972 /* True if this frame should display an external tool bar. */
973 #ifdef HAVE_EXT_TOOL_BAR
974 #define FRAME_EXTERNAL_TOOL_BAR(f) (f)->external_tool_bar
975 #else
976 #define FRAME_EXTERNAL_TOOL_BAR(f) false
977 #endif
978
979 /* This is really supported only with GTK. */
980 #ifdef USE_GTK
981 #define FRAME_TOOL_BAR_POSITION(f) (f)->tool_bar_position
982 #else
983 #define FRAME_TOOL_BAR_POSITION(f) ((void) (f), Qtop)
984 #endif
985
986 /* Size of frame F's internal tool bar in frame lines and pixels. */
987 #define FRAME_TOOL_BAR_LINES(f) (f)->tool_bar_lines
988 #define FRAME_TOOL_BAR_HEIGHT(f) (f)->tool_bar_height
989
990 /* Height of frame F's top margin in frame lines. */
991 #define FRAME_TOP_MARGIN(F) \
992 (FRAME_MENU_BAR_LINES (F) \
993 + FRAME_TAB_BAR_LINES (F) \
994 + FRAME_TOOL_BAR_LINES (F))
995
996 /* Pixel height of frame F's top margin. */
997 #define FRAME_TOP_MARGIN_HEIGHT(F) \
998 (FRAME_MENU_BAR_HEIGHT (F) \
999 + FRAME_TAB_BAR_HEIGHT (F) \
1000 + FRAME_TOOL_BAR_HEIGHT (F))
1001
1002 /* True if frame F is currently visible. */
1003 #define FRAME_VISIBLE_P(f) (f)->visible
1004
1005 /* True if frame F is currently visible but hidden. */
1006 #define FRAME_OBSCURED_P(f) ((f)->visible > 1)
1007
1008 /* True if frame F is currently iconified. */
1009 #define FRAME_ICONIFIED_P(f) (f)->iconified
1010
1011 /* Mark frame F as currently garbaged. */
1012 #define SET_FRAME_GARBAGED(f) \
1013 (frame_garbaged = true, fset_redisplay (f), f->garbaged = true)
1014
1015 /* True if frame F is currently garbaged. */
1016 #define FRAME_GARBAGED_P(f) (f)->garbaged
1017
1018 /* True means do not allow splitting this frame's window. */
1019 #define FRAME_NO_SPLIT_P(f) (f)->no_split
1020
1021 /* Not really implemented. */
1022 #define FRAME_WANTS_MODELINE_P(f) (f)->wants_modeline
1023
1024 /* True if all windows except selected window and mini window
1025 are frozen on frame F. */
1026 #define FRAME_WINDOWS_FROZEN(f) (f)->frozen_window_starts
1027
1028 /* True if at least one window changed on frame F since the last time
1029 window change functions were run on F. */
1030 #define FRAME_WINDOW_CHANGE(f) (f)->window_change
1031
1032 /* True if running window state change functions has been explicitly
1033 requested for this frame since last redisplay. */
1034 #define FRAME_WINDOW_STATE_CHANGE(f) (f)->window_state_change
1035
1036 /* The minibuffer window of frame F, if it has one; otherwise nil. */
1037 #define FRAME_MINIBUF_WINDOW(f) f->minibuffer_window
1038
1039 /* The root window of the window tree of frame F. */
1040 #define FRAME_ROOT_WINDOW(f) f->root_window
1041
1042 /* The currently selected window of frame F. */
1043 #define FRAME_SELECTED_WINDOW(f) f->selected_window
1044 /* The old selected window of frame F. */
1045 #define FRAME_OLD_SELECTED_WINDOW(f) f->old_selected_window
1046
1047 #define FRAME_INSERT_COST(f) (f)->insert_line_cost
1048 #define FRAME_DELETE_COST(f) (f)->delete_line_cost
1049 #define FRAME_INSERTN_COST(f) (f)->insert_n_lines_cost
1050 #define FRAME_DELETEN_COST(f) (f)->delete_n_lines_cost
1051 #define FRAME_FOCUS_FRAME(f) f->focus_frame
1052
1053 #ifdef HAVE_WINDOW_SYSTEM
1054 /* This frame slot says whether scroll bars are currently enabled for frame F,
1055 and which side they are on. */
1056 #define FRAME_VERTICAL_SCROLL_BAR_TYPE(f) ((f)->vertical_scroll_bar_type)
1057 #define FRAME_HAS_VERTICAL_SCROLL_BARS(f) \
1058 ((f)->vertical_scroll_bar_type != vertical_scroll_bar_none)
1059 #define FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT(f) \
1060 ((f)->vertical_scroll_bar_type == vertical_scroll_bar_left)
1061 #define FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT(f) \
1062 ((f)->vertical_scroll_bar_type == vertical_scroll_bar_right)
1063 #else /* not HAVE_WINDOW_SYSTEM */
1064 /* If there is no window system, there are no scroll bars. */
1065 #define FRAME_VERTICAL_SCROLL_BAR_TYPE(f) \
1066 ((void) (f), vertical_scroll_bar_none)
1067 #define FRAME_HAS_VERTICAL_SCROLL_BARS(f) ((void) (f), 0)
1068 #define FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT(f) ((void) (f), 0)
1069 #define FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT(f) ((void) (f), 0)
1070 #endif /* HAVE_WINDOW_SYSTEM */
1071
1072 #if defined (HAVE_WINDOW_SYSTEM)
1073 #define FRAME_UNDECORATED(f) ((f)->undecorated)
1074 #ifdef HAVE_NTGUI
1075 #define FRAME_OVERRIDE_REDIRECT(f) ((void) (f), 0)
1076 #else
1077 #define FRAME_OVERRIDE_REDIRECT(f) ((f)->override_redirect)
1078 #endif
1079 #define FRAME_PARENT_FRAME(f) \
1080 (NILP ((f)->parent_frame) \
1081 ? NULL \
1082 : XFRAME ((f)->parent_frame))
1083 #define FRAME_SKIP_TASKBAR(f) ((f)->skip_taskbar)
1084 #define FRAME_NO_FOCUS_ON_MAP(f) ((f)->no_focus_on_map)
1085 #define FRAME_NO_ACCEPT_FOCUS(f) ((f)->no_accept_focus)
1086 #define FRAME_NO_SPECIAL_GLYPHS(f) ((f)->no_special_glyphs)
1087 #define FRAME_Z_GROUP(f) ((f)->z_group)
1088 #define FRAME_Z_GROUP_NONE(f) ((f)->z_group == z_group_none)
1089 #define FRAME_Z_GROUP_ABOVE(f) ((f)->z_group == z_group_above)
1090 #define FRAME_Z_GROUP_ABOVE_SUSPENDED(f) \
1091 ((f)->z_group == z_group_above_suspended)
1092 #define FRAME_Z_GROUP_BELOW(f) ((f)->z_group == z_group_below)
1093 #define FRAME_TOOLTIP_P(f) ((f)->tooltip)
1094 #ifdef NS_IMPL_COCOA
1095 #define FRAME_NS_APPEARANCE(f) ((f)->ns_appearance)
1096 #define FRAME_NS_TRANSPARENT_TITLEBAR(f) ((f)->ns_transparent_titlebar)
1097 #endif
1098 #else /* not HAVE_WINDOW_SYSTEM */
1099 #define FRAME_UNDECORATED(f) ((void) (f), 0)
1100 #define FRAME_OVERRIDE_REDIRECT(f) ((void) (f), 0)
1101 #define FRAME_PARENT_FRAME(f) ((void) (f), NULL)
1102 #define FRAME_SKIP_TASKBAR(f) ((void) (f), 0)
1103 #define FRAME_NO_FOCUS_ON_MAP(f) ((void) (f), 0)
1104 #define FRAME_NO_ACCEPT_FOCUS(f) ((void) (f), 0)
1105 #define FRAME_NO_SPECIAL_GLYPHS(f) ((void) (f), 0)
1106 #define FRAME_Z_GROUP(f) ((void) (f), z_group_none)
1107 #define FRAME_Z_GROUP_NONE(f) ((void) (f), true)
1108 #define FRAME_Z_GROUP_ABOVE(f) ((void) (f), false)
1109 #define FRAME_Z_GROUP_BELOW(f) ((void) (f), false)
1110 #define FRAME_TOOLTIP_P(f) ((void) f, false)
1111 #endif /* HAVE_WINDOW_SYSTEM */
1112
1113 /* Whether horizontal scroll bars are currently enabled for frame F. */
1114 #if USE_HORIZONTAL_SCROLL_BARS
1115 #define FRAME_HAS_HORIZONTAL_SCROLL_BARS(f) \
1116 ((f)->horizontal_scroll_bars)
1117 #else
1118 #define FRAME_HAS_HORIZONTAL_SCROLL_BARS(f) ((void) (f), 0)
1119 #endif
1120
1121 /* Width that a scroll bar in frame F should have, if there is one.
1122 Measured in pixels.
1123 If scroll bars are turned off, this is still nonzero. */
1124 #define FRAME_CONFIG_SCROLL_BAR_WIDTH(f) ((f)->config_scroll_bar_width)
1125
1126 /* Height that a scroll bar in frame F should have, if there is one.
1127 Measured in pixels.
1128 If scroll bars are turned off, this is still nonzero. */
1129 #define FRAME_CONFIG_SCROLL_BAR_HEIGHT(f) ((f)->config_scroll_bar_height)
1130
1131 /* Width that a scroll bar in frame F should have, if there is one.
1132 Measured in columns (characters).
1133 If scroll bars are turned off, this is still nonzero. */
1134 #define FRAME_CONFIG_SCROLL_BAR_COLS(f) ((f)->config_scroll_bar_cols)
1135
1136 /* Height that a scroll bar in frame F should have, if there is one.
1137 Measured in lines (characters).
1138 If scroll bars are turned off, this is still nonzero. */
1139 #define FRAME_CONFIG_SCROLL_BAR_LINES(f) ((f)->config_scroll_bar_lines)
1140
1141 /* Width of a left scroll bar in frame F, measured in pixels */
1142 #define FRAME_LEFT_SCROLL_BAR_AREA_WIDTH(f) \
1143 (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f) \
1144 ? FRAME_CONFIG_SCROLL_BAR_WIDTH (f) \
1145 : 0)
1146
1147 /* Width of a right scroll bar area in frame F, measured in pixels */
1148 #define FRAME_RIGHT_SCROLL_BAR_AREA_WIDTH(f) \
1149 (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f) \
1150 ? FRAME_CONFIG_SCROLL_BAR_WIDTH (f) \
1151 : 0)
1152
1153 /* Width of a left scroll bar in frame F, measured in columns
1154 (characters), but only if scroll bars are on the left. If scroll
1155 bars are on the right in this frame, or there are no scroll bars,
1156 value is 0. */
1157 #define FRAME_LEFT_SCROLL_BAR_COLS(f) \
1158 (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f) \
1159 ? FRAME_CONFIG_SCROLL_BAR_COLS (f) \
1160 : 0)
1161
1162 /* Width of a right scroll bar in frame F, measured in columns
1163 (characters), but only if scroll bars are on the right. If scroll
1164 bars are on the left in this frame, or there are no scroll bars,
1165 value is 0. */
1166 #define FRAME_RIGHT_SCROLL_BAR_COLS(f) \
1167 (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f) \
1168 ? FRAME_CONFIG_SCROLL_BAR_COLS (f) \
1169 : 0)
1170
1171 /* Width of a vertical scroll bar area in frame F, measured in
1172 pixels. */
1173 #define FRAME_SCROLL_BAR_AREA_WIDTH(f) \
1174 (FRAME_HAS_VERTICAL_SCROLL_BARS (f) \
1175 ? FRAME_CONFIG_SCROLL_BAR_WIDTH (f) \
1176 : 0)
1177
1178 /* Height of horizontal scroll bar area in frame F, measured in
1179 pixels. */
1180 #define FRAME_SCROLL_BAR_AREA_HEIGHT(f) \
1181 (FRAME_HAS_HORIZONTAL_SCROLL_BARS (f) \
1182 ? FRAME_CONFIG_SCROLL_BAR_HEIGHT (f) \
1183 : 0)
1184
1185 /* Width of vertical scroll bar in frame F, measured in columns. */
1186 #define FRAME_SCROLL_BAR_COLS(f) \
1187 (FRAME_HAS_VERTICAL_SCROLL_BARS (f) \
1188 ? FRAME_CONFIG_SCROLL_BAR_COLS (f) \
1189 : 0)
1190
1191 /* Height of horizontal scroll bar in frame F, measured in lines. */
1192 #define FRAME_SCROLL_BAR_LINES(f) \
1193 (FRAME_HAS_HORIZONTAL_SCROLL_BARS (f) \
1194 ? FRAME_CONFIG_SCROLL_BAR_LINES (f) \
1195 : 0)
1196
1197 /* Maximum + 1 legitimate value for FRAME_CURSOR_X. */
1198 #define FRAME_CURSOR_X_LIMIT(f) \
1199 (FRAME_COLS (f) + FRAME_LEFT_SCROLL_BAR_COLS (f))
1200
1201 /* Nonzero if frame F has scroll bars. */
1202 #define FRAME_SCROLL_BARS(f) (f->scroll_bars)
1203 #define FRAME_CONDEMNED_SCROLL_BARS(f) (f->condemned_scroll_bars)
1204
1205 #define FRAME_MENU_BAR_ITEMS(f) (f->menu_bar_items)
1206 #define FRAME_COST_BAUD_RATE(f) ((f)->cost_calculation_baud_rate)
1207
1208 #define FRAME_DESIRED_CURSOR(f) ((f)->desired_cursor)
1209 #define FRAME_BLINK_OFF_CURSOR(f) ((f)->blink_off_cursor)
1210 #define FRAME_CURSOR_WIDTH(f) ((f)->cursor_width)
1211 #define FRAME_BLINK_OFF_CURSOR_WIDTH(f) ((f)->blink_off_cursor_width)
1212
1213 #define FRAME_FOREGROUND_PIXEL(f) ((f)->foreground_pixel)
1214 #define FRAME_BACKGROUND_PIXEL(f) ((f)->background_pixel)
1215
1216 /* Return a pointer to the face cache of frame F. */
1217 #define FRAME_FACE_CACHE(F) (F)->face_cache
1218
1219 /* Return the size of message_buf of the frame F. We multiply the
1220 width of the frame by 4 because multi-byte form may require at most
1221 4-byte for a character. */
1222
1223 #define FRAME_MESSAGE_BUF_SIZE(f) (((int) FRAME_COLS (f)) * 4)
1224
1225 #define CHECK_FRAME(x) \
1226 CHECK_TYPE (FRAMEP (x), Qframep, x)
1227
1228 #define CHECK_LIVE_FRAME(x) \
1229 CHECK_TYPE (FRAMEP (x) && FRAME_LIVE_P (XFRAME (x)), Qframe_live_p, x)
1230
1231 /* FOR_EACH_FRAME (LIST_VAR, FRAME_VAR) followed by a statement is a
1232 `for' loop which iterates over the elements of Vframe_list. The
1233 loop will set FRAME_VAR, a Lisp_Object, to each frame in
1234 Vframe_list in succession and execute the statement. LIST_VAR
1235 should be a Lisp_Object too; it is used to iterate through the
1236 Vframe_list. Note that this macro walks over child frames and
1237 the tooltip frame as well.
1238
1239 This macro is a holdover from a time when multiple frames weren't always
1240 supported. An alternate definition of the macro would expand to
1241 something which executes the statement once. */
1242 #define FOR_EACH_FRAME(list_var, frame_var) \
1243 for ((list_var) = Vframe_list; \
1244 (CONSP (list_var) \
1245 && (frame_var = XCAR (list_var), true)); \
1246 list_var = XCDR (list_var))
1247
1248 /* Reflect mouse movement when a complete frame update is performed. */
1249 #define FRAME_MOUSE_UPDATE(frame) \
1250 do { \
1251 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (frame); \
1252 if (frame == hlinfo->mouse_face_mouse_frame) \
1253 { \
1254 block_input (); \
1255 note_mouse_highlight (hlinfo->mouse_face_mouse_frame, \
1256 hlinfo->mouse_face_mouse_x, \
1257 hlinfo->mouse_face_mouse_y); \
1258 unblock_input (); \
1259 } \
1260 } while (false)
1261
1262 /* Handy macro to construct an argument to Fmodify_frame_parameters. */
1263 #define AUTO_FRAME_ARG(name, parameter, value) \
1264 AUTO_LIST1 (name, AUTO_CONS_EXPR (parameter, value))
1265
1266 /* False means there are no visible garbaged frames. */
1267 extern bool frame_garbaged;
1268
1269 /* Set visibility of frame F.
1270 We call redisplay_other_windows to make sure the frame gets redisplayed
1271 if some changes were applied to it while it wasn't visible (and hence
1272 wasn't redisplayed). */
1273 INLINE void
SET_FRAME_VISIBLE(struct frame * f,int v)1274 SET_FRAME_VISIBLE (struct frame *f, int v)
1275 {
1276 eassert (0 <= v && v <= 2);
1277 if (v)
1278 {
1279 if (v == 1 && f->visible != 1)
1280 redisplay_other_windows ();
1281 if (FRAME_GARBAGED_P (f))
1282 frame_garbaged = true;
1283 }
1284 f->visible = v;
1285 }
1286
1287 /* Set iconified status of frame F. */
1288 #define SET_FRAME_ICONIFIED(f, i) \
1289 (f)->iconified = (eassert (0 <= (i) && (i) <= 1), (i))
1290
1291 extern Lisp_Object selected_frame;
1292 extern Lisp_Object old_selected_frame;
1293
1294 extern int frame_default_tab_bar_height;
1295
1296 #ifndef HAVE_EXT_TOOL_BAR
1297 extern int frame_default_tool_bar_height;
1298 #endif
1299
1300 #ifdef HAVE_WINDOW_SYSTEM
1301 # define WINDOW_SYSTEM_RETURN
1302 #else
1303 # define WINDOW_SYSTEM_RETURN _Noreturn ATTRIBUTE_COLD
1304 #endif
1305
1306 extern WINDOW_SYSTEM_RETURN struct frame *
1307 decode_window_system_frame (Lisp_Object);
1308 extern struct frame *decode_live_frame (Lisp_Object);
1309 extern struct frame *decode_any_frame (Lisp_Object);
1310 extern struct frame *make_initial_frame (void);
1311 extern struct frame *make_frame (bool);
1312 #ifdef HAVE_WINDOW_SYSTEM
1313 extern struct frame *make_minibuffer_frame (void);
1314 extern struct frame *make_frame_without_minibuffer (Lisp_Object,
1315 struct kboard *,
1316 Lisp_Object);
1317 extern bool display_available (void);
1318 #endif
1319
1320 INLINE bool
window_system_available(struct frame * f)1321 window_system_available (struct frame *f)
1322 {
1323 #ifdef HAVE_WINDOW_SYSTEM
1324 return f ? FRAME_WINDOW_P (f) || FRAME_MSDOS_P (f) : display_available ();
1325 #else
1326 return false;
1327 #endif
1328 }
1329
1330 extern WINDOW_SYSTEM_RETURN void check_window_system (struct frame *);
1331 extern void frame_make_pointer_invisible (struct frame *);
1332 extern void frame_make_pointer_visible (struct frame *);
1333 extern Lisp_Object delete_frame (Lisp_Object, Lisp_Object);
1334 extern bool frame_inhibit_resize (struct frame *, bool, Lisp_Object);
1335 extern void adjust_frame_size (struct frame *, int, int, int, bool,
1336 Lisp_Object);
1337 extern Lisp_Object mouse_position (bool);
1338 extern int frame_windows_min_size (Lisp_Object, Lisp_Object, Lisp_Object,
1339 Lisp_Object);
1340 extern void frame_size_history_plain (struct frame *, Lisp_Object);
1341 extern void frame_size_history_extra (struct frame *, Lisp_Object,
1342 int, int, int, int, int, int);
1343 extern Lisp_Object Vframe_list;
1344
1345 /* Value is a pointer to the selected frame. If the selected frame
1346 isn't live, abort. */
1347
1348 #define SELECTED_FRAME() \
1349 ((FRAMEP (selected_frame) \
1350 && FRAME_LIVE_P (XFRAME (selected_frame))) \
1351 ? XFRAME (selected_frame) \
1352 : (emacs_abort (), (struct frame *) 0))
1353
1354
1355 /***********************************************************************
1356 Display-related Macros
1357 ***********************************************************************/
1358
1359 /* Canonical y-unit on frame F.
1360 This value currently equals the line height of the frame (which is
1361 the height of the default font of F). */
1362 #define FRAME_LINE_HEIGHT(F) ((F)->line_height)
1363
1364 /* Canonical x-unit on frame F.
1365 This value currently equals the average width of the default font of F. */
1366 #define FRAME_COLUMN_WIDTH(F) ((F)->column_width)
1367
1368 /* Get a frame's window system dimension. If no window system, this is 0. */
1369
1370 INLINE int
frame_dimension(int x)1371 frame_dimension (int x)
1372 {
1373 #ifdef HAVE_WINDOW_SYSTEM
1374 return x;
1375 #else
1376 return 0;
1377 #endif
1378 }
1379
1380 /* Total width of fringes reserved for drawing truncation bitmaps,
1381 continuation bitmaps and alike. The width is in canonical char
1382 units of the frame. This must currently be the case because window
1383 sizes aren't pixel values. If it weren't the case, we wouldn't be
1384 able to split windows horizontally nicely. */
1385 INLINE int
FRAME_FRINGE_COLS(struct frame * f)1386 FRAME_FRINGE_COLS (struct frame *f)
1387 {
1388 return frame_dimension (f->fringe_cols);
1389 }
1390
1391 /* Pixel-width of the left and right fringe. */
1392
1393 INLINE int
FRAME_LEFT_FRINGE_WIDTH(struct frame * f)1394 FRAME_LEFT_FRINGE_WIDTH (struct frame *f)
1395 {
1396 return frame_dimension (f->left_fringe_width);
1397 }
1398 INLINE int
FRAME_RIGHT_FRINGE_WIDTH(struct frame * f)1399 FRAME_RIGHT_FRINGE_WIDTH (struct frame *f)
1400 {
1401 return frame_dimension (f->right_fringe_width);
1402 }
1403
1404 /* Total width of fringes in pixels. */
1405
1406 INLINE int
FRAME_TOTAL_FRINGE_WIDTH(struct frame * f)1407 FRAME_TOTAL_FRINGE_WIDTH (struct frame *f)
1408 {
1409 return FRAME_LEFT_FRINGE_WIDTH (f) + FRAME_RIGHT_FRINGE_WIDTH (f);
1410 }
1411
1412 INLINE int
FRAME_CHILD_FRAME_BORDER_WIDTH(struct frame * f)1413 FRAME_CHILD_FRAME_BORDER_WIDTH (struct frame *f)
1414 {
1415 return frame_dimension (f->child_frame_border_width);
1416 }
1417
1418 /* Pixel-width of internal border. Uses child_frame_border_width for
1419 child frames if possible, and falls back on internal_border_width
1420 otherwise. */
1421 INLINE int
FRAME_INTERNAL_BORDER_WIDTH(struct frame * f)1422 FRAME_INTERNAL_BORDER_WIDTH (struct frame *f)
1423 {
1424 #ifdef HAVE_WINDOW_SYSTEM
1425 return (FRAME_PARENT_FRAME(f)
1426 ? (FRAME_CHILD_FRAME_BORDER_WIDTH(f) >= 0
1427 ? FRAME_CHILD_FRAME_BORDER_WIDTH(f)
1428 : frame_dimension (f->internal_border_width))
1429 : frame_dimension (f->internal_border_width));
1430 #else
1431 return frame_dimension (f->internal_border_width);
1432 #endif
1433 }
1434
1435 /* Pixel-size of window divider lines. */
1436 INLINE int
FRAME_RIGHT_DIVIDER_WIDTH(struct frame * f)1437 FRAME_RIGHT_DIVIDER_WIDTH (struct frame *f)
1438 {
1439 return frame_dimension (f->right_divider_width);
1440 }
1441
1442 INLINE int
FRAME_BOTTOM_DIVIDER_WIDTH(struct frame * f)1443 FRAME_BOTTOM_DIVIDER_WIDTH (struct frame *f)
1444 {
1445 return frame_dimension (f->bottom_divider_width);
1446 }
1447
1448 /* Return a non-null pointer to the cached face with ID on frame F. */
1449
1450 INLINE struct face *
FACE_FROM_ID(struct frame * f,int id)1451 FACE_FROM_ID (struct frame *f, int id)
1452 {
1453 eassert (0 <= id && id < FRAME_FACE_CACHE (f)->used);
1454 return FRAME_FACE_CACHE (f)->faces_by_id[id];
1455 }
1456
1457 /* Return a pointer to the face with ID on frame F, or null if such a
1458 face doesn't exist. */
1459
1460 INLINE struct face *
FACE_FROM_ID_OR_NULL(struct frame * f,int id)1461 FACE_FROM_ID_OR_NULL (struct frame *f, int id)
1462 {
1463 int used = FRAME_FACE_CACHE (f)->used;
1464 eassume (0 <= used);
1465 return 0 <= id && id < used ? FRAME_FACE_CACHE (f)->faces_by_id[id] : NULL;
1466 }
1467
1468 #ifdef HAVE_WINDOW_SYSTEM
1469
1470 /* A non-null pointer to the image with id ID on frame F. */
1471
1472 INLINE struct image *
IMAGE_FROM_ID(struct frame * f,int id)1473 IMAGE_FROM_ID (struct frame *f, int id)
1474 {
1475 eassert (0 <= id && id < FRAME_IMAGE_CACHE (f)->used);
1476 return FRAME_IMAGE_CACHE (f)->images[id];
1477 }
1478
1479 /* Value is a pointer to the image with id ID on frame F, or null if
1480 no image with that id exists. */
1481
1482 INLINE struct image *
IMAGE_OPT_FROM_ID(struct frame * f,int id)1483 IMAGE_OPT_FROM_ID (struct frame *f, int id)
1484 {
1485 int used = FRAME_IMAGE_CACHE (f)->used;
1486 eassume (0 <= used);
1487 return 0 <= id && id < used ? FRAME_IMAGE_CACHE (f)->images[id] : NULL;
1488 }
1489 #endif
1490
1491 /***********************************************************************
1492 Conversion between canonical units and pixels
1493 ***********************************************************************/
1494
1495 /* Canonical x-values are fractions of FRAME_COLUMN_WIDTH, canonical
1496 y-unit are fractions of FRAME_LINE_HEIGHT of a frame. Both are
1497 represented as Lisp numbers, i.e. integers or floats. */
1498
1499 /* Convert canonical value X to pixels. F is the frame whose
1500 canonical char width is to be used. X must be a Lisp integer or
1501 float. Value is a C integer. */
1502 #define FRAME_PIXEL_X_FROM_CANON_X(F, X) \
1503 ((int) (XFLOATINT (X) * FRAME_COLUMN_WIDTH (F)))
1504
1505 /* Convert canonical value Y to pixels. F is the frame whose
1506 canonical character height is to be used. X must be a Lisp integer
1507 or float. Value is a C integer. */
1508 #define FRAME_PIXEL_Y_FROM_CANON_Y(F, Y) \
1509 ((int) (XFLOATINT (Y) * FRAME_LINE_HEIGHT (F)))
1510
1511 /* Convert pixel-value X to canonical units. F is the frame whose
1512 canonical character width is to be used. X is a C integer. Result
1513 is a Lisp float if X is not a multiple of the canon width,
1514 otherwise it's a Lisp integer. */
1515 #define FRAME_CANON_X_FROM_PIXEL_X(F, X) \
1516 ((X) % FRAME_COLUMN_WIDTH (F) != 0 \
1517 ? make_float ((double) (X) / FRAME_COLUMN_WIDTH (F)) \
1518 : make_fixnum ((X) / FRAME_COLUMN_WIDTH (F)))
1519
1520 /* Convert pixel-value Y to canonical units. F is the frame whose
1521 canonical character height is to be used. Y is a C integer.
1522 Result is a Lisp float if Y is not a multiple of the canon width,
1523 otherwise it's a Lisp integer. */
1524 #define FRAME_CANON_Y_FROM_PIXEL_Y(F, Y) \
1525 ((Y) % FRAME_LINE_HEIGHT (F) \
1526 ? make_float ((double) (Y) / FRAME_LINE_HEIGHT (F)) \
1527 : make_fixnum ((Y) / FRAME_LINE_HEIGHT (F)))
1528
1529
1530
1531 /* Manipulating pixel sizes and character sizes.
1532 Knowledge of which factors affect the overall size of the window should
1533 be hidden in these macros, if that's possible.
1534
1535 Return the upper/left pixel position of the character cell on frame F
1536 at ROW/COL. */
1537 #define FRAME_LINE_TO_PIXEL_Y(f, row) \
1538 (((row) < FRAME_TOP_MARGIN (f) ? 0 : FRAME_INTERNAL_BORDER_WIDTH (f)) \
1539 + (row) * FRAME_LINE_HEIGHT (f))
1540
1541 #define FRAME_COL_TO_PIXEL_X(f, col) \
1542 (FRAME_INTERNAL_BORDER_WIDTH (f) \
1543 + (col) * FRAME_COLUMN_WIDTH (f))
1544
1545 /* Return the pixel width/height of frame F if it has
1546 COLS columns/LINES rows. */
1547 #define FRAME_TEXT_COLS_TO_PIXEL_WIDTH(f, cols) \
1548 ((cols) * FRAME_COLUMN_WIDTH (f) \
1549 + FRAME_SCROLL_BAR_AREA_WIDTH (f) \
1550 + FRAME_TOTAL_FRINGE_WIDTH (f) \
1551 + 2 * FRAME_INTERNAL_BORDER_WIDTH (f))
1552
1553 #define FRAME_TEXT_LINES_TO_PIXEL_HEIGHT(f, lines) \
1554 ((lines) * FRAME_LINE_HEIGHT (f) \
1555 + FRAME_TOP_MARGIN_HEIGHT (f) \
1556 + FRAME_SCROLL_BAR_AREA_HEIGHT (f) \
1557 + 2 * FRAME_INTERNAL_BORDER_WIDTH (f))
1558
1559 /* Return the row/column (zero-based) of the character cell containing
1560 the pixel on FRAME at Y/X. */
1561 #define FRAME_PIXEL_Y_TO_LINE(f, y) \
1562 (((y) < FRAME_TOP_MARGIN_HEIGHT (f) \
1563 ? (y) \
1564 : ((y) < (FRAME_TOP_MARGIN_HEIGHT (f) \
1565 + FRAME_INTERNAL_BORDER_WIDTH (f)) \
1566 ? (y) - (FRAME_TOP_MARGIN_HEIGHT (f) \
1567 + FRAME_INTERNAL_BORDER_WIDTH (f) \
1568 /* Arrange for the division to round down. */ \
1569 + FRAME_LINE_HEIGHT (f) - 1) \
1570 : (y) - FRAME_INTERNAL_BORDER_WIDTH (f))) \
1571 / FRAME_LINE_HEIGHT (f))
1572
1573 #define FRAME_PIXEL_X_TO_COL(f, x) \
1574 (((x) - FRAME_INTERNAL_BORDER_WIDTH (f)) \
1575 / FRAME_COLUMN_WIDTH (f))
1576
1577 /* How many columns/rows of text can we fit in WIDTH/HEIGHT pixels on
1578 frame F (so we round down)? */
1579 #define FRAME_PIXEL_WIDTH_TO_TEXT_COLS(f, width) \
1580 (((width) \
1581 - FRAME_TOTAL_FRINGE_WIDTH (f) \
1582 - FRAME_SCROLL_BAR_AREA_WIDTH (f) \
1583 - 2 * FRAME_INTERNAL_BORDER_WIDTH (f)) \
1584 / FRAME_COLUMN_WIDTH (f))
1585
1586 #define FRAME_PIXEL_HEIGHT_TO_TEXT_LINES(f, height) \
1587 (((height) \
1588 - FRAME_TOP_MARGIN_HEIGHT (f) \
1589 - FRAME_SCROLL_BAR_AREA_HEIGHT (f) \
1590 - 2 * FRAME_INTERNAL_BORDER_WIDTH (f)) \
1591 / FRAME_LINE_HEIGHT (f))
1592
1593 /* Return the pixel width/height of frame F with a text size of
1594 width/height. */
1595 #define FRAME_TEXT_TO_PIXEL_WIDTH(f, width) \
1596 ((width) \
1597 + FRAME_SCROLL_BAR_AREA_WIDTH (f) \
1598 + FRAME_TOTAL_FRINGE_WIDTH (f) \
1599 + 2 * FRAME_INTERNAL_BORDER_WIDTH (f))
1600
1601 #define FRAME_TEXT_TO_PIXEL_HEIGHT(f, height) \
1602 ((height) \
1603 + FRAME_TOP_MARGIN_HEIGHT (f) \
1604 + FRAME_SCROLL_BAR_AREA_HEIGHT (f) \
1605 + 2 * FRAME_INTERNAL_BORDER_WIDTH (f))
1606
1607 /* Return the text width/height of frame F with a pixel size of
1608 width/height. */
1609 #define FRAME_PIXEL_TO_TEXT_WIDTH(f, width) \
1610 ((width) \
1611 - FRAME_SCROLL_BAR_AREA_WIDTH (f) \
1612 - FRAME_TOTAL_FRINGE_WIDTH (f) \
1613 - 2 * FRAME_INTERNAL_BORDER_WIDTH (f))
1614
1615 #define FRAME_PIXEL_TO_TEXT_HEIGHT(f, height) \
1616 ((height) \
1617 - FRAME_TOP_MARGIN_HEIGHT (f) \
1618 - FRAME_SCROLL_BAR_AREA_HEIGHT (f) \
1619 - 2 * FRAME_INTERNAL_BORDER_WIDTH (f))
1620
1621 #define FRAME_INNER_WIDTH(f) \
1622 (FRAME_PIXEL_WIDTH (f) \
1623 - 2 * FRAME_INTERNAL_BORDER_WIDTH (f))
1624
1625 #define FRAME_INNER_HEIGHT(f) \
1626 (FRAME_PIXEL_HEIGHT (f) \
1627 - FRAME_TOP_MARGIN_HEIGHT (f) \
1628 - 2 * FRAME_INTERNAL_BORDER_WIDTH (f))
1629
1630 /* Value is the smallest width of any character in any font on frame F. */
1631 #define FRAME_SMALLEST_CHAR_WIDTH(f) \
1632 FRAME_DISPLAY_INFO (f)->smallest_char_width
1633
1634 /* Value is the smallest height of any font on frame F. */
1635 #define FRAME_SMALLEST_FONT_HEIGHT(f) \
1636 FRAME_DISPLAY_INFO (f)->smallest_font_height
1637
1638 /***********************************************************************
1639 Frame Parameters
1640 ***********************************************************************/
1641
1642 #ifdef HAVE_WINDOW_SYSTEM
1643
1644 /* The class of this X application. */
1645 #define EMACS_CLASS "Emacs"
1646
1647 extern void gui_set_frame_parameters (struct frame *, Lisp_Object);
1648 extern void gui_set_fullscreen (struct frame *, Lisp_Object, Lisp_Object);
1649 extern void gui_set_line_spacing (struct frame *, Lisp_Object, Lisp_Object);
1650 extern void gui_set_screen_gamma (struct frame *, Lisp_Object, Lisp_Object);
1651 extern void gui_set_font (struct frame *, Lisp_Object, Lisp_Object);
1652 extern void gui_set_font_backend (struct frame *, Lisp_Object, Lisp_Object);
1653 extern void gui_set_left_fringe (struct frame *, Lisp_Object, Lisp_Object);
1654 extern void gui_set_right_fringe (struct frame *, Lisp_Object, Lisp_Object);
1655 extern void gui_set_border_width (struct frame *, Lisp_Object, Lisp_Object);
1656 extern void gui_set_right_divider_width (struct frame *, Lisp_Object,
1657 Lisp_Object);
1658 extern void gui_set_bottom_divider_width (struct frame *, Lisp_Object,
1659 Lisp_Object);
1660 extern void gui_set_visibility (struct frame *, Lisp_Object, Lisp_Object);
1661 extern void gui_set_autoraise (struct frame *, Lisp_Object, Lisp_Object);
1662 extern void gui_set_autolower (struct frame *, Lisp_Object, Lisp_Object);
1663 extern void gui_set_unsplittable (struct frame *, Lisp_Object, Lisp_Object);
1664 extern void gui_set_vertical_scroll_bars (struct frame *, Lisp_Object, Lisp_Object);
1665 extern void gui_set_horizontal_scroll_bars (struct frame *, Lisp_Object, Lisp_Object);
1666 extern void gui_set_scroll_bar_width (struct frame *, Lisp_Object, Lisp_Object);
1667 extern void gui_set_scroll_bar_height (struct frame *, Lisp_Object, Lisp_Object);
1668
1669 extern long gui_figure_window_size (struct frame *, Lisp_Object, bool, bool);
1670
1671 extern void gui_set_alpha (struct frame *, Lisp_Object, Lisp_Object);
1672 extern void gui_set_no_special_glyphs (struct frame *, Lisp_Object, Lisp_Object);
1673
1674 extern void validate_x_resource_name (void);
1675
1676 extern Lisp_Object gui_display_get_resource (Display_Info *,
1677 Lisp_Object attribute,
1678 Lisp_Object class,
1679 Lisp_Object component,
1680 Lisp_Object subclass);
1681
1682 extern void set_frame_menubar (struct frame *f, bool deep_p);
1683 extern void frame_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y);
1684 extern void free_frame_menubar (struct frame *);
1685 extern bool frame_ancestor_p (struct frame *af, struct frame *df);
1686 extern enum internal_border_part frame_internal_border_part (struct frame *f, int x, int y);
1687
1688 #if defined HAVE_X_WINDOWS
1689 extern void x_wm_set_icon_position (struct frame *, int, int);
1690 #if !defined USE_X_TOOLKIT
1691 extern const char *x_get_resource_string (const char *, const char *);
1692 #endif
1693 extern void x_sync (struct frame *);
1694 #endif /* HAVE_X_WINDOWS */
1695
1696 #if !defined (HAVE_NS) && !defined (HAVE_PGTK)
1697
1698 /* Set F's bitmap icon, if specified among F's parameters. */
1699
1700 INLINE void
gui_set_bitmap_icon(struct frame * f)1701 gui_set_bitmap_icon (struct frame *f)
1702 {
1703 Lisp_Object obj = assq_no_quit (Qicon_type, f->param_alist);
1704
1705 if (CONSP (obj) && !NILP (XCDR (obj))
1706 && FRAME_TERMINAL (f)->set_bitmap_icon_hook)
1707 FRAME_TERMINAL (f)->set_bitmap_icon_hook (f, XCDR (obj));
1708 }
1709
1710 #endif /* !HAVE_NS */
1711 #endif /* HAVE_WINDOW_SYSTEM */
1712
1713 INLINE void
flush_frame(struct frame * f)1714 flush_frame (struct frame *f)
1715 {
1716 struct redisplay_interface *rif = FRAME_RIF (f);
1717
1718 if (rif && rif->flush_display)
1719 rif->flush_display (f);
1720 }
1721
1722 /***********************************************************************
1723 Multimonitor data
1724 ***********************************************************************/
1725
1726 #ifdef HAVE_WINDOW_SYSTEM
1727
1728 struct MonitorInfo {
1729 Emacs_Rectangle geom, work;
1730 int mm_width, mm_height;
1731 char *name;
1732 #ifdef HAVE_PGTK
1733 double scale_factor;
1734 #endif
1735 };
1736
1737 extern void free_monitors (struct MonitorInfo *monitors, int n_monitors);
1738 extern Lisp_Object make_monitor_attribute_list (struct MonitorInfo *monitors,
1739 int n_monitors,
1740 int primary_monitor,
1741 Lisp_Object monitor_frames,
1742 const char *source);
1743
1744 #endif /* HAVE_WINDOW_SYSTEM */
1745
1746
1747 INLINE_HEADER_END
1748
1749 /* Suppress -Wsuggest-attribute=const if there are no scroll bars.
1750 This is for functions like x_set_horizontal_scroll_bars that have
1751 no effect in this case. */
1752 #if ! USE_HORIZONTAL_SCROLL_BARS && GNUC_PREREQ (4, 6, 0)
1753 # pragma GCC diagnostic ignored "-Wsuggest-attribute=const"
1754 #endif
1755
1756 #endif /* not EMACS_FRAME_H */
1757