1 /* Define frame-object for GNU Emacs.
2 Copyright (C) 1993-1994, 1999-2014 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
26 #include "dispextern.h"
27 #include "termhooks.h"
32 enum vertical_scroll_bar_type
34 vertical_scroll_bar_none
,
35 vertical_scroll_bar_left
,
36 vertical_scroll_bar_right
42 FULLSCREEN_WIDTH
= 0x001,
43 FULLSCREEN_HEIGHT
= 0x002,
44 FULLSCREEN_BOTH
= 0x003,
45 FULLSCREEN_MAXIMIZED
= 0x013,
46 FULLSCREEN_WAIT
= 0x100
49 /* The structure representing a frame. */
53 struct vectorlike_header header
;
55 /* All Lisp_Object components must come first.
56 That ensures they are all aligned normally. */
58 /* Name of this frame: a Lisp string. It is used for looking up resources,
59 as well as for the title in some cases. */
62 /* The name to use for the icon, the last time
63 it was refreshed. nil means not explicitly specified. */
64 Lisp_Object icon_name
;
66 /* This is the frame title specified explicitly, if any.
70 /* The frame which should receive keystrokes that occur in this
71 frame, or nil if they should go to the frame itself. This is
72 usually nil, but if the frame is minibufferless, we can use this
73 to redirect keystrokes to a surrogate minibuffer frame when
76 Note that a value of nil is different than having the field point
77 to the frame itself. Whenever the Fselect_frame function is used
78 to shift from one frame to the other, any redirections to the
79 original frame are shifted to the newly selected frame; if
80 focus_frame is nil, Fselect_frame will leave it alone. */
81 Lisp_Object focus_frame
;
83 /* This frame's root window. Every frame has one.
84 If the frame has only a minibuffer window, this is it.
85 Otherwise, if the frame has a minibuffer window, this is its sibling. */
86 Lisp_Object root_window
;
88 /* This frame's selected window.
89 Each frame has its own window hierarchy
90 and one of the windows in it is selected within the frame.
91 The selected window of the selected frame is Emacs's selected window. */
92 Lisp_Object selected_window
;
94 /* This frame's minibuffer window.
95 Most frames have their own minibuffer windows,
96 but only the selected frame's minibuffer window
97 can actually appear to exist. */
98 Lisp_Object minibuffer_window
;
100 /* Parameter alist of this frame.
101 These are the parameters specified when creating the frame
102 or modified with modify-frame-parameters. */
103 Lisp_Object param_alist
;
105 /* List of scroll bars on this frame.
106 Actually, we don't specify exactly what is stored here at all; the
107 scroll bar implementation code can use it to store anything it likes.
108 This field is marked by the garbage collector. It is here
109 instead of in the `device' structure so that the garbage
110 collector doesn't need to look inside the window-system-dependent
112 Lisp_Object scroll_bars
;
113 Lisp_Object condemned_scroll_bars
;
115 /* Vector describing the items to display in the menu bar.
116 Each item has four elements in this vector.
117 They are KEY, STRING, SUBMAP, and HPOS.
118 (HPOS is not used in when the X toolkit is in use.)
119 There are four additional elements of nil at the end, to terminate. */
120 Lisp_Object menu_bar_items
;
122 /* Alist of elements (FACE-NAME . FACE-VECTOR-DATA). */
123 Lisp_Object face_alist
;
125 /* A vector that records the entire structure of this frame's menu bar.
126 For the format of the data, see extensive comments in xmenu.c.
127 Only the X toolkit version uses this. */
128 Lisp_Object menu_bar_vector
;
130 /* Predicate for selecting buffers for other-buffer. */
131 Lisp_Object buffer_predicate
;
133 /* List of buffers viewed in this frame, for other-buffer. */
134 Lisp_Object buffer_list
;
136 /* List of buffers that were viewed, then buried in this frame. The
137 most recently buried buffer is first. For last-buffer. */
138 Lisp_Object buried_buffer_list
;
140 #if defined (HAVE_X_WINDOWS) && ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK)
141 /* A dummy window used to display menu bars under X when no X
142 toolkit support is available. */
143 Lisp_Object menu_bar_window
;
146 #if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
147 /* A window used to display the tool-bar of a frame. */
148 Lisp_Object tool_bar_window
;
150 /* Desired and current contents displayed in that window. */
151 Lisp_Object desired_tool_bar_string
;
152 Lisp_Object current_tool_bar_string
;
155 /* Desired and current tool-bar items. */
156 Lisp_Object tool_bar_items
;
158 /* Where tool bar is, can be left, right, top or bottom. The native
159 tool bar only supports top. */
160 Lisp_Object tool_bar_position
;
162 /* Beyond here, there should be no more Lisp_Object components. */
164 /* Cache of realized faces. */
165 struct face_cache
*face_cache
;
167 #if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
168 /* Tool-bar item index of the item on which a mouse button was pressed. */
169 int last_tool_bar_item
;
172 /* Number of elements in `menu_bar_vector' that have meaningful data. */
173 int menu_bar_items_used
;
175 /* A buffer to hold the frame's name. We can't use the Lisp
176 string's pointer (`name', above) because it might get relocated. */
179 /* Glyph pool and matrix. */
180 struct glyph_pool
*current_pool
;
181 struct glyph_pool
*desired_pool
;
182 struct glyph_matrix
*desired_matrix
;
183 struct glyph_matrix
*current_matrix
;
185 /* True means that glyphs on this frame have been initialized so it can
186 be used for output. */
187 bool_bf glyphs_initialized_p
: 1;
189 /* Set to true in change_frame_size when size of frame changed
190 Clear the frame in clear_garbaged_frames if set. */
191 bool_bf resized_p
: 1;
193 /* Set to true if the default face for the frame has been
194 realized. Reset to zero whenever the default face changes.
195 Used to see the difference between a font change and face change. */
196 bool_bf default_face_done_p
: 1;
198 /* Set to true if this frame has already been hscrolled during
199 current redisplay. */
200 bool_bf already_hscrolled_p
: 1;
202 /* Set to true when current redisplay has updated frame. */
203 bool_bf updated_p
: 1;
205 #if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
206 /* Set to true to minimize tool-bar height even when
207 auto-resize-tool-bar is set to grow-only. */
208 bool_bf minimize_tool_bar_window_p
: 1;
211 #if defined (USE_GTK) || defined (HAVE_NS)
212 /* True means using a tool bar that comes from the toolkit. */
213 bool_bf external_tool_bar
: 1;
216 /* True means that fonts have been loaded since the last glyph
217 matrix adjustments. */
218 bool_bf fonts_changed
: 1;
220 /* True means that cursor type has been changed. */
221 bool_bf cursor_type_changed
: 1;
223 /* True if it needs to be redisplayed. */
224 bool_bf redisplay
: 1;
226 /* Margin at the top of the frame. Used to display the tool-bar. */
229 /* Pixel height of tool bar. */
233 int n_tool_bar_items
;
235 /* A buffer for decode_mode_line. */
236 char *decode_mode_spec_buffer
;
238 /* See do_line_insertion_deletion_costs for info on these arrays. */
239 /* Cost of inserting 1 line on this frame. */
240 int *insert_line_cost
;
241 /* Cost of deleting 1 line on this frame. */
242 int *delete_line_cost
;
243 /* Cost of inserting n lines on this frame. */
244 int *insert_n_lines_cost
;
245 /* Cost of deleting n lines on this frame. */
246 int *delete_n_lines_cost
;
248 /* Text width of this frame (excluding fringes, scroll bars and
249 internal border width) and text height (excluding internal border
250 width) in units of canonical characters. */
251 int text_cols
, text_lines
;
253 /* Total width of this frame (including fringes and scroll bars) in
254 units of canonical characters. */
257 /* Text width of this frame (excluding fringes, scroll bars and
258 internal border width) and text height (excluding internal border
260 int text_width
, text_height
;
262 /* New text height and width for pending size change. 0 if no change
263 pending. These values represent pixels or canonical character units
264 according to the value of new_pixelwise and correlate to the the
265 text width/height of the frame. */
266 int new_width
, new_height
;
268 /* Whether new_height and new_width shall be interpreted
272 /* Pixel position of the frame window (x and y offsets in root window). */
273 int left_pos
, top_pos
;
275 /* Size of the frame window (including internal border widths) in
277 int pixel_width
, pixel_height
;
279 /* These many pixels are the difference between the outer window (i.e. the
280 left and top of the window manager decoration) and FRAME_X_WINDOW. */
281 int x_pixels_diff
, y_pixels_diff
;
283 /* This is the gravity value for the specified window position. */
286 /* The geometry flags for this window. */
289 /* Border width of the frame window as known by the (X) window system. */
292 /* Width of the internal border. This is a line of background color
293 just inside the window's border. When the frame is selected,
294 a highlighting is displayed inside the internal border. */
295 int internal_border_width
;
297 /* Width of borders between this frame's windows. */
298 int right_divider_width
;
299 int bottom_divider_width
;
301 /* Canonical X unit. Width of default font, in pixels. */
304 /* Canonical Y unit. Height of a line, in pixels. */
307 /* The output method says how the contents of this frame are
308 displayed. It could be using termcap, or using an X window.
309 This must be the same as the terminal->type. */
310 enum output_method output_method
;
312 /* The terminal device that this frame uses. If this is NULL, then
313 the frame has been deleted. */
314 struct terminal
*terminal
;
316 /* Device-dependent, frame-local auxiliary data used for displaying
317 the contents. When the frame is deleted, this data is deleted as
321 struct tty_output
*tty
; /* From termchar.h. */
322 struct x_output
*x
; /* From xterm.h. */
323 struct w32_output
*w32
; /* From w32term.h. */
324 struct ns_output
*ns
; /* From nsterm.h. */
329 /* List of font-drivers available on the frame. */
330 struct font_driver_list
*font_driver_list
;
331 /* List of data specific to font-driver and frame, but common to
333 struct font_data_list
*font_data_list
;
335 /* Total width of fringes reserved for drawing truncation bitmaps,
336 continuation bitmaps and alike. The width is in canonical char
337 units of the frame. This must currently be the case because window
338 sizes aren't pixel values. If it weren't the case, we wouldn't be
339 able to split windows horizontally nicely. */
342 /* The extra width (in pixels) currently allotted for fringes. */
343 int left_fringe_width
, right_fringe_width
;
345 /* See FULLSCREEN_ enum below. */
346 enum fullscreen_type want_fullscreen
;
348 /* Number of lines of menu bar. */
351 /* Pixel height of menubar. */
354 #if defined (HAVE_X_WINDOWS)
355 /* Used by x_wait_for_event when watching for an X event on this frame. */
359 #if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) \
360 || defined (HAVE_NS) || defined (USE_GTK)
361 /* True means using a menu bar that comes from the X toolkit. */
362 bool_bf external_menu_bar
: 1;
365 /* Next two bitfields are mutually exclusive. They might both be
366 zero if the frame has been made invisible without an icon. */
368 /* Nonzero if the frame is currently displayed; we check
369 it to see if we should bother updating the frame's contents.
371 On ttys and on Windows NT/9X, to avoid wasting effort updating
372 visible frames that are actually completely obscured by other
373 windows on the display, we bend the meaning of visible slightly:
374 if equal to 2, then the frame is obscured - we still consider
375 it to be "visible" as seen from lisp, but we don't bother
377 unsigned visible
: 2;
379 /* True if the frame is currently iconified. Do not
380 set this directly, use SET_FRAME_ICONIFIED instead. */
381 bool_bf iconified
: 1;
383 /* True if this frame should be fully redisplayed. Disables all
384 optimizations while rebuilding matrices and redrawing. */
385 bool_bf garbaged
: 1;
387 /* False means, if this frame has just one window,
388 show no modeline for that window. */
389 bool_bf wants_modeline
: 1;
391 /* True means raise this frame to the top of the heap when selected. */
392 bool_bf auto_raise
: 1;
394 /* True means lower this frame to the bottom of the stack when left. */
395 bool_bf auto_lower
: 1;
397 /* True if frame's root window can't be split. */
398 bool_bf no_split
: 1;
400 /* If this is set, then Emacs won't change the frame name to indicate
401 the current buffer, etcetera. If the user explicitly sets the frame
402 name, this gets set. If the user sets the name to Qnil, this is
404 bool_bf explicit_name
: 1;
406 /* True if size of some window on this frame has changed. */
407 bool_bf window_sizes_changed
: 1;
409 /* True if the mouse has moved on this display device
410 since the last time we checked. */
411 bool_bf mouse_moved
: 1;
413 /* True means that the pointer is invisible. */
414 bool_bf pointer_invisible
: 1;
416 /* True means that all windows except mini-window and
417 selected window on this frame have frozen window starts. */
418 bool_bf frozen_window_starts
: 1;
420 /* Nonzero if we should actually display the scroll bars on this frame. */
421 enum vertical_scroll_bar_type vertical_scroll_bar_type
;
423 /* What kind of text cursor should we draw in the future?
424 This should always be filled_box_cursor or bar_cursor. */
425 enum text_cursor_kinds desired_cursor
;
427 /* Width of bar cursor (if we are using that). */
430 /* What kind of text cursor should we draw when the cursor blinks off?
431 This can be filled_box_cursor or bar_cursor or no_cursor. */
432 enum text_cursor_kinds blink_off_cursor
;
434 /* Width of bar cursor (if we are using that) for blink-off state. */
435 int blink_off_cursor_width
;
437 /* Configured width of the scroll bar, in pixels and in characters.
438 config_scroll_bar_cols tracks config_scroll_bar_width if the
439 latter is positive; a zero value in config_scroll_bar_width means
440 to compute the actual width on the fly, using config_scroll_bar_cols
441 and the current font width. */
442 int config_scroll_bar_width
;
443 int config_scroll_bar_cols
;
445 /* The baud rate that was used to calculate costs for this frame. */
446 int cost_calculation_baud_rate
;
449 alpha[0]: alpha transparency of the active frame
450 alpha[1]: alpha transparency of inactive frames
451 Negative values mean not to change alpha. */
454 /* Exponent for gamma correction of colors. 1/(VIEWING_GAMMA *
455 SCREEN_GAMMA) where viewing_gamma is 0.4545 and SCREEN_GAMMA is a
456 frame parameter. 0 means don't do gamma correction. */
459 /* Additional space to put between text lines on this frame. */
460 int extra_line_spacing
;
462 /* All display backends seem to need these two pixel values. */
463 unsigned long background_pixel
;
464 unsigned long foreground_pixel
;
467 /* Most code should use these functions to set Lisp fields in struct frame. */
470 fset_buffer_list (struct frame
*f
, Lisp_Object val
)
472 f
->buffer_list
= val
;
475 fset_buried_buffer_list (struct frame
*f
, Lisp_Object val
)
477 f
->buried_buffer_list
= val
;
480 fset_condemned_scroll_bars (struct frame
*f
, Lisp_Object val
)
482 f
->condemned_scroll_bars
= val
;
485 fset_face_alist (struct frame
*f
, Lisp_Object val
)
490 fset_focus_frame (struct frame
*f
, Lisp_Object val
)
492 f
->focus_frame
= val
;
495 fset_icon_name (struct frame
*f
, Lisp_Object val
)
500 fset_menu_bar_items (struct frame
*f
, Lisp_Object val
)
502 f
->menu_bar_items
= val
;
505 fset_menu_bar_vector (struct frame
*f
, Lisp_Object val
)
507 f
->menu_bar_vector
= val
;
509 #if defined (HAVE_X_WINDOWS) && ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK)
511 fset_menu_bar_window (struct frame
*f
, Lisp_Object val
)
513 f
->menu_bar_window
= val
;
517 fset_name (struct frame
*f
, Lisp_Object val
)
522 fset_param_alist (struct frame
*f
, Lisp_Object val
)
524 f
->param_alist
= val
;
527 fset_root_window (struct frame
*f
, Lisp_Object val
)
529 f
->root_window
= val
;
532 fset_scroll_bars (struct frame
*f
, Lisp_Object val
)
534 f
->scroll_bars
= val
;
537 fset_selected_window (struct frame
*f
, Lisp_Object val
)
539 f
->selected_window
= val
;
542 fset_title (struct frame
*f
, Lisp_Object val
)
547 fset_tool_bar_items (struct frame
*f
, Lisp_Object val
)
549 f
->tool_bar_items
= val
;
552 fset_tool_bar_position (struct frame
*f
, Lisp_Object val
)
554 f
->tool_bar_position
= val
;
556 #if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
558 fset_tool_bar_window (struct frame
*f
, Lisp_Object val
)
560 f
->tool_bar_window
= val
;
563 fset_current_tool_bar_string (struct frame
*f
, Lisp_Object val
)
565 f
->current_tool_bar_string
= val
;
568 fset_desired_tool_bar_string (struct frame
*f
, Lisp_Object val
)
570 f
->desired_tool_bar_string
= val
;
572 #endif /* HAVE_WINDOW_SYSTEM && !USE_GTK && !HAVE_NS */
574 #define NUMVAL(X) ((INTEGERP (X) || FLOATP (X)) ? XFLOATINT (X) : -1)
577 default_pixels_per_inch_x (void)
579 Lisp_Object v
= (CONSP (Vdisplay_pixels_per_inch
)
580 ? XCAR (Vdisplay_pixels_per_inch
)
581 : Vdisplay_pixels_per_inch
);
582 return NUMVAL (v
) > 0 ? NUMVAL (v
) : 72.0;
586 default_pixels_per_inch_y (void)
588 Lisp_Object v
= (CONSP (Vdisplay_pixels_per_inch
)
589 ? XCDR (Vdisplay_pixels_per_inch
)
590 : Vdisplay_pixels_per_inch
);
591 return NUMVAL (v
) > 0 ? NUMVAL (v
) : 72.0;
594 #define FRAME_KBOARD(f) ((f)->terminal->kboard)
596 /* Return a pointer to the image cache of frame F. */
597 #define FRAME_IMAGE_CACHE(F) ((F)->terminal->image_cache)
600 (eassert (FRAMEP (p)), (struct frame *) SCM_SMOB_DATA (p))
601 #define XSETFRAME(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_FRAME))
603 /* Given a window, return its frame as a Lisp_Object. */
604 #define WINDOW_FRAME(w) ((w)->frame)
606 /* Test a frame for particular kinds of display methods. */
607 #define FRAME_INITIAL_P(f) ((f)->output_method == output_initial)
608 #define FRAME_TERMCAP_P(f) ((f)->output_method == output_termcap)
609 #define FRAME_X_P(f) ((f)->output_method == output_x_window)
611 #define FRAME_W32_P(f) false
613 #define FRAME_W32_P(f) ((f)->output_method == output_w32)
616 #define FRAME_MSDOS_P(f) false
618 #define FRAME_MSDOS_P(f) ((f)->output_method == output_msdos_raw)
621 #define FRAME_NS_P(f) false
623 #define FRAME_NS_P(f) ((f)->output_method == output_ns)
626 /* FRAME_WINDOW_P tests whether the frame is a window, and is
627 defined to be the predicate for the window system being used. */
629 #ifdef HAVE_X_WINDOWS
630 #define FRAME_WINDOW_P(f) FRAME_X_P (f)
633 #define FRAME_WINDOW_P(f) FRAME_W32_P (f)
636 #define FRAME_WINDOW_P(f) FRAME_NS_P(f)
638 #ifndef FRAME_WINDOW_P
639 #define FRAME_WINDOW_P(f) ((void) (f), false)
642 /* Dots per inch of the screen the frame F is on. */
644 #ifdef HAVE_WINDOW_SYSTEM
646 #define FRAME_RES_X(f) \
647 (eassert (FRAME_WINDOW_P (f)), FRAME_DISPLAY_INFO (f)->resx)
648 #define FRAME_RES_Y(f) \
649 (eassert (FRAME_WINDOW_P (f)), FRAME_DISPLAY_INFO (f)->resy)
651 #else /* !HAVE_WINDOW_SYSTEM */
653 /* Defaults when no window system available. */
655 #define FRAME_RES_X(f) default_pixels_per_inch_x ()
656 #define FRAME_RES_Y(f) default_pixels_per_inch_y ()
658 #endif /* HAVE_WINDOW_SYSTEM */
660 /* Return a pointer to the structure holding information about the
661 region of text, if any, that is currently shown in mouse-face on
662 frame F. We need to define two versions because a TTY-only build
663 does not have FRAME_DISPLAY_INFO. */
664 #ifdef HAVE_WINDOW_SYSTEM
665 # define MOUSE_HL_INFO(F) \
667 ? &FRAME_DISPLAY_INFO(F)->mouse_highlight \
668 : &(F)->output_data.tty->display_info->mouse_highlight)
670 # define MOUSE_HL_INFO(F) \
671 (&(F)->output_data.tty->display_info->mouse_highlight)
674 /* True if frame F is still alive (not deleted). */
675 #define FRAME_LIVE_P(f) ((f)->terminal != 0)
677 /* True if frame F is a minibuffer-only frame. */
678 #define FRAME_MINIBUF_ONLY_P(f) \
679 EQ (FRAME_ROOT_WINDOW (f), FRAME_MINIBUF_WINDOW (f))
681 /* True if frame F contains it's own minibuffer window. Frame always has
682 minibuffer window, but it could use minibuffer window of another frame. */
683 #define FRAME_HAS_MINIBUF_P(f) \
684 (WINDOWP (f->minibuffer_window) \
685 && XFRAME (XWINDOW (f->minibuffer_window)->frame) == f)
687 /* Pixel width of frame F. */
688 #define FRAME_PIXEL_WIDTH(f) ((f)->pixel_width)
690 /* Pixel height of frame F, including non-toolkit menu bar and
691 non-toolkit tool bar lines. */
692 #define FRAME_PIXEL_HEIGHT(f) ((f)->pixel_height)
694 /* Width of frame F, measured in canonical character columns,
695 not including scroll bars if any. */
696 #define FRAME_COLS(f) (f)->text_cols
698 /* Height of frame F, measured in canonical lines, including
699 non-toolkit menu bar and non-toolkit tool bar lines. */
700 #define FRAME_LINES(f) (f)->text_lines
702 /* Width of frame F, measured in pixels not including the width for
703 fringes, scroll bar, and internal borders. */
704 #define FRAME_TEXT_WIDTH(f) (f)->text_width
706 /* Height of frame F, measured in pixels not including the height
707 for internal borders. */
708 #define FRAME_TEXT_HEIGHT(f) (f)->text_height
710 /* Number of lines of frame F used for menu bar.
711 This is relevant on terminal frames and on
712 X Windows when not using the X toolkit.
713 These lines are counted in FRAME_LINES. */
714 #define FRAME_MENU_BAR_LINES(f) (f)->menu_bar_lines
716 /* Pixel height of frame F's menu bar. */
717 #define FRAME_MENU_BAR_HEIGHT(f) (f)->menu_bar_height
719 /* True if this frame should display a tool bar
720 in a way that does not use any text lines. */
721 #if defined (USE_GTK) || defined (HAVE_NS)
722 #define FRAME_EXTERNAL_TOOL_BAR(f) (f)->external_tool_bar
724 #define FRAME_EXTERNAL_TOOL_BAR(f) false
727 /* Number of lines of frame F used for the tool-bar. */
728 #define FRAME_TOOL_BAR_LINES(f) (f)->tool_bar_lines
730 /* Pixel height of frame F's tool-bar. */
731 #define FRAME_TOOL_BAR_HEIGHT(f) (f)->tool_bar_height
733 /* Lines above the top-most window in frame F. */
734 #define FRAME_TOP_MARGIN(F) \
735 (FRAME_MENU_BAR_LINES (F) + FRAME_TOOL_BAR_LINES (F))
737 /* Pixel height of frame F's top margin. */
738 #define FRAME_TOP_MARGIN_HEIGHT(F) \
739 (FRAME_MENU_BAR_HEIGHT (F) + FRAME_TOOL_BAR_HEIGHT (F))
741 /* True if this frame should display a menu bar
742 in a way that does not use any text lines. */
743 #if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) \
744 || defined (HAVE_NS) || defined (USE_GTK)
745 #define FRAME_EXTERNAL_MENU_BAR(f) (f)->external_menu_bar
747 #define FRAME_EXTERNAL_MENU_BAR(f) false
749 #define FRAME_VISIBLE_P(f) (f)->visible
751 /* True if frame F is currently visible but hidden. */
752 #define FRAME_OBSCURED_P(f) ((f)->visible > 1)
754 /* True if frame F is currently iconified. */
755 #define FRAME_ICONIFIED_P(f) (f)->iconified
757 /* Mark frame F as currently garbaged. */
758 #define SET_FRAME_GARBAGED(f) \
759 (frame_garbaged = true, fset_redisplay (f), f->garbaged = true)
761 /* True if frame F is currently garbaged. */
762 #define FRAME_GARBAGED_P(f) (f)->garbaged
764 /* True means do not allow splitting this frame's window. */
765 #define FRAME_NO_SPLIT_P(f) (f)->no_split
767 /* Not really implemented. */
768 #define FRAME_WANTS_MODELINE_P(f) (f)->wants_modeline
770 /* True if all windows except selected window and mini window
771 are frozen on frame F. */
772 #define FRAME_WINDOWS_FROZEN(f) (f)->frozen_window_starts
774 /* True if a size change has been requested for frame F
775 but not yet really put into effect. This can be true temporarily
776 when an X event comes in at a bad time. */
777 #define FRAME_WINDOW_SIZES_CHANGED(f) (f)->window_sizes_changed
779 /* The minibuffer window of frame F, if it has one; otherwise nil. */
780 #define FRAME_MINIBUF_WINDOW(f) f->minibuffer_window
782 /* The root window of the window tree of frame F. */
783 #define FRAME_ROOT_WINDOW(f) f->root_window
785 /* The currently selected window of the window tree of frame F. */
786 #define FRAME_SELECTED_WINDOW(f) f->selected_window
788 #define FRAME_INSERT_COST(f) (f)->insert_line_cost
789 #define FRAME_DELETE_COST(f) (f)->delete_line_cost
790 #define FRAME_INSERTN_COST(f) (f)->insert_n_lines_cost
791 #define FRAME_DELETEN_COST(f) (f)->delete_n_lines_cost
792 #define FRAME_FOCUS_FRAME(f) f->focus_frame
794 /* This frame slot says whether scroll bars are currently enabled for frame F,
795 and which side they are on. */
796 #define FRAME_VERTICAL_SCROLL_BAR_TYPE(f) ((f)->vertical_scroll_bar_type)
797 #define FRAME_HAS_VERTICAL_SCROLL_BARS(f) \
798 ((f)->vertical_scroll_bar_type != vertical_scroll_bar_none)
799 #define FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT(f) \
800 ((f)->vertical_scroll_bar_type == vertical_scroll_bar_left)
801 #define FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT(f) \
802 ((f)->vertical_scroll_bar_type == vertical_scroll_bar_right)
804 /* Width that a scroll bar in frame F should have, if there is one.
806 If scroll bars are turned off, this is still nonzero. */
807 #define FRAME_CONFIG_SCROLL_BAR_WIDTH(f) ((f)->config_scroll_bar_width)
809 /* Width that a scroll bar in frame F should have, if there is one.
810 Measured in columns (characters).
811 If scroll bars are turned off, this is still nonzero. */
812 #define FRAME_CONFIG_SCROLL_BAR_COLS(f) ((f)->config_scroll_bar_cols)
814 /* Width of a scroll bar in frame F, measured in columns (characters),
815 but only if scroll bars are on the left. If scroll bars are on
816 the right in this frame, or there are no scroll bars, value is 0. */
818 #define FRAME_LEFT_SCROLL_BAR_COLS(f) \
819 (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f) \
820 ? FRAME_CONFIG_SCROLL_BAR_COLS (f) \
823 /* Width of a left scroll bar in frame F, measured in pixels */
825 #define FRAME_LEFT_SCROLL_BAR_AREA_WIDTH(f) \
826 (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f) \
827 ? FRAME_CONFIG_SCROLL_BAR_WIDTH (f) \
830 /* Width of a scroll bar in frame F, measured in columns (characters),
831 but only if scroll bars are on the right. If scroll bars are on
832 the left in this frame, or there are no scroll bars, value is 0. */
834 #define FRAME_RIGHT_SCROLL_BAR_COLS(f) \
835 (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f) \
836 ? FRAME_CONFIG_SCROLL_BAR_COLS (f) \
839 /* Width of a right scroll bar area in frame F, measured in pixels */
841 #define FRAME_RIGHT_SCROLL_BAR_AREA_WIDTH(f) \
842 (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f) \
843 ? FRAME_CONFIG_SCROLL_BAR_WIDTH (f) \
846 /* Actual width of a scroll bar in frame F, measured in columns. */
848 #define FRAME_SCROLL_BAR_COLS(f) \
849 (FRAME_HAS_VERTICAL_SCROLL_BARS (f) \
850 ? FRAME_CONFIG_SCROLL_BAR_COLS (f) \
853 /* Actual width of a scroll bar area in frame F, measured in pixels. */
855 #define FRAME_SCROLL_BAR_AREA_WIDTH(f) \
856 (FRAME_HAS_VERTICAL_SCROLL_BARS (f) \
857 ? FRAME_CONFIG_SCROLL_BAR_WIDTH (f) \
860 /* Total width of frame F, in columns (characters),
861 including the width used by scroll bars if any. */
862 #define FRAME_TOTAL_COLS(f) ((f)->total_cols)
864 /* Set the character widths of frame F. WIDTH specifies a nominal
865 character text width. */
866 #define SET_FRAME_COLS(f, width) \
867 ((f)->text_cols = (width), \
868 (f)->total_cols = ((width) \
869 + FRAME_SCROLL_BAR_COLS (f) \
870 + FRAME_FRINGE_COLS (f)))
872 /* Set the pixel widths of frame F. WIDTH specifies a nominal pixel
874 #define SET_FRAME_WIDTH(f, width) \
875 ((f)->text_width = (width), \
876 (f)->pixel_width = ((width) \
877 + FRAME_SCROLL_BAR_AREA_WIDTH (f) \
878 + FRAME_TOTAL_FRINGE_WIDTH (f) \
879 + 2 * FRAME_INTERNAL_BORDER_WIDTH (f)))
881 /* Set the pixel heights of frame F. HEIGHT specifies a nominal pixel
883 #define SET_FRAME_HEIGHT(f, height) \
884 ((f)->text_height = (height), \
885 (f)->pixel_height = ((height) \
886 + 2 * FRAME_INTERNAL_BORDER_WIDTH (f)))
888 /* Maximum + 1 legitimate value for FRAME_CURSOR_X. */
890 #define FRAME_CURSOR_X_LIMIT(f) \
891 (FRAME_COLS (f) + FRAME_LEFT_SCROLL_BAR_COLS (f))
893 #define FRAME_SCROLL_BARS(f) (f->scroll_bars)
895 #define FRAME_CONDEMNED_SCROLL_BARS(f) (f->condemned_scroll_bars)
896 #define FRAME_MENU_BAR_ITEMS(f) (f->menu_bar_items)
897 #define FRAME_COST_BAUD_RATE(f) ((f)->cost_calculation_baud_rate)
899 #define FRAME_DESIRED_CURSOR(f) ((f)->desired_cursor)
900 #define FRAME_BLINK_OFF_CURSOR(f) ((f)->blink_off_cursor)
901 #define FRAME_CURSOR_WIDTH(f) ((f)->cursor_width)
902 #define FRAME_BLINK_OFF_CURSOR_WIDTH(f) ((f)->blink_off_cursor_width)
904 #define FRAME_FOREGROUND_PIXEL(f) ((f)->foreground_pixel)
905 #define FRAME_BACKGROUND_PIXEL(f) ((f)->background_pixel)
907 /* Return a pointer to the face cache of frame F. */
909 #define FRAME_FACE_CACHE(F) (F)->face_cache
911 /* Return the size of message_buf of the frame F. We multiply the
912 width of the frame by 4 because multi-byte form may require at most
913 4-byte for a character. */
915 #define FRAME_MESSAGE_BUF_SIZE(f) (((int) FRAME_COLS (f)) * 4)
917 #define CHECK_FRAME(x) \
918 CHECK_TYPE (FRAMEP (x), Qframep, x)
920 #define CHECK_LIVE_FRAME(x) \
921 CHECK_TYPE (FRAMEP (x) && FRAME_LIVE_P (XFRAME (x)), Qframe_live_p, x)
923 /* FOR_EACH_FRAME (LIST_VAR, FRAME_VAR) followed by a statement is a
924 `for' loop which iterates over the elements of Vframe_list. The
925 loop will set FRAME_VAR, a Lisp_Object, to each frame in
926 Vframe_list in succession and execute the statement. LIST_VAR
927 should be a Lisp_Object too; it is used to iterate through the
930 This macro is a holdover from a time when multiple frames weren't always
931 supported. An alternate definition of the macro would expand to
932 something which executes the statement once. */
934 #define FOR_EACH_FRAME(list_var, frame_var) \
935 for ((list_var) = Vframe_list; \
937 && (frame_var = XCAR (list_var), true)); \
938 list_var = XCDR (list_var))
940 /* Reflect mouse movement when a complete frame update is performed. */
942 #define FRAME_MOUSE_UPDATE(frame) \
944 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (frame); \
945 if (frame == hlinfo->mouse_face_mouse_frame) \
948 note_mouse_highlight (hlinfo->mouse_face_mouse_frame, \
949 hlinfo->mouse_face_mouse_x, \
950 hlinfo->mouse_face_mouse_y); \
955 /* False means there are no visible garbaged frames. */
956 extern bool frame_garbaged
;
958 /* Set visibility of frame F.
959 We call redisplay_other_windows to make sure the frame gets redisplayed
960 if some changes were applied to it while it wasn't visible (and hence
961 wasn't redisplayed). */
964 SET_FRAME_VISIBLE (struct frame
*f
, int v
)
966 eassert (0 <= v
&& v
<= 2);
969 if (v
== 1 && f
->visible
!= 1)
970 redisplay_other_windows ();
971 if (FRAME_GARBAGED_P (f
))
972 frame_garbaged
= true;
977 /* Set iconify of frame F. */
979 #define SET_FRAME_ICONIFIED(f, i) \
980 (f)->iconified = (eassert (0 <= (i) && (i) <= 1), (i))
982 extern Lisp_Object selected_frame
;
983 extern Lisp_Object Qframep
, Qframe_live_p
;
984 extern Lisp_Object Qtty
, Qtty_type
;
985 extern Lisp_Object Qtty_color_mode
;
986 extern Lisp_Object Qterminal
;
987 extern Lisp_Object Qnoelisp
;
989 extern void set_menu_bar_lines (struct frame
*, Lisp_Object
, Lisp_Object
);
990 extern struct frame
*decode_window_system_frame (Lisp_Object
);
991 extern struct frame
*decode_live_frame (Lisp_Object
);
992 extern struct frame
*decode_any_frame (Lisp_Object
);
993 extern struct frame
*make_initial_frame (void);
994 extern struct frame
*make_frame (bool);
995 #ifdef HAVE_WINDOW_SYSTEM
996 extern struct frame
*make_minibuffer_frame (void);
997 extern struct frame
*make_frame_without_minibuffer (Lisp_Object
,
1000 extern bool window_system_available (struct frame
*);
1001 #else /* not HAVE_WINDOW_SYSTEM */
1002 #define window_system_available(f) ((void) (f), false)
1003 #endif /* HAVE_WINDOW_SYSTEM */
1004 extern void check_window_system (struct frame
*);
1005 extern void frame_make_pointer_invisible (struct frame
*);
1006 extern void frame_make_pointer_visible (struct frame
*);
1007 extern Lisp_Object
delete_frame (Lisp_Object
, Lisp_Object
);
1009 extern Lisp_Object Vframe_list
;
1011 /* Value is a pointer to the selected frame. If the selected frame
1012 isn't live, abort. */
1014 #define SELECTED_FRAME() \
1015 ((FRAMEP (selected_frame) \
1016 && FRAME_LIVE_P (XFRAME (selected_frame))) \
1017 ? XFRAME (selected_frame) \
1018 : (emacs_abort (), (struct frame *) 0))
1021 /***********************************************************************
1022 Display-related Macros
1023 ***********************************************************************/
1025 /* Canonical y-unit on frame F.
1026 This value currently equals the line height of the frame (which is
1027 the height of the default font of F). */
1029 #define FRAME_LINE_HEIGHT(F) ((F)->line_height)
1031 /* Canonical x-unit on frame F.
1032 This value currently equals the average width of the default font of F. */
1034 #define FRAME_COLUMN_WIDTH(F) ((F)->column_width)
1036 /* Pixel width of areas used to display truncation marks, continuation
1037 marks, overlay arrows. This is 0 for terminal frames. */
1039 #ifdef HAVE_WINDOW_SYSTEM
1041 /* Total width of fringes reserved for drawing truncation bitmaps,
1042 continuation bitmaps and alike. The width is in canonical char
1043 units of the frame. This must currently be the case because window
1044 sizes aren't pixel values. If it weren't the case, we wouldn't be
1045 able to split windows horizontally nicely. */
1047 #define FRAME_FRINGE_COLS(F) ((F)->fringe_cols)
1049 /* Pixel-width of the left and right fringe. */
1051 #define FRAME_LEFT_FRINGE_WIDTH(F) ((F)->left_fringe_width)
1052 #define FRAME_RIGHT_FRINGE_WIDTH(F) ((F)->right_fringe_width)
1054 /* Total width of fringes in pixels. */
1056 #define FRAME_TOTAL_FRINGE_WIDTH(F) \
1057 (FRAME_LEFT_FRINGE_WIDTH (F) + FRAME_RIGHT_FRINGE_WIDTH (F))
1059 /* Pixel-width of internal border lines */
1060 #define FRAME_INTERNAL_BORDER_WIDTH(F) ((F)->internal_border_width)
1062 /* Pixel-size of window border lines */
1063 #define FRAME_RIGHT_DIVIDER_WIDTH(F) ((F)->right_divider_width)
1064 #define FRAME_BOTTOM_DIVIDER_WIDTH(F) ((F)->bottom_divider_width)
1066 #else /* not HAVE_WINDOW_SYSTEM */
1068 #define FRAME_FRINGE_COLS(F) 0
1069 #define FRAME_TOTAL_FRINGE_WIDTH(F) 0
1070 #define FRAME_LEFT_FRINGE_WIDTH(F) 0
1071 #define FRAME_RIGHT_FRINGE_WIDTH(F) 0
1072 #define FRAME_INTERNAL_BORDER_WIDTH(F) 0
1073 #define FRAME_RIGHT_DIVIDER_WIDTH(F) 0
1074 #define FRAME_BOTTOM_DIVIDER_WIDTH(F) 0
1076 #endif /* not HAVE_WINDOW_SYSTEM */
1078 /***********************************************************************
1079 Conversion between canonical units and pixels
1080 ***********************************************************************/
1082 /* Canonical x-values are fractions of FRAME_COLUMN_WIDTH, canonical
1083 y-unit are fractions of FRAME_LINE_HEIGHT of a frame. Both are
1084 represented as Lisp numbers, i.e. integers or floats. */
1086 /* Convert canonical value X to pixels. F is the frame whose
1087 canonical char width is to be used. X must be a Lisp integer or
1088 float. Value is a C integer. */
1090 #define FRAME_PIXEL_X_FROM_CANON_X(F, X) \
1092 ? XINT (X) * FRAME_COLUMN_WIDTH (F) \
1093 : (int) (XFLOAT_DATA (X) * FRAME_COLUMN_WIDTH (F)))
1095 /* Convert canonical value Y to pixels. F is the frame whose
1096 canonical character height is to be used. X must be a Lisp integer
1097 or float. Value is a C integer. */
1099 #define FRAME_PIXEL_Y_FROM_CANON_Y(F, Y) \
1101 ? XINT (Y) * FRAME_LINE_HEIGHT (F) \
1102 : (int) (XFLOAT_DATA (Y) * FRAME_LINE_HEIGHT (F)))
1104 /* Convert pixel-value X to canonical units. F is the frame whose
1105 canonical character width is to be used. X is a C integer. Result
1106 is a Lisp float if X is not a multiple of the canon width,
1107 otherwise it's a Lisp integer. */
1109 #define FRAME_CANON_X_FROM_PIXEL_X(F, X) \
1110 ((X) % FRAME_COLUMN_WIDTH (F) != 0 \
1111 ? make_float ((double) (X) / FRAME_COLUMN_WIDTH (F)) \
1112 : make_number ((X) / FRAME_COLUMN_WIDTH (F)))
1114 /* Convert pixel-value Y to canonical units. F is the frame whose
1115 canonical character height is to be used. Y is a C integer.
1116 Result is a Lisp float if Y is not a multiple of the canon width,
1117 otherwise it's a Lisp integer. */
1119 #define FRAME_CANON_Y_FROM_PIXEL_Y(F, Y) \
1120 ((Y) % FRAME_LINE_HEIGHT (F) \
1121 ? make_float ((double) (Y) / FRAME_LINE_HEIGHT (F)) \
1122 : make_number ((Y) / FRAME_LINE_HEIGHT (F)))
1126 /* Manipulating pixel sizes and character sizes.
1127 Knowledge of which factors affect the overall size of the window should
1128 be hidden in these macros, if that's possible.
1130 Return the upper/left pixel position of the character cell on frame F
1133 #define FRAME_LINE_TO_PIXEL_Y(f, row) \
1134 (((row) < FRAME_TOP_MARGIN (f) ? 0 : FRAME_INTERNAL_BORDER_WIDTH (f)) \
1135 + (row) * FRAME_LINE_HEIGHT (f))
1137 #define FRAME_COL_TO_PIXEL_X(f, col) \
1138 (FRAME_INTERNAL_BORDER_WIDTH (f) \
1139 + (col) * FRAME_COLUMN_WIDTH (f))
1141 /* Return the pixel width/height of frame F if it has
1142 COLS columns/LINES rows. */
1144 #define FRAME_TEXT_COLS_TO_PIXEL_WIDTH(f, cols) \
1145 (FRAME_COL_TO_PIXEL_X (f, cols) \
1146 + FRAME_SCROLL_BAR_AREA_WIDTH (f) \
1147 + FRAME_TOTAL_FRINGE_WIDTH (f) \
1148 + FRAME_INTERNAL_BORDER_WIDTH (f))
1150 #define FRAME_TEXT_LINES_TO_PIXEL_HEIGHT(f, lines) \
1151 ((lines) * FRAME_LINE_HEIGHT (f) \
1152 + 2 * FRAME_INTERNAL_BORDER_WIDTH (f))
1154 /* Return the row/column (zero-based) of the character cell containing
1155 the pixel on FRAME at Y/X. */
1157 #define FRAME_PIXEL_Y_TO_LINE(f, y) \
1158 (((y) < FRAME_TOP_MARGIN_HEIGHT (f) \
1160 : ((y) < FRAME_TOP_MARGIN_HEIGHT (f) + FRAME_INTERNAL_BORDER_WIDTH (f) \
1161 ? (y) - (FRAME_TOP_MARGIN_HEIGHT (f) + FRAME_INTERNAL_BORDER_WIDTH (f) \
1162 /* Arrange for the division to round down. */ \
1163 + FRAME_LINE_HEIGHT (f) - 1) \
1164 : (y) - FRAME_INTERNAL_BORDER_WIDTH (f))) \
1165 / FRAME_LINE_HEIGHT (f))
1167 #define FRAME_PIXEL_X_TO_COL(f, x) \
1168 (((x) - FRAME_INTERNAL_BORDER_WIDTH (f)) \
1169 / FRAME_COLUMN_WIDTH (f))
1171 /* How many columns/rows of text can we fit in WIDTH/HEIGHT pixels on
1174 #define FRAME_PIXEL_WIDTH_TO_TEXT_COLS(f, width) \
1175 (FRAME_PIXEL_X_TO_COL (f, ((width) \
1176 - FRAME_INTERNAL_BORDER_WIDTH (f) \
1177 - FRAME_TOTAL_FRINGE_WIDTH (f) \
1178 - FRAME_SCROLL_BAR_AREA_WIDTH (f)))) \
1180 #define FRAME_PIXEL_HEIGHT_TO_TEXT_LINES(f, height) \
1181 (FRAME_PIXEL_Y_TO_LINE (f, ((height) \
1182 - FRAME_INTERNAL_BORDER_WIDTH (f))))
1184 /* Return the pixel width/height of frame F with a text size of
1187 #define FRAME_TEXT_TO_PIXEL_WIDTH(f, width) \
1189 + FRAME_SCROLL_BAR_AREA_WIDTH (f) \
1190 + FRAME_TOTAL_FRINGE_WIDTH (f) \
1191 + 2 * FRAME_INTERNAL_BORDER_WIDTH (f))
1193 #define FRAME_TEXT_TO_PIXEL_HEIGHT(f, height) \
1194 ((height) + 2 * FRAME_INTERNAL_BORDER_WIDTH (f))
1196 /* Return the text width/height of frame F with a pixel size of
1199 #define FRAME_PIXEL_TO_TEXT_WIDTH(f, width) \
1201 - FRAME_SCROLL_BAR_AREA_WIDTH (f) \
1202 - FRAME_TOTAL_FRINGE_WIDTH (f) \
1203 - 2 * FRAME_INTERNAL_BORDER_WIDTH (f))
1205 #define FRAME_PIXEL_TO_TEXT_HEIGHT(f, height) \
1206 ((height) - 2 * FRAME_INTERNAL_BORDER_WIDTH (f))
1208 /* Value is the smallest width of any character in any font on frame F. */
1210 #define FRAME_SMALLEST_CHAR_WIDTH(f) \
1211 FRAME_DISPLAY_INFO (f)->smallest_char_width
1213 /* Value is the smallest height of any font on frame F. */
1215 #define FRAME_SMALLEST_FONT_HEIGHT(f) \
1216 FRAME_DISPLAY_INFO (f)->smallest_font_height
1218 /***********************************************************************
1220 ***********************************************************************/
1222 extern Lisp_Object Qauto_raise
, Qauto_lower
;
1223 extern Lisp_Object Qborder_color
, Qborder_width
;
1224 extern Lisp_Object Qbuffer_predicate
;
1225 extern Lisp_Object Qcursor_color
, Qcursor_type
;
1226 extern Lisp_Object Qfont
;
1227 extern Lisp_Object Qicon
, Qicon_name
, Qicon_type
, Qicon_left
, Qicon_top
;
1228 extern Lisp_Object Qinternal_border_width
;
1229 extern Lisp_Object Qright_divider_width
, Qbottom_divider_width
;
1230 extern Lisp_Object Qtooltip
;
1231 extern Lisp_Object Qmenu_bar_lines
, Qtool_bar_lines
, Qtool_bar_position
;
1232 extern Lisp_Object Qmouse_color
;
1233 extern Lisp_Object Qname
, Qtitle
;
1234 extern Lisp_Object Qparent_id
;
1235 extern Lisp_Object Qunsplittable
, Qvisibility
;
1236 extern Lisp_Object Qscroll_bar_width
, Qvertical_scroll_bars
;
1237 extern Lisp_Object Qscroll_bar_foreground
, Qscroll_bar_background
;
1238 extern Lisp_Object Qscreen_gamma
;
1239 extern Lisp_Object Qline_spacing
;
1240 extern Lisp_Object Qwait_for_wm
;
1241 extern Lisp_Object Qfullscreen
;
1242 extern Lisp_Object Qfullwidth
, Qfullheight
, Qfullboth
, Qmaximized
;
1243 extern Lisp_Object Qsticky
;
1244 extern Lisp_Object Qfont_backend
;
1245 extern Lisp_Object Qalpha
;
1247 extern Lisp_Object Qleft_fringe
, Qright_fringe
;
1248 extern Lisp_Object Qheight
, Qwidth
;
1249 extern Lisp_Object Qminibuffer
, Qmodeline
;
1250 extern Lisp_Object Qx
, Qw32
, Qpc
, Qns
;
1251 extern Lisp_Object Qvisible
;
1252 extern Lisp_Object Qdisplay_type
;
1254 extern Lisp_Object Qx_resource_name
;
1256 extern Lisp_Object Qleft
, Qright
, Qtop
, Qbox
, Qbottom
;
1257 extern Lisp_Object Qdisplay
;
1259 extern Lisp_Object Qrun_hook_with_args
;
1261 #ifdef HAVE_WINDOW_SYSTEM
1263 /* The class of this X application. */
1264 #define EMACS_CLASS "Emacs"
1266 /* These are in xterm.c, w32term.c, etc. */
1268 extern void x_set_scroll_bar_default_width (struct frame
*);
1269 extern void x_set_offset (struct frame
*, int, int, int);
1270 extern void x_wm_set_size_hint (struct frame
*f
, long flags
, bool user_position
);
1272 extern Lisp_Object
x_new_font (struct frame
*, Lisp_Object
, int);
1275 extern Lisp_Object Qface_set_after_frame_default
;
1278 extern void x_fullscreen_adjust (struct frame
*f
, int *, int *,
1282 extern void x_set_frame_parameters (struct frame
*, Lisp_Object
);
1284 extern void x_set_fullscreen (struct frame
*, Lisp_Object
, Lisp_Object
);
1285 extern void x_set_line_spacing (struct frame
*, Lisp_Object
, Lisp_Object
);
1286 extern void x_set_screen_gamma (struct frame
*, Lisp_Object
, Lisp_Object
);
1287 extern void x_set_font (struct frame
*, Lisp_Object
, Lisp_Object
);
1288 extern void x_set_font_backend (struct frame
*, Lisp_Object
, Lisp_Object
);
1289 extern void x_set_fringe_width (struct frame
*, Lisp_Object
, Lisp_Object
);
1290 extern void x_set_border_width (struct frame
*, Lisp_Object
, Lisp_Object
);
1291 extern void x_set_internal_border_width (struct frame
*, Lisp_Object
,
1293 extern void x_set_right_divider_width (struct frame
*, Lisp_Object
,
1295 extern void x_set_bottom_divider_width (struct frame
*, Lisp_Object
,
1297 extern void x_set_visibility (struct frame
*, Lisp_Object
, Lisp_Object
);
1298 extern void x_set_autoraise (struct frame
*, Lisp_Object
, Lisp_Object
);
1299 extern void x_set_autolower (struct frame
*, Lisp_Object
, Lisp_Object
);
1300 extern void x_set_unsplittable (struct frame
*, Lisp_Object
, Lisp_Object
);
1301 extern void x_set_vertical_scroll_bars (struct frame
*, Lisp_Object
,
1303 extern void x_set_scroll_bar_width (struct frame
*, Lisp_Object
,
1306 extern long x_figure_window_size (struct frame
*, Lisp_Object
, bool);
1308 extern void x_set_alpha (struct frame
*, Lisp_Object
, Lisp_Object
);
1310 extern void validate_x_resource_name (void);
1312 extern Lisp_Object
display_x_get_resource (Display_Info
*,
1313 Lisp_Object attribute
,
1315 Lisp_Object component
,
1316 Lisp_Object subclass
);
1318 extern void set_frame_menubar (struct frame
*f
, bool first_time
, bool deep_p
);
1319 extern void x_set_window_size (struct frame
*f
, int change_grav
,
1320 int width
, int height
, bool pixelwise
);
1321 extern Lisp_Object
x_get_focus_frame (struct frame
*);
1322 extern void frame_set_mouse_pixel_position (struct frame
*f
, int pix_x
, int pix_y
);
1323 extern void x_make_frame_visible (struct frame
*f
);
1324 extern void x_make_frame_invisible (struct frame
*f
);
1325 extern void x_iconify_frame (struct frame
*f
);
1326 extern void x_set_frame_alpha (struct frame
*f
);
1327 extern void x_set_tool_bar_lines (struct frame
*, Lisp_Object
, Lisp_Object
);
1328 extern void x_activate_menubar (struct frame
*);
1329 extern void x_real_positions (struct frame
*, int *, int *);
1330 extern void free_frame_menubar (struct frame
*);
1331 extern void x_free_frame_resources (struct frame
*);
1333 #if defined HAVE_X_WINDOWS
1334 extern void x_wm_set_icon_position (struct frame
*, int, int);
1335 #if !defined USE_X_TOOLKIT
1336 extern char *x_get_resource_string (const char *, const char *);
1338 extern void x_sync (struct frame
*);
1339 #endif /* HAVE_X_WINDOWS */
1341 extern void x_query_colors (struct frame
*f
, XColor
*, int);
1342 extern void x_query_color (struct frame
*f
, XColor
*);
1343 extern void x_focus_frame (struct frame
*);
1347 extern int x_bitmap_icon (struct frame
*, Lisp_Object
);
1349 /* Set F's bitmap icon, if specified among F's parameters. */
1352 x_set_bitmap_icon (struct frame
*f
)
1354 Lisp_Object obj
= assq_no_quit (Qicon_type
, f
->param_alist
);
1357 x_bitmap_icon (f
, XCDR (obj
));
1360 #endif /* !HAVE_NS */
1361 #endif /* HAVE_WINDOW_SYSTEM */
1364 flush_frame (struct frame
*f
)
1366 struct redisplay_interface
*rif
= FRAME_RIF (f
);
1368 if (rif
&& rif
->flush_display
)
1369 rif
->flush_display (f
);
1372 /***********************************************************************
1374 ***********************************************************************/
1376 #ifdef HAVE_WINDOW_SYSTEM
1378 struct MonitorInfo
{
1379 XRectangle geom
, work
;
1380 int mm_width
, mm_height
;
1384 extern void free_monitors (struct MonitorInfo
*monitors
, int n_monitors
);
1385 extern Lisp_Object
make_monitor_attribute_list (struct MonitorInfo
*monitors
,
1387 int primary_monitor
,
1388 Lisp_Object monitor_frames
,
1389 const char *source
);
1391 #endif /* HAVE_WINDOW_SYSTEM */
1396 #endif /* not EMACS_FRAME_H */