* src/xdisp.c (message2, message2_nolog): Remove functions.
[bpt/emacs.git] / src / frame.h
1 /* Define frame-object for GNU Emacs.
2 Copyright (C) 1993-1994, 1999-2013 Free Software Foundation, Inc.
3
4 This file is part of GNU Emacs.
5
6 GNU Emacs is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 GNU Emacs is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
18
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. */
22
23 #ifndef EMACS_FRAME_H
24 #define EMACS_FRAME_H
25
26 #include "dispextern.h"
27
28 INLINE_HEADER_BEGIN
29 #ifndef FRAME_INLINE
30 # define FRAME_INLINE INLINE
31 #endif
32
33 \f
34 /* Miscellanea. */
35
36 /* Nonzero means there is at least one garbaged frame. */
37 extern bool frame_garbaged;
38
39 \f
40 /* The structure representing a frame. */
41
42 enum output_method
43 {
44 output_initial,
45 output_termcap,
46 output_x_window,
47 output_msdos_raw,
48 output_w32,
49 output_ns
50 };
51
52 enum vertical_scroll_bar_type
53 {
54 vertical_scroll_bar_none,
55 vertical_scroll_bar_left,
56 vertical_scroll_bar_right
57 };
58
59 enum text_cursor_kinds
60 {
61 DEFAULT_CURSOR = -2,
62 NO_CURSOR = -1,
63 FILLED_BOX_CURSOR,
64 HOLLOW_BOX_CURSOR,
65 BAR_CURSOR,
66 HBAR_CURSOR
67 };
68
69 enum fullscreen_type
70 {
71 FULLSCREEN_NONE,
72 FULLSCREEN_WIDTH = 0x001,
73 FULLSCREEN_HEIGHT = 0x002,
74 FULLSCREEN_BOTH = 0x003,
75 FULLSCREEN_MAXIMIZED = 0x013,
76 FULLSCREEN_WAIT = 0x100
77 };
78
79
80 #define FRAME_FOREGROUND_PIXEL(f) ((f)->foreground_pixel)
81 #define FRAME_BACKGROUND_PIXEL(f) ((f)->background_pixel)
82
83
84 struct frame
85 {
86 struct vectorlike_header header;
87
88 /* All Lisp_Object components must come first.
89 That ensures they are all aligned normally. */
90
91 /* Name of this frame: a Lisp string. It is used for looking up resources,
92 as well as for the title in some cases. */
93 Lisp_Object name;
94
95 /* The name to use for the icon, the last time
96 it was refreshed. nil means not explicitly specified. */
97 Lisp_Object icon_name;
98
99 /* This is the frame title specified explicitly, if any.
100 Usually it is nil. */
101 Lisp_Object title;
102
103 /* The frame which should receive keystrokes that occur in this
104 frame, or nil if they should go to the frame itself. This is
105 usually nil, but if the frame is minibufferless, we can use this
106 to redirect keystrokes to a surrogate minibuffer frame when
107 needed.
108
109 Note that a value of nil is different than having the field point
110 to the frame itself. Whenever the Fselect_frame function is used
111 to shift from one frame to the other, any redirections to the
112 original frame are shifted to the newly selected frame; if
113 focus_frame is nil, Fselect_frame will leave it alone. */
114 Lisp_Object focus_frame;
115
116 /* This frame's root window. Every frame has one.
117 If the frame has only a minibuffer window, this is it.
118 Otherwise, if the frame has a minibuffer window, this is its sibling. */
119 Lisp_Object root_window;
120
121 /* This frame's selected window.
122 Each frame has its own window hierarchy
123 and one of the windows in it is selected within the frame.
124 The selected window of the selected frame is Emacs's selected window. */
125 Lisp_Object selected_window;
126
127 /* This frame's minibuffer window.
128 Most frames have their own minibuffer windows,
129 but only the selected frame's minibuffer window
130 can actually appear to exist. */
131 Lisp_Object minibuffer_window;
132
133 /* Parameter alist of this frame.
134 These are the parameters specified when creating the frame
135 or modified with modify-frame-parameters. */
136 Lisp_Object param_alist;
137
138 /* List of scroll bars on this frame.
139 Actually, we don't specify exactly what is stored here at all; the
140 scroll bar implementation code can use it to store anything it likes.
141 This field is marked by the garbage collector. It is here
142 instead of in the `device' structure so that the garbage
143 collector doesn't need to look inside the window-system-dependent
144 structure. */
145 Lisp_Object scroll_bars;
146 Lisp_Object condemned_scroll_bars;
147
148 /* Vector describing the items to display in the menu bar.
149 Each item has four elements in this vector.
150 They are KEY, STRING, SUBMAP, and HPOS.
151 (HPOS is not used in when the X toolkit is in use.)
152 There are four additional elements of nil at the end, to terminate. */
153 Lisp_Object menu_bar_items;
154
155 /* Alist of elements (FACE-NAME . FACE-VECTOR-DATA). */
156 Lisp_Object face_alist;
157
158 /* A vector that records the entire structure of this frame's menu bar.
159 For the format of the data, see extensive comments in xmenu.c.
160 Only the X toolkit version uses this. */
161 Lisp_Object menu_bar_vector;
162
163 /* Predicate for selecting buffers for other-buffer. */
164 Lisp_Object buffer_predicate;
165
166 /* List of buffers viewed in this frame, for other-buffer. */
167 Lisp_Object buffer_list;
168
169 /* List of buffers that were viewed, then buried in this frame. The
170 most recently buried buffer is first. For last-buffer. */
171 Lisp_Object buried_buffer_list;
172
173 /* A dummy window used to display menu bars under X when no X
174 toolkit support is available. */
175 Lisp_Object menu_bar_window;
176
177 /* A window used to display the tool-bar of a frame. */
178 Lisp_Object tool_bar_window;
179
180 /* Desired and current tool-bar items. */
181 Lisp_Object tool_bar_items;
182
183 /* Where tool bar is, can be left, right, top or bottom. The native
184 tool bar only supports top. */
185 Lisp_Object tool_bar_position;
186
187 /* Desired and current contents displayed in tool_bar_window. */
188 Lisp_Object desired_tool_bar_string;
189 Lisp_Object current_tool_bar_string;
190
191 /* Beyond here, there should be no more Lisp_Object components. */
192
193 /* Cache of realized faces. */
194 struct face_cache *face_cache;
195
196 /* Number of elements in `menu_bar_vector' that have meaningful data. */
197 int menu_bar_items_used;
198
199 /* A buffer to hold the frame's name. We can't use the Lisp
200 string's pointer (`name', above) because it might get relocated. */
201 char *namebuf;
202
203 /* Glyph pool and matrix. */
204 struct glyph_pool *current_pool;
205 struct glyph_pool *desired_pool;
206 struct glyph_matrix *desired_matrix;
207 struct glyph_matrix *current_matrix;
208
209 /* 1 means that glyphs on this frame have been initialized so it can
210 be used for output. */
211 unsigned glyphs_initialized_p : 1;
212
213 /* Set to non-zero in change_frame_size when size of frame changed
214 Clear the frame in clear_garbaged_frames if set. */
215 unsigned resized_p : 1;
216
217 /* Set to non-zero in when we want for force a flush_display in
218 update_frame, usually after resizing the frame. */
219 unsigned force_flush_display_p : 1;
220
221 /* Set to non-zero if the default face for the frame has been
222 realized. Reset to zero whenever the default face changes.
223 Used to see the difference between a font change and face change. */
224 unsigned default_face_done_p : 1;
225
226 /* Set to non-zero if this frame has already been hscrolled during
227 current redisplay. */
228 unsigned already_hscrolled_p : 1;
229
230 /* Set to non-zero when current redisplay has updated frame. */
231 unsigned updated_p : 1;
232
233 /* Set to non-zero to minimize tool-bar height even when
234 auto-resize-tool-bar is set to grow-only. */
235 unsigned minimize_tool_bar_window_p : 1;
236
237 #if defined (USE_GTK) || defined (HAVE_NS)
238 /* Nonzero means using a tool bar that comes from the toolkit. */
239 unsigned external_tool_bar : 1;
240 #endif
241
242 /* Margin at the top of the frame. Used to display the tool-bar. */
243 int tool_bar_lines;
244
245 int n_tool_bar_rows;
246 int n_tool_bar_items;
247
248 /* A buffer for decode_mode_line. */
249 char *decode_mode_spec_buffer;
250
251 /* See do_line_insertion_deletion_costs for info on these arrays. */
252 /* Cost of inserting 1 line on this frame */
253 int *insert_line_cost;
254 /* Cost of deleting 1 line on this frame */
255 int *delete_line_cost;
256 /* Cost of inserting n lines on this frame */
257 int *insert_n_lines_cost;
258 /* Cost of deleting n lines on this frame */
259 int *delete_n_lines_cost;
260
261 /* Size of this frame, excluding fringes, scroll bars etc.,
262 in units of canonical characters. */
263 int text_lines, text_cols;
264
265 /* Total size of this frame (i.e. its native window), in units of
266 canonical characters. */
267 int total_lines, total_cols;
268
269 /* New text height and width for pending size change.
270 0 if no change pending. */
271 int new_text_lines, new_text_cols;
272
273 /* Pixel position of the frame window (x and y offsets in root window). */
274 int left_pos, top_pos;
275
276 /* Size of the frame window in pixels. */
277 int pixel_height, pixel_width;
278
279 /* Dots per inch of the screen the frame is on. */
280 double resx, resy;
281
282 /* These many pixels are the difference between the outer window (i.e. the
283 left and top of the window manager decoration) and FRAME_X_WINDOW. */
284 int x_pixels_diff, y_pixels_diff;
285
286 /* This is the gravity value for the specified window position. */
287 int win_gravity;
288
289 /* The geometry flags for this window. */
290 int size_hint_flags;
291
292 /* Border width of the frame window as known by the (X) window system. */
293 int border_width;
294
295 /* Width of the internal border. This is a line of background color
296 just inside the window's border. When the frame is selected,
297 a highlighting is displayed inside the internal border. */
298 int internal_border_width;
299
300 /* Canonical X unit. Width of default font, in pixels. */
301 int column_width;
302
303 /* Canonical Y unit. Height of a line, in pixels. */
304 int line_height;
305
306 /* The output method says how the contents of this frame are
307 displayed. It could be using termcap, or using an X window.
308 This must be the same as the terminal->type. */
309 enum output_method output_method;
310
311 /* The terminal device that this frame uses. If this is NULL, then
312 the frame has been deleted. */
313 struct terminal *terminal;
314
315 /* Device-dependent, frame-local auxiliary data used for displaying
316 the contents. When the frame is deleted, this data is deleted as
317 well. */
318 union output_data
319 {
320 struct tty_output *tty; /* termchar.h */
321 struct x_output *x; /* xterm.h */
322 struct w32_output *w32; /* w32term.h */
323 struct ns_output *ns; /* nsterm.h */
324 intptr_t nothing;
325 }
326 output_data;
327
328 /* List of font-drivers available on the frame. */
329 struct font_driver_list *font_driver_list;
330 /* List of data specific to font-driver and frame, but common to
331 faces. */
332 struct font_data_list *font_data_list;
333
334 /* Total width of fringes reserved for drawing truncation bitmaps,
335 continuation bitmaps and alike. The width is in canonical char
336 units of the frame. This must currently be the case because window
337 sizes aren't pixel values. If it weren't the case, we wouldn't be
338 able to split windows horizontally nicely. */
339 int fringe_cols;
340
341 /* The extra width (in pixels) currently allotted for fringes. */
342 int left_fringe_width, right_fringe_width;
343
344 /* See FULLSCREEN_ enum below */
345 enum fullscreen_type want_fullscreen;
346
347 /* Number of lines of menu bar. */
348 int menu_bar_lines;
349
350 #if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) \
351 || defined (HAVE_NS) || defined (USE_GTK)
352 /* Nonzero means using a menu bar that comes from the X toolkit. */
353 unsigned int external_menu_bar : 1;
354 #endif
355
356 /* visible is nonzero if the frame is currently displayed; we check
357 it to see if we should bother updating the frame's contents.
358 DON'T SET IT DIRECTLY; instead, use FRAME_SET_VISIBLE.
359
360 Note that, since invisible frames aren't updated, whenever a
361 frame becomes visible again, it must be marked as garbaged. The
362 FRAME_SAMPLE_VISIBILITY macro takes care of this.
363
364 On ttys and on Windows NT/9X, to avoid wasting effort updating
365 visible frames that are actually completely obscured by other
366 windows on the display, we bend the meaning of visible slightly:
367 if greater than 1, then the frame is obscured - we still consider
368 it to be "visible" as seen from lisp, but we don't bother
369 updating it. We must take care to garbage the frame when it
370 ceases to be obscured though.
371
372 iconified is nonzero if the frame is currently iconified.
373
374 Asynchronous input handlers should NOT change these directly;
375 instead, they should change async_visible or async_iconified, and
376 let the FRAME_SAMPLE_VISIBILITY macro set visible and iconified
377 at the next redisplay.
378
379 These should probably be considered read-only by everyone except
380 FRAME_SAMPLE_VISIBILITY.
381
382 These two are mutually exclusive. They might both be zero, if the
383 frame has been made invisible without an icon. */
384 unsigned visible : 2;
385 unsigned iconified : 1;
386
387 /* Let's not use bitfields for volatile variables. */
388
389 /* Asynchronous input handlers change these, and
390 FRAME_SAMPLE_VISIBILITY copies them into visible and iconified.
391 See FRAME_SAMPLE_VISIBILITY, below. */
392 volatile char async_visible, async_iconified;
393
394 /* Nonzero if this frame should be redrawn. */
395 volatile char garbaged;
396
397 /* True if frame actually has a minibuffer window on it.
398 0 if using a minibuffer window that isn't on this frame. */
399 unsigned has_minibuffer : 1;
400
401 /* 0 means, if this frame has just one window,
402 show no modeline for that window. */
403 unsigned wants_modeline : 1;
404
405 /* Non-0 means raise this frame to the top of the heap when selected. */
406 unsigned auto_raise : 1;
407
408 /* Non-0 means lower this frame to the bottom of the stack when left. */
409 unsigned auto_lower : 1;
410
411 /* True if frame's root window can't be split. */
412 unsigned no_split : 1;
413
414 /* If this is set, then Emacs won't change the frame name to indicate
415 the current buffer, etcetera. If the user explicitly sets the frame
416 name, this gets set. If the user sets the name to Qnil, this is
417 cleared. */
418 unsigned explicit_name : 1;
419
420 /* Nonzero if size of some window on this frame has changed. */
421 unsigned window_sizes_changed : 1;
422
423 /* Nonzero if the mouse has moved on this display device
424 since the last time we checked. */
425 unsigned mouse_moved :1;
426
427 /* Nonzero means that the pointer is invisible. */
428 unsigned pointer_invisible :1;
429
430 /* Nonzero if we should actually display the scroll bars on this frame. */
431 enum vertical_scroll_bar_type vertical_scroll_bar_type;
432
433 /* What kind of text cursor should we draw in the future?
434 This should always be filled_box_cursor or bar_cursor. */
435 enum text_cursor_kinds desired_cursor;
436
437 /* Width of bar cursor (if we are using that). */
438 int cursor_width;
439
440 /* What kind of text cursor should we draw when the cursor blinks off?
441 This can be filled_box_cursor or bar_cursor or no_cursor. */
442 enum text_cursor_kinds blink_off_cursor;
443
444 /* Width of bar cursor (if we are using that) for blink-off state. */
445 int blink_off_cursor_width;
446
447 /* Nonnegative if current redisplay should not do scroll computation
448 for lines beyond a certain vpos. This is the vpos. */
449 int scroll_bottom_vpos;
450
451 /* Configured width of the scroll bar, in pixels and in characters.
452 config_scroll_bar_cols tracks config_scroll_bar_width if the
453 latter is positive; a zero value in config_scroll_bar_width means
454 to compute the actual width on the fly, using config_scroll_bar_cols
455 and the current font width. */
456 int config_scroll_bar_width;
457 int config_scroll_bar_cols;
458
459 /* The size of the extra width currently allotted for vertical
460 scroll bars in this frame, in pixels. */
461 int scroll_bar_actual_width;
462
463 /* The baud rate that was used to calculate costs for this frame. */
464 int cost_calculation_baud_rate;
465
466 /* frame opacity
467 alpha[0]: alpha transparency of the active frame
468 alpha[1]: alpha transparency of inactive frames
469 Negative values mean not to change alpha. */
470 double alpha[2];
471
472 /* Exponent for gamma correction of colors. 1/(VIEWING_GAMMA *
473 SCREEN_GAMMA) where viewing_gamma is 0.4545 and SCREEN_GAMMA is a
474 frame parameter. 0 means don't do gamma correction. */
475 double gamma;
476
477 /* Additional space to put between text lines on this frame. */
478 int extra_line_spacing;
479
480 /* All display backends seem to need these two pixel values. */
481 unsigned long background_pixel;
482 unsigned long foreground_pixel;
483 };
484
485 /* Most code should use these functions to set Lisp fields in struct frame. */
486
487 FRAME_INLINE void
488 fset_buffer_list (struct frame *f, Lisp_Object val)
489 {
490 f->buffer_list = val;
491 }
492 FRAME_INLINE void
493 fset_buried_buffer_list (struct frame *f, Lisp_Object val)
494 {
495 f->buried_buffer_list = val;
496 }
497 FRAME_INLINE void
498 fset_condemned_scroll_bars (struct frame *f, Lisp_Object val)
499 {
500 f->condemned_scroll_bars = val;
501 }
502 FRAME_INLINE void
503 fset_current_tool_bar_string (struct frame *f, Lisp_Object val)
504 {
505 f->current_tool_bar_string = val;
506 }
507 FRAME_INLINE void
508 fset_desired_tool_bar_string (struct frame *f, Lisp_Object val)
509 {
510 f->desired_tool_bar_string = val;
511 }
512 FRAME_INLINE void
513 fset_face_alist (struct frame *f, Lisp_Object val)
514 {
515 f->face_alist = val;
516 }
517 FRAME_INLINE void
518 fset_focus_frame (struct frame *f, Lisp_Object val)
519 {
520 f->focus_frame = val;
521 }
522 FRAME_INLINE void
523 fset_icon_name (struct frame *f, Lisp_Object val)
524 {
525 f->icon_name = val;
526 }
527 FRAME_INLINE void
528 fset_menu_bar_items (struct frame *f, Lisp_Object val)
529 {
530 f->menu_bar_items = val;
531 }
532 FRAME_INLINE void
533 fset_menu_bar_vector (struct frame *f, Lisp_Object val)
534 {
535 f->menu_bar_vector = val;
536 }
537 FRAME_INLINE void
538 fset_menu_bar_window (struct frame *f, Lisp_Object val)
539 {
540 f->menu_bar_window = val;
541 }
542 FRAME_INLINE void
543 fset_name (struct frame *f, Lisp_Object val)
544 {
545 f->name = val;
546 }
547 FRAME_INLINE void
548 fset_param_alist (struct frame *f, Lisp_Object val)
549 {
550 f->param_alist = val;
551 }
552 FRAME_INLINE void
553 fset_root_window (struct frame *f, Lisp_Object val)
554 {
555 f->root_window = val;
556 }
557 FRAME_INLINE void
558 fset_scroll_bars (struct frame *f, Lisp_Object val)
559 {
560 f->scroll_bars = val;
561 }
562 FRAME_INLINE void
563 fset_selected_window (struct frame *f, Lisp_Object val)
564 {
565 f->selected_window = val;
566 }
567 FRAME_INLINE void
568 fset_title (struct frame *f, Lisp_Object val)
569 {
570 f->title = val;
571 }
572 FRAME_INLINE void
573 fset_tool_bar_items (struct frame *f, Lisp_Object val)
574 {
575 f->tool_bar_items = val;
576 }
577 FRAME_INLINE void
578 fset_tool_bar_position (struct frame *f, Lisp_Object val)
579 {
580 f->tool_bar_position = val;
581 }
582 FRAME_INLINE void
583 fset_tool_bar_window (struct frame *f, Lisp_Object val)
584 {
585 f->tool_bar_window = val;
586 }
587
588 #define FRAME_KBOARD(f) ((f)->terminal->kboard)
589
590 /* Return a pointer to the image cache of frame F. */
591 #define FRAME_IMAGE_CACHE(F) ((F)->terminal->image_cache)
592
593 typedef struct frame *FRAME_PTR;
594
595 #define XFRAME(p) \
596 (eassert (FRAMEP (p)), (struct frame *) XUNTAG (p, Lisp_Vectorlike))
597 #define XSETFRAME(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_FRAME))
598
599 /* Given a window, return its frame as a Lisp_Object. */
600 #define WINDOW_FRAME(w) w->frame
601
602 /* Test a frame for particular kinds of display methods. */
603 #define FRAME_INITIAL_P(f) ((f)->output_method == output_initial)
604 #define FRAME_TERMCAP_P(f) ((f)->output_method == output_termcap)
605 #define FRAME_X_P(f) ((f)->output_method == output_x_window)
606 #ifndef HAVE_NTGUI
607 #define FRAME_W32_P(f) (0)
608 #else
609 #define FRAME_W32_P(f) ((f)->output_method == output_w32)
610 #endif
611 #ifndef MSDOS
612 #define FRAME_MSDOS_P(f) (0)
613 #else
614 #define FRAME_MSDOS_P(f) ((f)->output_method == output_msdos_raw)
615 #endif
616 #ifndef HAVE_NS
617 #define FRAME_NS_P(f) (0)
618 #else
619 #define FRAME_NS_P(f) ((f)->output_method == output_ns)
620 #endif
621 /* FRAME_WINDOW_P tests whether the frame is a window, and is
622 defined to be the predicate for the window system being used. */
623
624 #ifdef HAVE_X_WINDOWS
625 #define FRAME_WINDOW_P(f) FRAME_X_P (f)
626 #endif
627 #ifdef HAVE_NTGUI
628 #define FRAME_WINDOW_P(f) FRAME_W32_P (f)
629 #endif
630 #ifdef HAVE_NS
631 #define FRAME_WINDOW_P(f) FRAME_NS_P(f)
632 #endif
633 #ifndef FRAME_WINDOW_P
634 #define FRAME_WINDOW_P(f) ((void) (f), 0)
635 #endif
636
637 /* Return a pointer to the structure holding information about the
638 region of text, if any, that is currently shown in mouse-face on
639 frame F. We need to define two versions because a TTY-only build
640 does not have FRAME_X_DISPLAY_INFO. */
641 #ifdef HAVE_WINDOW_SYSTEM
642 # define MOUSE_HL_INFO(F) \
643 (FRAME_WINDOW_P(F) \
644 ? &FRAME_X_DISPLAY_INFO(F)->mouse_highlight \
645 : &(F)->output_data.tty->display_info->mouse_highlight)
646 #else
647 # define MOUSE_HL_INFO(F) \
648 (&(F)->output_data.tty->display_info->mouse_highlight)
649 #endif
650
651 /* Nonzero if frame F is still alive (not deleted). */
652 #define FRAME_LIVE_P(f) ((f)->terminal != 0)
653
654 /* Nonzero if frame F is a minibuffer-only frame. */
655 #define FRAME_MINIBUF_ONLY_P(f) \
656 EQ (FRAME_ROOT_WINDOW (f), FRAME_MINIBUF_WINDOW (f))
657
658 /* Nonzero if frame F contains a minibuffer window.
659 (If this is 0, F must use some other minibuffer window.) */
660 #define FRAME_HAS_MINIBUF_P(f) ((f)->has_minibuffer)
661
662 /* Pixel height of frame F, including non-toolkit menu bar and
663 non-toolkit tool bar lines. */
664 #define FRAME_PIXEL_HEIGHT(f) ((f)->pixel_height)
665
666 /* Pixel width of frame F. */
667 #define FRAME_PIXEL_WIDTH(f) ((f)->pixel_width)
668
669 /* Height of frame F, measured in canonical lines, including
670 non-toolkit menu bar and non-toolkit tool bar lines. */
671 #define FRAME_LINES(f) (f)->text_lines
672
673 /* Width of frame F, measured in canonical character columns,
674 not including scroll bars if any. */
675 #define FRAME_COLS(f) (f)->text_cols
676
677 /* Number of lines of frame F used for menu bar.
678 This is relevant on terminal frames and on
679 X Windows when not using the X toolkit.
680 These lines are counted in FRAME_LINES. */
681 #define FRAME_MENU_BAR_LINES(f) (f)->menu_bar_lines
682
683 /* Nonzero if this frame should display a tool bar
684 in a way that does not use any text lines. */
685 #if defined (USE_GTK) || defined (HAVE_NS)
686 #define FRAME_EXTERNAL_TOOL_BAR(f) (f)->external_tool_bar
687 #else
688 #define FRAME_EXTERNAL_TOOL_BAR(f) 0
689 #endif
690
691 /* Number of lines of frame F used for the tool-bar. */
692
693 #define FRAME_TOOL_BAR_LINES(f) (f)->tool_bar_lines
694
695
696 /* Lines above the top-most window in frame F. */
697
698 #define FRAME_TOP_MARGIN(F) \
699 (FRAME_MENU_BAR_LINES (F) + FRAME_TOOL_BAR_LINES (F))
700
701 /* Pixel height of the top margin above. */
702
703 #define FRAME_TOP_MARGIN_HEIGHT(f) \
704 (FRAME_TOP_MARGIN (f) * FRAME_LINE_HEIGHT (f))
705
706 /* Nonzero if this frame should display a menu bar
707 in a way that does not use any text lines. */
708 #if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) \
709 || defined (HAVE_NS) || defined (USE_GTK)
710 #define FRAME_EXTERNAL_MENU_BAR(f) (f)->external_menu_bar
711 #else
712 #define FRAME_EXTERNAL_MENU_BAR(f) 0
713 #endif
714 #define FRAME_VISIBLE_P(f) ((f)->visible != 0)
715
716 /* Nonzero if frame F is currently visible but hidden. */
717 #define FRAME_OBSCURED_P(f) ((f)->visible > 1)
718
719 /* Nonzero if frame F is currently iconified. */
720 #define FRAME_ICONIFIED_P(f) (f)->iconified
721
722 #define FRAME_SET_VISIBLE(f,p) \
723 ((f)->async_visible = (p), FRAME_SAMPLE_VISIBILITY (f))
724 #define SET_FRAME_GARBAGED(f) (frame_garbaged = 1, f->garbaged = 1)
725 #define FRAME_GARBAGED_P(f) (f)->garbaged
726
727 /* Nonzero means do not allow splitting this frame's window. */
728 #define FRAME_NO_SPLIT_P(f) (f)->no_split
729
730 /* Not really implemented. */
731 #define FRAME_WANTS_MODELINE_P(f) (f)->wants_modeline
732
733 /* Nonzero if a size change has been requested for frame F
734 but not yet really put into effect. This can be true temporarily
735 when an X event comes in at a bad time. */
736 #define FRAME_WINDOW_SIZES_CHANGED(f) (f)->window_sizes_changed
737
738 /* The minibuffer window of frame F, if it has one; otherwise nil. */
739 #define FRAME_MINIBUF_WINDOW(f) f->minibuffer_window
740
741 /* The root window of the window tree of frame F. */
742 #define FRAME_ROOT_WINDOW(f) f->root_window
743
744 /* The currently selected window of the window tree of frame F. */
745 #define FRAME_SELECTED_WINDOW(f) f->selected_window
746
747 #define FRAME_INSERT_COST(f) (f)->insert_line_cost
748 #define FRAME_DELETE_COST(f) (f)->delete_line_cost
749 #define FRAME_INSERTN_COST(f) (f)->insert_n_lines_cost
750 #define FRAME_DELETEN_COST(f) (f)->delete_n_lines_cost
751 #define FRAME_SCROLL_BOTTOM_VPOS(f) (f)->scroll_bottom_vpos
752 #define FRAME_FOCUS_FRAME(f) f->focus_frame
753
754 /* This frame slot says whether scroll bars are currently enabled for frame F,
755 and which side they are on. */
756 #define FRAME_VERTICAL_SCROLL_BAR_TYPE(f) ((f)->vertical_scroll_bar_type)
757 #define FRAME_HAS_VERTICAL_SCROLL_BARS(f) \
758 ((f)->vertical_scroll_bar_type != vertical_scroll_bar_none)
759 #define FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT(f) \
760 ((f)->vertical_scroll_bar_type == vertical_scroll_bar_left)
761 #define FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT(f) \
762 ((f)->vertical_scroll_bar_type == vertical_scroll_bar_right)
763
764 /* Width that a scroll bar in frame F should have, if there is one.
765 Measured in pixels.
766 If scroll bars are turned off, this is still nonzero. */
767 #define FRAME_CONFIG_SCROLL_BAR_WIDTH(f) ((f)->config_scroll_bar_width)
768
769 /* Width that a scroll bar in frame F should have, if there is one.
770 Measured in columns (characters).
771 If scroll bars are turned off, this is still nonzero. */
772 #define FRAME_CONFIG_SCROLL_BAR_COLS(f) ((f)->config_scroll_bar_cols)
773
774 /* Width of a scroll bar in frame F, measured in columns (characters),
775 but only if scroll bars are on the left. If scroll bars are on
776 the right in this frame, or there are no scroll bars, value is 0. */
777
778 #define FRAME_LEFT_SCROLL_BAR_COLS(f) \
779 (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f) \
780 ? FRAME_CONFIG_SCROLL_BAR_COLS (f) \
781 : 0)
782
783 /* Width of a left scroll bar in frame F, measured in pixels */
784
785 #define FRAME_LEFT_SCROLL_BAR_AREA_WIDTH(f) \
786 (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f) \
787 ? (FRAME_CONFIG_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f)) \
788 : 0)
789
790 /* Width of a scroll bar in frame F, measured in columns (characters),
791 but only if scroll bars are on the right. If scroll bars are on
792 the left in this frame, or there are no scroll bars, value is 0. */
793
794 #define FRAME_RIGHT_SCROLL_BAR_COLS(f) \
795 (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f) \
796 ? FRAME_CONFIG_SCROLL_BAR_COLS (f) \
797 : 0)
798
799 /* Width of a right scroll bar area in frame F, measured in pixels */
800
801 #define FRAME_RIGHT_SCROLL_BAR_AREA_WIDTH(f) \
802 (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f) \
803 ? (FRAME_CONFIG_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f)) \
804 : 0)
805
806 /* Actual width of a scroll bar in frame F, measured in columns. */
807
808 #define FRAME_SCROLL_BAR_COLS(f) \
809 (FRAME_HAS_VERTICAL_SCROLL_BARS (f) \
810 ? FRAME_CONFIG_SCROLL_BAR_COLS (f) \
811 : 0)
812
813 /* Actual width of a scroll bar area in frame F, measured in pixels. */
814
815 #define FRAME_SCROLL_BAR_AREA_WIDTH(f) \
816 (FRAME_HAS_VERTICAL_SCROLL_BARS (f) \
817 ? (FRAME_CONFIG_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f)) \
818 : 0)
819
820 /* Total width of frame F, in columns (characters),
821 including the width used by scroll bars if any. */
822
823 #define FRAME_TOTAL_COLS(f) ((f)->total_cols)
824
825 /* Set the width of frame F to VAL.
826 VAL is the width of a full-frame window,
827 not including scroll bars and fringes. */
828
829 #define SET_FRAME_COLS(f, val) \
830 (FRAME_COLS (f) = (val), \
831 (f)->total_cols = FRAME_TOTAL_COLS_ARG (f, FRAME_COLS (f)))
832
833 /* Given a value WIDTH for frame F's nominal width,
834 return the value that FRAME_TOTAL_COLS should have. */
835
836 #define FRAME_TOTAL_COLS_ARG(f, width) \
837 ((width) \
838 + FRAME_SCROLL_BAR_COLS (f) \
839 + FRAME_FRINGE_COLS (f))
840
841 /* Maximum + 1 legitimate value for FRAME_CURSOR_X. */
842
843 #define FRAME_CURSOR_X_LIMIT(f) \
844 (FRAME_COLS (f) + FRAME_LEFT_SCROLL_BAR_COLS (f))
845
846 /* Nonzero if frame F has scroll bars. */
847
848 #define FRAME_SCROLL_BARS(f) (f->scroll_bars)
849
850 #define FRAME_CONDEMNED_SCROLL_BARS(f) (f->condemned_scroll_bars)
851 #define FRAME_MENU_BAR_ITEMS(f) (f->menu_bar_items)
852 #define FRAME_COST_BAUD_RATE(f) ((f)->cost_calculation_baud_rate)
853
854 #define FRAME_DESIRED_CURSOR(f) ((f)->desired_cursor)
855 #define FRAME_BLINK_OFF_CURSOR(f) ((f)->blink_off_cursor)
856 #define FRAME_CURSOR_WIDTH(f) ((f)->cursor_width)
857 #define FRAME_BLINK_OFF_CURSOR_WIDTH(f) ((f)->blink_off_cursor_width)
858
859 /* Return a pointer to the face cache of frame F. */
860
861 #define FRAME_FACE_CACHE(F) (F)->face_cache
862
863 /* Return the size of message_buf of the frame F. We multiply the
864 width of the frame by 4 because multi-byte form may require at most
865 4-byte for a character. */
866
867 #define FRAME_MESSAGE_BUF_SIZE(f) (((int) FRAME_COLS (f)) * 4)
868
869 /* Emacs's redisplay code could become confused if a frame's
870 visibility changes at arbitrary times. For example, if a frame is
871 visible while the desired glyphs are being built, but becomes
872 invisible before they are updated, then some rows of the
873 desired_glyphs will be left marked as enabled after redisplay is
874 complete, which should never happen. The next time the frame
875 becomes visible, redisplay will probably barf.
876
877 Currently, there are no similar situations involving iconified, but
878 the principle is the same.
879
880 So instead of having asynchronous input handlers directly set and
881 clear the frame's visibility and iconification flags, they just set
882 the async_visible and async_iconified flags; the redisplay code
883 calls the FRAME_SAMPLE_VISIBILITY macro before doing any redisplay,
884 which sets visible and iconified from their asynchronous
885 counterparts.
886
887 Synchronous code must use the FRAME_SET_VISIBLE macro.
888
889 Also, if a frame used to be invisible, but has just become visible,
890 it must be marked as garbaged, since redisplay hasn't been keeping
891 up its contents.
892
893 Note that a tty frame is visible if and only if it is the topmost
894 frame. */
895
896 #define FRAME_SAMPLE_VISIBILITY(f) \
897 (((f)->async_visible && (f)->visible != (f)->async_visible) ? \
898 SET_FRAME_GARBAGED (f) : 0, \
899 (f)->visible = (f)->async_visible, \
900 (f)->iconified = (f)->async_iconified)
901
902 #define CHECK_FRAME(x) \
903 CHECK_TYPE (FRAMEP (x), Qframep, x)
904
905 #define CHECK_LIVE_FRAME(x) \
906 CHECK_TYPE (FRAMEP (x) && FRAME_LIVE_P (XFRAME (x)), Qframe_live_p, x)
907
908 /* FOR_EACH_FRAME (LIST_VAR, FRAME_VAR) followed by a statement is a
909 `for' loop which iterates over the elements of Vframe_list. The
910 loop will set FRAME_VAR, a Lisp_Object, to each frame in
911 Vframe_list in succession and execute the statement. LIST_VAR
912 should be a Lisp_Object too; it is used to iterate through the
913 Vframe_list.
914
915 This macro is a holdover from a time when multiple frames weren't always
916 supported. An alternate definition of the macro would expand to
917 something which executes the statement once. */
918
919 #define FOR_EACH_FRAME(list_var, frame_var) \
920 for ((list_var) = Vframe_list; \
921 (CONSP (list_var) \
922 && (frame_var = XCAR (list_var), 1)); \
923 list_var = XCDR (list_var))
924
925 /* Reflect mouse movement when a complete frame update is performed. */
926
927 #define FRAME_MOUSE_UPDATE(frame) \
928 do { \
929 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (frame); \
930 if (frame == hlinfo->mouse_face_mouse_frame) \
931 { \
932 block_input (); \
933 if (hlinfo->mouse_face_mouse_frame) \
934 note_mouse_highlight (hlinfo->mouse_face_mouse_frame, \
935 hlinfo->mouse_face_mouse_x, \
936 hlinfo->mouse_face_mouse_y); \
937 unblock_input (); \
938 } \
939 } while (0)
940
941 extern Lisp_Object Qframep, Qframe_live_p;
942 extern Lisp_Object Qtty, Qtty_type;
943 extern Lisp_Object Qtty_color_mode;
944 extern Lisp_Object Qterminal, Qterminal_live_p;
945 extern Lisp_Object Qnoelisp;
946
947 extern struct frame *last_nonminibuf_frame;
948
949 extern void set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object);
950 extern struct frame *decode_live_frame (Lisp_Object);
951 extern struct frame *decode_any_frame (Lisp_Object);
952 extern struct frame *make_initial_frame (void);
953 extern struct frame *make_frame (int);
954 #ifdef HAVE_WINDOW_SYSTEM
955 extern struct frame *make_minibuffer_frame (void);
956 extern struct frame *make_frame_without_minibuffer (Lisp_Object,
957 struct kboard *,
958 Lisp_Object);
959 #endif /* HAVE_WINDOW_SYSTEM */
960 extern void frame_make_pointer_invisible (void);
961 extern void frame_make_pointer_visible (void);
962 extern Lisp_Object delete_frame (Lisp_Object, Lisp_Object);
963
964 extern Lisp_Object Vframe_list;
965 \f
966 /* The currently selected frame. */
967
968 extern Lisp_Object selected_frame;
969
970 /* Value is a pointer to the selected frame. If the selected frame
971 isn't live, abort. */
972
973 #define SELECTED_FRAME() \
974 ((FRAMEP (selected_frame) \
975 && FRAME_LIVE_P (XFRAME (selected_frame))) \
976 ? XFRAME (selected_frame) \
977 : (emacs_abort (), (struct frame *) 0))
978
979 \f
980 /***********************************************************************
981 Display-related Macros
982 ***********************************************************************/
983
984 /* Canonical y-unit on frame F.
985 This value currently equals the line height of the frame (which is
986 the height of the default font of F). */
987
988 #define FRAME_LINE_HEIGHT(F) ((F)->line_height)
989
990 /* Canonical x-unit on frame F.
991 This value currently equals the average width of the default font of F. */
992
993 #define FRAME_COLUMN_WIDTH(F) ((F)->column_width)
994
995 /* Pixel width of areas used to display truncation marks, continuation
996 marks, overlay arrows. This is 0 for terminal frames. */
997
998 #ifdef HAVE_WINDOW_SYSTEM
999
1000 /* Total width of fringes reserved for drawing truncation bitmaps,
1001 continuation bitmaps and alike. The width is in canonical char
1002 units of the frame. This must currently be the case because window
1003 sizes aren't pixel values. If it weren't the case, we wouldn't be
1004 able to split windows horizontally nicely. */
1005
1006 #define FRAME_FRINGE_COLS(F) ((F)->fringe_cols)
1007
1008 /* Pixel-width of the left and right fringe. */
1009
1010 #define FRAME_LEFT_FRINGE_WIDTH(F) ((F)->left_fringe_width)
1011 #define FRAME_RIGHT_FRINGE_WIDTH(F) ((F)->right_fringe_width)
1012
1013 /* Total width of fringes in pixels. */
1014
1015 #define FRAME_TOTAL_FRINGE_WIDTH(F) \
1016 (FRAME_LEFT_FRINGE_WIDTH (F) + FRAME_RIGHT_FRINGE_WIDTH (F))
1017
1018
1019 /* Pixel-width of internal border lines */
1020
1021 #define FRAME_INTERNAL_BORDER_WIDTH(F) ((F)->internal_border_width)
1022
1023 #else /* not HAVE_WINDOW_SYSTEM */
1024
1025 #define FRAME_FRINGE_COLS(F) 0
1026 #define FRAME_TOTAL_FRINGE_WIDTH(F) 0
1027 #define FRAME_LEFT_FRINGE_WIDTH(F) 0
1028 #define FRAME_RIGHT_FRINGE_WIDTH(F) 0
1029 #define FRAME_INTERNAL_BORDER_WIDTH(F) 0
1030
1031 #endif /* not HAVE_WINDOW_SYSTEM */
1032
1033
1034
1035 \f
1036 /***********************************************************************
1037 Conversion between canonical units and pixels
1038 ***********************************************************************/
1039
1040 /* Canonical x-values are fractions of FRAME_COLUMN_WIDTH, canonical
1041 y-unit are fractions of FRAME_LINE_HEIGHT of a frame. Both are
1042 represented as Lisp numbers, i.e. integers or floats. */
1043
1044 /* Convert canonical value X to pixels. F is the frame whose
1045 canonical char width is to be used. X must be a Lisp integer or
1046 float. Value is a C integer. */
1047
1048 #define FRAME_PIXEL_X_FROM_CANON_X(F, X) \
1049 (INTEGERP (X) \
1050 ? XINT (X) * FRAME_COLUMN_WIDTH (F) \
1051 : (int) (XFLOAT_DATA (X) * FRAME_COLUMN_WIDTH (F)))
1052
1053 /* Convert canonical value Y to pixels. F is the frame whose
1054 canonical character height is to be used. X must be a Lisp integer
1055 or float. Value is a C integer. */
1056
1057 #define FRAME_PIXEL_Y_FROM_CANON_Y(F, Y) \
1058 (INTEGERP (Y) \
1059 ? XINT (Y) * FRAME_LINE_HEIGHT (F) \
1060 : (int) (XFLOAT_DATA (Y) * FRAME_LINE_HEIGHT (F)))
1061
1062 /* Convert pixel-value X to canonical units. F is the frame whose
1063 canonical character width is to be used. X is a C integer. Result
1064 is a Lisp float if X is not a multiple of the canon width,
1065 otherwise it's a Lisp integer. */
1066
1067 #define FRAME_CANON_X_FROM_PIXEL_X(F, X) \
1068 ((X) % FRAME_COLUMN_WIDTH (F) != 0 \
1069 ? make_float ((double) (X) / FRAME_COLUMN_WIDTH (F)) \
1070 : make_number ((X) / FRAME_COLUMN_WIDTH (F)))
1071
1072 /* Convert pixel-value Y to canonical units. F is the frame whose
1073 canonical character height is to be used. Y is a C integer.
1074 Result is a Lisp float if Y is not a multiple of the canon width,
1075 otherwise it's a Lisp integer. */
1076
1077 #define FRAME_CANON_Y_FROM_PIXEL_Y(F, Y) \
1078 ((Y) % FRAME_LINE_HEIGHT (F) \
1079 ? make_float ((double) (Y) / FRAME_LINE_HEIGHT (F)) \
1080 : make_number ((Y) / FRAME_LINE_HEIGHT (F)))
1081
1082
1083 \f
1084 /* Manipulating pixel sizes and character sizes.
1085 Knowledge of which factors affect the overall size of the window should
1086 be hidden in these macros, if that's possible.
1087
1088 Return the upper/left pixel position of the character cell on frame F
1089 at ROW/COL. */
1090
1091 #define FRAME_LINE_TO_PIXEL_Y(f, row) \
1092 (((row) < FRAME_TOP_MARGIN (f) ? 0 : FRAME_INTERNAL_BORDER_WIDTH (f)) \
1093 + (row) * FRAME_LINE_HEIGHT (f))
1094
1095 #define FRAME_COL_TO_PIXEL_X(f, col) \
1096 (FRAME_INTERNAL_BORDER_WIDTH (f) \
1097 + (col) * FRAME_COLUMN_WIDTH (f))
1098
1099 /* Return the pixel width/height of frame F if it has
1100 COLS columns/LINES rows. */
1101
1102 #define FRAME_TEXT_COLS_TO_PIXEL_WIDTH(f, cols) \
1103 (FRAME_COL_TO_PIXEL_X (f, cols) \
1104 + (f)->scroll_bar_actual_width \
1105 + FRAME_TOTAL_FRINGE_WIDTH (f) \
1106 + FRAME_INTERNAL_BORDER_WIDTH (f))
1107
1108 #define FRAME_TEXT_LINES_TO_PIXEL_HEIGHT(f, lines) \
1109 ((lines) * FRAME_LINE_HEIGHT (f) \
1110 + 2 * FRAME_INTERNAL_BORDER_WIDTH (f))
1111
1112
1113 /* Return the row/column (zero-based) of the character cell containing
1114 the pixel on FRAME at Y/X. */
1115
1116 #define FRAME_PIXEL_Y_TO_LINE(f, y) \
1117 (((y) < FRAME_TOP_MARGIN_HEIGHT (f) \
1118 ? (y) \
1119 : ((y) < FRAME_TOP_MARGIN_HEIGHT (f) + FRAME_INTERNAL_BORDER_WIDTH (f) \
1120 ? (y) - (FRAME_TOP_MARGIN_HEIGHT (f) + FRAME_INTERNAL_BORDER_WIDTH (f) \
1121 /* Arrange for the division to round down. */ \
1122 + FRAME_LINE_HEIGHT (f) - 1) \
1123 : (y) - FRAME_INTERNAL_BORDER_WIDTH (f))) \
1124 / FRAME_LINE_HEIGHT (f))
1125
1126 #define FRAME_PIXEL_X_TO_COL(f, x) \
1127 (((x) - FRAME_INTERNAL_BORDER_WIDTH (f)) \
1128 / FRAME_COLUMN_WIDTH (f))
1129
1130 /* How many columns/rows of text can we fit in WIDTH/HEIGHT pixels on
1131 frame F? */
1132
1133 #define FRAME_PIXEL_WIDTH_TO_TEXT_COLS(f, width) \
1134 (FRAME_PIXEL_X_TO_COL (f, ((width) \
1135 - FRAME_INTERNAL_BORDER_WIDTH (f) \
1136 - FRAME_TOTAL_FRINGE_WIDTH (f) \
1137 - (f)->scroll_bar_actual_width)))
1138
1139 #define FRAME_PIXEL_HEIGHT_TO_TEXT_LINES(f, height) \
1140 (FRAME_PIXEL_Y_TO_LINE (f, ((height) \
1141 - FRAME_INTERNAL_BORDER_WIDTH (f))))
1142
1143
1144 /***********************************************************************
1145 Frame Parameters
1146 ***********************************************************************/
1147
1148 extern Lisp_Object Qauto_raise, Qauto_lower;
1149 extern Lisp_Object Qborder_color, Qborder_width;
1150 extern Lisp_Object Qbuffer_predicate;
1151 extern Lisp_Object Qcursor_color, Qcursor_type;
1152 extern Lisp_Object Qfont;
1153 extern Lisp_Object Qbackground_color, Qforeground_color;
1154 extern Lisp_Object Qicon, Qicon_name, Qicon_type, Qicon_left, Qicon_top;
1155 extern Lisp_Object Qinternal_border_width;
1156 extern Lisp_Object Qtooltip;
1157 extern Lisp_Object Qmenu_bar_lines, Qtool_bar_lines, Qtool_bar_position;
1158 extern Lisp_Object Qmouse_color;
1159 extern Lisp_Object Qname, Qtitle;
1160 extern Lisp_Object Qparent_id;
1161 extern Lisp_Object Qunsplittable, Qvisibility;
1162 extern Lisp_Object Qscroll_bar_width, Qvertical_scroll_bars;
1163 extern Lisp_Object Qscroll_bar_foreground, Qscroll_bar_background;
1164 extern Lisp_Object Qscreen_gamma;
1165 extern Lisp_Object Qline_spacing;
1166 extern Lisp_Object Qwait_for_wm;
1167 extern Lisp_Object Qfullscreen;
1168 extern Lisp_Object Qfullwidth, Qfullheight, Qfullboth, Qmaximized;
1169 extern Lisp_Object Qsticky;
1170 extern Lisp_Object Qfont_backend;
1171 extern Lisp_Object Qalpha;
1172
1173 extern Lisp_Object Qleft_fringe, Qright_fringe;
1174 extern Lisp_Object Qheight, Qwidth;
1175 extern Lisp_Object Qminibuffer, Qmodeline;
1176 extern Lisp_Object Qx, Qw32, Qpc, Qns;
1177 extern Lisp_Object Qvisible;
1178 extern Lisp_Object Qdisplay_type;
1179
1180 extern Lisp_Object Qx_resource_name;
1181
1182 extern Lisp_Object Qleft, Qright, Qtop, Qbox, Qbottom;
1183 extern Lisp_Object Qdisplay;
1184
1185 extern Lisp_Object Qrun_hook_with_args;
1186
1187 #ifdef HAVE_WINDOW_SYSTEM
1188
1189 /* The class of this X application. */
1190 #define EMACS_CLASS "Emacs"
1191
1192 /* These are in xterm.c, w32term.c, etc. */
1193
1194 extern void x_set_scroll_bar_default_width (struct frame *);
1195 extern void x_set_offset (struct frame *, int, int, int);
1196 extern void x_wm_set_icon_position (struct frame *, int, int);
1197 extern void x_wm_set_size_hint (FRAME_PTR f, long flags, bool user_position);
1198
1199 extern Lisp_Object x_new_font (struct frame *, Lisp_Object, int);
1200
1201
1202 extern Lisp_Object Qface_set_after_frame_default;
1203
1204 #ifdef HAVE_NTGUI
1205 extern void x_fullscreen_adjust (struct frame *f, int *, int *,
1206 int *, int *);
1207 #endif
1208
1209 extern void x_set_frame_parameters (struct frame *, Lisp_Object);
1210
1211 extern void x_set_fullscreen (struct frame *, Lisp_Object, Lisp_Object);
1212 extern void x_set_line_spacing (struct frame *, Lisp_Object, Lisp_Object);
1213 extern void x_set_screen_gamma (struct frame *, Lisp_Object, Lisp_Object);
1214 extern void x_set_font (struct frame *, Lisp_Object, Lisp_Object);
1215 extern void x_set_font_backend (struct frame *, Lisp_Object, Lisp_Object);
1216 extern void x_set_fringe_width (struct frame *, Lisp_Object, Lisp_Object);
1217 extern void x_set_border_width (struct frame *, Lisp_Object, Lisp_Object);
1218 extern void x_set_internal_border_width (struct frame *, Lisp_Object,
1219 Lisp_Object);
1220 extern void x_set_visibility (struct frame *, Lisp_Object, Lisp_Object);
1221 extern void x_set_autoraise (struct frame *, Lisp_Object, Lisp_Object);
1222 extern void x_set_autolower (struct frame *, Lisp_Object, Lisp_Object);
1223 extern void x_set_unsplittable (struct frame *, Lisp_Object, Lisp_Object);
1224 extern void x_set_vertical_scroll_bars (struct frame *, Lisp_Object,
1225 Lisp_Object);
1226 extern void x_set_scroll_bar_width (struct frame *, Lisp_Object,
1227 Lisp_Object);
1228
1229 extern Lisp_Object x_icon_type (struct frame *);
1230
1231 extern int x_figure_window_size (struct frame *, Lisp_Object, int);
1232
1233 extern void x_set_alpha (struct frame *, Lisp_Object, Lisp_Object);
1234
1235 extern void validate_x_resource_name (void);
1236
1237 extern Lisp_Object display_x_get_resource (Display_Info *,
1238 Lisp_Object attribute,
1239 Lisp_Object class,
1240 Lisp_Object component,
1241 Lisp_Object subclass);
1242
1243 extern void set_frame_menubar (struct frame *f, bool first_time, bool deep_p);
1244 extern void x_set_window_size (struct frame *f, int change_grav,
1245 int cols, int rows);
1246 extern void x_sync (struct frame *);
1247 extern Lisp_Object x_get_focus_frame (struct frame *);
1248 extern void x_set_mouse_position (struct frame *f, int h, int v);
1249 extern void x_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y);
1250 extern void x_make_frame_visible (struct frame *f);
1251 extern void x_make_frame_invisible (struct frame *f);
1252 extern void x_iconify_frame (struct frame *f);
1253 extern int x_pixel_width (struct frame *f);
1254 extern int x_pixel_height (struct frame *f);
1255 extern void x_set_frame_alpha (struct frame *f);
1256 extern void x_set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object);
1257 extern void x_set_tool_bar_lines (struct frame *f,
1258 Lisp_Object value,
1259 Lisp_Object oldval);
1260 extern void x_activate_menubar (struct frame *);
1261 extern void x_real_positions (struct frame *, int *, int *);
1262 extern int x_bitmap_icon (struct frame *, Lisp_Object);
1263 extern void x_set_menu_bar_lines (struct frame *,
1264 Lisp_Object,
1265 Lisp_Object);
1266 extern void free_frame_menubar (struct frame *);
1267 extern void x_free_frame_resources (struct frame *);
1268
1269 #if defined HAVE_X_WINDOWS && !defined USE_X_TOOLKIT
1270 extern char *x_get_resource_string (const char *, const char *);
1271 #endif
1272
1273 extern void x_query_colors (struct frame *f, XColor *, int);
1274 extern void x_query_color (struct frame *f, XColor *);
1275
1276 #endif /* HAVE_WINDOW_SYSTEM */
1277
1278 INLINE_HEADER_END
1279
1280 #endif /* not EMACS_FRAME_H */