Bug#16045
[emacs.git] / src / frame.h
blob8369cf6b17e29b4df8e78b3eb12276dc24db4edb
1 /* Define frame-object for GNU Emacs.
2 Copyright (C) 1993-1994, 1999-2013 Free Software Foundation, Inc.
4 This file is part of GNU Emacs.
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
9 (at your option) any later version.
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.
16 You should have received a copy of the GNU General Public License
17 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19 /* Don't multiply include: dispextern.h includes macterm.h which
20 includes frame.h some emacs source includes both dispextern.h and
21 frame.h. */
23 #ifndef EMACS_FRAME_H
24 #define EMACS_FRAME_H
26 #include "dispextern.h"
27 #include "termhooks.h"
29 INLINE_HEADER_BEGIN
31 enum vertical_scroll_bar_type
33 vertical_scroll_bar_none,
34 vertical_scroll_bar_left,
35 vertical_scroll_bar_right
38 enum fullscreen_type
40 FULLSCREEN_NONE,
41 FULLSCREEN_WIDTH = 0x001,
42 FULLSCREEN_HEIGHT = 0x002,
43 FULLSCREEN_BOTH = 0x003,
44 FULLSCREEN_MAXIMIZED = 0x013,
45 FULLSCREEN_WAIT = 0x100
48 /* The structure representing a frame. */
50 struct frame
52 struct vectorlike_header header;
54 /* All Lisp_Object components must come first.
55 That ensures they are all aligned normally. */
57 /* Name of this frame: a Lisp string. It is used for looking up resources,
58 as well as for the title in some cases. */
59 Lisp_Object name;
61 /* The name to use for the icon, the last time
62 it was refreshed. nil means not explicitly specified. */
63 Lisp_Object icon_name;
65 /* This is the frame title specified explicitly, if any.
66 Usually it is nil. */
67 Lisp_Object title;
69 /* The frame which should receive keystrokes that occur in this
70 frame, or nil if they should go to the frame itself. This is
71 usually nil, but if the frame is minibufferless, we can use this
72 to redirect keystrokes to a surrogate minibuffer frame when
73 needed.
75 Note that a value of nil is different than having the field point
76 to the frame itself. Whenever the Fselect_frame function is used
77 to shift from one frame to the other, any redirections to the
78 original frame are shifted to the newly selected frame; if
79 focus_frame is nil, Fselect_frame will leave it alone. */
80 Lisp_Object focus_frame;
82 /* This frame's root window. Every frame has one.
83 If the frame has only a minibuffer window, this is it.
84 Otherwise, if the frame has a minibuffer window, this is its sibling. */
85 Lisp_Object root_window;
87 /* This frame's selected window.
88 Each frame has its own window hierarchy
89 and one of the windows in it is selected within the frame.
90 The selected window of the selected frame is Emacs's selected window. */
91 Lisp_Object selected_window;
93 /* This frame's minibuffer window.
94 Most frames have their own minibuffer windows,
95 but only the selected frame's minibuffer window
96 can actually appear to exist. */
97 Lisp_Object minibuffer_window;
99 /* Parameter alist of this frame.
100 These are the parameters specified when creating the frame
101 or modified with modify-frame-parameters. */
102 Lisp_Object param_alist;
104 /* List of scroll bars on this frame.
105 Actually, we don't specify exactly what is stored here at all; the
106 scroll bar implementation code can use it to store anything it likes.
107 This field is marked by the garbage collector. It is here
108 instead of in the `device' structure so that the garbage
109 collector doesn't need to look inside the window-system-dependent
110 structure. */
111 Lisp_Object scroll_bars;
112 Lisp_Object condemned_scroll_bars;
114 /* Vector describing the items to display in the menu bar.
115 Each item has four elements in this vector.
116 They are KEY, STRING, SUBMAP, and HPOS.
117 (HPOS is not used in when the X toolkit is in use.)
118 There are four additional elements of nil at the end, to terminate. */
119 Lisp_Object menu_bar_items;
121 /* Alist of elements (FACE-NAME . FACE-VECTOR-DATA). */
122 Lisp_Object face_alist;
124 /* A vector that records the entire structure of this frame's menu bar.
125 For the format of the data, see extensive comments in xmenu.c.
126 Only the X toolkit version uses this. */
127 Lisp_Object menu_bar_vector;
129 /* Predicate for selecting buffers for other-buffer. */
130 Lisp_Object buffer_predicate;
132 /* List of buffers viewed in this frame, for other-buffer. */
133 Lisp_Object buffer_list;
135 /* List of buffers that were viewed, then buried in this frame. The
136 most recently buried buffer is first. For last-buffer. */
137 Lisp_Object buried_buffer_list;
139 #if defined (HAVE_X_WINDOWS) && ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK)
140 /* A dummy window used to display menu bars under X when no X
141 toolkit support is available. */
142 Lisp_Object menu_bar_window;
143 #endif
145 #if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
146 /* A window used to display the tool-bar of a frame. */
147 Lisp_Object tool_bar_window;
149 /* Desired and current contents displayed in that window. */
150 Lisp_Object desired_tool_bar_string;
151 Lisp_Object current_tool_bar_string;
152 #endif
154 /* Desired and current tool-bar items. */
155 Lisp_Object tool_bar_items;
157 /* Where tool bar is, can be left, right, top or bottom. The native
158 tool bar only supports top. */
159 Lisp_Object tool_bar_position;
161 /* Beyond here, there should be no more Lisp_Object components. */
163 /* Cache of realized faces. */
164 struct face_cache *face_cache;
166 /* Number of elements in `menu_bar_vector' that have meaningful data. */
167 int menu_bar_items_used;
169 /* A buffer to hold the frame's name. We can't use the Lisp
170 string's pointer (`name', above) because it might get relocated. */
171 char *namebuf;
173 /* Glyph pool and matrix. */
174 struct glyph_pool *current_pool;
175 struct glyph_pool *desired_pool;
176 struct glyph_matrix *desired_matrix;
177 struct glyph_matrix *current_matrix;
179 /* 1 means that glyphs on this frame have been initialized so it can
180 be used for output. */
181 unsigned glyphs_initialized_p : 1;
183 /* Set to non-zero in change_frame_size when size of frame changed
184 Clear the frame in clear_garbaged_frames if set. */
185 unsigned resized_p : 1;
187 /* Set to non-zero if the default face for the frame has been
188 realized. Reset to zero whenever the default face changes.
189 Used to see the difference between a font change and face change. */
190 unsigned default_face_done_p : 1;
192 /* Set to non-zero if this frame has already been hscrolled during
193 current redisplay. */
194 unsigned already_hscrolled_p : 1;
196 /* Set to non-zero when current redisplay has updated frame. */
197 unsigned updated_p : 1;
199 #if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
200 /* Set to non-zero to minimize tool-bar height even when
201 auto-resize-tool-bar is set to grow-only. */
202 unsigned minimize_tool_bar_window_p : 1;
203 #endif
205 #if defined (USE_GTK) || defined (HAVE_NS)
206 /* Nonzero means using a tool bar that comes from the toolkit. */
207 unsigned external_tool_bar : 1;
208 #endif
210 /* Nonzero means that fonts have been loaded since the last glyph
211 matrix adjustments. */
212 unsigned fonts_changed : 1;
214 /* Nonzero means that cursor type has been changed. */
215 unsigned cursor_type_changed : 1;
217 /* True if it needs to be redisplayed. */
218 unsigned redisplay : 1;
220 /* Margin at the top of the frame. Used to display the tool-bar. */
221 int tool_bar_lines;
223 /* Pixel height of tool bar. */
224 int tool_bar_height;
226 int n_tool_bar_rows;
227 int n_tool_bar_items;
229 /* A buffer for decode_mode_line. */
230 char *decode_mode_spec_buffer;
232 /* See do_line_insertion_deletion_costs for info on these arrays. */
233 /* Cost of inserting 1 line on this frame. */
234 int *insert_line_cost;
235 /* Cost of deleting 1 line on this frame. */
236 int *delete_line_cost;
237 /* Cost of inserting n lines on this frame. */
238 int *insert_n_lines_cost;
239 /* Cost of deleting n lines on this frame. */
240 int *delete_n_lines_cost;
242 /* Text width of this frame (excluding fringes, scroll bars and
243 internal border width) and text height (excluding internal border
244 width) in units of canonical characters. */
245 int text_cols, text_lines;
247 /* Total width of this frame (including fringes and scroll bars) in
248 units of canonical characters. */
249 int total_cols;
251 /* Text width of this frame (excluding fringes, scroll bars and
252 internal border width) and text height (excluding internal border
253 width) in pixels. */
254 int text_width, text_height;
256 /* New text height and width for pending size change. 0 if no change
257 pending. These values represent pixels or canonical character units
258 according to the value of new_pixelwise and correlate to the the
259 text width/height of the frame. */
260 int new_width, new_height;
262 /* Whether new_height and new_width shall be interpreted
263 in pixels. */
264 bool new_pixelwise;
266 /* Pixel position of the frame window (x and y offsets in root window). */
267 int left_pos, top_pos;
269 /* Size of the frame window (including internal border widths) in
270 pixels. */
271 int pixel_width, pixel_height;
273 /* These many pixels are the difference between the outer window (i.e. the
274 left and top of the window manager decoration) and FRAME_X_WINDOW. */
275 int x_pixels_diff, y_pixels_diff;
277 /* This is the gravity value for the specified window position. */
278 int win_gravity;
280 /* The geometry flags for this window. */
281 int size_hint_flags;
283 /* Border width of the frame window as known by the (X) window system. */
284 int border_width;
286 /* Width of the internal border. This is a line of background color
287 just inside the window's border. When the frame is selected,
288 a highlighting is displayed inside the internal border. */
289 int internal_border_width;
291 /* Width of borders between this frame's windows. */
292 int right_divider_width;
293 int bottom_divider_width;
295 /* Canonical X unit. Width of default font, in pixels. */
296 int column_width;
298 /* Canonical Y unit. Height of a line, in pixels. */
299 int line_height;
301 /* The output method says how the contents of this frame are
302 displayed. It could be using termcap, or using an X window.
303 This must be the same as the terminal->type. */
304 enum output_method output_method;
306 /* The terminal device that this frame uses. If this is NULL, then
307 the frame has been deleted. */
308 struct terminal *terminal;
310 /* Device-dependent, frame-local auxiliary data used for displaying
311 the contents. When the frame is deleted, this data is deleted as
312 well. */
313 union output_data
315 struct tty_output *tty; /* From termchar.h. */
316 struct x_output *x; /* From xterm.h. */
317 struct w32_output *w32; /* From w32term.h. */
318 struct ns_output *ns; /* From nsterm.h. */
319 intptr_t nothing;
321 output_data;
323 /* List of font-drivers available on the frame. */
324 struct font_driver_list *font_driver_list;
325 /* List of data specific to font-driver and frame, but common to
326 faces. */
327 struct font_data_list *font_data_list;
329 /* Total width of fringes reserved for drawing truncation bitmaps,
330 continuation bitmaps and alike. The width is in canonical char
331 units of the frame. This must currently be the case because window
332 sizes aren't pixel values. If it weren't the case, we wouldn't be
333 able to split windows horizontally nicely. */
334 int fringe_cols;
336 /* The extra width (in pixels) currently allotted for fringes. */
337 int left_fringe_width, right_fringe_width;
339 /* See FULLSCREEN_ enum below. */
340 enum fullscreen_type want_fullscreen;
342 /* Number of lines of menu bar. */
343 int menu_bar_lines;
345 /* Pixel height of menubar. */
346 int menu_bar_height;
348 #if defined (HAVE_X_WINDOWS)
349 /* Used by x_wait_for_event when watching for an X event on this frame. */
350 int wait_event_type;
351 #endif
353 #if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) \
354 || defined (HAVE_NS) || defined (USE_GTK)
355 /* Nonzero means using a menu bar that comes from the X toolkit. */
356 unsigned external_menu_bar : 1;
357 #endif
359 /* Next two bitfields are mutually exclusive. They might both be
360 zero if the frame has been made invisible without an icon. */
362 /* Nonzero if the frame is currently displayed; we check
363 it to see if we should bother updating the frame's contents.
365 On ttys and on Windows NT/9X, to avoid wasting effort updating
366 visible frames that are actually completely obscured by other
367 windows on the display, we bend the meaning of visible slightly:
368 if equal to 2, then the frame is obscured - we still consider
369 it to be "visible" as seen from lisp, but we don't bother
370 updating it. */
371 unsigned visible : 2;
373 /* Nonzero if the frame is currently iconified. Do not
374 set this directly, use SET_FRAME_ICONIFIED instead. */
375 unsigned iconified : 1;
377 /* Nonzero if this frame should be redrawn. */
378 unsigned garbaged : 1;
380 /* 0 means, if this frame has just one window,
381 show no modeline for that window. */
382 unsigned wants_modeline : 1;
384 /* Non-0 means raise this frame to the top of the heap when selected. */
385 unsigned auto_raise : 1;
387 /* Non-0 means lower this frame to the bottom of the stack when left. */
388 unsigned auto_lower : 1;
390 /* True if frame's root window can't be split. */
391 unsigned no_split : 1;
393 /* If this is set, then Emacs won't change the frame name to indicate
394 the current buffer, etcetera. If the user explicitly sets the frame
395 name, this gets set. If the user sets the name to Qnil, this is
396 cleared. */
397 unsigned explicit_name : 1;
399 /* Nonzero if size of some window on this frame has changed. */
400 unsigned window_sizes_changed : 1;
402 /* Nonzero if the mouse has moved on this display device
403 since the last time we checked. */
404 unsigned mouse_moved : 1;
406 /* Nonzero means that the pointer is invisible. */
407 unsigned pointer_invisible : 1;
409 /* Nonzero means that all windows except mini-window and
410 selected window on this frame have frozen window starts. */
411 unsigned frozen_window_starts : 1;
413 /* Nonzero if we should actually display the scroll bars on this frame. */
414 enum vertical_scroll_bar_type vertical_scroll_bar_type;
416 /* What kind of text cursor should we draw in the future?
417 This should always be filled_box_cursor or bar_cursor. */
418 enum text_cursor_kinds desired_cursor;
420 /* Width of bar cursor (if we are using that). */
421 int cursor_width;
423 /* What kind of text cursor should we draw when the cursor blinks off?
424 This can be filled_box_cursor or bar_cursor or no_cursor. */
425 enum text_cursor_kinds blink_off_cursor;
427 /* Width of bar cursor (if we are using that) for blink-off state. */
428 int blink_off_cursor_width;
430 /* Configured width of the scroll bar, in pixels and in characters.
431 config_scroll_bar_cols tracks config_scroll_bar_width if the
432 latter is positive; a zero value in config_scroll_bar_width means
433 to compute the actual width on the fly, using config_scroll_bar_cols
434 and the current font width. */
435 int config_scroll_bar_width;
436 int config_scroll_bar_cols;
438 /* The size of the extra width currently allotted for vertical
439 scroll bars in this frame, in pixels. */
440 int scroll_bar_actual_width;
442 /* The baud rate that was used to calculate costs for this frame. */
443 int cost_calculation_baud_rate;
445 /* frame opacity
446 alpha[0]: alpha transparency of the active frame
447 alpha[1]: alpha transparency of inactive frames
448 Negative values mean not to change alpha. */
449 double alpha[2];
451 /* Exponent for gamma correction of colors. 1/(VIEWING_GAMMA *
452 SCREEN_GAMMA) where viewing_gamma is 0.4545 and SCREEN_GAMMA is a
453 frame parameter. 0 means don't do gamma correction. */
454 double gamma;
456 /* Additional space to put between text lines on this frame. */
457 int extra_line_spacing;
459 /* All display backends seem to need these two pixel values. */
460 unsigned long background_pixel;
461 unsigned long foreground_pixel;
464 /* Most code should use these functions to set Lisp fields in struct frame. */
466 INLINE void
467 fset_buffer_list (struct frame *f, Lisp_Object val)
469 f->buffer_list = val;
471 INLINE void
472 fset_buried_buffer_list (struct frame *f, Lisp_Object val)
474 f->buried_buffer_list = val;
476 INLINE void
477 fset_condemned_scroll_bars (struct frame *f, Lisp_Object val)
479 f->condemned_scroll_bars = val;
481 INLINE void
482 fset_face_alist (struct frame *f, Lisp_Object val)
484 f->face_alist = val;
486 INLINE void
487 fset_focus_frame (struct frame *f, Lisp_Object val)
489 f->focus_frame = val;
491 INLINE void
492 fset_icon_name (struct frame *f, Lisp_Object val)
494 f->icon_name = val;
496 INLINE void
497 fset_menu_bar_items (struct frame *f, Lisp_Object val)
499 f->menu_bar_items = val;
501 INLINE void
502 fset_menu_bar_vector (struct frame *f, Lisp_Object val)
504 f->menu_bar_vector = val;
506 #if defined (HAVE_X_WINDOWS) && ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK)
507 INLINE void
508 fset_menu_bar_window (struct frame *f, Lisp_Object val)
510 f->menu_bar_window = val;
512 #endif
513 INLINE void
514 fset_name (struct frame *f, Lisp_Object val)
516 f->name = val;
518 INLINE void
519 fset_param_alist (struct frame *f, Lisp_Object val)
521 f->param_alist = val;
523 INLINE void
524 fset_root_window (struct frame *f, Lisp_Object val)
526 f->root_window = val;
528 INLINE void
529 fset_scroll_bars (struct frame *f, Lisp_Object val)
531 f->scroll_bars = val;
533 INLINE void
534 fset_selected_window (struct frame *f, Lisp_Object val)
536 f->selected_window = val;
538 INLINE void
539 fset_title (struct frame *f, Lisp_Object val)
541 f->title = val;
543 INLINE void
544 fset_tool_bar_items (struct frame *f, Lisp_Object val)
546 f->tool_bar_items = val;
548 INLINE void
549 fset_tool_bar_position (struct frame *f, Lisp_Object val)
551 f->tool_bar_position = val;
553 #if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
554 INLINE void
555 fset_tool_bar_window (struct frame *f, Lisp_Object val)
557 f->tool_bar_window = val;
559 INLINE void
560 fset_current_tool_bar_string (struct frame *f, Lisp_Object val)
562 f->current_tool_bar_string = val;
564 INLINE void
565 fset_desired_tool_bar_string (struct frame *f, Lisp_Object val)
567 f->desired_tool_bar_string = val;
569 #endif /* HAVE_WINDOW_SYSTEM && !USE_GTK && !HAVE_NS */
571 #define NUMVAL(X) ((INTEGERP (X) || FLOATP (X)) ? XFLOATINT (X) : -1)
573 INLINE double
574 default_pixels_per_inch_x (void)
576 Lisp_Object v = (CONSP (Vdisplay_pixels_per_inch)
577 ? XCAR (Vdisplay_pixels_per_inch)
578 : Vdisplay_pixels_per_inch);
579 return NUMVAL (v) > 0 ? NUMVAL (v) : 72.0;
582 INLINE double
583 default_pixels_per_inch_y (void)
585 Lisp_Object v = (CONSP (Vdisplay_pixels_per_inch)
586 ? XCDR (Vdisplay_pixels_per_inch)
587 : Vdisplay_pixels_per_inch);
588 return NUMVAL (v) > 0 ? NUMVAL (v) : 72.0;
591 #define FRAME_KBOARD(f) ((f)->terminal->kboard)
593 /* Return a pointer to the image cache of frame F. */
594 #define FRAME_IMAGE_CACHE(F) ((F)->terminal->image_cache)
596 #define XFRAME(p) \
597 (eassert (FRAMEP (p)), (struct frame *) XUNTAG (p, Lisp_Vectorlike))
598 #define XSETFRAME(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_FRAME))
600 /* Given a window, return its frame as a Lisp_Object. */
601 #define WINDOW_FRAME(w) ((w)->frame)
603 /* Test a frame for particular kinds of display methods. */
604 #define FRAME_INITIAL_P(f) ((f)->output_method == output_initial)
605 #define FRAME_TERMCAP_P(f) ((f)->output_method == output_termcap)
606 #define FRAME_X_P(f) ((f)->output_method == output_x_window)
607 #ifndef HAVE_NTGUI
608 #define FRAME_W32_P(f) (0)
609 #else
610 #define FRAME_W32_P(f) ((f)->output_method == output_w32)
611 #endif
612 #ifndef MSDOS
613 #define FRAME_MSDOS_P(f) (0)
614 #else
615 #define FRAME_MSDOS_P(f) ((f)->output_method == output_msdos_raw)
616 #endif
617 #ifndef HAVE_NS
618 #define FRAME_NS_P(f) (0)
619 #else
620 #define FRAME_NS_P(f) ((f)->output_method == output_ns)
621 #endif
623 /* FRAME_WINDOW_P tests whether the frame is a window, and is
624 defined to be the predicate for the window system being used. */
626 #ifdef HAVE_X_WINDOWS
627 #define FRAME_WINDOW_P(f) FRAME_X_P (f)
628 #endif
629 #ifdef HAVE_NTGUI
630 #define FRAME_WINDOW_P(f) FRAME_W32_P (f)
631 #endif
632 #ifdef HAVE_NS
633 #define FRAME_WINDOW_P(f) FRAME_NS_P(f)
634 #endif
635 #ifndef FRAME_WINDOW_P
636 #define FRAME_WINDOW_P(f) ((void) (f), 0)
637 #endif
639 /* Dots per inch of the screen the frame F is on. */
641 #ifdef HAVE_WINDOW_SYSTEM
643 #define FRAME_RES_X(f) \
644 (eassert (FRAME_WINDOW_P (f)), FRAME_DISPLAY_INFO (f)->resx)
645 #define FRAME_RES_Y(f) \
646 (eassert (FRAME_WINDOW_P (f)), FRAME_DISPLAY_INFO (f)->resy)
648 #else /* !HAVE_WINDOW_SYSTEM */
650 /* Defaults when no window system available. */
652 #define FRAME_RES_X(f) default_pixels_per_inch_x ()
653 #define FRAME_RES_Y(f) default_pixels_per_inch_y ()
655 #endif /* HAVE_WINDOW_SYSTEM */
657 /* Return a pointer to the structure holding information about the
658 region of text, if any, that is currently shown in mouse-face on
659 frame F. We need to define two versions because a TTY-only build
660 does not have FRAME_DISPLAY_INFO. */
661 #ifdef HAVE_WINDOW_SYSTEM
662 # define MOUSE_HL_INFO(F) \
663 (FRAME_WINDOW_P(F) \
664 ? &FRAME_DISPLAY_INFO(F)->mouse_highlight \
665 : &(F)->output_data.tty->display_info->mouse_highlight)
666 #else
667 # define MOUSE_HL_INFO(F) \
668 (&(F)->output_data.tty->display_info->mouse_highlight)
669 #endif
671 /* Nonzero if frame F is still alive (not deleted). */
672 #define FRAME_LIVE_P(f) ((f)->terminal != 0)
674 /* Nonzero if frame F is a minibuffer-only frame. */
675 #define FRAME_MINIBUF_ONLY_P(f) \
676 EQ (FRAME_ROOT_WINDOW (f), FRAME_MINIBUF_WINDOW (f))
678 /* Nonzero if frame F contains it's own minibuffer window. Frame always has
679 minibuffer window, but it could use minibuffer window of another frame. */
680 #define FRAME_HAS_MINIBUF_P(f) \
681 (WINDOWP (f->minibuffer_window) \
682 && XFRAME (XWINDOW (f->minibuffer_window)->frame) == f)
684 /* Pixel width of frame F. */
685 #define FRAME_PIXEL_WIDTH(f) ((f)->pixel_width)
687 /* Pixel height of frame F, including non-toolkit menu bar and
688 non-toolkit tool bar lines. */
689 #define FRAME_PIXEL_HEIGHT(f) ((f)->pixel_height)
691 /* Width of frame F, measured in canonical character columns,
692 not including scroll bars if any. */
693 #define FRAME_COLS(f) (f)->text_cols
695 /* Height of frame F, measured in canonical lines, including
696 non-toolkit menu bar and non-toolkit tool bar lines. */
697 #define FRAME_LINES(f) (f)->text_lines
699 /* Width of frame F, measured in pixels not including the width for
700 fringes, scroll bar, and internal borders. */
701 #define FRAME_TEXT_WIDTH(f) (f)->text_width
703 /* Height of frame F, measured in pixels not including the height
704 for internal borders. */
705 #define FRAME_TEXT_HEIGHT(f) (f)->text_height
707 /* Number of lines of frame F used for menu bar.
708 This is relevant on terminal frames and on
709 X Windows when not using the X toolkit.
710 These lines are counted in FRAME_LINES. */
711 #define FRAME_MENU_BAR_LINES(f) (f)->menu_bar_lines
713 /* Pixel height of frame F's menu bar. */
714 #define FRAME_MENU_BAR_HEIGHT(f) (f)->menu_bar_height
716 /* Nonzero if this frame should display a tool bar
717 in a way that does not use any text lines. */
718 #if defined (USE_GTK) || defined (HAVE_NS)
719 #define FRAME_EXTERNAL_TOOL_BAR(f) (f)->external_tool_bar
720 #else
721 #define FRAME_EXTERNAL_TOOL_BAR(f) 0
722 #endif
724 /* Number of lines of frame F used for the tool-bar. */
725 #define FRAME_TOOL_BAR_LINES(f) (f)->tool_bar_lines
727 /* Pixel height of frame F's tool-bar. */
728 #define FRAME_TOOL_BAR_HEIGHT(f) (f)->tool_bar_height
730 /* Lines above the top-most window in frame F. */
731 #define FRAME_TOP_MARGIN(F) \
732 (FRAME_MENU_BAR_LINES (F) + FRAME_TOOL_BAR_LINES (F))
734 /* Pixel height of frame F's top margin. */
735 #define FRAME_TOP_MARGIN_HEIGHT(F) \
736 (FRAME_MENU_BAR_HEIGHT (F) + FRAME_TOOL_BAR_HEIGHT (F))
738 /* Nonzero if this frame should display a menu bar
739 in a way that does not use any text lines. */
740 #if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) \
741 || defined (HAVE_NS) || defined (USE_GTK)
742 #define FRAME_EXTERNAL_MENU_BAR(f) (f)->external_menu_bar
743 #else
744 #define FRAME_EXTERNAL_MENU_BAR(f) 0
745 #endif
746 #define FRAME_VISIBLE_P(f) (f)->visible
748 /* Nonzero if frame F is currently visible but hidden. */
749 #define FRAME_OBSCURED_P(f) ((f)->visible > 1)
751 /* Nonzero if frame F is currently iconified. */
752 #define FRAME_ICONIFIED_P(f) (f)->iconified
754 /* Mark frame F as currently garbaged. */
755 #define SET_FRAME_GARBAGED(f) \
756 (frame_garbaged = true, fset_redisplay (f), f->garbaged = true)
758 /* Nonzero if frame F is currently garbaged. */
759 #define FRAME_GARBAGED_P(f) (f)->garbaged
761 /* Nonzero means do not allow splitting this frame's window. */
762 #define FRAME_NO_SPLIT_P(f) (f)->no_split
764 /* Not really implemented. */
765 #define FRAME_WANTS_MODELINE_P(f) (f)->wants_modeline
767 /* Nonzero if all windows except selected window and mini window
768 are frozen on frame F. */
769 #define FRAME_WINDOWS_FROZEN(f) (f)->frozen_window_starts
771 /* Nonzero if a size change has been requested for frame F
772 but not yet really put into effect. This can be true temporarily
773 when an X event comes in at a bad time. */
774 #define FRAME_WINDOW_SIZES_CHANGED(f) (f)->window_sizes_changed
776 /* The minibuffer window of frame F, if it has one; otherwise nil. */
777 #define FRAME_MINIBUF_WINDOW(f) f->minibuffer_window
779 /* The root window of the window tree of frame F. */
780 #define FRAME_ROOT_WINDOW(f) f->root_window
782 /* The currently selected window of the window tree of frame F. */
783 #define FRAME_SELECTED_WINDOW(f) f->selected_window
785 #define FRAME_INSERT_COST(f) (f)->insert_line_cost
786 #define FRAME_DELETE_COST(f) (f)->delete_line_cost
787 #define FRAME_INSERTN_COST(f) (f)->insert_n_lines_cost
788 #define FRAME_DELETEN_COST(f) (f)->delete_n_lines_cost
789 #define FRAME_FOCUS_FRAME(f) f->focus_frame
791 /* This frame slot says whether scroll bars are currently enabled for frame F,
792 and which side they are on. */
793 #define FRAME_VERTICAL_SCROLL_BAR_TYPE(f) ((f)->vertical_scroll_bar_type)
794 #define FRAME_HAS_VERTICAL_SCROLL_BARS(f) \
795 ((f)->vertical_scroll_bar_type != vertical_scroll_bar_none)
796 #define FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT(f) \
797 ((f)->vertical_scroll_bar_type == vertical_scroll_bar_left)
798 #define FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT(f) \
799 ((f)->vertical_scroll_bar_type == vertical_scroll_bar_right)
801 /* Width that a scroll bar in frame F should have, if there is one.
802 Measured in pixels.
803 If scroll bars are turned off, this is still nonzero. */
804 #define FRAME_CONFIG_SCROLL_BAR_WIDTH(f) ((f)->config_scroll_bar_width)
806 /* Width that a scroll bar in frame F should have, if there is one.
807 Measured in columns (characters).
808 If scroll bars are turned off, this is still nonzero. */
809 #define FRAME_CONFIG_SCROLL_BAR_COLS(f) ((f)->config_scroll_bar_cols)
811 /* Width of a scroll bar in frame F, measured in columns (characters),
812 but only if scroll bars are on the left. If scroll bars are on
813 the right in this frame, or there are no scroll bars, value is 0. */
815 #define FRAME_LEFT_SCROLL_BAR_COLS(f) \
816 (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f) \
817 ? FRAME_CONFIG_SCROLL_BAR_COLS (f) \
818 : 0)
820 /* Width of a left scroll bar in frame F, measured in pixels */
822 #define FRAME_LEFT_SCROLL_BAR_AREA_WIDTH(f) \
823 (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f) \
824 ? FRAME_CONFIG_SCROLL_BAR_WIDTH (f) \
825 : 0)
827 /* Width of a scroll bar in frame F, measured in columns (characters),
828 but only if scroll bars are on the right. If scroll bars are on
829 the left in this frame, or there are no scroll bars, value is 0. */
831 #define FRAME_RIGHT_SCROLL_BAR_COLS(f) \
832 (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f) \
833 ? FRAME_CONFIG_SCROLL_BAR_COLS (f) \
834 : 0)
836 /* Width of a right scroll bar area in frame F, measured in pixels */
838 #define FRAME_RIGHT_SCROLL_BAR_AREA_WIDTH(f) \
839 (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f) \
840 ? FRAME_CONFIG_SCROLL_BAR_WIDTH (f) \
841 : 0)
843 /* Actual width of a scroll bar in frame F, measured in columns. */
845 #define FRAME_SCROLL_BAR_COLS(f) \
846 (FRAME_HAS_VERTICAL_SCROLL_BARS (f) \
847 ? FRAME_CONFIG_SCROLL_BAR_COLS (f) \
848 : 0)
850 /* Actual width of a scroll bar area in frame F, measured in pixels. */
852 #define FRAME_SCROLL_BAR_AREA_WIDTH(f) \
853 (FRAME_HAS_VERTICAL_SCROLL_BARS (f) \
854 ? FRAME_CONFIG_SCROLL_BAR_WIDTH (f) \
855 : 0)
857 /* Total width of frame F, in columns (characters),
858 including the width used by scroll bars if any. */
859 #define FRAME_TOTAL_COLS(f) ((f)->total_cols)
861 /* Set the character widths of frame F. WIDTH specifies a nominal
862 character text width. */
863 #define SET_FRAME_COLS(f, width) \
864 ((f)->text_cols = (width), \
865 (f)->total_cols = ((width) \
866 + FRAME_SCROLL_BAR_COLS (f) \
867 + FRAME_FRINGE_COLS (f)))
869 /* Set the pixel widths of frame F. WIDTH specifies a nominal pixel
870 text width. */
871 #define SET_FRAME_WIDTH(f, width) \
872 ((f)->text_width = (width), \
873 (f)->pixel_width = ((width) \
874 + FRAME_SCROLL_BAR_AREA_WIDTH (f) \
875 + FRAME_TOTAL_FRINGE_WIDTH (f) \
876 + 2 * FRAME_INTERNAL_BORDER_WIDTH (f)))
878 /* Set the pixel heights of frame F. HEIGHT specifies a nominal pixel
879 text width. */
880 #define SET_FRAME_HEIGHT(f, height) \
881 ((f)->text_height = (height), \
882 (f)->pixel_height = ((height) \
883 + 2 * FRAME_INTERNAL_BORDER_WIDTH (f)))
885 /* Maximum + 1 legitimate value for FRAME_CURSOR_X. */
887 #define FRAME_CURSOR_X_LIMIT(f) \
888 (FRAME_COLS (f) + FRAME_LEFT_SCROLL_BAR_COLS (f))
890 /* Nonzero if frame F has scroll bars. */
892 #define FRAME_SCROLL_BARS(f) (f->scroll_bars)
894 #define FRAME_CONDEMNED_SCROLL_BARS(f) (f->condemned_scroll_bars)
895 #define FRAME_MENU_BAR_ITEMS(f) (f->menu_bar_items)
896 #define FRAME_COST_BAUD_RATE(f) ((f)->cost_calculation_baud_rate)
898 #define FRAME_DESIRED_CURSOR(f) ((f)->desired_cursor)
899 #define FRAME_BLINK_OFF_CURSOR(f) ((f)->blink_off_cursor)
900 #define FRAME_CURSOR_WIDTH(f) ((f)->cursor_width)
901 #define FRAME_BLINK_OFF_CURSOR_WIDTH(f) ((f)->blink_off_cursor_width)
903 #define FRAME_FOREGROUND_PIXEL(f) ((f)->foreground_pixel)
904 #define FRAME_BACKGROUND_PIXEL(f) ((f)->background_pixel)
906 /* Return a pointer to the face cache of frame F. */
908 #define FRAME_FACE_CACHE(F) (F)->face_cache
910 /* Return the size of message_buf of the frame F. We multiply the
911 width of the frame by 4 because multi-byte form may require at most
912 4-byte for a character. */
914 #define FRAME_MESSAGE_BUF_SIZE(f) (((int) FRAME_COLS (f)) * 4)
916 #define CHECK_FRAME(x) \
917 CHECK_TYPE (FRAMEP (x), Qframep, x)
919 #define CHECK_LIVE_FRAME(x) \
920 CHECK_TYPE (FRAMEP (x) && FRAME_LIVE_P (XFRAME (x)), Qframe_live_p, x)
922 /* FOR_EACH_FRAME (LIST_VAR, FRAME_VAR) followed by a statement is a
923 `for' loop which iterates over the elements of Vframe_list. The
924 loop will set FRAME_VAR, a Lisp_Object, to each frame in
925 Vframe_list in succession and execute the statement. LIST_VAR
926 should be a Lisp_Object too; it is used to iterate through the
927 Vframe_list.
929 This macro is a holdover from a time when multiple frames weren't always
930 supported. An alternate definition of the macro would expand to
931 something which executes the statement once. */
933 #define FOR_EACH_FRAME(list_var, frame_var) \
934 for ((list_var) = Vframe_list; \
935 (CONSP (list_var) \
936 && (frame_var = XCAR (list_var), 1)); \
937 list_var = XCDR (list_var))
939 /* Reflect mouse movement when a complete frame update is performed. */
941 #define FRAME_MOUSE_UPDATE(frame) \
942 do { \
943 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (frame); \
944 if (frame == hlinfo->mouse_face_mouse_frame) \
946 block_input (); \
947 note_mouse_highlight (hlinfo->mouse_face_mouse_frame, \
948 hlinfo->mouse_face_mouse_x, \
949 hlinfo->mouse_face_mouse_y); \
950 unblock_input (); \
952 } while (0)
954 /* Set visibility of frame F.
955 We call redisplay_other_windows to make sure the frame gets redisplayed
956 if some changes were applied to it while it wasn't visible (and hence
957 wasn't redisplayed). */
959 #define SET_FRAME_VISIBLE(f, v) \
960 (((f)->visible == 0 || ((f)->visible == 2)) && ((v) == 1) \
961 ? redisplay_other_windows () : 0, \
962 (f)->visible = (eassert (0 <= (v) && (v) <= 2), (v)))
964 /* Set iconify of frame F. */
966 #define SET_FRAME_ICONIFIED(f, i) \
967 (f)->iconified = (eassert (0 <= (i) && (i) <= 1), (i))
969 extern Lisp_Object selected_frame;
970 extern Lisp_Object Qframep, Qframe_live_p;
971 extern Lisp_Object Qtty, Qtty_type;
972 extern Lisp_Object Qtty_color_mode;
973 extern Lisp_Object Qterminal;
974 extern Lisp_Object Qnoelisp;
976 /* Nonzero means there is at least one garbaged frame. */
977 extern bool frame_garbaged;
979 extern void set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object);
980 extern struct frame *decode_window_system_frame (Lisp_Object);
981 extern struct frame *decode_live_frame (Lisp_Object);
982 extern struct frame *decode_any_frame (Lisp_Object);
983 extern struct frame *make_initial_frame (void);
984 extern struct frame *make_frame (bool);
985 #ifdef HAVE_WINDOW_SYSTEM
986 extern struct frame *make_minibuffer_frame (void);
987 extern struct frame *make_frame_without_minibuffer (Lisp_Object,
988 struct kboard *,
989 Lisp_Object);
990 #endif /* HAVE_WINDOW_SYSTEM */
991 extern bool window_system_available (struct frame *);
992 extern void check_window_system (struct frame *);
993 extern void frame_make_pointer_invisible (void);
994 extern void frame_make_pointer_visible (void);
995 extern Lisp_Object delete_frame (Lisp_Object, Lisp_Object);
997 extern Lisp_Object Vframe_list;
999 /* Value is a pointer to the selected frame. If the selected frame
1000 isn't live, abort. */
1002 #define SELECTED_FRAME() \
1003 ((FRAMEP (selected_frame) \
1004 && FRAME_LIVE_P (XFRAME (selected_frame))) \
1005 ? XFRAME (selected_frame) \
1006 : (emacs_abort (), (struct frame *) 0))
1009 /***********************************************************************
1010 Display-related Macros
1011 ***********************************************************************/
1013 /* Canonical y-unit on frame F.
1014 This value currently equals the line height of the frame (which is
1015 the height of the default font of F). */
1017 #define FRAME_LINE_HEIGHT(F) ((F)->line_height)
1019 /* Canonical x-unit on frame F.
1020 This value currently equals the average width of the default font of F. */
1022 #define FRAME_COLUMN_WIDTH(F) ((F)->column_width)
1024 /* Pixel width of areas used to display truncation marks, continuation
1025 marks, overlay arrows. This is 0 for terminal frames. */
1027 #ifdef HAVE_WINDOW_SYSTEM
1029 /* Total width of fringes reserved for drawing truncation bitmaps,
1030 continuation bitmaps and alike. The width is in canonical char
1031 units of the frame. This must currently be the case because window
1032 sizes aren't pixel values. If it weren't the case, we wouldn't be
1033 able to split windows horizontally nicely. */
1035 #define FRAME_FRINGE_COLS(F) ((F)->fringe_cols)
1037 /* Pixel-width of the left and right fringe. */
1039 #define FRAME_LEFT_FRINGE_WIDTH(F) ((F)->left_fringe_width)
1040 #define FRAME_RIGHT_FRINGE_WIDTH(F) ((F)->right_fringe_width)
1042 /* Total width of fringes in pixels. */
1044 #define FRAME_TOTAL_FRINGE_WIDTH(F) \
1045 (FRAME_LEFT_FRINGE_WIDTH (F) + FRAME_RIGHT_FRINGE_WIDTH (F))
1047 /* Pixel-width of internal border lines */
1048 #define FRAME_INTERNAL_BORDER_WIDTH(F) ((F)->internal_border_width)
1050 /* Pixel-size of window border lines */
1051 #define FRAME_RIGHT_DIVIDER_WIDTH(F) ((F)->right_divider_width)
1052 #define FRAME_BOTTOM_DIVIDER_WIDTH(F) ((F)->bottom_divider_width)
1054 #else /* not HAVE_WINDOW_SYSTEM */
1056 #define FRAME_FRINGE_COLS(F) 0
1057 #define FRAME_TOTAL_FRINGE_WIDTH(F) 0
1058 #define FRAME_LEFT_FRINGE_WIDTH(F) 0
1059 #define FRAME_RIGHT_FRINGE_WIDTH(F) 0
1060 #define FRAME_INTERNAL_BORDER_WIDTH(F) 0
1061 #define FRAME_RIGHT_DIVIDER_WIDTH(F) 0
1062 #define FRAME_BOTTOM_DIVIDER_WIDTH(F) 0
1064 #endif /* not HAVE_WINDOW_SYSTEM */
1066 /***********************************************************************
1067 Conversion between canonical units and pixels
1068 ***********************************************************************/
1070 /* Canonical x-values are fractions of FRAME_COLUMN_WIDTH, canonical
1071 y-unit are fractions of FRAME_LINE_HEIGHT of a frame. Both are
1072 represented as Lisp numbers, i.e. integers or floats. */
1074 /* Convert canonical value X to pixels. F is the frame whose
1075 canonical char width is to be used. X must be a Lisp integer or
1076 float. Value is a C integer. */
1078 #define FRAME_PIXEL_X_FROM_CANON_X(F, X) \
1079 (INTEGERP (X) \
1080 ? XINT (X) * FRAME_COLUMN_WIDTH (F) \
1081 : (int) (XFLOAT_DATA (X) * FRAME_COLUMN_WIDTH (F)))
1083 /* Convert canonical value Y to pixels. F is the frame whose
1084 canonical character height is to be used. X must be a Lisp integer
1085 or float. Value is a C integer. */
1087 #define FRAME_PIXEL_Y_FROM_CANON_Y(F, Y) \
1088 (INTEGERP (Y) \
1089 ? XINT (Y) * FRAME_LINE_HEIGHT (F) \
1090 : (int) (XFLOAT_DATA (Y) * FRAME_LINE_HEIGHT (F)))
1092 /* Convert pixel-value X to canonical units. F is the frame whose
1093 canonical character width is to be used. X is a C integer. Result
1094 is a Lisp float if X is not a multiple of the canon width,
1095 otherwise it's a Lisp integer. */
1097 #define FRAME_CANON_X_FROM_PIXEL_X(F, X) \
1098 ((X) % FRAME_COLUMN_WIDTH (F) != 0 \
1099 ? make_float ((double) (X) / FRAME_COLUMN_WIDTH (F)) \
1100 : make_number ((X) / FRAME_COLUMN_WIDTH (F)))
1102 /* Convert pixel-value Y to canonical units. F is the frame whose
1103 canonical character height is to be used. Y is a C integer.
1104 Result is a Lisp float if Y is not a multiple of the canon width,
1105 otherwise it's a Lisp integer. */
1107 #define FRAME_CANON_Y_FROM_PIXEL_Y(F, Y) \
1108 ((Y) % FRAME_LINE_HEIGHT (F) \
1109 ? make_float ((double) (Y) / FRAME_LINE_HEIGHT (F)) \
1110 : make_number ((Y) / FRAME_LINE_HEIGHT (F)))
1114 /* Manipulating pixel sizes and character sizes.
1115 Knowledge of which factors affect the overall size of the window should
1116 be hidden in these macros, if that's possible.
1118 Return the upper/left pixel position of the character cell on frame F
1119 at ROW/COL. */
1121 #define FRAME_LINE_TO_PIXEL_Y(f, row) \
1122 (((row) < FRAME_TOP_MARGIN (f) ? 0 : FRAME_INTERNAL_BORDER_WIDTH (f)) \
1123 + (row) * FRAME_LINE_HEIGHT (f))
1125 #define FRAME_COL_TO_PIXEL_X(f, col) \
1126 (FRAME_INTERNAL_BORDER_WIDTH (f) \
1127 + (col) * FRAME_COLUMN_WIDTH (f))
1129 /* Return the pixel width/height of frame F if it has
1130 COLS columns/LINES rows. */
1132 #define FRAME_TEXT_COLS_TO_PIXEL_WIDTH(f, cols) \
1133 (FRAME_COL_TO_PIXEL_X (f, cols) \
1134 + FRAME_SCROLL_BAR_AREA_WIDTH (f) \
1135 + FRAME_TOTAL_FRINGE_WIDTH (f) \
1136 + FRAME_INTERNAL_BORDER_WIDTH (f))
1138 #define FRAME_TEXT_LINES_TO_PIXEL_HEIGHT(f, lines) \
1139 ((lines) * FRAME_LINE_HEIGHT (f) \
1140 + 2 * FRAME_INTERNAL_BORDER_WIDTH (f))
1142 /* Return the row/column (zero-based) of the character cell containing
1143 the pixel on FRAME at Y/X. */
1145 #define FRAME_PIXEL_Y_TO_LINE(f, y) \
1146 (((y) < FRAME_TOP_MARGIN_HEIGHT (f) \
1147 ? (y) \
1148 : ((y) < FRAME_TOP_MARGIN_HEIGHT (f) + FRAME_INTERNAL_BORDER_WIDTH (f) \
1149 ? (y) - (FRAME_TOP_MARGIN_HEIGHT (f) + FRAME_INTERNAL_BORDER_WIDTH (f) \
1150 /* Arrange for the division to round down. */ \
1151 + FRAME_LINE_HEIGHT (f) - 1) \
1152 : (y) - FRAME_INTERNAL_BORDER_WIDTH (f))) \
1153 / FRAME_LINE_HEIGHT (f))
1155 #define FRAME_PIXEL_X_TO_COL(f, x) \
1156 (((x) - FRAME_INTERNAL_BORDER_WIDTH (f)) \
1157 / FRAME_COLUMN_WIDTH (f))
1159 /* How many columns/rows of text can we fit in WIDTH/HEIGHT pixels on
1160 frame F? */
1162 #define FRAME_PIXEL_WIDTH_TO_TEXT_COLS(f, width) \
1163 (FRAME_PIXEL_X_TO_COL (f, ((width) \
1164 - FRAME_INTERNAL_BORDER_WIDTH (f) \
1165 - FRAME_TOTAL_FRINGE_WIDTH (f) \
1166 - FRAME_SCROLL_BAR_AREA_WIDTH (f)))) \
1168 #define FRAME_PIXEL_HEIGHT_TO_TEXT_LINES(f, height) \
1169 (FRAME_PIXEL_Y_TO_LINE (f, ((height) \
1170 - FRAME_INTERNAL_BORDER_WIDTH (f))))
1172 /* Return the pixel width/height of frame F with a text size of
1173 width/height. */
1175 #define FRAME_TEXT_TO_PIXEL_WIDTH(f, width) \
1176 ((width) \
1177 + FRAME_SCROLL_BAR_AREA_WIDTH (f) \
1178 + FRAME_TOTAL_FRINGE_WIDTH (f) \
1179 + 2 * FRAME_INTERNAL_BORDER_WIDTH (f))
1181 #define FRAME_TEXT_TO_PIXEL_HEIGHT(f, height) \
1182 ((height) + 2 * FRAME_INTERNAL_BORDER_WIDTH (f))
1184 /* Return the text width/height of frame F with a pixel size of
1185 width/height. */
1187 #define FRAME_PIXEL_TO_TEXT_WIDTH(f, width) \
1188 ((width) \
1189 - FRAME_SCROLL_BAR_AREA_WIDTH (f) \
1190 - FRAME_TOTAL_FRINGE_WIDTH (f) \
1191 - 2 * FRAME_INTERNAL_BORDER_WIDTH (f))
1193 #define FRAME_PIXEL_TO_TEXT_HEIGHT(f, height) \
1194 ((height) - 2 * FRAME_INTERNAL_BORDER_WIDTH (f))
1196 /* Value is the smallest width of any character in any font on frame F. */
1198 #define FRAME_SMALLEST_CHAR_WIDTH(f) \
1199 FRAME_DISPLAY_INFO (f)->smallest_char_width
1201 /* Value is the smallest height of any font on frame F. */
1203 #define FRAME_SMALLEST_FONT_HEIGHT(f) \
1204 FRAME_DISPLAY_INFO (f)->smallest_font_height
1206 /***********************************************************************
1207 Frame Parameters
1208 ***********************************************************************/
1210 extern Lisp_Object Qauto_raise, Qauto_lower;
1211 extern Lisp_Object Qborder_color, Qborder_width;
1212 extern Lisp_Object Qbuffer_predicate;
1213 extern Lisp_Object Qcursor_color, Qcursor_type;
1214 extern Lisp_Object Qfont;
1215 extern Lisp_Object Qbackground_color, Qforeground_color;
1216 extern Lisp_Object Qicon, Qicon_name, Qicon_type, Qicon_left, Qicon_top;
1217 extern Lisp_Object Qinternal_border_width;
1218 extern Lisp_Object Qright_divider_width, Qbottom_divider_width;
1219 extern Lisp_Object Qtooltip;
1220 extern Lisp_Object Qmenu_bar_lines, Qtool_bar_lines, Qtool_bar_position;
1221 extern Lisp_Object Qmouse_color;
1222 extern Lisp_Object Qname, Qtitle;
1223 extern Lisp_Object Qparent_id;
1224 extern Lisp_Object Qunsplittable, Qvisibility;
1225 extern Lisp_Object Qscroll_bar_width, Qvertical_scroll_bars;
1226 extern Lisp_Object Qscroll_bar_foreground, Qscroll_bar_background;
1227 extern Lisp_Object Qscreen_gamma;
1228 extern Lisp_Object Qline_spacing;
1229 extern Lisp_Object Qwait_for_wm;
1230 extern Lisp_Object Qfullscreen;
1231 extern Lisp_Object Qfullwidth, Qfullheight, Qfullboth, Qmaximized;
1232 extern Lisp_Object Qsticky;
1233 extern Lisp_Object Qfont_backend;
1234 extern Lisp_Object Qalpha;
1236 extern Lisp_Object Qleft_fringe, Qright_fringe;
1237 extern Lisp_Object Qheight, Qwidth;
1238 extern Lisp_Object Qminibuffer, Qmodeline;
1239 extern Lisp_Object Qx, Qw32, Qpc, Qns;
1240 extern Lisp_Object Qvisible;
1241 extern Lisp_Object Qdisplay_type;
1243 extern Lisp_Object Qx_resource_name;
1245 extern Lisp_Object Qleft, Qright, Qtop, Qbox, Qbottom;
1246 extern Lisp_Object Qdisplay;
1248 extern Lisp_Object Qrun_hook_with_args;
1250 #ifdef HAVE_WINDOW_SYSTEM
1252 /* The class of this X application. */
1253 #define EMACS_CLASS "Emacs"
1255 /* These are in xterm.c, w32term.c, etc. */
1257 extern void x_set_scroll_bar_default_width (struct frame *);
1258 extern void x_set_offset (struct frame *, int, int, int);
1259 extern void x_wm_set_size_hint (struct frame *f, long flags, bool user_position);
1261 extern Lisp_Object x_new_font (struct frame *, Lisp_Object, int);
1264 extern Lisp_Object Qface_set_after_frame_default;
1266 #ifdef HAVE_NTGUI
1267 extern void x_fullscreen_adjust (struct frame *f, int *, int *,
1268 int *, int *);
1269 #endif
1271 extern void x_set_frame_parameters (struct frame *, Lisp_Object);
1273 extern void x_set_fullscreen (struct frame *, Lisp_Object, Lisp_Object);
1274 extern void x_set_line_spacing (struct frame *, Lisp_Object, Lisp_Object);
1275 extern void x_set_screen_gamma (struct frame *, Lisp_Object, Lisp_Object);
1276 extern void x_set_font (struct frame *, Lisp_Object, Lisp_Object);
1277 extern void x_set_font_backend (struct frame *, Lisp_Object, Lisp_Object);
1278 extern void x_set_fringe_width (struct frame *, Lisp_Object, Lisp_Object);
1279 extern void x_set_border_width (struct frame *, Lisp_Object, Lisp_Object);
1280 extern void x_set_internal_border_width (struct frame *, Lisp_Object,
1281 Lisp_Object);
1282 extern void x_set_right_divider_width (struct frame *, Lisp_Object,
1283 Lisp_Object);
1284 extern void x_set_bottom_divider_width (struct frame *, Lisp_Object,
1285 Lisp_Object);
1286 extern void x_set_visibility (struct frame *, Lisp_Object, Lisp_Object);
1287 extern void x_set_autoraise (struct frame *, Lisp_Object, Lisp_Object);
1288 extern void x_set_autolower (struct frame *, Lisp_Object, Lisp_Object);
1289 extern void x_set_unsplittable (struct frame *, Lisp_Object, Lisp_Object);
1290 extern void x_set_vertical_scroll_bars (struct frame *, Lisp_Object,
1291 Lisp_Object);
1292 extern void x_set_scroll_bar_width (struct frame *, Lisp_Object,
1293 Lisp_Object);
1295 extern long x_figure_window_size (struct frame *, Lisp_Object, bool);
1297 extern void x_set_alpha (struct frame *, Lisp_Object, Lisp_Object);
1299 extern void validate_x_resource_name (void);
1301 extern Lisp_Object display_x_get_resource (Display_Info *,
1302 Lisp_Object attribute,
1303 Lisp_Object class,
1304 Lisp_Object component,
1305 Lisp_Object subclass);
1307 extern void set_frame_menubar (struct frame *f, bool first_time, bool deep_p);
1308 extern void x_set_window_size (struct frame *f, int change_grav,
1309 int width, int height, bool pixelwise);
1310 extern Lisp_Object x_get_focus_frame (struct frame *);
1311 extern void x_set_mouse_position (struct frame *f, int h, int v);
1312 extern void x_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y);
1313 extern void x_make_frame_visible (struct frame *f);
1314 extern void x_make_frame_invisible (struct frame *f);
1315 extern void x_iconify_frame (struct frame *f);
1316 extern void x_set_frame_alpha (struct frame *f);
1317 extern void x_set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object);
1318 extern void x_set_tool_bar_lines (struct frame *, Lisp_Object, Lisp_Object);
1319 extern void x_activate_menubar (struct frame *);
1320 extern void x_real_positions (struct frame *, int *, int *);
1321 extern void free_frame_menubar (struct frame *);
1322 extern void x_free_frame_resources (struct frame *);
1324 #if defined HAVE_X_WINDOWS
1325 extern void x_wm_set_icon_position (struct frame *, int, int);
1326 #if !defined USE_X_TOOLKIT
1327 extern char *x_get_resource_string (const char *, const char *);
1328 #endif
1329 extern void x_sync (struct frame *);
1330 #endif /* HAVE_X_WINDOWS */
1332 extern void x_query_colors (struct frame *f, XColor *, int);
1333 extern void x_query_color (struct frame *f, XColor *);
1334 extern void x_focus_frame (struct frame *);
1336 #ifndef HAVE_NS
1338 extern int x_bitmap_icon (struct frame *, Lisp_Object);
1340 /* Set F's bitmap icon, if specified among F's parameters. */
1342 INLINE void
1343 x_set_bitmap_icon (struct frame *f)
1345 Lisp_Object obj = assq_no_quit (Qicon_type, f->param_alist);
1347 if (CONSP (obj))
1348 x_bitmap_icon (f, XCDR (obj));
1351 #endif /* !HAVE_NS */
1353 #endif /* HAVE_WINDOW_SYSTEM */
1355 INLINE void
1356 flush_frame (struct frame *f)
1358 struct redisplay_interface *rif = FRAME_RIF (f);
1360 if (rif && rif->flush_display)
1361 rif->flush_display (f);
1364 /***********************************************************************
1365 Multimonitor data
1366 ***********************************************************************/
1368 #ifdef HAVE_WINDOW_SYSTEM
1370 struct MonitorInfo {
1371 XRectangle geom, work;
1372 int mm_width, mm_height;
1373 char *name;
1376 extern void free_monitors (struct MonitorInfo *monitors, int n_monitors);
1377 extern Lisp_Object make_monitor_attribute_list (struct MonitorInfo *monitors,
1378 int n_monitors,
1379 int primary_monitor,
1380 Lisp_Object monitor_frames,
1381 const char *source);
1383 #endif /* HAVE_WINDOW_SYSTEM */
1386 INLINE_HEADER_END
1388 #endif /* not EMACS_FRAME_H */